Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

valarray.hpp File Reference

#include <stdio.h>
#include <valarray>
#include <s11n.net/s11n/variant.hpp>

Go to the source code of this file.

Namespaces

namespace  s11n
namespace  s11n::va

Defines

#define s11n_VALARRAY_HPP_INCLUDED   1

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.


Define Documentation

#define s11n_VALARRAY_HPP_INCLUDED   1
 

Definition at line 7 of file valarray.hpp.


Function Documentation

template<typename NodeT, typename VAT>
bool deserialize_valarray const NodeT &  src,
VAT &  dest
 

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 serialize_valarray NodeT &  dest,
const VAT &  src
 

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 Thu Sep 29 20:01:15 2005 for libs11n-1.1.3-dev by  doxygen 1.4.1