Public Member Functions | Private Attributes

ana::serializer::container_writer< T > Class Template Reference

A helper class to insert containers from single elements. More...

#include <binary_streams.hpp>

Collaboration diagram for ana::serializer::container_writer< T >:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 container_writer (size_t size, bostream &bos)
 Default constructor.
container_writeroperator<< (T element)
 Push an element.
 ~container_writer ()
 Default destructor.

Private Attributes

size_t _elements_left
 The amount of elements you have yet to insert.
bostream_bos
 A reference to the output stream.

Detailed Description

template<class T>
class ana::serializer::container_writer< T >

A helper class to insert containers from single elements.

Use this when you know that the data will later be read into a vector or some other container but you don't have such a container for insertion, you want to create it on the go.

Parameters:
T : The type of the elements in the container.

Definition at line 289 of file binary_streams.hpp.


Constructor & Destructor Documentation

template<class T >
ana::serializer::container_writer< T >::container_writer ( size_t  size,
bostream bos 
) [inline]

Default constructor.

Parameters:
size : The amount of elements you will write.
bos : A reference to the output stream where you will create the container.

Definition at line 300 of file binary_streams.hpp.

References ana::serializer::container_writer< T >::_bos.

template<class T >
ana::serializer::container_writer< T >::~container_writer (  )  [inline]

Default destructor.

Precondition:
: The elements inserted equals the amount of elements that were promised to be inserted at the time of creation (size parameter.)

Definition at line 326 of file binary_streams.hpp.

References ana::serializer::container_writer< T >::_elements_left.


Member Function Documentation

template<class T >
container_writer& ana::serializer::container_writer< T >::operator<< ( element  )  [inline]

Member Data Documentation

template<class T >
bostream& ana::serializer::container_writer< T >::_bos [private]
template<class T >
size_t ana::serializer::container_writer< T >::_elements_left [private]

The amount of elements you have yet to insert.

Definition at line 334 of file binary_streams.hpp.

Referenced by ana::serializer::container_writer< T >::operator<<(), and ana::serializer::container_writer< T >::~container_writer().


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated by doxygen 1.7.1 on Thu May 24 2012 01:19:19 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs