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

s11n::data_node_child_serializer< NodeType > Struct Template Reference

A helper functor to loop over serializable children. More...

#include <data_node_functor.h>

List of all members.

Public Types

typedef NodeType node_type

Public Member Functions

 data_node_child_serializer (node_type &dest, const std::string &subname)
 Creates an object for serializing.

template<typename SerializableT> bool operator() (const SerializableT *src)
 Serializes src into a subnode of dest using the name given in this object's ctor.


Public Attributes

bool result
 For use as a "return value catcher" for std::for_each().


Detailed Description

template<typename NodeType>
struct s11n::data_node_child_serializer< NodeType >

A helper functor to loop over serializable children.

Designed for use with std::for_each().

NodeType must be compatible with s11n::data_node.

Please see the operator() docs for important usage information, especially if you want to use this object outside the context of for_each().

Definition at line 69 of file data_node_functor.h.


Constructor & Destructor Documentation

template<typename NodeType>
s11n::data_node_child_serializer< NodeType >::data_node_child_serializer node_type &  dest,
const std::string &  subname
[inline]
 

Creates an object for serializing.

Preconditions:

  • dest must outlive this object. More correctly, this object's operator() must not be called after dest is destroyed.

Definition at line 83 of file data_node_functor.h.

References s11n::data_node_child_serializer< NodeType >::result.


Member Function Documentation

template<typename NodeType>
template<typename SerializableT>
bool s11n::data_node_child_serializer< NodeType >::operator() const SerializableT *  src  )  [inline]
 

Serializes src into a subnode of dest using the name given in this object's ctor.

Note that during an, e.g., for_each() this object will return false on a failed serialize, and will CONTINUE to return false on additional serializations. This is to avoid the possibility that for_each() fails on the first item of a list, handles 3000 items, and then the whole thing fails because of the first one. Thus, this operator will never process another request once it has returned false ONCE.

Definition at line 102 of file data_node_functor.h.

References s11n::data_node_child_serializer< NodeType >::operator()(), s11n::data_node_child_serializer< NodeType >::result, and s11n::serialize_subnode().

Referenced by s11n::data_node_child_serializer< NodeType >::operator()().


Member Data Documentation

template<typename NodeType>
bool s11n::data_node_child_serializer< NodeType >::result
 

For use as a "return value catcher" for std::for_each().

See operator() for how it is set. The starting value is true, which means that looping over an empty list with this object will return a true result (which is the convention in s11n).

Definition at line 117 of file data_node_functor.h.

Referenced by s11n::data_node_child_serializer< NodeType >::data_node_child_serializer(), and s11n::data_node_child_serializer< NodeType >::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