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 
14 {
15 /** \addtogroup stlext_grp
16  * @{ */
17 
18 /** An object for reading objects from a stream, intended for being used in STL
19  * algorithms. */
21 {
22  private:
24 
25  public:
27  : m_stream(stream)
28  {
29  }
30  // T can be CSerializable::Ptr, CSerializable, or any other class
31  // implementing ">>"
32  template <typename T>
33  inline void operator()(T& obj)
34  {
35  (*m_stream) >> obj;
36  }
37 };
38 
39 template <typename ptr_t>
41 {
42  private:
44 
45  public:
47  : m_stream(stream)
48  {
49  }
50  template <typename ptr2ptr_t>
51  inline void operator()(ptr2ptr_t& obj)
52  {
53  ptr_t p;
54  (*m_stream) >> p;
55  obj = p;
56  }
57 };
58 
59 /** An object for writing objects to a stream, intended for being used in STL
60  * algorithms. */
62 {
63  private:
65 
66  public:
68  : m_stream(stream)
69  {
70  }
71 
72  // T can be CSerializable::Ptr, CSerializable, or any other class
73  // implementing "<<"
74  template <typename T>
75  inline void operator()(const T& ptr)
76  {
77  (*m_stream) << ptr;
78  }
79 };
80 
81 /** @} */ // end of grouping
82 }
83 
An object for reading objects from a stream, intended for being used in STL algorithms.
GLsizei GLsizei GLuint * obj
Definition: glext.h:4070
Virtual base class for "archives": classes abstracting I/O streams.
Definition: CArchive.h:52
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: 7d5e6d718 Fri Aug 24 01:51:28 2018 +0200 at lun nov 2 08:35:50 CET 2020