Boost  v1.57.0
doxygen for www.boost.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
boost::python::detail::direct_serialization_table< IArchiver, OArchiver > Class Template Reference

INTERNAL ONLY. More...

#include <serialize.hpp>

Collaboration diagram for boost::python::detail::direct_serialization_table< IArchiver, OArchiver >:

Classes

struct  default_loader
 
struct  default_saver
 

Public Types

typedef boost::function3< void,
OArchiver &, const object
&, const unsigned int > 
saver_t
 
typedef boost::function3< void,
IArchiver &, object &, const
unsigned int > 
loader_t
 
typedef std::map< PyTypeObject
*, std::pair< int, saver_t > > 
savers_t
 
typedef std::map< int, loader_tloaders_t
 

Public Member Functions

saver_t saver (const object &obj, int &descriptor)
 Retrieve the saver (serializer) associated with the Python object obj. More...
 
loader_t loader (int descriptor)
 Retrieve the loader (deserializer) associated with the given descriptor. More...
 
template<typename T >
void register_type (const T &value=T(), PyTypeObject *type=0)
 Register the type T for direct serialization. More...
 
template<typename T >
void register_type (const saver_t &saver, const loader_t &loader, const T &value=T(), PyTypeObject *type=0)
 Register the type T for direct serialization. More...
 

Protected Attributes

savers_t savers
 
loaders_t loaders
 

Detailed Description

template<typename IArchiver, typename OArchiver>
class boost::python::detail::direct_serialization_table< IArchiver, OArchiver >

INTERNAL ONLY.

This class contains the direct-serialization code for the given IArchiver/OArchiver pair. It is intended to be used as a singleton class, and will be accessed when (de-)serializing a Boost.Python object with an archiver that supports direct serializations. Do not create instances of this class directly: instead, use get_direct_serialization_table.

Member Typedef Documentation

template<typename IArchiver, typename OArchiver>
typedef boost::function3<void, IArchiver&, object&, const unsigned int> boost::python::detail::direct_serialization_table< IArchiver, OArchiver >::loader_t
template<typename IArchiver, typename OArchiver>
typedef std::map<int, loader_t> boost::python::detail::direct_serialization_table< IArchiver, OArchiver >::loaders_t
template<typename IArchiver, typename OArchiver>
typedef boost::function3<void, OArchiver&, const object&, const unsigned int> boost::python::detail::direct_serialization_table< IArchiver, OArchiver >::saver_t
template<typename IArchiver, typename OArchiver>
typedef std::map<PyTypeObject*, std::pair<int, saver_t> > boost::python::detail::direct_serialization_table< IArchiver, OArchiver >::savers_t

Member Function Documentation

template<typename IArchiver, typename OArchiver>
loader_t boost::python::detail::direct_serialization_table< IArchiver, OArchiver >::loader ( int  descriptor)
inline

Retrieve the loader (deserializer) associated with the given descriptor.

Parameters
descriptorThe descriptor number provided by saver() when determining the saver for this type.
Returns
a function object that can be used to deserialize an object whose type is the same as that corresponding to the descriptor. If the descriptor is unknown, the return value will be an empty function object.

Referenced by boost::python::detail::load_impl().

template<typename IArchiver, typename OArchiver>
template<typename T >
void boost::python::detail::direct_serialization_table< IArchiver, OArchiver >::register_type ( const T value = T(),
PyTypeObject *  type = 0 
)
inline

Register the type T for direct serialization.

Parameters
valueA sample value of the type T. This may be used to compute the Python type associated with the C++ type T.
typeThe Python type associated with the C++ type T. If not provided, it will be computed from the same value value.

References boost::program_options::value().

Referenced by boost::python::register_serialized().

template<typename IArchiver, typename OArchiver>
template<typename T >
void boost::python::detail::direct_serialization_table< IArchiver, OArchiver >::register_type ( const saver_t saver,
const loader_t loader,
const T value = T(),
PyTypeObject *  type = 0 
)
inline

Register the type T for direct serialization.

Parameters
saverA function object that will serialize a Boost.Python object (that represents a C++ object of type T) to an OArchive.
loaderA function object that will deserialize from an IArchive into a Boost.Python object that represents a C++ object of type T.
valueA sample value of the type T. This may be used to compute the Python type associated with the C++ type T.
typeThe Python type associated with the C++ type T. If not provided, it will be computed from the same value value.

References boost::xpressive::make_pair, boost::detail::type, and boost::program_options::value().

template<typename IArchiver, typename OArchiver>
saver_t boost::python::detail::direct_serialization_table< IArchiver, OArchiver >::saver ( const object &  obj,
int &  descriptor 
)
inline

Retrieve the saver (serializer) associated with the Python object obj.

Parameters
objThe object we want to save. Only its (Python) type is important.
descriptorThe value of the descriptor associated to the returned saver. Will be set to zero if no saver was found for obj.
Returns
a function object that can be used to serialize this object (and other objects of the same type), if possible. If no saver can be found, returns an empty function object..

Referenced by boost::python::detail::save_impl().

Member Data Documentation

template<typename IArchiver, typename OArchiver>
loaders_t boost::python::detail::direct_serialization_table< IArchiver, OArchiver >::loaders
protected
template<typename IArchiver, typename OArchiver>
savers_t boost::python::detail::direct_serialization_table< IArchiver, OArchiver >::savers
protected

The documentation for this class was generated from the following file: