EnumBitArray Class Template Reference

An array of n-bit values that uses an enumerated datatype. More...

#include <EnumBitArray.h>

Inheritance diagram for EnumBitArray::

BitArrayBase List of all members.

Public Methods

 EnumBitArray ()
 Empty constructor.

 EnumBitArray (const size_type len, const size_type nbytes=0, char *d=(char *) 0, const EnumDataOwned o=DataNotOwned)
 Construct with data provided by the d array.

 EnumBitArray (const EnumBitArray &array)
 Copy constructor.

operator() (const size_type idx) const
 Return the ndx element of this array.

void put (const size_type idx, const T val)
 Put the value val at the ndx index.

EnumBitArray< T > & operator= (const T value)
 Set all elements of the array to value.

int write (ostream &input) const
 Write the array to an output stream. More...

int read (istream &input)
 Read the array from an input stream.


Protected Methods

int operator[] (const size_type idx) const
 Returns the value of the ndx-th bit-pair.

void put (const size_type, const int)
 Put bit value val in the ndx-th bit-pair.

int element_size () const
 Returns the number of bits in an element in the array.


Static Protected Attributes

int enum_count
 The number of elements in the enumeration type.

char enum_labels []
 The character labels of the enumeration types.

enum_vals []
 A list of the enumeration values.


Detailed Description

template<class T>
class EnumBitArray< T >

An array of n-bit values that uses an enumerated datatype.

The main elements of this array have the same look and feel as a SimpleArray object. However, this class uses a special, compact representation of the data elements, which forces it to be a separate class. This class does not impose a restriction on the maximum length of the array.

Note: this class assumes that 1. the user sets up the static variable seperately, and 2. the enum type is set to integral values, starting from 0


Member Function Documentation

template<class T>
int EnumBitArray< T >::write ostream &    s const
 

Write the array to an output stream.

The format for this output is

 <len> : <bit-1><bit-2>...<bit-n> 

Reimplemented from BitArrayBase.


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