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

CReadOrder Class Reference

#include <CReadOrder.h>

Inheritance diagram for CReadOrder:

Inheritance graph
[legend]
Collaboration diagram for CReadOrder:

Collaboration graph
[legend]
List of all members.

Public Types

typedef list< CReadableObject * > ModuleList
 Ordered list of modules.

typedef ModuleList::iterator ModuleIterator
 Iterator for list of modules.

typedef list< CDigitizerModule * > ModuleList
typedef ModuleList::iterator ModuleIterator

Public Member Functions

 CReadOrder (CTCLInterpreter *pInterp, CDigitizerDictionary *pDictionary, const string &rCommand=string("readout"))
virtual ~CReadOrder ()
ModuleList getReadoutList () const
int operator() (CTCLInterpreter &rInterp, CTCLResult &rResult, int nArgc, char **pArgv)
 Command processing operator.

int AddCommand (CTCLInterpreter &rInterp, CTCLResult &rResult, int nArgc, char **pArgv)
 Add a module to our readout list.

int RemoveCommand (CTCLInterpreter &rInterp, CTCLResult &rResult, int nArgc, char **pArgv)
 Remove a module from our readout list.

int ListCommand (CTCLInterpreter &rInterp, CTCLResult &rResult, int nArgc, char **pArgv)
 List modules in our list.

virtual void Initialize ()
 1-time Initialize our modules.

virtual void Prepare ()
 Prepare modules for readout.

virtual void Read (DAQWordBufferPtr &p)
 Read -> spectrodaq.

virtual int Read (void *pBuffer)
 Read to ordinary buffer.

virtual void Clear ()
 Clear after read & @ Run start.

virtual string getType () const
 Return module type information.

int readersize ()
 # modules in the list.

ModuleIterator readerbegin ()
 Start iterator.

ModuleIterator readerend ()
 End iterator.

ModuleIterator readerfind (const string &rName)
 Find module by name.

string Usage ()
 Command usage.

void Add (CReadableObject *pModule)
 Add a module.

void Remove (ModuleIterator p)
 Remove module.

void Remove (CReadableObject *pModule)
 Remove module.

virtual void OnDelete ()
 Just prior to deletion.

 CReadOrder (CTCLInterpreter *pInterp, CDigitizerDictionary *pDictionary, const string &rCommand=string("readout"))
virtual ~CReadOrder ()
ModuleList getReadoutList () const
int operator() (CTCLInterpreter &rInterp, CTCLResult &rResult, int nArgc, char **pArgv)
 Process commands.

int AddCommand (CTCLInterpreter &rInterp, CTCLResult &rResult, int nArgc, char **pArgv)
int RemoveCommand (CTCLInterpreter &rInterp, CTCLResult &rResult, int nArgc, char **pArgv)
int ListCommand (CTCLInterpreter &rInterp, CTCLResult &rResult, int nArgc, char **pArgv)
void Add (CDigitizerModule *pModule)
void Remove (ModuleIterator p)
virtual void Initialize ()
 Initialize the readable (pure virt.).

virtual void Prepare ()
 Prepare module for readout (pure virt.).

virtual DAQWordBufferPtr Read (DAQWordBufferPtr &p)
 Read to buffer.

virtual int Read (void *pBuffer)
 Read to memory. (pure virt).

virtual void Clear ()
 Clear (after read e.g.).(Pure virt).

int size ()
ModuleIterator begin ()
ModuleIterator end ()
ModuleIterator find (const string &rName)
string Usage ()

Protected Member Functions

void setReadoutList (const ModuleList &rReadoutlist)
void setReadoutList (const ModuleList &rReadoutlist)

Private Member Functions

 CReadOrder (const CReadOrder &aCReadOrder)
CReadOrderoperator= (const CReadOrder &aCReadOrder)
int operator== (const CReadOrder &aCReadOrder) const
int operator!= (const CReadOrder &rhs) const
 CReadOrder (const CReadOrder &aCReadOrder)
CReadOrderoperator= (const CReadOrder &aCReadOrder)
int operator== (const CReadOrder &aCReadOrder) const
int operator!= (const CReadOrder &rhs) const

Private Attributes

ModuleList m_ReadoutList
 What we read.

CDigitizerDictionarym_pModules
 Known modules we could read.

int m_nPacketId
 Our id if packetizing.

bool m_fPacketize
 true if packetizing.

CIntConfigParamm_pPacketIdParam
 Ptr to packet parameter.

CBoolConfigParamm_pPacketizeParam
 Ptr to packetizer parameter.

CDigitizerDictionarym_pModules

Detailed Description

Encapsulates the order in which modules are read out. CReadOrder maintains an ordered list of modules to read. There is normally only one CReadorder object, but that's not necessary. At each key point in the skeleton the read order object is invoked to iterate through the set of active modules via its entry points:

Definition at line 339 of file CReadOrder.h.


Member Typedef Documentation

typedef ModuleList::iterator CReadOrder::ModuleIterator
 

Definition at line 336 of file include/CReadOrder.h.

typedef ModuleList::iterator CReadOrder::ModuleIterator
 

Iterator for list of modules.

Definition at line 343 of file CReadOrder.h.

Referenced by OnDelete(), CScalerBank::Read(), Read(), Remove(), and RemoveCommand().

typedef list<CDigitizerModule*> CReadOrder::ModuleList
 

Definition at line 335 of file include/CReadOrder.h.

typedef list<CReadableObject*> CReadOrder::ModuleList
 

Ordered list of modules.

Definition at line 342 of file CReadOrder.h.

Referenced by getReadoutList(), and setReadoutList().


Constructor & Destructor Documentation

CReadOrder::CReadOrder CTCLInterpreter *  pInterp,
CDigitizerDictionary pDict,
const string &  rCommand = string("readout")
 

Constructor: Creates an instance of a CReadOrder class. The constructor is a no-op as we are not descended from a base class and STL takes care of intiailizing oure single attribute.

Definition at line 304 of file CReadOrder.cpp.

References CConfigurableObject::AddBoolParam(), CConfigurableObject::AddIntParam(), m_pPacketIdParam, m_pPacketizeParam, CConfigurableObject::ParameterIterator, pInterp(), and CIntConfigParam::setRange().

CReadOrder::~CReadOrder  )  [virtual]
 

If we are destroyed, then all the modules we are reading get unlinked from us.

Definition at line 328 of file CReadOrder.cpp.

References OnDelete().

CReadOrder::CReadOrder const CReadOrder aCReadOrder  )  [private]
 

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

virtual CReadOrder::~CReadOrder  )  [virtual]
 

CReadOrder::CReadOrder const CReadOrder aCReadOrder  )  [private]
 


Member Function Documentation

void CReadOrder::Add CDigitizerModule pModule  ) 
 

Adds a module to the end of the readout list.

Parameters:
pModule CDigitizerModule* [in] The module to add.

Definition at line 326 of file src/CReadOrder.cpp.

References m_ReadoutList.

void CReadOrder::Add CReadableObject pModule  ) 
 

Add a module.

Adds a module to the end of the readout list.

Parameters:
pModule CReadableObject* [in] The module to add.

Definition at line 343 of file CReadOrder.cpp.

References CReadableObject::Link(), and m_ReadoutList.

Referenced by AddCommand().

int CReadOrder::AddCommand CTCLInterpreter &  rInterp,
CTCLResult &  rResult,
int  nArgc,
char **  pArgv
 

int CReadOrder::AddCommand CTCLInterpreter &  rInterp,
CTCLResult &  rResult,
int  nArgc,
char **  pArgv
 

Add a module to our readout list.

processes subcommand to add a set of modules to the readout list. The modules to add are specified by name on the command line. Adding the module list is an all or nothing proposotion. Either all are aded or none.

Parameters:
rInterp CTCLInterpreter& [in] TCL interpreter that excecuted this command.
rResult CTCLResult& [out] The result string showing the final status of the command.
nArgc int [in] The number of parameters remaining on the command line. The main command has been stripped off, but the subcommand is still in the list.
pArgv char** [in] The command parameters including the subcommand keyword.
Returns:
int status of the command:
  • TCL_OK - The command worked fine.
  • TCL_ERROR - There was a problem executing the command the reason for the error will be returned in rResult.

Definition at line 658 of file CReadOrder.cpp.

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

Referenced by operator()().

CReadOrder::ModuleIterator CReadOrder::begin  ) 
 

Returns a begin iterator for the module list.

Reimplemented from CConfigurableObject.

Definition at line 440 of file src/CReadOrder.cpp.

References m_ReadoutList.

Referenced by find().

virtual void CReadOrder::Clear  )  [virtual]
 

Clear (after read e.g.).(Pure virt).

Implements CReadableObject.

void CReadOrder::Clear  )  [virtual]
 

Clear after read & @ Run start.

Clears the modules in the readout list.

Implements CReadableObject.

Definition at line 516 of file CReadOrder.cpp.

References readerbegin(), and readerend().

Referenced by iniscl(), and initevt().

CReadOrder::ModuleIterator CReadOrder::end  ) 
 

Returns an end of iteration iterator for the digitizers in the digitizer list.

Reimplemented from CConfigurableObject.

Definition at line 452 of file src/CReadOrder.cpp.

References m_ReadoutList.

Referenced by find().

CReadOrder::ModuleIterator CReadOrder::find const string &  rName  ) 
 

Locates a module by name.

Parameters:
rName const string& [in] Name of the module to locate.
Returns:
An iterator to the module else end() if the module does not exist.

Definition at line 462 of file src/CReadOrder.cpp.

References begin(), and end().

Referenced by Remove().

ModuleList CReadOrder::getReadoutList  )  const [inline]
 

Definition at line 430 of file include/CReadOrder.h.

References m_ReadoutList, and ModuleList.

ModuleList CReadOrder::getReadoutList  )  const [inline]
 

Definition at line 441 of file CReadOrder.h.

References m_ReadoutList, and ModuleList.

string CReadOrder::getType  )  const [virtual]
 

Return module type information.

Return the type of the module this is (packetizer).

Implements CReadableObject.

Definition at line 858 of file CReadOrder.cpp.

virtual void CReadOrder::Initialize  )  [virtual]
 

Initialize the readable (pure virt.).

Implements CReadableObject.

void CReadOrder::Initialize  )  [virtual]
 

1-time Initialize our modules.

Function:

  • Update the configuration parameters from our configuration:
  • Inititializes the modules in the reaout chain

Implements CReadableObject.

Definition at line 393 of file CReadOrder.cpp.

References CIntConfigParam::getOptionValue(), CBoolConfigParam::getOptionValue(), m_fPacketize, m_nPacketId, m_pPacketIdParam, m_pPacketizeParam, readerbegin(), and readerend().

Referenced by iniscl(), and initevt().

int CReadOrder::ListCommand CTCLInterpreter &  rInterp,
CTCLResult &  rResult,
int  nArgc,
char **  pArgv
 

int CReadOrder::ListCommand CTCLInterpreter &  rInterp,
CTCLResult &  rResult,
int  nArgc,
char **  pArgv
 

List modules in our list.

List the modules that are in the readout list that match an optional pattern. If the pattern is omitted, then it is assumed to be *.

Parameters:
rInterp CTCLInterpreter& [in] TCL interpreter that excecuted this command.
rResult CTCLResult& [out] The result string showing the final status of the command.
nArgc int [in] The number of parameters remaining on the command line. The main command has been stripped off, but the subcommand is still in the list.
pArgv char** [in] the command parameters including the subcommand. There should be at most two:
  • The subcommand
  • The optional match pattern.
Returns:
int status of the command:
  • TCL_OK - The command worked fine.
  • TCL_ERROR - There was a problem executing the command the reason for the error will be returned in rResult.
Note:
We use the for_each generic algorithm which a function object that matches the pattern and conditionally adds the listing to a reference to the result string. Each entry in the string is a sublist containing: module_name module_type

Definition at line 784 of file CReadOrder.cpp.

References readerbegin(), readerend(), and Usage().

Referenced by operator()().

void CReadOrder::OnDelete  )  [virtual]
 

Just prior to deletion.

Called prior to delete: unlink everyone from us. It's harmless to call this multiple times.

Reimplemented from CReadableObject.

Definition at line 842 of file CReadOrder.cpp.

References m_ReadoutList, ModuleIterator, readerbegin(), and readerend().

Referenced by ~CReadOrder().

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

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

int CReadOrder::operator() CTCLInterpreter &  rInterp,
CTCLResult &  rResult,
int  nArgc,
char **  pArgv
[virtual]
 

Process commands.

Processes the module's command. The default implementation is to look for matches of the pArgs[1] with:

  • "config" calls the module's Configure member. member function.
  • "cget" calls the module's ListConfiguration member function.
  • "help" calls the module's Usage member function.

Parameters:
rInterp CTCLInterpreter& [in] Interpreter running the command.
rResult CTCLResult& [in] The result string that will be returned to the caller.
nArgs int [in] The number of parameters on the command line. Note that the first one should be m_sName.
pArgs char** [in] The command parameters.
Returns:
Either of:
  • TCL_OK if the command completed properly or
  • TCL_ERROR if the command failed. If the command fails, rResult will be a descriptive error followed by the usage information for what we know:
Note:
To extend functionaly to support additional keyword, override this, check for your own keywords and if you don't find them, call the base class member with the unaltered parameters.

Reimplemented from CConfigurableObject.

int CReadOrder::operator() CTCLInterpreter &  rInterp,
CTCLResult &  rResult,
int  nArgc,
char **  pArgv
[virtual]
 

Command processing operator.

Executes the readout command. This entry point just figures out if the subcommand is:

  • add - Dispatches to AddCommand
  • remove - Dispatches to RemoveCommand.
  • list - Dispatches to ListCommand.

Parameters:
rInterp CTCLInterpreter& [in] The interpreter that is running this command.
rResult CTCLResult [ou] The result string that is filled in by this command.
nArgc int [in] Number of command parameters, note that the 0'th is the command itsef.
pArgv char** [in] the parameters passed to the command. Note that pArgv[0] == "readout".
Returns:
int one of:
  • TCL_OK - if everything worked ok.
  • TCL_ERROR - If there was an error. More than likely, rResult will have error information.

Reimplemented from CConfigurableObject.

Definition at line 591 of file CReadOrder.cpp.

References AddCommand(), ListCommand(), CConfigurableObject::operator()(), RemoveCommand(), and Usage().

CReadOrder& CReadOrder::operator= const CReadOrder aCReadOrder  )  [private]
 

CReadOrder& CReadOrder::operator= const CReadOrder aCReadOrder  )  [private]
 

int CReadOrder::operator== const CReadOrder aCReadOrder  )  const [private]
 

int CReadOrder::operator== const CReadOrder aCReadOrder  )  const [private]
 

virtual void CReadOrder::Prepare  )  [virtual]
 

Prepare module for readout (pure virt.).

Implements CReadableObject.

void CReadOrder::Prepare  )  [virtual]
 

Prepare modules for readout.

Function:

Prepares the modules in the readout chain.

Implements CReadableObject.

Definition at line 411 of file CReadOrder.cpp.

References readerbegin(), and readerend().

Referenced by clearevt(), and clrscl().

virtual int CReadOrder::Read void *  pBuffer  )  [virtual]
 

Read to memory. (pure virt).

Implements CReadableObject.

virtual DAQWordBufferPtr CReadOrder::Read DAQWordBufferPtr &  p  )  [virtual]
 

Read to buffer.

Implements CReadableObject.

int CReadOrder::Read void *  pBuf  )  [virtual]
 

Read to ordinary buffer.

Reads an event into an ordinary buffer.

Returns:
the number of words read.

Implements CReadableObject.

Definition at line 467 of file CReadOrder.cpp.

References CReadException::Add(), CReadException::GetCount(), m_fPacketize, m_nPacketId, ModuleIterator, CReadableObject::Read(), readerbegin(), and readerend().

DAQWordBufferPtr CReadOrder::Read DAQWordBufferPtr &  p  )  [virtual]
 

Read -> spectrodaq.

Reads out the event.

Parameters:
p DAQWordBufferptr& [modified] Refers to the pointer to the buffer where the data will be stored.
Returns:
DAQWordBufferPtr - Points past the end of the stuff that was just read out.

Implements CReadableObject.

Definition at line 426 of file CReadOrder.cpp.

References CReadException::Add(), CReadException::GetCount(), m_fPacketize, m_nPacketId, ModuleIterator, CReadableObject::Read(), readerbegin(), readerend(), and size().

Referenced by iniscl(), readevt(), and readscl().

CReadOrder::ModuleIterator CReadOrder::readerbegin  ) 
 

Start iterator.

Returns a begin iterator for the module list.

Definition at line 541 of file CReadOrder.cpp.

References m_ReadoutList.

Referenced by Clear(), Initialize(), ListCommand(), OnDelete(), Prepare(), CScalerBank::Read(), Read(), readerfind(), and Remove().

CReadOrder::ModuleIterator CReadOrder::readerend  ) 
 

End iterator.

Returns an end of iteration iterator for the digitizers in the digitizer list.

Definition at line 553 of file CReadOrder.cpp.

References m_ReadoutList.

Referenced by Clear(), Initialize(), ListCommand(), OnDelete(), Prepare(), CScalerBank::Read(), Read(), readerfind(), Remove(), and RemoveCommand().

CReadOrder::ModuleIterator CReadOrder::readerfind const string &  rName  ) 
 

Find module by name.

Locates a module by name.

Parameters:
rName const string& [in] Name of the module to locate.
Returns:
An iterator to the module else end() if the module does not exist.

Definition at line 563 of file CReadOrder.cpp.

References readerbegin(), and readerend().

Referenced by RemoveCommand().

int CReadOrder::readersize  ) 
 

# modules in the list.

Returns the number of modules in the readout chain.

Definition at line 529 of file CReadOrder.cpp.

References m_ReadoutList.

void CReadOrder::Remove ModuleIterator  p  ) 
 

void CReadOrder::Remove CReadableObject pModule  ) 
 

Remove module.

Definition at line 374 of file CReadOrder.cpp.

References find(), ModuleIterator, readerbegin(), readerend(), and Remove().

void CReadOrder::Remove ModuleIterator  p  ) 
 

Remove module.

Removes a module from the readout list. The module is selected by an iterator:

Parameters:
p ModuleIterator [in] 'points' to the module to delete. If end(), this function is a noop.

Definition at line 363 of file CReadOrder.cpp.

References m_ReadoutList, ModuleIterator, and readerend().

Referenced by CReadableObject::OnDelete(), Remove(), and RemoveCommand().

int CReadOrder::RemoveCommand CTCLInterpreter &  rInterp,
CTCLResult &  rResult,
int  nArgc,
char **  pArgv
 

int CReadOrder::RemoveCommand CTCLInterpreter &  rInterp,
CTCLResult &  rResult,
int  nArgc,
char **  pArgv
 

Remove a module from our readout list.

Removes a module from the readout list. The module still exists and can be added back to the list at any time in the future.

Parameters:
rInterp CTCLInterpreter& [in] TCL interpreter that excecuted this command.
rResult CTCLResult& [out] The result string showing the final status of the command.
nArgc int [in] The number of parameters remaining on the command line. The main command has been stripped off, but the subcommand is still in the list.
Returns:
int status of the command:
  • TCL_OK - The command worked fine.
  • TCL_ERROR - There was a problem executing the command the reason for the error will be returned in rResult.

Definition at line 723 of file CReadOrder.cpp.

References ModuleIterator, readerend(), readerfind(), Remove(), and Usage().

Referenced by operator()().

void CReadOrder::setReadoutList const ModuleList rReadoutlist  )  [inline, protected]
 

Definition at line 438 of file include/CReadOrder.h.

References m_ReadoutList, and ModuleList.

void CReadOrder::setReadoutList const ModuleList rReadoutlist  )  [inline, protected]
 

Definition at line 449 of file CReadOrder.h.

References m_ReadoutList, and ModuleList.

int CReadOrder::size  ) 
 

Returns the number of modules in the readout chain.

Reimplemented from CConfigurableObject.

Definition at line 428 of file src/CReadOrder.cpp.

References m_ReadoutList.

Referenced by Read().

string CReadOrder::Usage  ) 
 

Returns a string describing the command usage. The defafult implementation produces a string of the form:


m_sName config Paramdescription
m_sName cget
m_sName help

Paramdescription is produced by iterating through the set of configuration parameter descriptions and for each of them listing the name and the type expected e.g.:

  • theshold int
  • pedestal {int[16]}
  • subtraction on|off|enable|disable

Reimplemented from CConfigurableObject.

string CReadOrder::Usage  ) 
 

Command usage.

Return a string that provides helpful usage information.

Reimplemented from CConfigurableObject.

Definition at line 819 of file CReadOrder.cpp.

References CConfigurableObject::Usage().

Referenced by ListCommand(), operator()(), and RemoveCommand().


Member Data Documentation

bool CReadOrder::m_fPacketize [private]
 

true if packetizing.

Definition at line 351 of file CReadOrder.h.

Referenced by Initialize(), and Read().

int CReadOrder::m_nPacketId [private]
 

Our id if packetizing.

Definition at line 350 of file CReadOrder.h.

Referenced by Initialize(), and Read().

CDigitizerDictionary* CReadOrder::m_pModules [private]
 

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

CDigitizerDictionary* CReadOrder::m_pModules [private]
 

Known modules we could read.

Definition at line 349 of file CReadOrder.h.

Referenced by AddCommand().

CIntConfigParam* CReadOrder::m_pPacketIdParam [private]
 

Ptr to packet parameter.

Definition at line 352 of file CReadOrder.h.

Referenced by CReadOrder(), and Initialize().

CBoolConfigParam* CReadOrder::m_pPacketizeParam [private]
 

Ptr to packetizer parameter.

Definition at line 353 of file CReadOrder.h.

Referenced by CReadOrder(), and Initialize().

ModuleList CReadOrder::m_ReadoutList [private]
 

What we read.

Definition at line 341 of file include/CReadOrder.h.

Referenced by Add(), begin(), end(), getReadoutList(), OnDelete(), readerbegin(), readerend(), readersize(), Remove(), setReadoutList(), and size().


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