Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

CArrayBinding< T > Class Template Reference

#include <CArrayBinding.h>

Inheritance diagram for CArrayBinding< T >:

CBinding< T > CTypeFreeBinding List of all members.

Public Member Functions

 CArrayBinding (T *pArray, int nFirst, int nLast, const STD(string)&m_sName, T *Defaults=NULL)
 CArrayBinding (T *pArray, int nFirst, int nLast, const char *m_sName, T *Defaults=NULL)
 ~CArrayBinding ()
getValue (int n) const
T * getPointer ()
int getFirstIndex () const
int getLastIndex () const
 STD (string) getArrayName() const
getDefault (int n) const
int getVariableType () const
virtual void InitBindings (CTCLInterpreter &rInterp)
virtual void Commit (CTCLInterpreter &rInterp)
virtual void ShutdownBindings (CTCLInterpreter &rInterp)
virtual void Dump (int fd)

Protected Member Functions

void setValue (int n, T value)
void setArrayBase (T *pBase)
void setFirstIndex (int n)
void setLastIndex (int n)
void setName (const STD(string)&rName)
void setDefaults (T *pDefaults)
void setVariableType (int nType)

Private Member Functions

 STD (string) m_sName
 Name of the Tcl array.
 CArrayBinding (const CArrayBinding &rhs)
 Forbidden.
CArrayBindingoperator= (const CArrayBinding &rhs)
 Forbidden.
int operator== (const CArrayBinding &rhs)
 Forbidden.

Private Attributes

T * m_pArrayBase
 Pointer to the configured array.
int m_nFirstIndex
 Low index of the binding.
int m_nLastIndex
 High index of the binding.
T * m_pInitialValues
 Optional array of initial values.
int m_TCLVariableType
 Type of the variable.

Detailed Description

template<class T>
class CArrayBinding< T >

Binds an array of configuration values to a slice of a numerically indexed array of TCL variables. When the configuration file is read the tcl array is checked for the slice of indices provided. any defined indices result in an overwrite of the corresponding configuration array element. The member data of this class are:

Definition at line 335 of file CArrayBinding.h.


Constructor & Destructor Documentation

template<class T>
CArrayBinding< T >::CArrayBinding T *  pArray,
int  nFirst,
int  nLast,
const STD(string)&  m_sName,
T *  Defaults = NULL
 

template<class T>
CArrayBinding< T >::CArrayBinding T *  pArray,
int  nFirst,
int  nLast,
const char *  pName,
T *  Defaults = NULL
 

Construct an array binding from a TCL Variable name given as a char*:

Parameters:
pArray - Pointer to the base of the array.
nFirst,nLast - Slice of array to configure.
pName - Name of Tcl array to configure from.
Defaults - Optional pointer to defautls array.

Definition at line 331 of file CArrayBinding.cpp.

template<class T>
CArrayBinding< T >::~CArrayBinding  )  [inline]
 

Definition at line 353 of file CArrayBinding.h.

template<class T>
CArrayBinding< T >::CArrayBinding const CArrayBinding< T > &  rhs  )  [private]
 

Forbidden.


Member Function Documentation

template<class T>
void CArrayBinding< T >::Commit CTCLInterpreter &  rInterp  )  [virtual]
 

Commits the changes from the TCL array to the configured array. This is done by sequentially attempting to read the TCL array with textual indices that are encoded integers in the range [m_nFirstIndex, m_nLastIndex). For each succesful read of a variable and decode of an integer value from it, the corresponding configured array element is set. Note that strings (T == char* are handled specially.

Parameters:
rInterp (CTCLInterpreter* [in]) the interpreter which read in the configuration file.

Implements CBinding< T >.

Definition at line 371 of file CArrayBinding.cpp.

References CArrayBinding< T >::m_pArrayBase.

template<class T>
void CArrayBinding< T >::Dump int  fd  )  [virtual]
 

Dumps the contents of the array to a file in TCL Script form. Since spaces are possible, this cannot be done straightforwardly. We will build (for each line in the file): a list containing the set command, the variable, and index name, and the stringified array value.

Parameters:
fd - File descriptor to which to write this.

Implements CBinding< T >.

Definition at line 444 of file CArrayBinding.cpp.

References CArrayBinding< T >::m_pArrayBase.

template<class T>
T CArrayBinding< T >::getDefault int  n  )  const [inline]
 

Definition at line 378 of file CArrayBinding.h.

template<class T>
int CArrayBinding< T >::getFirstIndex  )  const [inline]
 

Definition at line 369 of file CArrayBinding.h.

template<class T>
int CArrayBinding< T >::getLastIndex  )  const [inline]
 

Definition at line 372 of file CArrayBinding.h.

template<class T>
T* CArrayBinding< T >::getPointer  )  [inline]
 

Definition at line 366 of file CArrayBinding.h.

template<class T>
T CArrayBinding< T >::getValue int  n  )  const [inline]
 

Definition at line 363 of file CArrayBinding.h.

References CArrayBinding< T >::m_pArrayBase.

template<class T>
int CArrayBinding< T >::getVariableType  )  const [inline]
 

Definition at line 386 of file CArrayBinding.h.

template<class T>
void CArrayBinding< T >::InitBindings CTCLInterpreter &  rInterp  )  [virtual]
 

Initializes the objects prior to reading in the configuration file. For arrays, what we do is just initialize the configured array slice.

Parameters:
rInterp - The TCL interpreter which will be used to configure the array.

Implements CBinding< T >.

Definition at line 351 of file CArrayBinding.cpp.

References CArrayBinding< T >::m_pArrayBase, and CArrayBinding< T >::m_pInitialValues.

template<class T>
CArrayBinding& CArrayBinding< T >::operator= const CArrayBinding< T > &  rhs  )  [private]
 

Forbidden.

template<class T>
int CArrayBinding< T >::operator== const CArrayBinding< T > &  rhs  )  [private]
 

Forbidden.

template<class T>
void CArrayBinding< T >::setArrayBase T *  pBase  )  [inline, protected]
 

Definition at line 395 of file CArrayBinding.h.

References CArrayBinding< T >::m_pArrayBase.

template<class T>
void CArrayBinding< T >::setDefaults T *  pDefaults  )  [inline, protected]
 

Definition at line 407 of file CArrayBinding.h.

References CArrayBinding< T >::m_pInitialValues.

template<class T>
void CArrayBinding< T >::setFirstIndex int  n  )  [inline, protected]
 

Definition at line 398 of file CArrayBinding.h.

References CArrayBinding< T >::m_nFirstIndex.

template<class T>
void CArrayBinding< T >::setLastIndex int  n  )  [inline, protected]
 

Definition at line 401 of file CArrayBinding.h.

References CArrayBinding< T >::m_nLastIndex.

template<class T>
void CArrayBinding< T >::setName const STD(string)&  rName  )  [inline, protected]
 

Definition at line 404 of file CArrayBinding.h.

template<class T>
void CArrayBinding< T >::setValue int  n,
value
[inline, protected]
 

Definition at line 392 of file CArrayBinding.h.

References CArrayBinding< T >::m_pArrayBase.

template<class T>
void CArrayBinding< T >::setVariableType int  nType  )  [inline, protected]
 

Definition at line 410 of file CArrayBinding.h.

References CArrayBinding< T >::m_TCLVariableType.

template<class T>
void CArrayBinding< T >::ShutdownBindings CTCLInterpreter &  rInterp  )  [virtual]
 

Terminates any linkages to the Tcl variable space.. this is a no-op for this class.

Parameters:
rInterp - interpreter about to be shutdown.

Implements CBinding< T >.

Definition at line 428 of file CArrayBinding.cpp.

template<class T>
CArrayBinding< T >::STD string   )  const [inline]
 

Definition at line 375 of file CArrayBinding.h.

template<class T>
CArrayBinding< T >::STD string   )  [private]
 

Name of the Tcl array.

Reimplemented from CBinding< T >.


Member Data Documentation

template<class T>
int CArrayBinding< T >::m_nFirstIndex [private]
 

Low index of the binding.

Definition at line 340 of file CArrayBinding.h.

Referenced by CArrayBinding< T >::setFirstIndex().

template<class T>
int CArrayBinding< T >::m_nLastIndex [private]
 

High index of the binding.

Definition at line 341 of file CArrayBinding.h.

Referenced by CArrayBinding< T >::setLastIndex().

template<class T>
T* CArrayBinding< T >::m_pArrayBase [private]
 

Pointer to the configured array.

Definition at line 339 of file CArrayBinding.h.

Referenced by CArrayBinding< T >::Commit(), CArrayBinding< T >::Dump(), CArrayBinding< T >::getValue(), CArrayBinding< T >::InitBindings(), CArrayBinding< T >::setArrayBase(), and CArrayBinding< T >::setValue().

template<class T>
T* CArrayBinding< T >::m_pInitialValues [private]
 

Optional array of initial values.

Definition at line 343 of file CArrayBinding.h.

Referenced by CArrayBinding< T >::InitBindings(), and CArrayBinding< T >::setDefaults().

template<class T>
int CArrayBinding< T >::m_TCLVariableType [private]
 

Type of the variable.

Definition at line 344 of file CArrayBinding.h.

Referenced by CArrayBinding< T >::setVariableType().


The documentation for this class was generated from the following files:
Generated on Thu Jan 6 16:58:43 2005 for Spectrodaq External Event Framework by  doxygen 1.3.9.1