Point Cloud Library (PCL)  1.8.1
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 #ifndef PCL_IO_PLY_PLY_PARSER_H
42 #define PCL_IO_PLY_PLY_PARSER_H
43 
44 #include <fstream>
45 #include <iostream>
46 #include <istream>
47 #include <sstream>
48 #include <string>
49 #include <vector>
50 
51 #ifdef BUILD_Maintainer
52 # if defined __GNUC__
53 # if __GNUC__ == 4 && __GNUC_MINOR__ > 3
54 # pragma GCC diagnostic ignored "-Weffc++"
55 # pragma GCC diagnostic ignored "-pedantic"
56 # else
57 # pragma GCC system_header
58 # endif
59 # elif defined _MSC_VER
60 # pragma warning(push, 1)
61 # endif
62 #endif
63 
64 #include <pcl/io/boost.h>
65 
66 #include <pcl/io/ply/ply.h>
68 #include <pcl/pcl_macros.h>
69 
70 namespace pcl
71 {
72  namespace io
73  {
74  namespace ply
75  {
76  /** Class ply_parser parses a PLY file and generates appropriate atomic
77  * parsers for the body.
78  * \author Ares Lagae as part of libply, Nizar Sallem
79  * Ported with agreement from the author under the terms of the BSD
80  * license.
81  */
82  class PCL_EXPORTS ply_parser
83  {
84  public:
85 
86  typedef boost::function<void (std::size_t, const std::string&)> info_callback_type;
87  typedef boost::function<void (std::size_t, const std::string&)> warning_callback_type;
88  typedef boost::function<void (std::size_t, const std::string&)> error_callback_type;
89 
90  typedef boost::function<void ()> magic_callback_type;
91  typedef boost::function<void (format_type, const std::string&)> format_callback_type;
92  typedef boost::function<void (const std::string&)> comment_callback_type;
93  typedef boost::function<void (const std::string&)> obj_info_callback_type;
94  typedef boost::function<bool ()> end_header_callback_type;
95 
96  typedef boost::function<void ()> begin_element_callback_type;
97  typedef boost::function<void ()> end_element_callback_type;
98  typedef boost::tuple<begin_element_callback_type, end_element_callback_type> element_callbacks_type;
99  typedef boost::function<element_callbacks_type (const std::string&, std::size_t)> element_definition_callback_type;
100 
101  template <typename ScalarType>
103  {
104  typedef boost::function<void (ScalarType)> type;
105  };
106 
107  template <typename ScalarType>
109  {
111  typedef boost::function<scalar_property_callback_type (const std::string&, const std::string&)> type;
112  };
113 
114  typedef boost::mpl::vector<int8, int16, int32, uint8, uint16, uint32, float32, float64> scalar_types;
115 
117  {
118  private:
119  template <typename T>
120  struct callbacks_element
121  {
122 // callbacks_element () : callback ();
123  typedef T scalar_type;
125  };
126 
127  typedef boost::mpl::inherit_linearly<
128  scalar_types,
129  boost::mpl::inherit<
130  boost::mpl::_1,
131  callbacks_element<boost::mpl::_2>
132  >
133  >::type callbacks;
134  callbacks callbacks_;
135 
136  public:
137  template <typename ScalarType>
139  get () const
140  {
141  return (static_cast<const callbacks_element<ScalarType>&> (callbacks_).callback);
142  }
143 
144  template <typename ScalarType>
146  get ()
147  {
148  return (static_cast<callbacks_element<ScalarType>&> (callbacks_).callback);
149  }
150 
151  template <typename ScalarType>
153  at (scalar_property_definition_callbacks_type& scalar_property_definition_callbacks);
154 
155  template <typename ScalarType>
157  at (const scalar_property_definition_callbacks_type& scalar_property_definition_callbacks);
158  };
159 
160  template <typename ScalarType> static
162  at (scalar_property_definition_callbacks_type& scalar_property_definition_callbacks)
163  {
164  return (scalar_property_definition_callbacks.get<ScalarType> ());
165  }
166 
167 
168  template <typename ScalarType> static
170  at (const scalar_property_definition_callbacks_type& scalar_property_definition_callbacks)
171  {
172  return (scalar_property_definition_callbacks.get<ScalarType> ());
173  }
174 
175  template <typename SizeType, typename ScalarType>
177  {
178  typedef boost::function<void (SizeType)> type;
179  };
180 
181  template <typename SizeType, typename ScalarType>
183  {
184  typedef boost::function<void (ScalarType)> type;
185  };
186 
187  template <typename SizeType, typename ScalarType>
189  {
190  typedef boost::function<void ()> type;
191  };
192 
193  template <typename SizeType, typename ScalarType>
195  {
199  typedef boost::function<
200  boost::tuple<
201  list_property_begin_callback_type,
202  list_property_element_callback_type,
203  list_property_end_callback_type
204  > (const std::string&, const std::string&)> type;
205  };
206 
207  typedef boost::mpl::vector<uint8, uint16, uint32> size_types;
208 
210  {
211  private:
212  template <typename T> struct pair_with : boost::mpl::pair<T,boost::mpl::_> {};
213  template<typename Sequence1, typename Sequence2>
214 
215  struct sequence_product :
216  boost::mpl::fold<Sequence1, boost::mpl::vector0<>,
217  boost::mpl::joint_view<
218  boost::mpl::_1,boost::mpl::transform<Sequence2, pair_with<boost::mpl::_2> > > >
219  {};
220 
221  template <typename T>
222  struct callbacks_element
223  {
224  typedef typename T::first size_type;
225  typedef typename T::second scalar_type;
227  };
228 
229  typedef boost::mpl::inherit_linearly<sequence_product<size_types, scalar_types>::type, boost::mpl::inherit<boost::mpl::_1, callbacks_element<boost::mpl::_2> > >::type callbacks;
230  callbacks callbacks_;
231 
232  public:
233  template <typename SizeType, typename ScalarType>
235  get ()
236  {
237  return (static_cast<callbacks_element<boost::mpl::pair<SizeType, ScalarType> >&> (callbacks_).callback);
238  }
239 
240  template <typename SizeType, typename ScalarType>
242  get () const
243  {
244  return (static_cast<const callbacks_element<boost::mpl::pair<SizeType, ScalarType> >&> (callbacks_).callback);
245  }
246 
247  template <typename SizeType, typename ScalarType>
249  at (list_property_definition_callbacks_type& list_property_definition_callbacks);
250 
251  template <typename SizeType, typename ScalarType>
253  at (const list_property_definition_callbacks_type& list_property_definition_callbacks);
254  };
255 
256  template <typename SizeType, typename ScalarType> static
258  at (list_property_definition_callbacks_type& list_property_definition_callbacks)
259  {
260  return (list_property_definition_callbacks.get<SizeType, ScalarType> ());
261  }
262 
263  template <typename SizeType, typename ScalarType> static
265  at (const list_property_definition_callbacks_type& list_property_definition_callbacks)
266  {
267  return (list_property_definition_callbacks.get<SizeType, ScalarType> ());
268  }
269 
270 
271  inline void
272  info_callback (const info_callback_type& info_callback);
273 
274  inline void
275  warning_callback (const warning_callback_type& warning_callback);
276 
277  inline void
278  error_callback (const error_callback_type& error_callback);
279 
280  inline void
281  magic_callback (const magic_callback_type& magic_callback);
282 
283  inline void
284  format_callback (const format_callback_type& format_callback);
285 
286  inline void
287  element_definition_callback (const element_definition_callback_type& element_definition_callback);
288 
289  inline void
290  scalar_property_definition_callbacks (const scalar_property_definition_callbacks_type& scalar_property_definition_callbacks);
291 
292  inline void
293  list_property_definition_callbacks (const list_property_definition_callbacks_type& list_property_definition_callbacks);
294 
295  inline void
296  comment_callback (const comment_callback_type& comment_callback);
297 
298  inline void
299  obj_info_callback (const obj_info_callback_type& obj_info_callback);
300 
301  inline void
302  end_header_callback (const end_header_callback_type& end_header_callback);
303 
304  typedef int flags_type;
305  enum flags { };
306 
307  ply_parser (flags_type flags = 0) :
308  flags_ (flags),
309  comment_callback_ (), obj_info_callback_ (), end_header_callback_ (),
310  line_number_ (0), current_element_ ()
311  {}
312 
313  bool parse (const std::string& filename);
314  //inline bool parse (const std::string& filename);
315 
316  private:
317 
318  struct property
319  {
320  property (const std::string& name) : name (name) {}
321  virtual ~property () {}
322  virtual bool parse (class ply_parser& ply_parser, format_type format, std::istream& istream) = 0;
323  std::string name;
324  };
325 
326  template <typename ScalarType>
327  struct scalar_property : public property
328  {
329  typedef ScalarType scalar_type;
330  typedef typename scalar_property_callback_type<scalar_type>::type callback_type;
331  scalar_property (const std::string& name, callback_type callback)
332  : property (name)
333  , callback (callback)
334  {}
335  bool parse (class ply_parser& ply_parser,
337  std::istream& istream)
338  {
339  return ply_parser.parse_scalar_property<scalar_type> (format, istream, callback);
340  }
341  callback_type callback;
342  };
343 
344  template <typename SizeType, typename ScalarType>
345  struct list_property : public property
346  {
347  typedef SizeType size_type;
348  typedef ScalarType scalar_type;
349  typedef typename list_property_begin_callback_type<size_type, scalar_type>::type begin_callback_type;
350  typedef typename list_property_element_callback_type<size_type, scalar_type>::type element_callback_type;
351  typedef typename list_property_end_callback_type<size_type, scalar_type>::type end_callback_type;
352  list_property (const std::string& name,
353  begin_callback_type begin_callback,
354  element_callback_type element_callback,
355  end_callback_type end_callback)
356  : property (name)
357  , begin_callback (begin_callback)
358  , element_callback (element_callback)
359  , end_callback (end_callback)
360  {}
361  bool parse (class ply_parser& ply_parser,
363  std::istream& istream)
364  {
365  return ply_parser.parse_list_property<size_type, scalar_type> (format,
366  istream,
367  begin_callback,
368  element_callback,
369  end_callback);
370  }
371  begin_callback_type begin_callback;
372  element_callback_type element_callback;
373  end_callback_type end_callback;
374  };
375 
376  struct element
377  {
378  element (const std::string& name,
379  std::size_t count,
380  const begin_element_callback_type& begin_element_callback,
381  const end_element_callback_type& end_element_callback)
382  : name (name)
383  , count (count)
384  , begin_element_callback (begin_element_callback)
385  , end_element_callback (end_element_callback)
386  , properties ()
387  {}
388  std::string name;
389  std::size_t count;
390  begin_element_callback_type begin_element_callback;
391  end_element_callback_type end_element_callback;
392  std::vector<boost::shared_ptr<property> > properties;
393  };
394 
395  flags_type flags_;
396 
397  info_callback_type info_callback_;
398  warning_callback_type warning_callback_;
399  error_callback_type error_callback_;
400 
401  magic_callback_type magic_callback_;
402  format_callback_type format_callback_;
403  element_definition_callback_type element_definition_callbacks_;
404  scalar_property_definition_callbacks_type scalar_property_definition_callbacks_;
405  list_property_definition_callbacks_type list_property_definition_callbacks_;
406  comment_callback_type comment_callback_;
407  obj_info_callback_type obj_info_callback_;
408  end_header_callback_type end_header_callback_;
409 
410  template <typename ScalarType> inline void
411  parse_scalar_property_definition (const std::string& property_name);
412 
413  template <typename SizeType, typename ScalarType> inline void
414  parse_list_property_definition (const std::string& property_name);
415 
416  template <typename ScalarType> inline bool
417  parse_scalar_property (format_type format,
418  std::istream& istream,
419  const typename scalar_property_callback_type<ScalarType>::type& scalar_property_callback);
420 
421  template <typename SizeType, typename ScalarType> inline bool
422  parse_list_property (format_type format,
423  std::istream& istream,
424  const typename list_property_begin_callback_type<SizeType, ScalarType>::type& list_property_begin_callback,
425  const typename list_property_element_callback_type<SizeType, ScalarType>::type& list_property_element_callback,
426  const typename list_property_end_callback_type<SizeType, ScalarType>::type& list_property_end_callback);
427 
428  std::size_t line_number_;
429  element* current_element_;
430  };
431  } // namespace ply
432  } // namespace io
433 } // namespace pcl
434 
435 /* inline bool pcl::io::ply::ply_parser::parse (const std::string& filename) */
436 /* { */
437 /* std::ifstream ifstream (filename.c_str ()); */
438 /* return (parse (ifstream)); */
439 /* } */
440 
442 {
443  info_callback_ = info_callback;
444 }
445 
447 {
448  warning_callback_ = warning_callback;
449 }
450 
452 {
453  error_callback_ = error_callback;
454 }
455 
457 {
458  magic_callback_ = magic_callback;
459 }
460 
462 {
463  format_callback_ = format_callback;
464 }
465 
467 {
468  element_definition_callbacks_ = element_definition_callback;
469 }
470 
472 {
473  scalar_property_definition_callbacks_ = scalar_property_definition_callbacks;
474 }
475 
477 {
478  list_property_definition_callbacks_ = list_property_definition_callbacks;
479 }
480 
482 {
483  comment_callback_ = comment_callback;
484 }
485 
487 {
488  obj_info_callback_ = obj_info_callback;
489 }
490 
492 {
493  end_header_callback_ = end_header_callback;
494 }
495 
496 template <typename ScalarType>
497 inline void pcl::io::ply::ply_parser::parse_scalar_property_definition (const std::string& property_name)
498 {
499  typedef ScalarType scalar_type;
500  typename scalar_property_definition_callback_type<scalar_type>::type& scalar_property_definition_callback =
501  scalar_property_definition_callbacks_.get<scalar_type> ();
502  typename scalar_property_callback_type<scalar_type>::type scalar_property_callback;
503  if (scalar_property_definition_callback)
504  {
505  scalar_property_callback = scalar_property_definition_callback (current_element_->name, property_name);
506  }
507  if (!scalar_property_callback)
508  {
509  if (warning_callback_)
510  {
511  warning_callback_ (line_number_,
512  "property '" + std::string (type_traits<scalar_type>::name ()) + " " +
513  property_name + "' of element '" + current_element_->name + "' is not handled");
514  }
515  }
516  current_element_->properties.push_back (boost::shared_ptr<property> (new scalar_property<scalar_type> (property_name, scalar_property_callback)));
517 }
518 
519 template <typename SizeType, typename ScalarType>
520 inline void pcl::io::ply::ply_parser::parse_list_property_definition (const std::string& property_name)
521 {
522  typedef SizeType size_type;
523  typedef ScalarType scalar_type;
525  list_property_definition_callback_type& list_property_definition_callback = list_property_definition_callbacks_.get<size_type, scalar_type> ();
529  boost::tuple<list_property_begin_callback_type, list_property_element_callback_type, list_property_end_callback_type> list_property_callbacks;
530  if (list_property_definition_callback)
531  {
532  list_property_callbacks = list_property_definition_callback (current_element_->name, property_name);
533  }
534  if (!boost::get<0> (list_property_callbacks) || !boost::get<1> (list_property_callbacks) || !boost::get<2> (list_property_callbacks))
535  {
536  if (warning_callback_)
537  {
538  warning_callback_ (line_number_,
539  "property 'list " + std::string (type_traits<size_type>::name ()) + " " +
540  std::string (type_traits<scalar_type>::name ()) + " " +
541  property_name + "' of element '" +
542  current_element_->name + "' is not handled");
543  }
544  }
545  current_element_->properties.push_back (boost::shared_ptr<property> (
546  new list_property<size_type, scalar_type> (
547  property_name,
548  boost::get<0> (list_property_callbacks),
549  boost::get<1> (list_property_callbacks),
550  boost::get<2> (list_property_callbacks))));
551 }
552 
553 template <typename ScalarType>
554 inline bool pcl::io::ply::ply_parser::parse_scalar_property (format_type format,
555  std::istream& istream,
556  const typename scalar_property_callback_type<ScalarType>::type& scalar_property_callback)
557 {
558  using namespace io_operators;
559  typedef ScalarType scalar_type;
560  if (format == ascii_format)
561  {
562  std::string value_s;
563  scalar_type value;
564  char space = ' ';
565  istream >> value_s;
566  try
567  {
568  value = static_cast<scalar_type> (boost::lexical_cast<typename pcl::io::ply::type_traits<scalar_type>::parse_type> (value_s));
569  }
570  catch (boost::bad_lexical_cast &)
571  {
572  value = std::numeric_limits<scalar_type>::quiet_NaN ();
573  }
574 
575  if (!istream.eof ())
576  istream >> space >> std::ws;
577  if (!istream || !isspace (space))
578  {
579  if (error_callback_)
580  error_callback_ (line_number_, "parse error");
581  return (false);
582  }
583  if (scalar_property_callback)
584  scalar_property_callback (value);
585  return (true);
586  }
587  else
588  {
589  scalar_type value = std::numeric_limits<scalar_type>::quiet_NaN ();
590  istream.read (reinterpret_cast<char*> (&value), sizeof (scalar_type));
591  if (!istream)
592  {
593  if (error_callback_)
594  error_callback_ (line_number_, "parse error");
595  return (false);
596  }
597  if (((format == binary_big_endian_format) && (host_byte_order == little_endian_byte_order)) ||
598  ((format == binary_little_endian_format) && (host_byte_order == big_endian_byte_order)))
599  swap_byte_order (value);
600  if (scalar_property_callback)
601  scalar_property_callback (value);
602  return (true);
603  }
604 }
605 
606 template <typename SizeType, typename ScalarType>
607 inline bool pcl::io::ply::ply_parser::parse_list_property (format_type format, std::istream& istream,
608  const typename list_property_begin_callback_type<SizeType, ScalarType>::type& list_property_begin_callback,
609  const typename list_property_element_callback_type<SizeType, ScalarType>::type& list_property_element_callback,
610  const typename list_property_end_callback_type<SizeType, ScalarType>::type& list_property_end_callback)
611 {
612  using namespace io_operators;
613  typedef SizeType size_type;
614  typedef ScalarType scalar_type;
615  if (format == ascii_format)
616  {
617  size_type size = std::numeric_limits<size_type>::infinity ();
618  char space = ' ';
619  istream >> size;
620  if (!istream.eof ())
621  {
622  istream >> space >> std::ws;
623  }
624  if (!istream || !isspace (space))
625  {
626  if (error_callback_)
627  {
628  error_callback_ (line_number_, "parse error");
629  }
630  return (false);
631  }
632  if (list_property_begin_callback)
633  {
634  list_property_begin_callback (size);
635  }
636  for (std::size_t index = 0; index < size; ++index)
637  {
638  std::string value_s;
639  scalar_type value;
640  char space = ' ';
641  istream >> value_s;
642  try
643  {
644  value = static_cast<scalar_type> (boost::lexical_cast<typename pcl::io::ply::type_traits<scalar_type>::parse_type> (value_s));
645  }
646  catch (boost::bad_lexical_cast &)
647  {
648  value = std::numeric_limits<scalar_type>::quiet_NaN ();
649  }
650 
651  if (!istream.eof ())
652  {
653  istream >> space >> std::ws;
654  }
655  if (!istream || !isspace (space))
656  {
657  if (error_callback_)
658  {
659  error_callback_ (line_number_, "parse error");
660  }
661  return (false);
662  }
663  if (list_property_element_callback)
664  {
665  list_property_element_callback (value);
666  }
667  }
668  if (list_property_end_callback)
669  {
670  list_property_end_callback ();
671  }
672  return (true);
673  }
674  else
675  {
676  size_type size = std::numeric_limits<size_type>::infinity ();
677  istream.read (reinterpret_cast<char*> (&size), sizeof (size_type));
678  if (((format == binary_big_endian_format) && (host_byte_order == little_endian_byte_order)) ||
679  ((format == binary_little_endian_format) && (host_byte_order == big_endian_byte_order)))
680  {
681  swap_byte_order (size);
682  }
683  if (!istream)
684  {
685  if (error_callback_)
686  {
687  error_callback_ (line_number_, "parse error");
688  }
689  return (false);
690  }
691  if (list_property_begin_callback)
692  {
693  list_property_begin_callback (size);
694  }
695  for (std::size_t index = 0; index < size; ++index) {
696  scalar_type value = std::numeric_limits<scalar_type>::quiet_NaN ();
697  istream.read (reinterpret_cast<char*> (&value), sizeof (scalar_type));
698  if (!istream) {
699  if (error_callback_) {
700  error_callback_ (line_number_, "parse error");
701  }
702  return (false);
703  }
704  if (((format == binary_big_endian_format) && (host_byte_order == little_endian_byte_order)) ||
705  ((format == binary_little_endian_format) && (host_byte_order == big_endian_byte_order)))
706  {
707  swap_byte_order (value);
708  }
709  if (list_property_element_callback)
710  {
711  list_property_element_callback (value);
712  }
713  }
714  if (list_property_end_callback)
715  {
716  list_property_end_callback ();
717  }
718  return (true);
719  }
720 }
721 
722 #ifdef BUILD_Maintainer
723 # if defined __GNUC__
724 # if __GNUC__ == 4 && __GNUC_MINOR__ > 3
725 # pragma GCC diagnostic warning "-Weffc++"
726 # pragma GCC diagnostic warning "-pedantic"
727 # endif
728 # elif defined _MSC_VER
729 # pragma warning(pop)
730 # endif
731 #endif
732 
733 #endif // PCL_IO_PLY_PLY_PARSER_H
boost::function< bool()> end_header_callback_type
Definition: ply_parser.h:94
list_property_definition_callback_type< SizeType, ScalarType >::type & get()
Definition: ply_parser.h:235
boost::mpl::vector< int8, int16, int32, uint8, uint16, uint32, float32, float64 > scalar_types
Definition: ply_parser.h:114
static scalar_property_definition_callback_type< ScalarType >::type & at(scalar_property_definition_callbacks_type &scalar_property_definition_callbacks)
Definition: ply_parser.h:162
void error_callback(const error_callback_type &error_callback)
Definition: ply_parser.h:451
boost::function< void(const std::string &)> obj_info_callback_type
Definition: ply_parser.h:93
const scalar_property_definition_callback_type< ScalarType >::type & get() const
Definition: ply_parser.h:139
boost::function< void(std::size_t, const std::string &)> error_callback_type
Definition: ply_parser.h:88
boost::function< void(std::size_t, const std::string &)> info_callback_type
Definition: ply_parser.h:86
boost::function< void()> end_element_callback_type
Definition: ply_parser.h:97
void magic_callback(const magic_callback_type &magic_callback)
Definition: ply_parser.h:456
boost::function< void(std::size_t, const std::string &)> warning_callback_type
Definition: ply_parser.h:87
boost::function< void(format_type, const std::string &)> format_callback_type
Definition: ply_parser.h:91
contains standard typedefs and generic type traits
ply_parser(flags_type flags=0)
Definition: ply_parser.h:307
defines output operators for int8 and uint8
list_property_element_callback_type< SizeType, ScalarType >::type list_property_element_callback_type
Definition: ply_parser.h:197
static const scalar_property_definition_callback_type< ScalarType >::type & at(const scalar_property_definition_callbacks_type &scalar_property_definition_callbacks)
Definition: ply_parser.h:170
void warning_callback(const warning_callback_type &warning_callback)
Definition: ply_parser.h:446
boost::function< void()> begin_element_callback_type
Definition: ply_parser.h:96
Class ply_parser parses a PLY file and generates appropriate atomic parsers for the body...
Definition: ply_parser.h:82
void info_callback(const info_callback_type &info_callback)
Definition: ply_parser.h:441
int format_type
Definition: ply.h:98
void scalar_property_definition_callbacks(const scalar_property_definition_callbacks_type &scalar_property_definition_callbacks)
Definition: ply_parser.h:471
list_property_begin_callback_type< SizeType, ScalarType >::type list_property_begin_callback_type
Definition: ply_parser.h:196
void format_callback(const format_callback_type &format_callback)
Definition: ply_parser.h:461
list_property_end_callback_type< SizeType, ScalarType >::type list_property_end_callback_type
Definition: ply_parser.h:198
void list_property_definition_callbacks(const list_property_definition_callbacks_type &list_property_definition_callbacks)
Definition: ply_parser.h:476
static list_property_definition_callback_type< SizeType, ScalarType >::type & at(list_property_definition_callbacks_type &list_property_definition_callbacks)
Definition: ply_parser.h:258
boost::tuple< begin_element_callback_type, end_element_callback_type > element_callbacks_type
Definition: ply_parser.h:98
boost::function< element_callbacks_type(const std::string &, std::size_t)> element_definition_callback_type
Definition: ply_parser.h:99
void end_header_callback(const end_header_callback_type &end_header_callback)
Definition: ply_parser.h:491
boost::mpl::vector< uint8, uint16, uint32 > size_types
Definition: ply_parser.h:207
void obj_info_callback(const obj_info_callback_type &obj_info_callback)
Definition: ply_parser.h:486
boost::function< boost::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:204
void comment_callback(const comment_callback_type &comment_callback)
Definition: ply_parser.h:481
void swap_byte_order(char *bytes)
boost::function< void()> magic_callback_type
Definition: ply_parser.h:90
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:265
boost::function< void(const std::string &)> comment_callback_type
Definition: ply_parser.h:92
boost::function< scalar_property_callback_type(const std::string &, const std::string &)> type
Definition: ply_parser.h:111
scalar_property_callback_type< ScalarType >::type scalar_property_callback_type
Definition: ply_parser.h:110
void element_definition_callback(const element_definition_callback_type &element_definition_callback)
Definition: ply_parser.h:466