Main MRPT website > C++ reference for MRPT 1.5.6
Namespaces | Macros | Functions
stl_serialization.h File Reference
#include <mrpt/utils/TTypeName_impl.h>
#include <mrpt/utils/metaprogramming_serialization.h>
#include <mrpt/utils/CStream.h>
#include <vector>
#include <deque>
#include <set>
#include <map>
#include <list>
#include <algorithm>
Include dependency graph for stl_serialization.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 mrpt
 This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
 
 mrpt::utils
 Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
 

Macros

#define MRPTSTL_SERIALIZABLE_SEQ_CONTAINER(CONTAINER)
 
#define MRPTSTL_SERIALIZABLE_ASSOC_CONTAINER(CONTAINER)
 
#define MRPTSTL_SERIALIZABLE_SIMPLE_ASSOC_CONTAINER(CONTAINER)
 

Functions

 mrpt::utils::MRPTSTL_SERIALIZABLE_SEQ_CONTAINER (std::vector) MRPTSTL_SERIALIZABLE_SEQ_CONTAINER(std
 Template method to serialize a STL pair. More...
 
template<class T1 , class T2 >
CStream & mrpt::utils::operator>> (mrpt::utils::CStream &in, std::pair< T1, T2 > &obj)
 Template method to deserialize a STL pair. More...
 

Macro Definition Documentation

◆ MRPTSTL_SERIALIZABLE_SIMPLE_ASSOC_CONTAINER

#define MRPTSTL_SERIALIZABLE_SIMPLE_ASSOC_CONTAINER (   CONTAINER)
Value:
/** Template method to serialize an associative STL container */ \
template <class K,class _Pr,class _Alloc> \
CStream& operator << (mrpt::utils::CStream& out, const CONTAINER<K,_Pr,_Alloc> &obj) \
{ \
out << std::string(#CONTAINER) << TTypeName<K>::get(); \
out << static_cast<uint32_t>(obj.size()); \
for (typename CONTAINER<K,_Pr,_Alloc>::const_iterator it=obj.begin();it!=obj.end();++it) \
out << *it; \
return out; \
} \
/** Template method to deserialize an associative STL container */ \
template <class K,class _Pr,class _Alloc> \
CStream& operator >> (mrpt::utils::CStream& in, CONTAINER<K,_Pr,_Alloc> &obj) \
{ \
obj.clear(); \
std::string pref,stored_K; \
in >> pref; \
if (pref!=#CONTAINER) THROW_EXCEPTION(format("Error: serialized container %s<%s>'s preamble is wrong: '%s'",#CONTAINER, TTypeName<K>::get().c_str(),pref.c_str())) \
in >> stored_K; \
if (stored_K != TTypeName<K>::get()) THROW_EXCEPTION(format("Error: serialized container %s key type %s != %s",#CONTAINER,stored_K.c_str(), TTypeName<K>::get().c_str())) \
uint32_t n; \
in >> n; \
for (uint32_t i=0;i<n;i++) \
{ \
K key_obj; \
in >> key_obj; \
obj.insert(key_obj); \
} \
return in; \
}
#define THROW_EXCEPTION(msg)
const Scalar * const_iterator
Definition: eigen_plugins.h:24
GLdouble s
Definition: glext.h:3602
GLsizei GLsizei GLuint * obj
Definition: glext.h:3902
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
Definition: CStream.h:38
CStream & operator>>(mrpt::utils::CStream &in, std::pair< T1, T2 > &obj)
Template method to deserialize a STL pair.
GLsizei const GLchar ** string
Definition: glext.h:3919
GLuint in
Definition: glext.h:6301
GLenum GLsizei GLenum format
Definition: glext.h:3513
GLuint GLuint GLsizei GLenum type
Definition: glext.h:3512



Page generated by Doxygen 1.8.14 for MRPT 1.5.6 Git: 4c65e8431 Tue Apr 24 08:18:17 2018 +0200 at lun oct 28 01:35:26 CET 2019