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