Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members

s11n::streamable_type_serializer_proxy Struct Reference

A Serializable Proxy for streamable types. More...

#include <data_node_functor.h>

List of all members.

Public Member Functions

 streamable_type_serializer_proxy (const std::string &subnodename)
 Sets the subnode name used for this object's serialize operator.

 streamable_type_serializer_proxy ()
 Uses a default, unspecified, name for subnode insertions.

template<typename NodeType, typename SerType> bool operator() (NodeType &dest, const SerType &src) const
 Creates a property in dest, called 'v', and sets its value to src.

template<typename NodeType, typename SerType> bool operator() (const NodeType &src, SerType &dest) const
 Looks for a property in src called 'v' and sets dest to it's value.


Detailed Description

A Serializable Proxy for streamable types.

It "should" work with any type which meets these conditions:

It's output is significantly bigger than using, e.g., node properties to store them, but with this proxy any streamable can be treated as a full-fledged Serializable, which allows some generic container-based serialization to be done regardless of the underlying types (see list_serializer_proxy for an example).

ACHTUNG: never pass the same Serializable to the operators more than once or you will get duplicate and/or incorrect data.

Definition at line 234 of file data_node_functor.h.


Member Function Documentation

template<typename NodeType, typename SerType>
bool s11n::streamable_type_serializer_proxy::operator() const NodeType &  src,
SerType &  dest
const [inline]
 

Looks for a property in src called 'v' and sets dest to it's value.

The default for dest, in the case of a missing property or nonconvertable value is dest itself.

If the 'v' property is missing this function does nothing and returns false, otherwise dest gets assigned the property's value and true is returned. This function cannot catch a case of inability to convert 'v' into a SerType: client code interested in doing so should compare dest's value to a known error value after this function returns.

Definition at line 288 of file data_node_functor.h.

References s11n::dump_node_debug(), and operator()().

template<typename NodeType, typename SerType>
bool s11n::streamable_type_serializer_proxy::operator() NodeType &  dest,
const SerType &  src
const [inline]
 

Creates a property in dest, called 'v', and sets its value to src.

Each node gets the name assigned via this object's ctor or an undefined dummy name. Note that the deserialize operator pays no attention to the subnode names.

Always returns true.

Definition at line 260 of file data_node_functor.h.

References operator()().

Referenced by operator()().


The documentation for this struct was generated from the following file:
Generated on Wed Jul 28 16:04:15 2004 for s11n by doxygen 1.3.7