FRIBParallelanalysis  1.0
FrameworkforMPIParalleldataanalysisatFRIB
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
CTCLProcessor Class Referenceabstract

#include <TCLProcessor.h>

Inheritance diagram for CTCLProcessor:
Inheritance graph
[legend]
Collaboration diagram for CTCLProcessor:
Collaboration graph
[legend]

Public Member Functions

 CTCLProcessor (const std::string sCommand, CTCLInterpreter *pInterp)
 
 CTCLProcessor (const char *pCommand, CTCLInterpreter *pInterp)
 
virtual ~CTCLProcessor ()
 
std::string getCommandName () const
 
virtual int operator() (CTCLInterpreter &rInterpreter, CTCLResult &rResult, int argc, char **argv)=0
 
virtual void OnDelete ()
 
void Register ()
 
void Unregister ()
 
void RegisterAll ()
 
void UnregisterAll ()
 
int ParseInt (const char *pString, int *pInteger)
 
int ParseInt (const std::string &rString, int *pInteger)
 
int ParseDouble (const char *pString, double *pDouble)
 
int ParseDouble (const std::string &rString, double *pDouble)
 
int ParseBoolean (const char *pString, TCLPLUS::Bool_t *pBoolean)
 
int ParseBoolean (const std::string &rString, TCLPLUS::Bool_t *pBoolean)
 
virtual void preCommand ()
 
virtual void postCommand ()
 
virtual void preDelete ()
 
virtual void postDelete ()
 
CTCLInterpreterBind (CTCLInterpreter &binding)
 
CTCLInterpreterBind (CTCLInterpreter *binding)
 
- Public Member Functions inherited from CTCLInterpreterObject
 CTCLInterpreterObject (CTCLInterpreter *pInterp)
 
 CTCLInterpreterObject (const CTCLInterpreterObject &aCTCLInterpreterObject)
 
CTCLInterpreterObjectoperator= (const CTCLInterpreterObject &aCTCLInterpreterObject)
 
int operator== (const CTCLInterpreterObject &aCTCLInterpreterObject) const
 
CTCLInterpretergetInterpreter () const
 
CTCLInterpreterBind (CTCLInterpreter &rBinding)
 
CTCLInterpreterBind (CTCLInterpreter *pBinding)
 

Static Public Member Functions

static std::string ConcatenateParameters (int nArguments, char *pArguments[])
 
static int MatchKeyword (std::vector< std::string > &MatchTable, const std::string &rValue, int NoMatch=-1)
 

Protected Member Functions

void NextParam (int &argc, char **&argv)
 
- Protected Member Functions inherited from CTCLInterpreterObject
CTCLInterpreterAssertIfNotBound ()
 

Detailed Description

This class is an abstract base class for commands written against the argc/argv interface of Tcl/Tk. Note that since this interface is supposedly due to be deprecated with Tcl 9.0, this is actually written with the aid of an adaptor class (CTCLCompatibilityProcessor) to work with only the object interface.

This is a complete rewrite of this class since SpecTcl-3.0 however it should be compatible with older uses.

Constructor & Destructor Documentation

◆ CTCLProcessor()

CTCLProcessor::CTCLProcessor ( const char *  pCommand,
CTCLInterpreter pInterp 
)

Construct from the char* version of the command name.

◆ ~CTCLProcessor()

CTCLProcessor::~CTCLProcessor ( )
virtual

Destruction requires unregistration, if possible, and deletion of the compatibility processor.

Member Function Documentation

◆ Bind()

CTCLInterpreter * CTCLProcessor::Bind ( CTCLInterpreter binding)

Binding must also rebind the adaptor.

◆ ConcatenateParameters()

std::string CTCLProcessor::ConcatenateParameters ( int  nArguments,
char *  pArguments[] 
)
static

Concatenates a parameter set into a single string. This can be used by command interpreters which will need to further parse their input (e.g an epxression evaluator may want to act globally on the expression, rather than a token at a time). Spaces are put between each parameter.

Parameters
nArgumentsNumber of parameters to concatenate.
pArguments[]: char* Pointer to the set of parameters to concatenate.
Returns
string
Return values
Stringcontaining the concatenation of the parameters.
Note
Command invocations set argv[0] to be the command text. In order to be policy free, we act as if that's not the case, therefore if the client really only wants the parameters, they should pass a pointer to argv[1]

◆ getCommandName()

string CTCLProcessor::getCommandName ( ) const

Return the name of the command. This is the initial command name, not the name after any renaming e.g.

◆ MatchKeyword()

int CTCLProcessor::MatchKeyword ( std::vector< std::string > &  MatchTable,
const std::string &  rValue,
int  NoMatch = -1 
)
static

Match a keyword, rValue, against the set of keywords in a MatchTable. If no match can be found, the NoMatch value is returned. Otherwise the index into the table is returned.

Parameters
MatchTable: vector<string>& vector of legitimate keyword strings.
rValue: const string& The keyword to match against the table.
NoMatch: int Value to return if no match is found.
Returns
int
Return values
theindex into MatchTable where a string matched rValue.
NoMatchif there is no such index.

◆ OnDelete()

void CTCLProcessor::OnDelete ( )
virtual

Called when the command is being deleted. The default action is to do nothing.

Reimplemented in Reverse.

◆ ParseBoolean()

int CTCLProcessor::ParseBoolean ( const char *  pString,
TCLPLUS::Bool_t *  pBoolean 
)

Parses a string as a boolean. True values are any of: 1,true,on, or yes False values are any of 0, false, off, or no.

Parameters
pStringconst char* Pointer to the string to parse.
pBoolBool_t* Pointer to the result boolean.
Returns
int
Return values
TCL_OKif parse worked.
TCL_ERRORand instantiating a CTCLResult object on the currently bound interpreter will enable a textual reason for the parse failure to be retrieved.

◆ ParseDouble()

int CTCLProcessor::ParseDouble ( const char *  pString,
double *  pDouble 
)

Parses a string as a double using the currently bound interpreter.

Parameters
pStringchar* String to parse.
pDoubledouble* Points to where to put value to parse.
Returns
Return values
TCL_OK- If ok.
TCL_ERRORand a CTCLResult can be instantiated on the bound interpreter to retrieve a textual reason for the parse failure.

◆ ParseInt()

int CTCLProcessor::ParseInt ( const char *  pString,
int *  pInteger 
)

Uses the currently bound interpreter to parse a parameter as an integer.

 \param  pString : char*
       Pointer to the string to parse as an integer.
 \param pInteger : int*
      Pointer to the integer to fill in.
 \return int
 \retval   TCL_OK if ok, 
 \retval  TCL_ERROR If not:
          client should instantiate a 
          CTCLResult object on the bound interpreter to get detailed error
          information.

◆ postCommand()

void CTCLProcessor::postCommand ( )
virtual

This is a hook that can be overiddent by derived classes. It is called just after the execution of operator()... success or failure.

Reimplemented in Reverse.

◆ postDelete()

void CTCLProcessor::postDelete ( )
virtual

Hook for derived classes to get control just after OnDelete

◆ preCommand()

void CTCLProcessor::preCommand ( )
virtual

This is a hook that can be overridden by derived classes. It is called just prior to the execution of operator().

Reimplemented in Reverse.

◆ preDelete()

void CTCLProcessor::preDelete ( )
virtual

Hook for derived classes to get control just prior to OnDelete.

◆ Register()

void CTCLProcessor::Register ( )

Register the object with the interpreter. We allow multiple registrations (subsequent are no-ops).

◆ RegisterAll()

void CTCLProcessor::RegisterAll ( )

Register all is the same as register.

◆ UnregisterAll()

void CTCLProcessor::UnregisterAll ( )

Unregister all just does a caught unregister on the adaptor.


The documentation for this class was generated from the following files: