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