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