CTCLPackagedObjectProcessor

Name

CTCLPackagedObjectProcessor -- Base class for commands living in a CTCLObjectPackage

Synopsis


#include <TCLPackagedObjectProcessor.h>
         
 class CTCLPackagedObjectProcessor {

  CTCLPackagedObjectProcessor(CTCLInterpreter& interp, std::string command, bool registerMe = true);

  void onAttach(CTCLObjectPackage* package);
  protected CTCLObjectPackage* getPackage();
  protected virtual void Initialize();
}

Description

A packaged object command is a CTCLObjectProcessor that can draw on a set of services shared between it and a set of related commands. The set of commands and the common set of services is called a package.

The CTCLPackagedObjectProcessor class described here provides a base class for such commands. The base class provides mechanisms for the package to associate the object that contains the shared services with the command, and a mechanism for the subclass that actually implements real commands to access this associated object.

Public member functions

CTCLPackagedObjectProcessor(CTCLInterpreter& interp, std::string command, bool registerMe = true);

Construct the object. The parameters are the same as for a CTCLObjectProcessor; interp is a reference to the TCL interpreter to which the command will be added. command is the command keyword that will invoke the object's operator(). regsiterMe is true if the command should be registered on the interpreter immediately (this is usually the case and hence the parameter is optional, defaulting to true

void onAttach(CTCLObjectPackage* package);

This method is called by the package when the command object is added to the package. package is a pointer to the package object, which contains its shared services. This is saved and can be retrieved by subclass objects via getPackage.

protected CTCLObjectPackage* getPackage();

Returns the package object pointer supplied to onAttach by the package. Normally this will need to be cast to a specific concrete package type by the caller so that its methods can be accessed.

If called prior to the onAttach call, this returns a null pointer.

protected virtual void Initialize();

Called by onAttach after the package has been saved (and is therefore accessible by getPackage. This does nothing in the base class but can be overidden in subclasses to allow for initialization that requires access to the package services.

SEE ALSO

CTCLObjectPackage(3daq)