Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

CModuleCommand Class Reference

#include <CModuleCommand.h>

Collaboration diagram for CModuleCommand:

Collaboration graph
[legend]
List of all members.

Public Types

typedef list< CModuleCreator * > CreatorList
typedef CreatorList::iterator CreatorIterator
typedef list< CModuleCreator * > CreatorList
typedef CreatorList::iterator CreatorIterator

Public Member Functions

 CModuleCommand (CTCLInterpreter *pInterp, CDigitizerDictionary *pDictionary, const string &command=string("module"))
virtual ~CModuleCommand ()
CDigitizerDictionarygetModules ()
CreatorList getCreators () const
virtual int operator() (CTCLInterpreter &rInterp, CTCLResult &rResult, int nArgs, char **pArgs)
void AddCreator (CModuleCreator *pCreator)
CreatorIterator CreatorBegin ()
CreatorIterator CreatorEnd ()
int CreatorSize ()
CDigitizerDictionary::ModuleIterator DigitizerBegin ()
CDigitizerDictionary::ModuleIterator DigitizerEnd ()
int DigitizerSize ()
CDigitizerDictionary::ModuleIterator DigitizerFind (const string &rName)
string Usage ()
 CModuleCommand (CTCLInterpreter *pInterp, CDigitizerDictionary *pDictionary, CReadOrder *pReader, const string &command=string("module"))
virtual ~CModuleCommand ()
CDigitizerDictionarygetModules ()
CreatorList getCreators () const
virtual int operator() (CTCLInterpreter &rInterp, CTCLResult &rResult, int nArgs, char **pArgs)
void AddCreator (CModuleCreator *pCreator)
CreatorIterator CreatorBegin ()
CreatorIterator CreatorEnd ()
int CreatorSize ()
CDigitizerDictionary::ModuleIterator DigitizerBegin ()
CDigitizerDictionary::ModuleIterator DigitizerEnd ()
int DigitizerSize ()
CDigitizerDictionary::ModuleIterator DigitizerFind (const string &rName)
string Usage ()

Protected Member Functions

void setModules (CDigitizerDictionary *pModules)
void setCreators (const CreatorList &creators)
int Create (CTCLInterpreter &rInterp, CTCLResult &rResult, int nArgs, char **pArgs)
int List (CTCLInterpreter &rInterp, CTCLResult &rResult, int nArgs, char **pArgs)
int Delete (CTCLInterpreter &rInterp, CTCLResult &rResult, int nArgs, char **pArgs)
int ListTypes (CTCLInterpreter &rinterp, CTCLResult &rResult, int nArgs, char **pArgs)
CreatorIterator FindCreator (const string &ModuleType)
int Create (CTCLInterpreter &rInterp, CTCLResult &rResult, int nArgs, char **pArgs)
int List (CTCLInterpreter &rInterp, CTCLResult &rResult, int nArgs, char **pArgs)
int Delete (CTCLInterpreter &rInterp, CTCLResult &rResult, int nArgs, char **pArgs)
int ListTypes (CTCLInterpreter &rinterp, CTCLResult &rResult, int nArgs, char **pArgs)
void setModules (CDigitizerDictionary *pModules)
void setCreators (const CreatorList &creators)

Private Member Functions

 CModuleCommand (const CModuleCommand &aCModuleCommand)
CModuleCommandoperator= (const CModuleCommand &rhs)
int operator== (const CModuleCommand &rhs) const
int operator!= (const CModuleCommand &rhs) const
 CModuleCommand (const CModuleCommand &aCModuleCommand)
CModuleCommandoperator= (const CModuleCommand &rhs)
int operator== (const CModuleCommand &rhs) const
int operator!= (const CModuleCommand &rhs) const

Private Attributes

CDigitizerDictionarym_pModules
 Created module lookup.

CreatorList m_Creators
 List of Creators.

CDigitizerDictionarym_pModules
 Created module lookup.

CReadOrderm_pReader
 Reader.


Detailed Description

Executes the module command. The module command has the following form: module newname type ?configuration data? module -list ?pattern module -delete name module -types

The module command relies on the recognizer pattern. m_Creators is a list of module type creators. The creational form of the module command iterates through the set of creators looking for one that matches the type keword. When one is found it is used to create the actual module.

This object is a singleton object.

Definition at line 346 of file CModuleCommand.h.


Member Typedef Documentation

typedef CreatorList::iterator CModuleCommand::CreatorIterator
 

Definition at line 343 of file include/CModuleCommand.h.

typedef CreatorList::iterator CModuleCommand::CreatorIterator
 

Definition at line 351 of file CModuleCommand.h.

Referenced by Create(), and FindCreator().

typedef list<CModuleCreator*> CModuleCommand::CreatorList
 

Definition at line 342 of file include/CModuleCommand.h.

typedef list<CModuleCreator*> CModuleCommand::CreatorList
 

Definition at line 350 of file CModuleCommand.h.

Referenced by getCreators(), and setCreators().


Constructor & Destructor Documentation

CModuleCommand::CModuleCommand CTCLInterpreter *  pInterp,
CDigitizerDictionary pDictionary,
const string &  rCommand = string("module")
 

Constructor. This is essentially a no-op since STL containers are capable of default initialization.

Definition at line 314 of file CModuleCommand.cpp.

References pDictionary(), and pInterp().

CModuleCommand::~CModuleCommand  )  [virtual]
 

Destroy the module command. Assumptions:

  • We are not resonsible for destroying the recognizers or the modules.
  • STL containers are capable of self destruction.

Definition at line 329 of file CModuleCommand.cpp.

CModuleCommand::CModuleCommand const CModuleCommand aCModuleCommand  )  [private]
 

CModuleCommand::CModuleCommand CTCLInterpreter *  pInterp,
CDigitizerDictionary pDictionary,
CReadOrder pReader,
const string &  rCommand = string("module")
 

Constructor. This is essentially a no-op since STL containers are capable of default initialization.

Definition at line 353 of file src/CModuleCommand.cpp.

References pDictionary(), pInterp(), and pReader().

virtual CModuleCommand::~CModuleCommand  )  [virtual]
 

CModuleCommand::CModuleCommand const CModuleCommand aCModuleCommand  )  [private]
 


Member Function Documentation

void CModuleCommand::AddCreator CModuleCreator pCreator  ) 
 

void CModuleCommand::AddCreator CModuleCreator pCreator  ) 
 

Add a module creator to the list of module creators checked during the module create command.

Parameters:
pCreator CModuleCreator* [in] Pointer to the new creator to add. This is assumed to be managed by clients. Note that modules, on the other hand are managed by us.

Definition at line 686 of file CModuleCommand.cpp.

References m_Creators, and pCreator().

Referenced by InitializeConfigurator().

int CModuleCommand::Create CTCLInterpreter &  rInterp,
CTCLResult &  rResult,
int  nArgs,
char **  pArgs
[protected]
 

int CModuleCommand::Create CTCLInterpreter &  rInterp,
CTCLResult &  rResult,
int  nArgs,
char **  pArgs
[protected]
 

Function:

Executes the command to create a new digitization module. The form of this command is:

    module name type {configuration}

  • name is the name of the module.
  • type is the type of module to create.
  • {configuration} a parameter describing the type specific configuration.

m_Creators is iterated through. At each iteration, the entry's Match function is called to determine if the module creator is suitable for the module type. If so, the Creator's create member is called to create and configure a new module.

Parameters:
rInterp CTCLInterpreter& [in] TCL interpreter running the command that called us.
rResult CTCLResult& [out] TCL Result string that will contain the text descrigibing what happened.
nArgs int [in] Number of parameters on the line (must be at least 2, module name and type.
pArgs char** [in] Pointers to parameter strings.
Note:
Extra parameters are considered to be configuration parameters and are passed to the appropriate creator without interpretation.
Returns:
int One of:
  • TCL_OK - If everything worked.
  • TCL_ERROR - If there was a problem that prevented the module from being created.
Note:
if the function succeds, it will enter the new module into the module dictionary (m_pModules).

Definition at line 443 of file CModuleCommand.cpp.

References CreatorEnd(), CreatorIterator, CDigitizerDictionary::DigitizerAdd(), DigitizerEnd(), DigitizerFind(), FindCreator(), m_pModules, and Usage().

Referenced by operator()().

CreatorIterator CModuleCommand::CreatorBegin  ) 
 

CModuleCommand::CreatorIterator CModuleCommand::CreatorBegin  ) 
 

Returns an iterator to the front of the creator list:

Definition at line 696 of file CModuleCommand.cpp.

References m_Creators.

Referenced by FindCreator(), and ListTypes().

CreatorIterator CModuleCommand::CreatorEnd  ) 
 

CModuleCommand::CreatorIterator CModuleCommand::CreatorEnd  ) 
 

Returns an end of iteration iterator to the creation list:

Definition at line 704 of file CModuleCommand.cpp.

References m_Creators.

Referenced by Create(), FindCreator(), and ListTypes().

int CModuleCommand::CreatorSize  ) 
 

int CModuleCommand::CreatorSize  ) 
 

Returns the number of modules in the creator list.

Definition at line 712 of file CModuleCommand.cpp.

References m_Creators.

int CModuleCommand::Delete CTCLInterpreter &  rInterp,
CTCLResult &  rResult,
int  nArgs,
char **  pArgs
[protected]
 

int CModuleCommand::Delete CTCLInterpreter &  rInterp,
CTCLResult &  rResult,
int  nArgs,
char **  pArgs
[protected]
 

Deletes a module from the module list. If the module is part of the readout it is removed from the readout. The form of the command is:

    module delete name
where name is the name of the module to delete.

Note:
There is some ugly coupling here: We need to remove the module from the Readout list. This can only be done if we can ask the Readout list object to do that. As a design restriction, we assume the readout list is a singleton that can give us it's instance via the static member getInstance()
Parameters:
rInterp CTCLInterpreter& [in] The TCL interpreter that's running this command.
rResult CTCLResult& [out] Result string returned. Empty on success, and contains an error message on failure.
nArgs int [in] Number of parameters remaining in the command.
pArgs char** [in] The parameters themselves.
Returns:
int Return status code see also rResult above. This will be one of:
  • TCL_OK - if the command succeeded.
  • TCL_ERROR - if the command failed.

Definition at line 589 of file CModuleCommand.cpp.

References DigitizerEnd(), DigitizerFind(), m_pModules, CDigitizerDictionary::ModuleIterator, CReadableObject::OnDelete(), CDigitizerDictionary::Remove(), and Usage().

Referenced by operator()().

CDigitizerDictionary::ModuleIterator CModuleCommand::DigitizerBegin  ) 
 

CDigitizerDictionary::ModuleIterator CModuleCommand::DigitizerBegin  ) 
 

Returns an iterator to the front of the created modules Dictionary.

Definition at line 721 of file CModuleCommand.cpp.

References CDigitizerDictionary::DigitizerBegin(), and m_pModules.

Referenced by List().

CDigitizerDictionary::ModuleIterator CModuleCommand::DigitizerEnd  ) 
 

CDigitizerDictionary::ModuleIterator CModuleCommand::DigitizerEnd  ) 
 

Returns an end of iteration iterator to the created modules Dictionary..

Definition at line 730 of file CModuleCommand.cpp.

References CDigitizerDictionary::DigitizerEnd(), and m_pModules.

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

CDigitizerDictionary::ModuleIterator CModuleCommand::DigitizerFind const string &  rName  )  [inline]
 

Definition at line 418 of file include/CModuleCommand.h.

References CDigitizerDictionary::DigitizerFind(), m_pModules, and CDigitizerDictionary::ModuleIterator.

CDigitizerDictionary::ModuleIterator CModuleCommand::DigitizerFind const string &  rName  )  [inline]
 

Definition at line 442 of file CModuleCommand.h.

References CDigitizerDictionary::DigitizerFind(), m_pModules, and CDigitizerDictionary::ModuleIterator.

Referenced by Create(), and Delete().

int CModuleCommand::DigitizerSize  ) 
 

int CModuleCommand::DigitizerSize  ) 
 

Returns the number of modules that have been created:

Definition at line 738 of file CModuleCommand.cpp.

References CDigitizerDictionary::DigitizerSize(), and m_pModules.

CModuleCommand::CreatorIterator CModuleCommand::FindCreator const string &  ModuleType  )  [protected]
 

Locate a module creator that matches the creation name.

Parameters:
ModuleName (const string&) Name of the module type to locate.
Returns:
CreatorIterator end() if not found otherwise an iterator 'pointing' to the creator.

Definition at line 779 of file CModuleCommand.cpp.

References CreatorBegin(), CreatorEnd(), and CreatorIterator.

Referenced by Create().

CreatorList CModuleCommand::getCreators  )  const [inline]
 

Definition at line 389 of file include/CModuleCommand.h.

References CreatorList, and m_Creators.

CreatorList CModuleCommand::getCreators  )  const [inline]
 

Definition at line 413 of file CModuleCommand.h.

References CreatorList, and m_Creators.

CDigitizerDictionary& CModuleCommand::getModules  )  [inline]
 

Definition at line 385 of file include/CModuleCommand.h.

References m_pModules.

CDigitizerDictionary& CModuleCommand::getModules  )  [inline]
 

Definition at line 409 of file CModuleCommand.h.

References m_pModules.

int CModuleCommand::List CTCLInterpreter &  rInterp,
CTCLResult &  rResult,
int  nArgs,
char **  pArgs
[protected]
 

int CModuleCommand::List CTCLInterpreter &  rInterp,
CTCLResult &  rResult,
int  nArgs,
char **  pArgs
[protected]
 

Lists the set of modules that have been created. The form of this command is

    module -list ?pattern?
If the optional ?pattern? is supplied it is a glob matching pattern. Only modules with names matching the pattern are listed. The ?pattern? parameter defaults to * (match all modules).

Parameters:
rInterp CTCLInterpreter& [in] Refers to the Interpreter that's running this command.
rResult CTCLResult& [out] Refers to the result string That will hold any textual status information. On success, this will include information about the modules that have been instantiated. On error, this will be an error message. Note that the success information will be in the form of a Tcl list. Each element of the list will be a two element sublist with entries as follows:
  • name - The name of a module.
  • type - The type of a module.
nArgs int [in] - Number of parameters remaining on the input line.
pArgs char** [in] The parameters themselves.
Returns:
int See also the rResult parameter. The value will be one of the following:
  • TCL_OK if everything was successful.
  • TCL_ERROR if there was a problem of some sort.

Definition at line 528 of file CModuleCommand.cpp.

References DigitizerBegin(), DigitizerEnd(), and Usage().

Referenced by operator()().

int CModuleCommand::ListTypes CTCLInterpreter &  rinterp,
CTCLResult &  rResult,
int  nArgs,
char **  pArgs
[protected]
 

int CModuleCommand::ListTypes CTCLInterpreter &  rInterp,
CTCLResult &  rResult,
int  nArgs,
char **  pArgs
[protected]
 

Lists the types of modules that can be created. Iterates through the m_Creators and asks each of them for their help text. The form of the help text is expected to be:

      type   - description of modules of this type
The information is returned as a command result with successful completion. The output at this time is not intended to be used by TCL commands as input... it's just normal help text for humans such as what Usage() returns.

Parameters:
rInterp CTCLInterpreter& [in] The interpreter that is running this command.
rResult CTCLResult& [out] The result string that will be filled in with the help text.
nArgs int [in] The number of parameters remaining on the command line.
pArgs char** [in] The parameters themselves.
Returns:
int The status of the command, see also rResult above. This can be:
  • TCL_OK - Everything worked, and rResult is the help text.
  • TCL_ERROR - Some problem was encountered and rResult is an error message.

Definition at line 655 of file CModuleCommand.cpp.

References CreatorBegin(), CreatorEnd(), and Usage().

Referenced by operator()().

int CModuleCommand::operator!= const CModuleCommand rhs  )  const [private]
 

int CModuleCommand::operator!= const CModuleCommand rhs  )  const [private]
 

virtual int CModuleCommand::operator() CTCLInterpreter &  rInterp,
CTCLResult &  rResult,
int  nArgs,
char **  pArgs
[virtual]
 

int CModuleCommand::operator() CTCLInterpreter &  rInterp,
CTCLResult &  rResult,
int  nArgs,
char **  pArgs
[virtual]
 

Processes the module command. This level just determines the type of module command and dispatches to the associated member function accordingly. We pass control to protected member functions that process the cases:

  • Create new module.
  • List the set of modules matching some glob pattern.
  • delete a specified module.
  • Return help on the types of modules supported.

Parameters:
rInterp CTCLInterpreter& [in] TCL interpreter that is running this command.
rResult CTCLResult& [in] TCL result string that will contain the results of the operation.
nArgs int [in] Number of command line parameters. Note that the command name is the first of the parameters.
pArgs char** [in] Set of parameter strings.
Returns:
int one of:
  • TCL_OK - If everything worked.
  • TCL_ERROR - If there was a problem.

Definition at line 362 of file CModuleCommand.cpp.

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

CModuleCommand& CModuleCommand::operator= const CModuleCommand rhs  )  [private]
 

CModuleCommand& CModuleCommand::operator= const CModuleCommand rhs  )  [private]
 

int CModuleCommand::operator== const CModuleCommand rhs  )  const [private]
 

int CModuleCommand::operator== const CModuleCommand rhs  )  const [private]
 

void CModuleCommand::setCreators const CreatorList creators  )  [inline, protected]
 

Definition at line 401 of file include/CModuleCommand.h.

References CreatorList, and m_Creators.

void CModuleCommand::setCreators const CreatorList creators  )  [inline, protected]
 

Definition at line 425 of file CModuleCommand.h.

References CreatorList, and m_Creators.

void CModuleCommand::setModules CDigitizerDictionary pModules  )  [inline, protected]
 

Definition at line 397 of file include/CModuleCommand.h.

References m_pModules.

void CModuleCommand::setModules CDigitizerDictionary pModules  )  [inline, protected]
 

Definition at line 421 of file CModuleCommand.h.

References m_pModules.

string CModuleCommand::Usage  ) 
 

string CModuleCommand::Usage  ) 
 

Returns command usage information.

Definition at line 746 of file CModuleCommand.cpp.

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


Member Data Documentation

CreatorList CModuleCommand::m_Creators [private]
 

List of Creators.

Definition at line 350 of file include/CModuleCommand.h.

Referenced by AddCreator(), CreatorBegin(), CreatorEnd(), CreatorSize(), getCreators(), and setCreators().

CDigitizerDictionary* CModuleCommand::m_pModules [private]
 

Created module lookup.

Definition at line 349 of file include/CModuleCommand.h.

CDigitizerDictionary* CModuleCommand::m_pModules [private]
 

Created module lookup.

Definition at line 357 of file CModuleCommand.h.

Referenced by Create(), Delete(), DigitizerBegin(), DigitizerEnd(), DigitizerFind(), DigitizerSize(), getModules(), and setModules().

CReadOrder* CModuleCommand::m_pReader [private]
 

Reader.

Definition at line 351 of file include/CModuleCommand.h.


The documentation for this class was generated from the following files:
Generated on Fri Mar 12 13:04:35 2004 for Scripted Readout by doxygen 1.3.4