Point Cloud Library (PCL)  1.9.1-dev
ply_parser.h
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Point Cloud Library (PCL) - www.pointclouds.org
5  * Copyright (c) 2007-2012, Ares Lagae
6  * Copyright (c) 2010-2011, Willow Garage, Inc.
7  *
8  * All rights reserved.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  *
14  * * Redistributions of source code must retain the above copyright
15  * notice, this list of conditions and the following disclaimer.
16  * * Redistributions in binary form must reproduce the above
17  * copyright notice, this list of conditions and the following
18  * disclaimer in the documentation and/or other materials provided
19  * with the distribution.
20  * * Neither the name of the copyright holder(s) nor the names of its
21  * contributors may be used to endorse or promote products derived
22  * from this software without specific prior written permission.
23  *
24  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
27  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
28  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
29  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
30  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
31  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
32  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
34  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35  * POSSIBILITY OF SUCH DAMAGE.
36  *
37  * $Id$
38  *
39  */
40 
41 #pragma once
42 
43 #ifdef BUILD_Maintainer
44 # if defined __GNUC__
45 # pragma GCC system_header
46 # elif defined _MSC_VER
47 # pragma warning(push, 1)
48 # endif
49 #endif
50 
51 #include <pcl/io/boost.h>
52 #include <pcl/io/ply/ply.h>
54 #include <pcl/pcl_macros.h>
55 
56 #include <fstream>
57 #include <iostream>
58 #include <istream>
59 #include <memory>
60 #include <sstream>
61 #include <string>
62 #include <tuple>
63 #include <vector>
64 
65 namespace pcl
66 {
67  namespace io
68  {
69  namespace ply
70  {
71  /** Class ply_parser parses a PLY file and generates appropriate atomic
72  * parsers for the body.
73  * \author Ares Lagae as part of libply, Nizar Sallem
74  * Ported with agreement from the author under the terms of the BSD
75  * license.
76  */
78  {
79  public:
80 
81  using info_callback_type = std::function<void (std::size_t, const std::string&)>;
82  using warning_callback_type = std::function<void (std::size_t, const std::string&)>;
83  using error_callback_type = std::function<void (std::size_t, const std::string&)>;
84 
85  using magic_callback_type = std::function<void ()>;
86  using format_callback_type = std::function<void (format_type, const std::string&)>;
87  using comment_callback_type = std::function<void (const std::string&)>;
88  using obj_info_callback_type = std::function<void (const std::string&)>;
89  using end_header_callback_type = std::function<bool ()>;
90 
91  using begin_element_callback_type = std::function<void ()>;
92  using end_element_callback_type = std::function<void ()>;
93  using element_callbacks_type = std::tuple<begin_element_callback_type, end_element_callback_type>;
94  using element_definition_callback_type = std::function<element_callbacks_type (const std::string&, std::size_t)>;
95 
96  template <typename ScalarType>
98  {
99  using type = std::function<void (ScalarType)>;
100  };
101 
102  template <typename ScalarType>
104  {
106  using type = std::function<scalar_property_callback_type (const std::string&, const std::string&)>;
107  };
108 
109  using scalar_types = boost::mpl::vector<int8, int16, int32, uint8, uint16, uint32, float32, float64>;
110 
112  {
113  private:
114  template <typename T>
115  struct callbacks_element
116  {
117 // callbacks_element () : callback ();
118  using scalar_type = T;
120  };
121 
122  using callbacks = boost::mpl::inherit_linearly<
123  scalar_types,
124  boost::mpl::inherit<
125  boost::mpl::_1,
126  callbacks_element<boost::mpl::_2>
127  >
128  >::type;
129  callbacks callbacks_;
130 
131  public:
132  template <typename ScalarType>
134  get () const
135  {
136  return (static_cast<const callbacks_element<ScalarType>&> (callbacks_).callback);
137  }
138 
139  template <typename ScalarType>
141  get ()
142  {
143  return (static_cast<callbacks_element<ScalarType>&> (callbacks_).callback);
144  }
145 
146  template <typename ScalarType>
148  at (scalar_property_definition_callbacks_type& scalar_property_definition_callbacks);
149 
150  template <typename ScalarType>
152  at (const scalar_property_definition_callbacks_type& scalar_property_definition_callbacks);
153  };
154 
155  template <typename ScalarType> static
157  at (scalar_property_definition_callbacks_type& scalar_property_definition_callbacks)
158  {
159  return (scalar_property_definition_callbacks.get<ScalarType> ());
160  }
161 
162 
163  template <typename ScalarType> static
165  at (const scalar_property_definition_callbacks_type& scalar_property_definition_callbacks)
166  {
167  return (scalar_property_definition_callbacks.get<ScalarType> ());
168  }
169 
170  template <typename SizeType, typename ScalarType>
172  {
173  using type = std::function<void (SizeType)>;
174  };
175 
176  template <typename SizeType, typename ScalarType>
178  {
179  using type = std::function<void (ScalarType)>;
180  };
181 
182  template <typename SizeType, typename ScalarType>
184  {
185  using type = std::function<void ()>;
186  };
187 
188  template <typename SizeType, typename ScalarType>
190  {
194  using type = std::function<std::tuple<
198  > (const std::string&, const std::string&)>;
199  };
200 
201  using size_types = boost::mpl::vector<uint8, uint16, uint32>;
202 
204  {
205  private:
206  template <typename T> struct pair_with : boost::mpl::pair<T,boost::mpl::_> {};
207  template<typename Sequence1, typename Sequence2>
208 
209  struct sequence_product :
210  boost::mpl::fold<Sequence1, boost::mpl::vector0<>,
211  boost::mpl::joint_view<
212  boost::mpl::_1,boost::mpl::transform<Sequence2, pair_with<boost::mpl::_2> > > >
213  {};
214 
215  template <typename T>
216  struct callbacks_element
217  {
218  using size_type = typename T::first;
219  using scalar_type = typename T::second;
221  };
222 
223  using callbacks = boost::mpl::inherit_linearly<sequence_product<size_types, scalar_types>::type, boost::mpl::inherit<boost::mpl::_1, callbacks_element<boost::mpl::_2> > >::type;
224  callbacks callbacks_;
225 
226  public:
227  template <typename SizeType, typename ScalarType>
229  get ()
230  {
231  return (static_cast<callbacks_element<boost::mpl::pair<SizeType, ScalarType> >&> (callbacks_).callback);
232  }
233 
234  template <typename SizeType, typename ScalarType>
236  get () const
237  {
238  return (static_cast<const callbacks_element<boost::mpl::pair<SizeType, ScalarType> >&> (callbacks_).callback);
239  }
240 
241  template <typename SizeType, typename ScalarType>
243  at (list_property_definition_callbacks_type& list_property_definition_callbacks);
244 
245  template <typename SizeType, typename ScalarType>
247  at (const list_property_definition_callbacks_type& list_property_definition_callbacks);
248  };
249 
250  template <typename SizeType, typename ScalarType> static
252  at (list_property_definition_callbacks_type& list_property_definition_callbacks)
253  {
254  return (list_property_definition_callbacks.get<SizeType, ScalarType> ());
255  }
256 
257  template <typename SizeType, typename ScalarType> static
259  at (const list_property_definition_callbacks_type& list_property_definition_callbacks)
260  {
261  return (list_property_definition_callbacks.get<SizeType, ScalarType> ());
262  }
263 
264 
265  inline void
266  info_callback (const info_callback_type& info_callback);
267 
268  inline void
269  warning_callback (const warning_callback_type& warning_callback);
270 
271  inline void
272  error_callback (const error_callback_type& error_callback);
273 
274  inline void
275  magic_callback (const magic_callback_type& magic_callback);
276 
277  inline void
278  format_callback (const format_callback_type& format_callback);
279 
280  inline void
281  element_definition_callback (const element_definition_callback_type& element_definition_callback);
282 
283  inline void
284  scalar_property_definition_callbacks (const scalar_property_definition_callbacks_type& scalar_property_definition_callbacks);
285 
286  inline void
287  list_property_definition_callbacks (const list_property_definition_callbacks_type& list_property_definition_callbacks);
288 
289  inline void
290  comment_callback (const comment_callback_type& comment_callback);
291 
292  inline void
293  obj_info_callback (const obj_info_callback_type& obj_info_callback);
294 
295  inline void
296  end_header_callback (const end_header_callback_type& end_header_callback);
297 
298  using flags_type = int;
299  enum flags { };
300 
302  line_number_ (0), current_element_ ()
303  {}
304 
305  bool parse (const std::string& filename);
306  //inline bool parse (const std::string& filename);
307 
308  private:
309 
310  struct property
311  {
312  property (const std::string& name) : name (name) {}
313  virtual ~property () {}
314  virtual bool parse (class ply_parser& ply_parser, format_type format, std::istream& istream) = 0;
315  std::string name;
316  };
317 
318  template <typename ScalarType>
319  struct scalar_property : public property
320  {
321  using scalar_type = ScalarType;
322  using callback_type = typename scalar_property_callback_type<scalar_type>::type;
323  scalar_property (const std::string& name, callback_type callback)
324  : property (name)
325  , callback (callback)
326  {}
327  bool parse (class ply_parser& ply_parser,
329  std::istream& istream) override
330  {
331  return ply_parser.parse_scalar_property<scalar_type> (format, istream, callback);
332  }
333  callback_type callback;
334  };
335 
336  template <typename SizeType, typename ScalarType>
337  struct list_property : public property
338  {
339  using size_type = SizeType;
340  using scalar_type = ScalarType;
341  using begin_callback_type = typename list_property_begin_callback_type<size_type, scalar_type>::type;
342  using element_callback_type = typename list_property_element_callback_type<size_type, scalar_type>::type;
343  using end_callback_type = typename list_property_end_callback_type<size_type, scalar_type>::type;
344  list_property (const std::string& name,
345  begin_callback_type begin_callback,
346  element_callback_type element_callback,
347  end_callback_type end_callback)
348  : property (name)
349  , begin_callback (begin_callback)
350  , element_callback (element_callback)
351  , end_callback (end_callback)
352  {}
353  bool parse (class ply_parser& ply_parser,
355  std::istream& istream) override
356  {
357  return ply_parser.parse_list_property<size_type, scalar_type> (format,
358  istream,
359  begin_callback,
360  element_callback,
361  end_callback);
362  }
363  begin_callback_type begin_callback;
364  element_callback_type element_callback;
365  end_callback_type end_callback;
366  };
367 
368  struct element
369  {
370  element (const std::string& name,
371  std::size_t count,
372  const begin_element_callback_type& begin_element_callback,
373  const end_element_callback_type& end_element_callback)
374  : name (name)
375  , count (count)
376  , begin_element_callback (begin_element_callback)
377  , end_element_callback (end_element_callback)
378  {}
379  std::string name;
380  std::size_t count;
381  begin_element_callback_type begin_element_callback;
382  end_element_callback_type end_element_callback;
383  std::vector<std::shared_ptr<property>> properties;
384  };
385 
386  info_callback_type info_callback_ = [](std::size_t, const std::string&){};
387  warning_callback_type warning_callback_ = [](std::size_t, const std::string&){};
388  error_callback_type error_callback_ = [](std::size_t, const std::string&){};
389 
390  magic_callback_type magic_callback_ = [](){};
391  format_callback_type format_callback_ = [](format_type, const std::string&){};
392  comment_callback_type comment_callback_ = [](const std::string&){};
393  obj_info_callback_type obj_info_callback_ = [](const std::string&){};
394  end_header_callback_type end_header_callback_ = [](){return true;};
395 
396  element_definition_callback_type element_definition_callbacks_ =
397  [](const std::string&, std::size_t)
398  {
399  return std::make_tuple([](){}, [](){});
400  };
401  scalar_property_definition_callbacks_type scalar_property_definition_callbacks_;
402  list_property_definition_callbacks_type list_property_definition_callbacks_;
403 
404  template <typename ScalarType> inline void
405  parse_scalar_property_definition (const std::string& property_name);
406 
407  template <typename SizeType, typename ScalarType> inline void
408  parse_list_property_definition (const std::string& property_name);
409 
410  template <typename ScalarType> inline bool
411  parse_scalar_property (format_type format,
412  std::istream& istream,
413  const typename scalar_property_callback_type<ScalarType>::type& scalar_property_callback);
414 
415  template <typename SizeType, typename ScalarType> inline bool
416  parse_list_property (format_type format,
417  std::istream& istream,
418  const typename list_property_begin_callback_type<SizeType, ScalarType>::type& list_property_begin_callback,
419  const typename list_property_element_callback_type<SizeType, ScalarType>::type& list_property_element_callback,
420  const typename list_property_end_callback_type<SizeType, ScalarType>::type& list_property_end_callback);
421 
422  std::size_t line_number_;
423  element* current_element_;
424  };
425  } // namespace ply
426  } // namespace io
427 } // namespace pcl
428 
429 /* inline bool pcl::io::ply::ply_parser::parse (const std::string& filename) */
430 /* { */
431 /* std::ifstream ifstream (filename.c_str ()); */
432 /* return (parse (ifstream)); */
433 /* } */
434 
436 {
437  info_callback_ = info_callback;
438 }
439 
441 {
442  warning_callback_ = warning_callback;
443 }
444 
446 {
447  error_callback_ = error_callback;
448 }
449 
451 {
452  magic_callback_ = magic_callback;
453 }
454 
456 {
457  format_callback_ = format_callback;
458 }
459 
461 {
462  element_definition_callbacks_ = element_definition_callback;
463 }
464 
466 {
467  scalar_property_definition_callbacks_ = scalar_property_definition_callbacks;
468 }
469 
471 {
472  list_property_definition_callbacks_ = list_property_definition_callbacks;
473 }
474 
476 {
477  comment_callback_ = comment_callback;
478 }
479 
481 {
482  obj_info_callback_ = obj_info_callback;
483 }
484 
486 {
487  end_header_callback_ = end_header_callback;
488 }
489 
490 template <typename ScalarType>
491 inline void pcl::io::ply::ply_parser::parse_scalar_property_definition (const std::string& property_name)
492 {
493  using scalar_type = ScalarType;
494  typename scalar_property_definition_callback_type<scalar_type>::type& scalar_property_definition_callback =
495  scalar_property_definition_callbacks_.get<scalar_type> ();
496  typename scalar_property_callback_type<scalar_type>::type scalar_property_callback;
497  if (scalar_property_definition_callback)
498  {
499  scalar_property_callback = scalar_property_definition_callback (current_element_->name, property_name);
500  }
501  if (!scalar_property_callback)
502  {
503  if (warning_callback_)
504  {
505  warning_callback_ (line_number_,
506  "property '" + std::string (type_traits<scalar_type>::name ()) + " " +
507  property_name + "' of element '" + current_element_->name + "' is not handled");
508  }
509  }
510  current_element_->properties.emplace_back (new scalar_property<scalar_type> (property_name, scalar_property_callback));
511 }
512 
513 template <typename SizeType, typename ScalarType>
514 inline void pcl::io::ply::ply_parser::parse_list_property_definition (const std::string& property_name)
515 {
516  using size_type = SizeType;
517  using scalar_type = ScalarType;
519  list_property_definition_callback_type& list_property_definition_callback = list_property_definition_callbacks_.get<size_type, scalar_type> ();
523  std::tuple<list_property_begin_callback_type, list_property_element_callback_type, list_property_end_callback_type> list_property_callbacks;
524  if (list_property_definition_callback)
525  {
526  list_property_callbacks = list_property_definition_callback (current_element_->name, property_name);
527  }
528  if (!std::get<0> (list_property_callbacks) || !std::get<1> (list_property_callbacks) || !std::get<2> (list_property_callbacks))
529  {
530  if (warning_callback_)
531  {
532  warning_callback_ (line_number_,
533  "property 'list " + std::string (type_traits<size_type>::name ()) + " " +
534  std::string (type_traits<scalar_type>::name ()) + " " +
535  property_name + "' of element '" +
536  current_element_->name + "' is not handled");
537  }
538  }
539  current_element_->properties.emplace_back (new list_property<size_type, scalar_type> (
540  property_name,
541  std::get<0> (list_property_callbacks),
542  std::get<1> (list_property_callbacks),
543  std::get<2> (list_property_callbacks)));
544 }
545 
546 template <typename ScalarType>
547 inline bool pcl::io::ply::ply_parser::parse_scalar_property (format_type format,
548  std::istream& istream,
549  const typename scalar_property_callback_type<ScalarType>::type& scalar_property_callback)
550 {
551  using namespace io_operators;
552  using scalar_type = ScalarType;
553  if (format == ascii_format)
554  {
555  std::string value_s;
556  scalar_type value;
557  char space = ' ';
558  istream >> value_s;
559  try
560  {
561  value = static_cast<scalar_type> (boost::lexical_cast<typename pcl::io::ply::type_traits<scalar_type>::parse_type> (value_s));
562  }
563  catch (boost::bad_lexical_cast &)
564  {
565  value = std::numeric_limits<scalar_type>::quiet_NaN ();
566  }
567 
568  if (!istream.eof ())
569  istream >> space >> std::ws;
570  if (!istream || !isspace (space))
571  {
572  if (error_callback_)
573  error_callback_ (line_number_, "parse error");
574  return (false);
575  }
576  if (scalar_property_callback)
577  scalar_property_callback (value);
578  return (true);
579  }
580  scalar_type value = std::numeric_limits<scalar_type>::quiet_NaN ();
581  istream.read (reinterpret_cast<char*> (&value), sizeof (scalar_type));
582  if (!istream)
583  {
584  if (error_callback_)
585  error_callback_ (line_number_, "parse error");
586  return (false);
587  }
588  if (((format == binary_big_endian_format) && (host_byte_order == little_endian_byte_order)) ||
589  ((format == binary_little_endian_format) && (host_byte_order == big_endian_byte_order)))
590  swap_byte_order (value);
591  if (scalar_property_callback)
592  scalar_property_callback (value);
593  return (true);
594 }
595 
596 template <typename SizeType, typename ScalarType>
597 inline bool pcl::io::ply::ply_parser::parse_list_property (format_type format, std::istream& istream,
598  const typename list_property_begin_callback_type<SizeType, ScalarType>::type& list_property_begin_callback,
599  const typename list_property_element_callback_type<SizeType, ScalarType>::type& list_property_element_callback,
600  const typename list_property_end_callback_type<SizeType, ScalarType>::type& list_property_end_callback)
601 {
602  using namespace io_operators;
603  using size_type = SizeType;
604  using scalar_type = ScalarType;
605  if (format == ascii_format)
606  {
607  size_type size = std::numeric_limits<size_type>::infinity ();
608  char space = ' ';
609  istream >> size;
610  if (!istream.eof ())
611  {
612  istream >> space >> std::ws;
613  }
614  if (!istream || !isspace (space))
615  {
616  if (error_callback_)
617  {
618  error_callback_ (line_number_, "parse error");
619  }
620  return (false);
621  }
622  if (list_property_begin_callback)
623  {
624  list_property_begin_callback (size);
625  }
626  for (std::size_t index = 0; index < size; ++index)
627  {
628  std::string value_s;
629  scalar_type value;
630  char space = ' ';
631  istream >> value_s;
632  try
633  {
634  value = static_cast<scalar_type> (boost::lexical_cast<typename pcl::io::ply::type_traits<scalar_type>::parse_type> (value_s));
635  }
636  catch (boost::bad_lexical_cast &)
637  {
638  value = std::numeric_limits<scalar_type>::quiet_NaN ();
639  }
640 
641  if (!istream.eof ())
642  {
643  istream >> space >> std::ws;
644  }
645  if (!istream || !isspace (space))
646  {
647  if (error_callback_)
648  {
649  error_callback_ (line_number_, "parse error");
650  }
651  return (false);
652  }
653  if (list_property_element_callback)
654  {
655  list_property_element_callback (value);
656  }
657  }
658  if (list_property_end_callback)
659  {
660  list_property_end_callback ();
661  }
662  return (true);
663  }
664  size_type size = std::numeric_limits<size_type>::infinity ();
665  istream.read (reinterpret_cast<char*> (&size), sizeof (size_type));
666  if (((format == binary_big_endian_format) && (host_byte_order == little_endian_byte_order)) ||
667  ((format == binary_little_endian_format) && (host_byte_order == big_endian_byte_order)))
668  {
669  swap_byte_order (size);
670  }
671  if (!istream)
672  {
673  if (error_callback_)
674  {
675  error_callback_ (line_number_, "parse error");
676  }
677  return (false);
678  }
679  if (list_property_begin_callback)
680  {
681  list_property_begin_callback (size);
682  }
683  for (std::size_t index = 0; index < size; ++index) {
684  scalar_type value = std::numeric_limits<scalar_type>::quiet_NaN ();
685  istream.read (reinterpret_cast<char*> (&value), sizeof (scalar_type));
686  if (!istream) {
687  if (error_callback_) {
688  error_callback_ (line_number_, "parse error");
689  }
690  return (false);
691  }
692  if (((format == binary_big_endian_format) && (host_byte_order == little_endian_byte_order)) ||
693  ((format == binary_little_endian_format) && (host_byte_order == big_endian_byte_order)))
694  {
695  swap_byte_order (value);
696  }
697  if (list_property_element_callback)
698  {
699  list_property_element_callback (value);
700  }
701  }
702  if (list_property_end_callback)
703  {
704  list_property_end_callback ();
705  }
706  return (true);
707 }
708 
709 #ifdef BUILD_Maintainer
710 # if defined __GNUC__
711 # if __GNUC__ == 4 && __GNUC_MINOR__ > 3
712 # pragma GCC diagnostic warning "-Weffc++"
713 # pragma GCC diagnostic warning "-pedantic"
714 # endif
715 # elif defined _MSC_VER
716 # pragma warning(pop)
717 # endif
718 #endif
boost::mpl::vector< int8, int16, int32, uint8, uint16, uint32, float32, float64 > scalar_types
Definition: ply_parser.h:109
std::function< void(format_type, const std::string &)> format_callback_type
Definition: ply_parser.h:86
list_property_definition_callback_type< SizeType, ScalarType >::type & get()
Definition: ply_parser.h:229
std::tuple< begin_element_callback_type, end_element_callback_type > element_callbacks_type
Definition: ply_parser.h:93
static scalar_property_definition_callback_type< ScalarType >::type & at(scalar_property_definition_callbacks_type &scalar_property_definition_callbacks)
Definition: ply_parser.h:157
typename list_property_end_callback_type< size_type, scalar_type >::type list_property_end_callback_type
Definition: ply_parser.h:193
This file defines compatibility wrappers for low level I/O functions.
Definition: convolution.h:45
std::function< element_callbacks_type(const std::string &, std::size_t)> element_definition_callback_type
Definition: ply_parser.h:94
void error_callback(const error_callback_type &error_callback)
Definition: ply_parser.h:445
boost::mpl::vector< uint8, uint16, uint32 > size_types
Definition: ply_parser.h:201
const scalar_property_definition_callback_type< ScalarType >::type & get() const
Definition: ply_parser.h:134
std::function< void()> begin_element_callback_type
Definition: ply_parser.h:91
typename list_property_begin_callback_type< size_type, scalar_type >::type list_property_begin_callback_type
Definition: ply_parser.h:191
void magic_callback(const magic_callback_type &magic_callback)
Definition: ply_parser.h:450
std::function< std::tuple< list_property_begin_callback_type, list_property_element_callback_type, list_property_end_callback_type >(const std::string &, const std::string &)> type
Definition: ply_parser.h:198
std::function< void(std::size_t, const std::string &)> error_callback_type
Definition: ply_parser.h:83
std::function< void(std::size_t, const std::string &)> warning_callback_type
Definition: ply_parser.h:82
contains standard typedefs and generic type traits
defines output operators for int8 and uint8
std::function< void()> magic_callback_type
Definition: ply_parser.h:85
static const scalar_property_definition_callback_type< ScalarType >::type & at(const scalar_property_definition_callbacks_type &scalar_property_definition_callbacks)
Definition: ply_parser.h:165
std::function< void(const std::string &)> comment_callback_type
Definition: ply_parser.h:87
void warning_callback(const warning_callback_type &warning_callback)
Definition: ply_parser.h:440
Class ply_parser parses a PLY file and generates appropriate atomic parsers for the body...
Definition: ply_parser.h:77
void info_callback(const info_callback_type &info_callback)
Definition: ply_parser.h:435
void scalar_property_definition_callbacks(const scalar_property_definition_callbacks_type &scalar_property_definition_callbacks)
Definition: ply_parser.h:465
void format_callback(const format_callback_type &format_callback)
Definition: ply_parser.h:455
typename scalar_property_callback_type< scalar_type >::type scalar_property_callback_type
Definition: ply_parser.h:105
void list_property_definition_callbacks(const list_property_definition_callbacks_type &list_property_definition_callbacks)
Definition: ply_parser.h:470
static list_property_definition_callback_type< SizeType, ScalarType >::type & at(list_property_definition_callbacks_type &list_property_definition_callbacks)
Definition: ply_parser.h:252
void end_header_callback(const end_header_callback_type &end_header_callback)
Definition: ply_parser.h:485
int format_type
Definition: ply.h:97
std::function< void(std::size_t, const std::string &)> info_callback_type
Definition: ply_parser.h:81
std::function< void()> end_element_callback_type
Definition: ply_parser.h:92
void obj_info_callback(const obj_info_callback_type &obj_info_callback)
Definition: ply_parser.h:480
void comment_callback(const comment_callback_type &comment_callback)
Definition: ply_parser.h:475
std::function< scalar_property_callback_type(const std::string &, const std::string &)> type
Definition: ply_parser.h:106
std::function< void(const std::string &)> obj_info_callback_type
Definition: ply_parser.h:88
void swap_byte_order(char *bytes)
typename list_property_element_callback_type< size_type, scalar_type >::type list_property_element_callback_type
Definition: ply_parser.h:192
static const list_property_definition_callback_type< SizeType, ScalarType >::type & at(const list_property_definition_callbacks_type &list_property_definition_callbacks)
Definition: ply_parser.h:259
std::function< bool()> end_header_callback_type
Definition: ply_parser.h:89
#define PCL_EXPORTS
Definition: pcl_macros.h:241
Defines all the PCL and non-PCL macros used.
void element_definition_callback(const element_definition_callback_type &element_definition_callback)
Definition: ply_parser.h:460