OrderedSubset Class Reference

An OrderedSubset defines a list of indices into a data set. More...

#include <OrderedSubset.h>

Inherits NamedObject.

Inheritance diagram for OrderedSubset:

Inheritance graph
[legend]
Collaboration diagram for OrderedSubset:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 OrderedSubset (const char *name, bool zeroBased=true)
 Creates an empty OrderedSubset, to be filled later.
 OrderedSubset (const char *name, int numIndices, bool zeroBased=true)
 Creates an OrderedSubset, and fills it with numIndices values, in order.
 OrderedSubset (OrderedSubset &)
 Copy constructor.
int getNumEntries ()
 Accessor method.
void add (int i)
 Adds an index to the OrderedSubset.
const int get (int i)
 Retrieves the index at the given position.
void add (OrderedSubset &)
 Adds the contents of one OrderedSubset to this one.
void loadAscii (istream &s)
 Loads the space-separated ordering indices from an input stream.
void loadBinary (istream &s, int numEntries)
 Loads the ordering indices from a binary stream (faster than parsing text).
void saveAscii (ostream &s)
 Writes the indices to the passed output stream, one per line.
void saveBinary (ostream &s)
 Writes the indices to the passed output stream as a binary array of integers.
void permuteEntries ()
 Randomizes the order of the stored indices.

Friends

ostream & operator<< (ostream &s, OrderedSubset &os)
 Sends the indices in an OrderedSubset to the passed stream.
istream & operator>> (istream &s, OrderedSubset &os)
 Reads the indices for the OrderedSubset from the passed input stream.

Detailed Description

An OrderedSubset defines a list of indices into a data set.

As such, it defines both a subset, and an ordering of a subset. OrderedSubsets are used to store the orderings in View Objects.


Constructor & Destructor Documentation

OrderedSubset::OrderedSubset const char *  name,
bool  zeroBased = true
 

Creates an empty OrderedSubset, to be filled later.

Parameters:
name Used to describe object in logged messages.
zeroBased If false, 1 means the first entry, otherwise 0 means the first entry.

OrderedSubset::OrderedSubset const char *  name,
int  numIndices,
bool  zeroBased = true
 

Creates an OrderedSubset, and fills it with numIndices values, in order.

Parameters:
name Used to describe object in logged messages.
numIndices How many entries to add to the ordering
zeroBased If true, entries go from 0 to numIndices-1, else 1 to numIndices.

OrderedSubset::OrderedSubset OrderedSubset os  ) 
 

Copy constructor.

Parameters:
os The object to copy.


Member Function Documentation

void OrderedSubset::add OrderedSubset os  ) 
 

Adds the contents of one OrderedSubset to this one.

Parameters:
os The object to add to this one.

void OrderedSubset::add int  index  ) 
 

Adds an index to the OrderedSubset.

Parameters:
index The value to add.

const int OrderedSubset::get int  i  )  [inline]
 

Retrieves the index at the given position.

Parameters:
i The position to get the index from (depends on whether or not the OrderedSubset is zero-based).
Exceptions:
MsgException If the requested position is out of range.

int OrderedSubset::getNumEntries  )  [inline]
 

Accessor method.

Returns:
The number of stored indices

void OrderedSubset::loadAscii istream &  s  ) 
 

Loads the space-separated ordering indices from an input stream.

Parameters:
s The input stream to get the indices from.

void OrderedSubset::loadBinary istream &  s,
int  numEntries
 

Loads the ordering indices from a binary stream (faster than parsing text).

The indices are loaded as an array of integers of specified size.

Parameters:
s The input stream to load the index array from.
numEntries The number of indices to load.

void OrderedSubset::permuteEntries  ) 
 

Randomizes the order of the stored indices.

void OrderedSubset::saveAscii ostream &  s  ) 
 

Writes the indices to the passed output stream, one per line.

Parameters:
s The output stream to write the indices to.

void OrderedSubset::saveBinary ostream &  s  ) 
 

Writes the indices to the passed output stream as a binary array of integers.

Parameters:
s The output stream to write the indices to.


Friends And Related Function Documentation

ostream& operator<< ostream &  s,
OrderedSubset os
[friend]
 

Sends the indices in an OrderedSubset to the passed stream.

Parameters:
s The output stream to which to send the indices.
os The OrderedSubset to use.

istream& operator>> istream &  s,
OrderedSubset os
[friend]
 

Reads the indices for the OrderedSubset from the passed input stream.

Parameters:
s The stream to read the space-separated indices from.
os The OrderedSubset object to add the indices to.


The documentation for this class was generated from the following files:
Generated on Tue Dec 13 11:00:27 2005 for Classer by  doxygen 1.4.3