#include <mrpt/utils/CSerializable.h>
#include <mrpt/utils/CStream.h>
#include <mrpt/utils/metaprogramming.h>
#include <set>
#include <map>
#include <list>
Go to the source code of this file.
Classes | |
class | mrpt::utils::list_searchable< T > |
This class implements a STL container with features of both, a std::set and a std::list. More... | |
Namespaces | |
namespace | mrpt |
This is the global namespace for all Mobile Robot Porgramming Toolkit (MRPT) libraries. | |
namespace | mrpt::utils |
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL. | |
Defines | |
#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. | |
template<class T1 , class T2 > | |
CStream & | mrpt::utils::operator>> (CStream &in, std::pair< T1, T2 > &obj) |
Template method to deserialize a STL pair. | |
template<class T > | |
size_t | mrpt::utils::find_in_vector (const T &value, const std::vector< T > &vect) |
Returns the index of the value "T" in the container "vect", or string::npos if not found. | |
template<class CONTAINER > | |
CONTAINER::iterator | mrpt::utils::erase_return_next (CONTAINER &cont, typename CONTAINER::iterator &it) |
Calls the standard "erase" method of a STL container, but also returns an iterator to the next element in the container (or end if none). |
#define MRPTSTL_SERIALIZABLE_ASSOC_CONTAINER | ( | CONTAINER | ) |
Definition at line 76 of file stl_extensions.h.
#define MRPTSTL_SERIALIZABLE_SEQ_CONTAINER | ( | CONTAINER | ) |
Value:
/** Template method to serialize a sequential STL container */ \ template <class T> \ CStream& operator << (CStream& out, const CONTAINER<T> &obj) \ { \ out << string(#CONTAINER) << TTypeName<T>::get(); \ out << static_cast<uint32_t>(obj.size()); \ for_each( obj.begin(), obj.end(), ObjectWriteToStream(&out) ); \ return out; \ } \ /** Template method to deserialize a sequential STL container */ \ template <class T> \ CStream& operator >> (CStream& in, CONTAINER<T> &obj) \ { \ obj.clear(); \ string pref,stored_T; \ in >> pref; \ if (pref!=#CONTAINER) THROW_EXCEPTION(format("Error: serialized container %s<%s>'s preambles is wrong: '%s'",#CONTAINER,TTypeName<T>::get().c_str(),pref.c_str() )) \ in >> stored_T; \ if (stored_T != TTypeName<T>::get() ) THROW_EXCEPTION(format("Error: serialized container %s< %s != %s >",#CONTAINER,stored_T.c_str(),TTypeName<T>::get().c_str() )) \ uint32_t n; \ in >> n; \ obj.resize(n); \ for_each( obj.begin(), obj.end(), ObjectReadFromStream(&in) ); \ return in; \ }
Definition at line 48 of file stl_extensions.h.
#define MRPTSTL_SERIALIZABLE_SIMPLE_ASSOC_CONTAINER | ( | CONTAINER | ) |
Value:
/** Template method to serialize an associative STL container */ \ template <class K> \ CStream& operator << (CStream& out, const CONTAINER<K> &obj) \ { \ out << string(#CONTAINER) << TTypeName<K>::get(); \ out << static_cast<uint32_t>(obj.size()); \ for (typename CONTAINER<K>::const_iterator it=obj.begin();it!=obj.end();++it) \ out << *it; \ return out; \ } \ /** Template method to deserialize an associative STL container */ \ template <class K> \ CStream& operator >> (CStream& in, CONTAINER<K> &obj) \ { \ obj.clear(); \ 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; \ }
Referenced by mrpt::utils::MRPTSTL_SERIALIZABLE_SEQ_CONTAINER().
Page generated by Doxygen 1.5.9 for MRPT 0.7.1 SVN: at Mon Aug 17 22:21:34 EDT 2009 |