Point Cloud Library (PCL) 1.14.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
296 ply_parser () = default;
297
298 bool parse (const std::string& filename);
299 //inline bool parse (const std::string& filename);
300
301 private:
302
303 struct property
304 {
305 property (const std::string& name) : name (name) {}
306 virtual ~property () = default;
307 virtual bool parse (class ply_parser& ply_parser, format_type format, std::istream& istream) = 0;
308 std::string name;
309 };
310
311 template <typename ScalarType>
312 struct scalar_property : public property
313 {
314 using scalar_type = ScalarType;
315 using callback_type = typename scalar_property_callback_type<scalar_type>::type;
316 scalar_property (const std::string& name, callback_type callback)
317 : property (name)
318 , callback (callback)
319 {}
320 bool parse (class ply_parser& ply_parser,
321 format_type format,
322 std::istream& istream) override
323 {
324 return ply_parser.parse_scalar_property<scalar_type> (format, istream, callback);
325 }
326 callback_type callback;
327 };
328
329 template <typename SizeType, typename ScalarType>
330 struct list_property : public property
331 {
332 using size_type = SizeType;
333 using scalar_type = ScalarType;
334 using begin_callback_type = typename list_property_begin_callback_type<size_type, scalar_type>::type;
335 using element_callback_type = typename list_property_element_callback_type<size_type, scalar_type>::type;
336 using end_callback_type = typename list_property_end_callback_type<size_type, scalar_type>::type;
337 list_property (const std::string& name,
338 begin_callback_type begin_callback,
339 element_callback_type element_callback,
340 end_callback_type end_callback)
341 : property (name)
342 , begin_callback (begin_callback)
343 , element_callback (element_callback)
344 , end_callback (end_callback)
345 {}
346 bool parse (class ply_parser& ply_parser,
347 format_type format,
348 std::istream& istream) override
349 {
350 return ply_parser.parse_list_property<size_type, scalar_type> (format,
351 istream,
352 begin_callback,
353 element_callback,
354 end_callback);
355 }
356 begin_callback_type begin_callback;
357 element_callback_type element_callback;
358 end_callback_type end_callback;
359 };
360
361 struct element
362 {
363 element (const std::string& name,
364 std::size_t count,
365 const begin_element_callback_type& begin_element_callback,
366 const end_element_callback_type& end_element_callback)
367 : name (name)
368 , count (count)
369 , begin_element_callback (begin_element_callback)
370 , end_element_callback (end_element_callback)
371 {}
372 std::string name;
373 std::size_t count;
374 begin_element_callback_type begin_element_callback;
375 end_element_callback_type end_element_callback;
376 std::vector<std::shared_ptr<property>> properties;
377 };
378
379 info_callback_type info_callback_ = [](std::size_t, const std::string&){};
380 warning_callback_type warning_callback_ = [](std::size_t, const std::string&){};
381 error_callback_type error_callback_ = [](std::size_t, const std::string&){};
382
383 magic_callback_type magic_callback_ = [](){};
384 format_callback_type format_callback_ = [](format_type, const std::string&){};
385 comment_callback_type comment_callback_ = [](const std::string&){};
386 obj_info_callback_type obj_info_callback_ = [](const std::string&){};
387 end_header_callback_type end_header_callback_ = [](){return true;};
388
389 element_definition_callback_type element_definition_callbacks_ =
390 [](const std::string&, std::size_t)
391 {
392 return std::make_tuple([](){}, [](){});
393 };
394 scalar_property_definition_callbacks_type scalar_property_definition_callbacks_;
395 list_property_definition_callbacks_type list_property_definition_callbacks_;
396
397 template <typename ScalarType> inline void
398 parse_scalar_property_definition (const std::string& property_name);
399
400 template <typename SizeType, typename ScalarType> inline void
401 parse_list_property_definition (const std::string& property_name);
402
403 template <typename ScalarType> inline bool
404 parse_scalar_property (format_type format,
405 std::istream& istream,
406 const typename scalar_property_callback_type<ScalarType>::type& scalar_property_callback);
407
408 template <typename SizeType, typename ScalarType> inline bool
409 parse_list_property (format_type format,
410 std::istream& istream,
411 const typename list_property_begin_callback_type<SizeType, ScalarType>::type& list_property_begin_callback,
412 const typename list_property_element_callback_type<SizeType, ScalarType>::type& list_property_element_callback,
413 const typename list_property_end_callback_type<SizeType, ScalarType>::type& list_property_end_callback);
414
415 std::size_t line_number_{0};
416 element* current_element_{nullptr};
417 };
418 } // namespace ply
419 } // namespace io
420} // namespace pcl
421
422/* inline bool pcl::io::ply::ply_parser::parse (const std::string& filename) */
423/* { */
424/* std::ifstream ifstream (filename.c_str ()); */
425/* return (parse (ifstream)); */
426/* } */
427
429{
430 info_callback_ = info_callback;
431}
432
434{
435 warning_callback_ = warning_callback;
436}
437
439{
440 error_callback_ = error_callback;
441}
442
444{
445 magic_callback_ = magic_callback;
446}
447
449{
450 format_callback_ = format_callback;
451}
452
454{
455 element_definition_callbacks_ = element_definition_callback;
456}
457
459{
460 scalar_property_definition_callbacks_ = scalar_property_definition_callbacks;
461}
462
464{
465 list_property_definition_callbacks_ = list_property_definition_callbacks;
466}
467
469{
470 comment_callback_ = comment_callback;
471}
472
474{
475 obj_info_callback_ = obj_info_callback;
476}
477
479{
480 end_header_callback_ = end_header_callback;
481}
482
483template <typename ScalarType>
484inline void pcl::io::ply::ply_parser::parse_scalar_property_definition (const std::string& property_name)
485{
486 using scalar_type = ScalarType;
487 typename scalar_property_definition_callback_type<scalar_type>::type& scalar_property_definition_callback =
488 scalar_property_definition_callbacks_.get<scalar_type> ();
489 typename scalar_property_callback_type<scalar_type>::type scalar_property_callback;
490 if (scalar_property_definition_callback)
491 {
492 scalar_property_callback = scalar_property_definition_callback (current_element_->name, property_name);
493 }
494 if (!scalar_property_callback)
495 {
496 if (warning_callback_)
497 {
498 warning_callback_ (line_number_,
499 "property '" + std::string (type_traits<scalar_type>::name ()) + " " +
500 property_name + "' of element '" + current_element_->name + "' is not handled");
501 }
502 }
503 current_element_->properties.emplace_back (new scalar_property<scalar_type> (property_name, scalar_property_callback));
504}
505
506template <typename SizeType, typename ScalarType>
507inline void pcl::io::ply::ply_parser::parse_list_property_definition (const std::string& property_name)
508{
509 using size_type = SizeType;
510 using scalar_type = ScalarType;
511 using list_property_definition_callback_type = typename list_property_definition_callback_type<size_type, scalar_type>::type;
512 list_property_definition_callback_type& list_property_definition_callback = list_property_definition_callbacks_.get<size_type, scalar_type> ();
513 using list_property_begin_callback_type = typename list_property_begin_callback_type<size_type, scalar_type>::type;
514 using list_property_element_callback_type = typename list_property_element_callback_type<size_type, scalar_type>::type;
515 using list_property_end_callback_type = typename list_property_end_callback_type<size_type, scalar_type>::type;
516 std::tuple<list_property_begin_callback_type, list_property_element_callback_type, list_property_end_callback_type> list_property_callbacks;
517 if (list_property_definition_callback)
518 {
519 list_property_callbacks = list_property_definition_callback (current_element_->name, property_name);
520 }
521 if (!std::get<0> (list_property_callbacks) || !std::get<1> (list_property_callbacks) || !std::get<2> (list_property_callbacks))
522 {
523 if (warning_callback_)
524 {
525 warning_callback_ (line_number_,
526 "property 'list " + std::string (type_traits<size_type>::name ()) + " " +
527 std::string (type_traits<scalar_type>::name ()) + " " +
528 property_name + "' of element '" +
529 current_element_->name + "' is not handled");
530 }
531 }
532 current_element_->properties.emplace_back (new list_property<size_type, scalar_type> (
533 property_name,
534 std::get<0> (list_property_callbacks),
535 std::get<1> (list_property_callbacks),
536 std::get<2> (list_property_callbacks)));
537}
538
539template <typename ScalarType>
540inline bool pcl::io::ply::ply_parser::parse_scalar_property (format_type format,
541 std::istream& istream,
542 const typename scalar_property_callback_type<ScalarType>::type& scalar_property_callback)
543{
544 using namespace io_operators;
545 using scalar_type = ScalarType;
546 if (format == ascii_format)
547 {
548 std::string value_s;
549 scalar_type value;
550 char space = ' ';
551 istream >> value_s;
552 try
553 {
554 value = static_cast<scalar_type> (boost::lexical_cast<typename pcl::io::ply::type_traits<scalar_type>::parse_type> (value_s));
555 }
556 catch (boost::bad_lexical_cast &)
557 {
558 value = std::numeric_limits<scalar_type>::quiet_NaN ();
559 }
560
561 if (!istream.eof ())
562 istream >> space >> std::ws;
563 if (!istream || !isspace (space))
564 {
565 if (error_callback_)
566 error_callback_ (line_number_, "error while parsing scalar property (file format: ascii)");
567 return (false);
568 }
569 if (scalar_property_callback)
570 scalar_property_callback (value);
571 return (true);
572 }
573 scalar_type value = std::numeric_limits<scalar_type>::quiet_NaN ();
574 istream.read (reinterpret_cast<char*> (&value), sizeof (scalar_type));
575 if (!istream)
576 {
577 if (error_callback_)
578 error_callback_ (line_number_, "error while parsing scalar property (file format: binary)");
579 return (false);
580 }
581 if (((format == binary_big_endian_format) && (host_byte_order == little_endian_byte_order)) ||
582 ((format == binary_little_endian_format) && (host_byte_order == big_endian_byte_order)))
583 swap_byte_order (value);
584 if (scalar_property_callback)
585 scalar_property_callback (value);
586 return (true);
587}
588
589template <typename SizeType, typename ScalarType>
590inline bool pcl::io::ply::ply_parser::parse_list_property (format_type format, std::istream& istream,
591 const typename list_property_begin_callback_type<SizeType, ScalarType>::type& list_property_begin_callback,
592 const typename list_property_element_callback_type<SizeType, ScalarType>::type& list_property_element_callback,
593 const typename list_property_end_callback_type<SizeType, ScalarType>::type& list_property_end_callback)
594{
595 using namespace io_operators;
596 using size_type = SizeType;
597 using scalar_type = ScalarType;
598 if (format == ascii_format)
599 {
600 size_type size = std::numeric_limits<size_type>::infinity ();
601 char space = ' ';
602 istream >> size;
603 if (!istream.eof ())
604 {
605 istream >> space >> std::ws;
606 }
607 if (!istream || !isspace (space))
608 {
609 if (error_callback_)
610 {
611 error_callback_ (line_number_, "error while parsing list (file format: ascii)");
612 }
613 return (false);
614 }
615 if (list_property_begin_callback)
616 {
617 list_property_begin_callback (size);
618 }
619 for (std::size_t index = 0; index < size; ++index)
620 {
621 std::string value_s;
622 scalar_type value;
623 char space = ' ';
624 istream >> value_s;
625 try
626 {
627 value = static_cast<scalar_type> (boost::lexical_cast<typename pcl::io::ply::type_traits<scalar_type>::parse_type> (value_s));
628 }
629 catch (boost::bad_lexical_cast &)
630 {
631 value = std::numeric_limits<scalar_type>::quiet_NaN ();
632 }
633
634 if (!istream.eof ())
635 {
636 istream >> space >> std::ws;
637 }
638 if (!istream || !isspace (space))
639 {
640 if (error_callback_)
641 {
642 error_callback_ (line_number_, "error while parsing list (file format: ascii)");
643 }
644 return (false);
645 }
646 if (list_property_element_callback)
647 {
648 list_property_element_callback (value);
649 }
650 }
651 if (list_property_end_callback)
652 {
653 list_property_end_callback ();
654 }
655 return (true);
656 }
657 size_type size = std::numeric_limits<size_type>::infinity ();
658 istream.read (reinterpret_cast<char*> (&size), sizeof (size_type));
659 if (((format == binary_big_endian_format) && (host_byte_order == little_endian_byte_order)) ||
660 ((format == binary_little_endian_format) && (host_byte_order == big_endian_byte_order)))
661 {
662 swap_byte_order (size);
663 }
664 if (!istream)
665 {
666 if (error_callback_)
667 {
668 error_callback_ (line_number_, "error while parsing list (file format: binary)");
669 }
670 return (false);
671 }
672 if (list_property_begin_callback)
673 {
674 list_property_begin_callback (size);
675 }
676 for (std::size_t index = 0; index < size; ++index) {
677 scalar_type value = std::numeric_limits<scalar_type>::quiet_NaN ();
678 istream.read (reinterpret_cast<char*> (&value), sizeof (scalar_type));
679 if (!istream) {
680 if (error_callback_) {
681 error_callback_ (line_number_, "error while parsing list (file format: binary)");
682 }
683 return (false);
684 }
685 if (((format == binary_big_endian_format) && (host_byte_order == little_endian_byte_order)) ||
686 ((format == binary_little_endian_format) && (host_byte_order == big_endian_byte_order)))
687 {
688 swap_byte_order (value);
689 }
690 if (list_property_element_callback)
691 {
692 list_property_element_callback (value);
693 }
694 }
695 if (list_property_end_callback)
696 {
697 list_property_end_callback ();
698 }
699 return (true);
700}
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:468
void error_callback(const error_callback_type &error_callback)
Definition ply_parser.h:438
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:473
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:463
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:478
void info_callback(const info_callback_type &info_callback)
Definition ply_parser.h:428
void magic_callback(const magic_callback_type &magic_callback)
Definition ply_parser.h:443
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:433
void format_callback(const format_callback_type &format_callback)
Definition ply_parser.h:448
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:458
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:453
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)
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.
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:188
typename list_property_element_callback_type< SizeType, ScalarType >::type list_property_element_callback_type
Definition ply_parser.h:187
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:193
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