#include <cmdproto.h>
The prototype description is given to the CmdProto constructor as a string of the format
"outargs_name_inargs"
"outargs" is a list of characters describing number and datatypes of output arguments, "inargs" describes the input args in the same way. "name" is the name of the command.
The following datatypes are defined:
Examples of prototype descriptions:
v_rotate_fff - name is 'rotate', no output args, 3 float input args, v_set_si - name is 'set', no output args, one string and one int input arg fff_getrotate_v - 3 float output args, no input arg, name is 'getrotate'
Public Member Functions | |
CmdProto (const char *proto_def, fourcc_t id) | |
CmdProto (const CmdProto &rhs) | |
virtual | ~CmdProto () |
virtual bool | Dispatch (void *, Cmd *)=0 |
Executes a command on the provided object. | |
fourcc_t | GetId () const |
int | GetInArgsCount () const |
int | GetOutArgsCount () const |
int | GetNumArgs () const |
const char * | GetProtoDef () const |
Cmd * | NewCmd () |
void | RelCmd (Cmd *cmd) |
Private Attributes | |
fourcc_t | fourcc |
byte_t | in_args_count |
byte_t | out_args_count |
bool | cmd_locked |
Cmd * | cmd_template |
string | proto_def |
CmdProto::CmdProto | ( | const char * | proto_def, | |
fourcc_t | id | |||
) |
Constructor.
CmdProto::CmdProto | ( | const CmdProto & | rhs | ) |
Copy constructor.
CmdProto::~CmdProto | ( | ) | [virtual] |
Destructor.
virtual bool CmdProto::Dispatch | ( | void * | , | |
Cmd * | ||||
) | [pure virtual] |
fourcc_t CmdProto::GetId | ( | ) | const [inline] |
Gets fourcc code.
int CmdProto::GetInArgsCount | ( | ) | const [inline] |
Gets number of input args.
int CmdProto::GetOutArgsCount | ( | ) | const [inline] |
Gets number of output args.
int CmdProto::GetNumArgs | ( | ) | const [inline] |
Gets overall number of args.
const char * CmdProto::GetProtoDef | ( | ) | const [inline] |
Gets the prototype string.
Cmd * CmdProto::NewCmd | ( | ) |
Create a new cmd object from the internal template object. Optimization: normally just returns the template object (if nobody else uses it), instead of creating a new object.
IMPORTANT: the CmdProto::RelCmd() method MUST be used to release the Cmd object!!!
void CmdProto::RelCmd | ( | Cmd * | cmd | ) |
Release a Cmd object created with CmdProto::NewCmd()
fourcc_t CmdProto::fourcc [private] |
byte_t CmdProto::in_args_count [private] |
byte_t CmdProto::out_args_count [private] |
bool CmdProto::cmd_locked [private] |
Cmd* CmdProto::cmd_template [private] |
string CmdProto::proto_def [private] |