FRIBParallelanalysis  1.0
FrameworkforMPIParalleldataanalysisatFRIB
Public Member Functions | Protected Member Functions | List of all members
frib::analysis::CTreeVariableArray Class Reference

#include <TreeVariableArray.h>

Public Member Functions

 CTreeVariableArray ()
 
 CTreeVariableArray (std::string baseName, double initialValue, std::string units, unsigned size, int firstIndex=0)
 
 CTreeVariableArray (std::string baseName, unsigned size, int firstIndex=0)
 
 CTreeVariableArray (const CTreeVariableArray &rhs)
 
 ~CTreeVariableArray ()
 
void Initialize (std::string baseName, double initialValue, std::string units, unsigned size, int firstElement)
 
CTreeVariableoperator[] (int index)
 
const CTreeVariableoperator[] (int index) const
 
CTreeVariableArrayoperator= (const CTreeVariableArray &rhs)
 
unsigned size () const
 
int firstIndex () const
 

Protected Member Functions

void BuildArray (std::string basename, unsigned int size, const CTreeVariable::Definition &example)
 
void CopyArray (const CTreeVariableArray &rhs)
 

Detailed Description

This class wraps a vector of tree variables in a nice convenient package. The treevariables are named given a base name, one more level of hierarchy and individual names like nn where nn is a number with enough digits to ensure a good sort order. For example, if I have 16 pads in some detector named somedetector.fp, the individual variables might have names like: somedetector.fp.00, somedetector.fp.01 .. somedetector.fp.10 .. somedetector.fp. 15

The vector wrapping also allows for a first index specification much like in Fortran where you can do dimension a(firstdim:lastdim) .. although for 'traditional' reasons tree prameters express this as firstdim,size. The original implementation required firstdim positive. Fortran and this implementation make no such restrictions, allowing negative indices if this is appropriate to the application.. in the example above, if the first index was given as -1, the names might be e.g.: somedetector.fp.-01, somedetector.fp.00 .. somedetector.fp.14

Author
Ron Fox
Version
1.0 30-Mar-2005 11:03:53 AM

Constructor & Destructor Documentation

◆ CTreeVariableArray() [1/2]

frib::analysis::CTreeVariableArray::CTreeVariableArray ( )

Default constructor... Creates a tree variable array that has an empty vector, and therefore no elements.

◆ CTreeVariableArray() [2/2]

frib::analysis::CTreeVariableArray::CTreeVariableArray ( const CTreeVariableArray rhs)

Copy constructor. The array of variables is deep copied to produce a duplicate set, bound to the same underlying variables... unless the vector is empty in which case we have duplicated an empty variable.

Parameters
rhsThe source of the copy construction

◆ ~CTreeVariableArray()

frib::analysis::CTreeVariableArray::~CTreeVariableArray ( )

Destroys the tree variable and its contents. Note that while the binding to the underlying TCLVariables is obviously undone, the variables themselves are left alone.

Member Function Documentation

◆ BuildArray()

void frib::analysis::CTreeVariableArray::BuildArray ( std::string  basename,
unsigned int  size,
const CTreeVariable::Definition example 
)
protected

Builds up the new array.

Parameters
basenameBase name used to construct the individual names.
sizeNumber of elements in the array.
exampleSample properties that will be used to construct the individual elements.

◆ CopyArray()

void frib::analysis::CTreeVariableArray::CopyArray ( const CTreeVariableArray rhs)
protected

Copys the member elements from a rhs CTreeVariableArray into the current object. This utility is used both by assignment and copy construction.

Parameters
rhsThe source of the copy.

◆ firstIndex()

int frib::analysis::CTreeVariableArray::firstIndex ( ) const

Return the value of the lowest index (could be negative).

◆ Initialize()

void frib::analysis::CTreeVariableArray::Initialize ( std::string  baseName,
double  initialValue,
std::string  units,
unsigned  size,
int  firstElement 
)

Intended for use with a variable array that was default constructed.Any existing array is destroyed, and a new one built.

Parameters
baseNameName used to construct element names.
initialValueThe value to be assigned to the elements.
unitsThe units of measure of the elements of the array.
sizenumber of array elements.
firstElementLowest numbered index.

◆ operator=()

CTreeVariableArray & frib::analysis::CTreeVariableArray::operator= ( const CTreeVariableArray rhs)

Values in the rhs are copied to the values of the LHS.

Note
precondition is that rhs.size( == this->size()) Else invalid_argument is thrown.
Parameters
rhs

◆ operator[]()

CTreeVariable & frib::analysis::CTreeVariableArray::operator[] ( int  index)

Indexes in to the array of tree variables and returns the selected element (throw on range errors).

Parameters
indexIndex into the array.

◆ size()

unsigned frib::analysis::CTreeVariableArray::size ( ) const

return the number of elements in the array (could be 0).


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