INTERNAL ONLY. More...
#include <serialize.hpp>
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_t > | loaders_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 |
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.
typedef boost::function3<void, IArchiver&, object&, const unsigned int> boost::python::detail::direct_serialization_table< IArchiver, OArchiver >::loader_t |
typedef std::map<int, loader_t> boost::python::detail::direct_serialization_table< IArchiver, OArchiver >::loaders_t |
typedef boost::function3<void, OArchiver&, const object&, const unsigned int> boost::python::detail::direct_serialization_table< IArchiver, OArchiver >::saver_t |
typedef std::map<PyTypeObject*, std::pair<int, saver_t> > boost::python::detail::direct_serialization_table< IArchiver, OArchiver >::savers_t |
|
inline |
Retrieve the loader (deserializer) associated with the given descriptor.
descriptor | The descriptor number provided by saver() when determining the saver for this type. |
Referenced by boost::python::detail::load_impl().
|
inline |
Register the type T for direct serialization.
value | A sample value of the type T . This may be used to compute the Python type associated with the C++ type T . |
type | The 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().
|
inline |
Register the type T for direct serialization.
saver | A function object that will serialize a Boost.Python object (that represents a C++ object of type T ) to an OArchive . |
loader | A function object that will deserialize from an IArchive into a Boost.Python object that represents a C++ object of type T . |
value | A sample value of the type T . This may be used to compute the Python type associated with the C++ type T . |
type | The 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().
|
inline |
Retrieve the saver (serializer) associated with the Python object obj
.
obj | The object we want to save. Only its (Python) type is important. |
descriptor | The value of the descriptor associated to the returned saver. Will be set to zero if no saver was found for obj . |
Referenced by boost::python::detail::save_impl().
|
protected |
|
protected |