mace::sparse_array< T, size > Class Template Reference
[Collections]

#include <msparse_array.h>

Inheritance diagram for mace::sparse_array< T, size >:

Inheritance graph
[legend]
Collaboration diagram for mace::sparse_array< T, size >:

Collaboration graph
[legend]

List of all members.


Detailed Description

template<class T, int size>
class mace::sparse_array< T, size >

provides an interface like mace::array, but designed for sparse arrays

Definition at line 55 of file msparse_array.h.


Public Member Functions

int deserialize (std::istream &in) throw (SerializationException)
 Replace the current object value from the bytes read from in, returning the number of bytes read.
void serialize (std::string &str) const
 Encode the current object at the end of str as a bytestring in a compact format (and which doesn't require delimiters to parse).
const std::string & getTypeName () const
 Return the template parameter string Key->Data for actual template parameters. (Mace extension).
bool contains (size_type i) const
 check if the array has an element at position i
T & operator[] (size_type place)
 return the data at position place, constructing one if needed
const T & operator[] (size_type place) const
 return the data at position place, throwing an exception if not already there
void erase (size_type i)
 erase the element in position i (does not change the size of the array)
size_type count () const
 return the number of non-NULL elements in the array
T & random (int *p=NULL)
 return a random (non-null) element, constructing one at position 0 if there are none. Sets the position of the element returned.
const T & random (int *p=NULL) const
 return a random (non-null) element, throwing an exception if there are none. Sets the position of the element returned.

The documentation for this class was generated from the following file:

Generated on Sat Oct 4 21:30:41 2008 for Mace Library by  doxygen 1.5.5