CScriptedSegment

Name

CScriptedSegment -- Scripted readout event segment

Synopsis


            CScriptedSegment : public CEventSegment
           
   CScriptedSegment()
          throws ;
           
   void  addCreator(CModuleCreator&  creator)
          throws ;
                void  addStandardCreators()
          throws ;
              virtual   void  addUserWrittenCreators()
          throws ;
              virtual  std::string  getConfigurationFile()
          throws ;
  
        

DESCRIPTION

This class is a scripted event segment. It ties together the readout and module commands along with a set of module creators and an interpreter that will be used to execute the configuration file.

The virtual methods addUserWrittenCreators and getConfigurationFile allow applications to tailor the important aspects of this class.

Note that since this class is derived from CEventSegment, it defines and implements the initialize, clear, disable and read methods from that class. Those implementations iterate through the modules thta have been added to the readout in the order in which they have been added invoking appropriate methods in those modules.

METHODS

CScriptedSegment() throws ;

Constructor. Weaves together a Tcl interpreter, a configuration file a readout and a module command along with a set of module creators to build an event segment that is configurable via a Tcl script.

void addCreator(CModuleCreator& creator) throws ;

This is a convenience method used by addStandardCreators and, if used, addUserWrittenCreators to register module creators with the object/interpreter's module command. creator is a reference to a CModuleCreator object that will be added. The creator object must live for the lifetime of this object.

void addStandardCreators() throws ;

This method is invoked from the initialize method to register the creators for the standard supported modules.

virtual void addUserWrittenCreators() throws ;

Called by initialize. The implementation in the base class is empty. Derived classes may override this implementation to create and register additional module creators by invoking addCreator as needed.

virtual std::string getConfigurationFile() throws ;

Called by initialize to obtain the path to the configuration file. The base class implementation returns the first match among $HARDWARE_FILE, $HOME/config/hardware.tcl ./hardware.tcl. An error is thrown (CErrnoException with a meaningful error message) if there is no match in any of these locations.

getConfigurationFile is virtual allowing you to override this behavior. This is normally done if you want a scriptable event segment to use a different configuration script.