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

CStateVariableCommand Class Reference

#include <CStateVariableCommand.h>

List of all members.

Public Methods

 CStateVariableCommand ()
 Default constructor.

 ~CStateVariableCommand ()
 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 &rRestul, int argc, char **argv)
CStateVariableCreate (const string &rName)
void Delete (const string &rName)
void Delete (StateVariableIterator &rIter)
StateVariableIterator begin ()
StateVariableIterator end ()
size_t size ()
StateVariableIterator find (const string &rName)

Protected Methods

void Usage (CTCLResult &rResult)

Private Methods

 CStateVariableCommand (const CStateVariableCommand &rhs)
 Copy constructor.

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

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

int operator!= (const CStateVariableCommand &rhs) const

Private Attributes

StateVariableMap m_StateVariables


Constructor & Destructor Documentation

CStateVariableCommand::CStateVariableCommand  
 

Default constructor.

Default constructor. This is called when declarations of the form e.g.:

  • CStateVariableCommand object; are performed.
Note:
pInterp in the base class is set to null with the knowledge that our creator will at some point do a CTCLProcessor::Bind() command.

Definition at line 314 of file CStateVariableCommand.cpp.

CStateVariableCommand::~CStateVariableCommand  
 

Destructor.

Destructor. Iterate through the state variable map, destroying each var.

Definition at line 322 of file CStateVariableCommand.cpp.

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

CStateVariableCommand::CStateVariableCommand const CStateVariableCommand &    rhs [private]
 

Copy constructor.


Member Function Documentation

StateVariableIterator CStateVariableCommand::begin  
 

Returns a looping iterator which will, on repeated increments, traverse the set of state variables.

Definition at line 532 of file CStateVariableCommand.cpp.

References m_StateVariables.

Referenced by List(), CInterpreterCore::RegisterExtensions(), CExperiment::TriggerStateVariableBuffer(), and ~CStateVariableCommand().

CStateVariable * CStateVariableCommand::Create const string &    rName
 

Create a new state variable given its name. This interface allows creating variable programmatically. It is also used by the command interface.

Parameters:
rName  const string& [in] - Name of the new variable.
Note:
This is a NOOP if the name already exists.
Returns:
One of:
  • A pointer to the newly created state variable.
  • Null if the state variable already exists.

Definition at line 591 of file CStateVariableCommand.cpp.

References m_StateVariables.

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

Creates a new run variable. The optional parameters specify the name and the optional initial value for the variable. The syntax of this command is:

statevar name

Since the name can be an array base name, there's no mechanism to provide an initial value.

Parameters:
rInterp  - Interpreter on which the command is running.
rResult  - Result string to fill in.
argc,argv  - Parameters following command name.
Note:
- It is a successful no-op to create a statevar which already exists.
- On success, rResult will be empty, otherwise it will contain a descriptive error message. rResult can't be built to have the variable value because, once more, the variable could be an array base name.

Definition at line 410 of file CStateVariableCommand.cpp.

References Usage().

Referenced by operator()(), and CInterpreterCore::RegisterExtensions().

void CStateVariableCommand::Delete StateVariableIterator   rIter
 

Delete a state variable given an iterator that points to it.

Parameters:
rIter  StateVariableIterator[in] - Iterator that 'points' to the variable to delete.

Definition at line 622 of file CStateVariableCommand.cpp.

References m_StateVariables, and StateVariableIterator.

void CStateVariableCommand::Delete const string &    rName
 

Delete a state variable given its name. This function is a no-op if the name does not exist.

Parameters:
rName  const string& [in] - Name of the variable to erase.

Definition at line 608 of file CStateVariableCommand.cpp.

References Delete(), m_StateVariables, and StateVariableIterator.

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

Deletes an existing state variable. If the underlying TCL variables are still defined, they will remain defined, but won't figure in the production of StateVariableBuffers, nor will readonly-ness be enforced if the run is not halted.

Parameters:
rInterp  - The interpreter which is running this command.
rResult  - The result string to fill in.
argc,argv  - The parameters following the -delete switch.
Returns:
TCL_OK - on success. TCL_ERROR - on failure.
Note:
rResult will be empt on TCL_OK, but will contain a descriptive error message if TCL_ERROR is returned.
it is an error to attempt to delete a nonexistent state variable.

Definition at line 449 of file CStateVariableCommand.cpp.

References m_StateVariables, StateVariableIterator, and Usage().

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

StateVariableIterator CStateVariableCommand::end  
 

Returns an end of iteration sentinel iterator for the set of state variables being maintained.

Definition at line 545 of file CStateVariableCommand.cpp.

References m_StateVariables.

Referenced by CExperiment::GetRunNumber(), CReadoutMain::getScalerPeriod(), CReadoutMain::getTitle(), List(), CInterpreterCore::RegisterExtensions(), CExperiment::TriggerStateVariableBuffer(), and ~CStateVariableCommand().

StateVariableIterator CStateVariableCommand::find const string &    rName
 

Locate the state variable that corresponds to the specified name.

Parameters:
rName  const string& [in] Name of the variable to look for.
Returns:
iterator to the item, or end() if not found.

Definition at line 637 of file CStateVariableCommand.cpp.

References m_StateVariables.

Referenced by CExperiment::GetRunNumber(), CReadoutMain::getScalerPeriod(), and CReadoutMain::getTitle().

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

Lists the set of state variables which glob match the pattern. This work is all done in the internal class: ListMatches which provides a function object to the STL for_each generic algorithm.

Syntax:

statevar -list pattern

pattern can contain glob substitution special characters.

Parameters:
rInterp  - Interpreter under which the command is running.
rResult  - Result to be returned from the command.
argc,argv  - Parameters after the -list option.
Note:
On success, rResult will contain a potentially empty Tcl formatted list of state variable names which match the pattern.
Note:
The default pattern value is *

Definition at line 500 of file CStateVariableCommand.cpp.

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

Referenced by operator()().

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

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

Provides the dispatching for the various subcommands of the statevariable core command. This command has the following forms and handlers:

  • statevariable name Create()
  • statevaraible -delete name Delete()
  • statevariable -list [pattern] List()
Parameters:
rInterp  - The interpreter running the command.
rResult  - Result string returned to the interpreter.
argc,argv  - The command parameters. Note that argv[0] is the command name all over again.
Returns:
TCL_OK - If the everything worked. TCL_ERROR - On error.
Note:
- The return values for rResult will depend in general not only on the 'subcommand' executed, but on whether or not it worked.

Definition at line 354 of file CStateVariableCommand.cpp.

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

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

Assignment.

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

Comparison for equality.

size_t CStateVariableCommand::size  
 

Returns the number of variables which have been defined.

Parameters:

Definition at line 557 of file CStateVariableCommand.cpp.

References m_StateVariables.

void CStateVariableCommand::Usage CTCLResult &    rResult [protected]
 

Append usage information to the result string.

Definition at line 567 of file CStateVariableCommand.cpp.

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


Member Data Documentation

StateVariableMap CStateVariableCommand::m_StateVariables [private]
 

Definition at line 318 of file CStateVariableCommand.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:24 2002 for Event Readout system. by doxygen1.2.16