Main MRPT website > C++ reference for MRPT 1.9.9
metaprogramming_serialization.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2018, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 #pragma once
10 
12 
13 namespace mrpt
14 {
15 namespace serialization
16 {
17 namespace metaprogramming
18 {
19 /** \addtogroup stlext_grp
20  * @{ */
21 
22 /** An object for reading objects from a stream, intended for being used in STL
23  * algorithms. */
25 {
26  private:
28 
29  public:
31  : m_stream(stream)
32  {
33  }
34  // T can be CSerializable::Ptr, CSerializable, or any other class
35  // implementing ">>"
36  template <typename T>
37  inline void operator()(T& obj)
38  {
39  (*m_stream) >> obj;
40  }
41 };
42 
43 template <typename ptr_t>
45 {
46  private:
48 
49  public:
51  : m_stream(stream)
52  {
53  }
54  template <typename ptr2ptr_t>
55  inline void operator()(ptr2ptr_t& obj)
56  {
57  ptr_t p;
58  (*m_stream) >> p;
59  obj = p;
60  }
61 };
62 
63 /** An object for writing objects to a stream, intended for being used in STL
64  * algorithms. */
66 {
67  private:
69 
70  public:
72  : m_stream(stream)
73  {
74  }
75 
76  // T can be CSerializable::Ptr, CSerializable, or any other class
77  // implementing "<<"
78  template <typename T>
79  inline void operator()(const T& ptr)
80  {
81  (*m_stream) << ptr;
82  }
83 };
84 
85 /** @} */ // end of grouping
86 }
87 }
88 }
An object for reading objects from a stream, intended for being used in STL algorithms.
GLsizei GLsizei GLuint * obj
Definition: glext.h:4070
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Virtual base class for "archives": classes abstracting I/O streams.
Definition: CArchive.h:48
GLfloat GLfloat p
Definition: glext.h:6305
An object for writing objects to a stream, intended for being used in STL algorithms.



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at lun oct 28 00:14:14 CET 2019