Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

CRunVariableCommand Class Reference

#include <CRunVariableCommand.h>

List of all members.

Public Methods

 CRunVariableCommand ()
 Default constructor.

virtual ~CRunVariableCommand ()
 Destructor.

virtual int operator() (CTCLInterpreter &rInterp, CTCLResult &rResult, int argc, char **argv)
int Create (CTCLInterpreter &rInterp, CTCLResult &rResult, int argc, char **argv)
int Delete (CTCLInterpreter &rInterp, CTCLResult &rResult, int argc, char **argv)
int List (CTCLInterpreter &rInterp, CTCLResult &rResult, int argc, char **argv)
CRunVariableCreate (const string &rName, const string &rInitialValue=string("-uninitialized"))
void Delete (const string &rName)
void Delete (RunVariableIterator &rIter)
RunVariableIterator begin ()
RunVariableIterator end ()
size_t size ()
RunVariableIterator find (const string &rName)

Protected Methods

void Usage (CTCLResult &rResult)

Private Methods

 CRunVariableCommand (const CRunVariableCommand &rhs)
 Copy constructor.

CRunVariableCommand & operator= (const CRunVariableCommand &rhs)
 Assignment.

int operator== (const CRunVariableCommand &rhs) const
 Comparison for equality.

int operator!= (const CRunVariableCommand &rhs) const

Private Attributes

RunVariableList m_RunVariables


Constructor & Destructor Documentation

CRunVariableCommand::CRunVariableCommand  
 

Default constructor.

Construct the command object. The object is bound to no interprater the command name, which will eventually be registered is:

runvar

Definition at line 319 of file CRunVariableCommand.cpp.

CRunVariableCommand::~CRunVariableCommand   [virtual]
 

Destructor.

Destructor... we need to delete all the items pointed to:

Definition at line 329 of file CRunVariableCommand.cpp.

References begin(), end(), and RunVariableIterator.

CRunVariableCommand::CRunVariableCommand const CRunVariableCommand &    rhs [private]
 

Copy constructor.


Member Function Documentation

RunVariableIterator CRunVariableCommand::begin  
 

Returns an iterator to the list of variables which are considered to be run variables.

Parameters:

Definition at line 596 of file CRunVariableCommand.cpp.

References m_RunVariables.

Referenced by List(), CExperiment::TriggerRunVariableBuffer(), and ~CRunVariableCommand().

CRunVariable * CRunVariableCommand::Create const string &    rName,
const string &    rInitialValue = string("-uninitialized")
 

Create a run variable programmatically

Parameters:
rName  - const string& [in] - Name of the variable.
rInitialValue  const string& [in] - Initial value of the variable.
Note:
If the variable rName already exists, this function is a no-op (for now) future implementations reserve the right to throw an exception for duplicate object.
Returns:
One of:
  • a pointer to the new variable on success.
  • NULL if the variable could not be created (e.g. one with that name already exists.

Definition at line 655 of file CRunVariableCommand.cpp.

References end(), find(), and m_RunVariables.

int CRunVariableCommand::Create CTCLInterpreter &    rInterp,
CTCLResult &    rResult,
int    argc,
char **    argv
 

Dispatched to from the operator() member function. This member function has the form:

runvar name [value]

If the variable does not exist it is created, and, if no initializer is specified, is set to "-uninitialized-" If the variable exists and no initializer is specified, the value is not changed.

Parameters:
rInterp  - Reference to the interpreter object which is running this command.
rResult  - Reference to the result string which will be filled in either with the value of the variable if success or contain an error message on failure.
argc,argv  - Parameters after the runvar command.
Returns:
TCL_OK - If success. TCL_ERROR - If failure
Note:
- It is a successful no-op to attempt to create a runvar which already exists.
- There's no mechanism to create an array, however individual elements can be created; e.g. runvar george(harry) 1234

Definition at line 444 of file CRunVariableCommand.cpp.

References end(), find(), m_RunVariables, RunVariableIterator, and Usage().

Referenced by operator()().

void CRunVariableCommand::Delete RunVariableIterator   rIter
 

Delete programmatically a run variable given an iterator to it:

Parameters:
rIter  - RunVariableIterator& iterator ``Pointing'' to the variable object in the map.

Definition at line 693 of file CRunVariableCommand.cpp.

References m_RunVariables, and RunVariableIterator.

void CRunVariableCommand::Delete const string &    rName
 

Delete (programmatically) a run variable given its name.

Parameters:
rName  - const string& [in] the name of the variable to delete.
Note:
If rName does not exist, this function currently is a no-op, future implementations reserve the right to throw an exception derived from CException.

Definition at line 678 of file CRunVariableCommand.cpp.

References end(), find(), m_RunVariables, and RunVariableIterator.

int CRunVariableCommand::Delete CTCLInterpreter &    rInterp,
CTCLResult &    rResult,
int    argc,
char **    argv
 

Removes a run variable from the list of run variables. The variable continues to be a Tcl/Tk variable; however it is no longer written to buffers when the run is active. The form of this command is: runvariable -delete name

Parameters:
rInterp, -  Refers to the interpreter running this command.
rResult  - Refers to the result string. On success this will be empty, otherwise, an instructive error message.
argc,argv  - Command parameters following the -delete switch.
Returns:
TCL_OK - Everything worked and the result string is empty. TCL_ERROR - something failed and the result string tells you what.
Note:
it is not possible to directly delete entire arrays, however you can delete the individual elements in foreach script where the list comes from foreach item [runvar -list arrayname(*)] ...

Definition at line 511 of file CRunVariableCommand.cpp.

References end(), find(), RunVariableIterator, and Usage().

Referenced by operator()().

RunVariableIterator CRunVariableCommand::end  
 

Returns an end loop interator for the set of run variables.

Parameters:

Definition at line 609 of file CRunVariableCommand.cpp.

References m_RunVariables.

Referenced by Create(), Delete(), List(), CExperiment::TriggerRunVariableBuffer(), and ~CRunVariableCommand().

RunVariableIterator CRunVariableCommand::find const string &    rName [inline]
 

Definition at line 358 of file CRunVariableCommand.h.

References m_RunVariables, and RunVariableIterator.

Referenced by Create(), and Delete().

int CRunVariableCommand::List CTCLInterpreter &    rInterp,
CTCLResult &    rResult,
int    argc,
char **    argv
 

Lists the set of run variables which match a patter which can contain glob wildcard specials. This is sort of like info var but for the set of variables which are run variables.

Parameters:
rInterp  - the interpreter running this command.
rResult  - The result string. If all goes well, this will be a TCL List containing the names of variables which match the pattern or empty if none do. If there's a problem, this will contain an informative error message.
argc,argv  - The remaining parameters after the -list switch.
Returns:
TCL_OK - Everything worked and rResult contains the (possibly empty) list of matching patterns). TCL_ERROR - if there was an error parsing the rest of the command. (not really possible).
Note:
This function makes use of the STL for_each visitor function to visit each variable in the list and match it against the pattern.
Note:
If no pattern is supplied by the user (argc == 0), the default pattern "*" will be used.
Note:
If the variable corresponding to a run variable was unset, it will still be listed.. it is therefore a bad idea to unset a run variable without also deleting it.

Definition at line 567 of file CRunVariableCommand.cpp.

References begin(), end(), and Usage().

Referenced by operator()().

int CRunVariableCommand::operator!= const CRunVariableCommand &    rhs const [private]
 

int CRunVariableCommand::operator() CTCLInterpreter &    rInterp,
CTCLResult &    rResult,
int    argc,
char **    argv
[virtual]
 

Executes the runvariable command. This command has the following subcommands:

  • add Create a new run variable. syntax: runvar newname ?initialvalue?
  • list List the existing run variables. syntax: runvar -list ?pattern?
  • delete Delete a run variable. syntax: runvar -delete name
A run variable is simply a Tcl/Tk variable which is put in the RunVariable registry. A run variable can be changed at any time. A run variable can also be a state variable. Run Variables are periodically written to buffers during a run.
Parameters:
rInterp  - Refers to the interpreter which is running this command
rResult  - Refers to the result variable into which the command result is put. The value of this will depend on the subcommand executed.
argc,argv  - Parameter count and array.
Returns:
TCL_OK - If success else TCL_ERROR - If there was a problem with rResult having a reason message.
Note:
- The variable may already exist or not as a Tcl Variable. If the variable is new, and no initial value is supplied, The variable will be initialized to the value "-uninitialized-"
Note:
- Each subcommand is farmed out it its own execution function:
  • Create - handles variable creation.
  • Delete - handles variable deletion.
  • List - handles listing variables.

Definition at line 381 of file CRunVariableCommand.cpp.

References Create(), Delete(), List(), and Usage().

CRunVariableCommand& CRunVariableCommand::operator= const CRunVariableCommand &    rhs [private]
 

Assignment.

int CRunVariableCommand::operator== const CRunVariableCommand &    rhs const [private]
 

Comparison for equality.

size_t CRunVariableCommand::size  
 

Returns the number of run variables currently defined.

Parameters:

Definition at line 622 of file CRunVariableCommand.cpp.

References m_RunVariables.

void CRunVariableCommand::Usage CTCLResult &    rResult [protected]
 

Appends usage information to the rResult string.

Definition at line 630 of file CRunVariableCommand.cpp.

Referenced by Create(), Delete(), List(), and operator()().


Member Data Documentation

RunVariableList CRunVariableCommand::m_RunVariables [private]
 

Definition at line 316 of file CRunVariableCommand.h.

Referenced by begin(), Create(), Delete(), end(), find(), and size().


The documentation for this class was generated from the following files:
Generated on Fri Nov 8 13:37:22 2002 for Event Readout system. by doxygen1.2.16