s11n::va Namespace Reference

s11n::va encapsulates de/serialization operators for std::valarray objects. More...


Classes

struct  valarray_serializable_proxy
 A Serializable proxy for valarray types. More...

Functions

template<typename NodeT, typename VAT>
bool serialize_valarray (NodeT &dest, const VAT &src)
 Serializes src to dest.
template<typename NodeT, typename VAT>
bool deserialize_valarray (const NodeT &src, VAT &dest)
 Deserializes dest from src.


Detailed Description

s11n::va encapsulates de/serialization operators for std::valarray objects.

Function Documentation

template<typename NodeT, typename VAT>
bool s11n::va::deserialize_valarray ( const NodeT &  src,
VAT &  dest 
) [inline]

Deserializes dest from src.

Returns true on success, false on error. VAT must be a std::valarray type with a numeric value_type.

Always returns true.

Definition at line 83 of file valarray.hpp.

Referenced by s11n::va::valarray_serializable_proxy::operator()().

template<typename NodeT, typename VAT>
bool s11n::va::serialize_valarray ( NodeT &  dest,
const VAT &  src 
) [inline]

Serializes src to dest.

Returns true on success, false on error. VAT must be a std::valarray type with a numeric value_type.

Always returns true.

Each entry is stored as a key/value pair in src, which means this algorithm works with all iostreamable contained types. Since valarray is intended for use with numbers, this should be appropriate for all cases.

To avoid entering numeric keys into dest, which don't work with XML serializers, and to keep proper ordering of the keys, it synthesizes sequential numbers, preceded by an 'x', for use as keys. The number of digits in the keys is calculated based off of src.size().

This function never returns false, but will throw if src has more than some arbitrarily large number of items (at least 64 bits worth), due to a minor detail you can read about in the source code.

ACHTUNG: precision of doubles in limited to whatever default is used by s11n for lexical casting via iostreams.

Definition at line 50 of file valarray.hpp.

Referenced by s11n::va::valarray_serializable_proxy::operator()().


Generated on Wed Jun 4 21:44:21 2008 for libs11n by  doxygen 1.5.3