CTCLCompatibiltyProcessor

Name

CTCLCompatibilityProcessor --  Adaptor between CTCLOjbectProcessor and CTCLProcessor.

Synopsis


#include <TCLCompatibilityProcessor.h>
...
class CTCLCompatibilityProcessor : public CTCLObjectProcessor
{

public:

  CTCLCompatibilityProcessor(CTCLProcessor& actualCommand);
  virtual ~CTCLCompatibilityProcessor();

  virtual int operator()(CTCLInterpreter& interp,
                         std::vector<CTCLObject>& objv);
  virtual void onUnregister();
};

    

DESCRIPTION

Note that the information on this page is only to be used to "grandfather" old CTCLProcessor objects into Tcl. New command processors should be based on the CTCLObjectProcessor.

A rewrite of the TCL++ library in March 2006 eliminated the use of Tcl functions that are scheduled to be deprecated in the known future of Tcl. One set of functions scheduled for deprecation are those that revolve around direct access to the Tcl interpreter result, and command processors that use the argc, argv interfaces.

Since a number of existing command extensions are, no doubt built on top of the CTCLProcessor argc argv interface, a mechanism that allows the use of existing commands was built as well.

The current implementation of a CTCLProcessor includes as member data a CTCLCompatibilityProcessor object. This object registers itself as a CTCLObjectProcessor for the command intended by the CTCLProcessor and serves as an adaptor between these two command types, marshalling command objects into an argc, argv pair, creating and committing a CTCLResult object.

For most users of this library, this is completely transparent, this documentation is provided for completeness, however.

METHODS


CTCLCompatibilityProcessor(CTCLProcessor& actualCommand);
        

Constructs a compatibility processor that adapts the object based command interface for actualCommand. actualCommand must already be bound to an interpreter.


virtual int operator()(CTCLInterpreter& interp,
                       std::vector<CTCLObject>& objv);
        

Called when the command is executed. objv is marshalled into an argc, argv pair. A CTCLResult is created and the actual command's operator() is called to execute the command. On return, the result is committed, and all dynamic storage released prior to returning the status from the command processor.


virtual void onUnregister();
        

Called when the command is unregistered. The actual command's OnDelete member is called.

SEE ALSO

CTCLObject(3), CTCLObjectProcessor(3), CTCLProcessor(3), CTCLResult(3),

REFERENCES


Gamma, Helm, Johnson, Vlissides Design Patterns Elements of Reusable
Object-Oriented Software
Addison-Wesley Professional Computing Series 1995 ISBN 0-0201-63361-2
See Chapter 4 the Adapter pattern.