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