control::Command Class Reference

#include <command.hpp>

Inheritance diagram for control::Command:

Inheritance graph
[legend]
Collaboration diagram for control::Command:

Collaboration graph
[legend]

List of all members.


Detailed Description

Handle object representing a single Command instance to be used by client code.

Commands are accessed through a symbolic ID ; there needs to be a CommandDef somewhere to specify the actual operation and to define, how the effect of the command can be undone. Moreover, the command's definition refers to a HandlingPattern, which describes how the command is actually to be executed (the default is scheduling it within the ProcDispatcher)

Client code usually just

Definition at line 106 of file command.hpp.


Public Member Functions

template<typename TYPES>
CommandbindArg (Tuple< TYPES > const &)
bool canExec () const
bool canUndo () const
 Command ()
 undefined command
 Command (Symbol cmdID)
void duplicate_detected (Symbol) const
ExecResult exec (HandlingPattern::ID)
ExecResult exec (HandlingPattern const &execPattern)
 core operation: invoke the command
ExecResult execSync ()
 invoke using a default "synchronous" execution pattern
HandlingPattern::ID getDefaultHandlingPattern () const
Command newInstance () const
 create independent clone copy of this command
 operator string () const
 diagnostics: shows the commandID, if any, and the degree of definition of this command
ExecResult operator() ()
HandlingPattern::ID setHandlingPattern (HandlingPattern::ID)
 define a handling pattern to be used by default
Command storeDef (Symbol newCmdID) const
 create a clone definition
ExecResult undo ()

Static Public Member Functions

static bool canExec (Symbol cmdID)
static bool canUndo (Symbol cmdID)
static bool defined (Symbol cmdID)
static size_t definition_count ()
static Command get (FuncPtr func)
static Command get (Symbol cmdID)
 Access existing command for use.
static size_t instance_count ()
static bool remove (Symbol cmdID)

Protected Member Functions

void activate (shared_ptr< CommandImpl > const &, Symbol cmdID=0)

Static Protected Member Functions

static Command fetchDef (Symbol cmdID)

Private Types

typedef lib::Handle< CommandImpl_Handle

Private Member Functions

void setArguments (Arguments &)

Static Private Member Functions

static bool equivalentImpl (Command const &, Command const &)

Friends

class CommandDef
bool operator< (Command const &, Command const &)
 allow for sets and associative containers
bool operator== (Command const &, Command const &)

Constructor & Destructor Documentation

control::Command::Command (  )  [inline]

undefined command

Definition at line 125 of file command.hpp.


Member Function Documentation

void control::Command::activate ( shared_ptr< CommandImpl > const &  implFrame,
Symbol  cmdID = 0 
) [protected]

For internal use only.

make a command ready for use. Typically to be invoked through CommandDef during the definition stage, but also used for activating clone instances.

Parameters:
cmdID new ID for creating a separate command registration when provided
Exceptions:
error::Logic when this is already activated.

Definition at line 151 of file command.cpp.

References lib::Handle< IMP >::activate(), and control::CommandRegistry::instance.

Referenced by control::CommandDef::activate(), newInstance(), and storeDef().

Here is the call graph for this function:

Here is the caller graph for this function:

size_t control::Command::definition_count (  )  [static]

Returns:
the number of command definitions currently registered

Definition at line 245 of file command.cpp.

References control::CommandRegistry::instance.

ExecResult control::Command::exec ( HandlingPattern const &  execPattern  ) 

core operation: invoke the command

Parameters:
execPattern describes the individual steps necessary to get this command invoked properly

Definition at line 372 of file command.cpp.

References control::HandlingPattern::invoke().

Referenced by execSync().

Here is the call graph for this function:

Here is the caller graph for this function:

ExecResult control::Command::execSync (  ) 

invoke using a default "synchronous" execution pattern

Definition at line 390 of file command.cpp.

References exec(), and control::HandlingPattern::get().

Here is the call graph for this function:

Command control::Command::fetchDef ( Symbol  cmdID  )  [static, protected]

For internal use only.

just query an existing instance, if any.

Definition at line 139 of file command.cpp.

References control::CommandRegistry::instance.

Command control::Command::get ( FuncPtr  func  )  [static]

Definition at line 131 of file command.cpp.

Command control::Command::get ( Symbol  cmdID  )  [static]

Access existing command for use.

Exceptions:
error::Invalid if command not registered or incompletely defined.

Definition at line 112 of file command.cpp.

References control::CommandRegistry::instance, and asset::str().

Here is the call graph for this function:

HandlingPattern::ID control::Command::getDefaultHandlingPattern (  )  const

Returns:
ID of the execution pattern used by operator()

Definition at line 397 of file command.cpp.

size_t control::Command::instance_count (  )  [static]

Returns:
number of distinguishable registered command instances

Definition at line 254 of file command.cpp.

References control::CommandRegistry::instance.

Command control::Command::newInstance (  )  const

create independent clone copy of this command

Definition at line 187 of file command.cpp.

References activate(), control::CommandRegistry::createCloneImpl(), and control::CommandRegistry::instance.

Here is the call graph for this function:

control::Command::operator string (  )  const

diagnostics: shows the commandID, if any, and the degree of definition of this command

Definition at line 332 of file command.cpp.

References control::CommandRegistry::instance.

void control::Command::setArguments ( Arguments &  args  )  [private]

For internal use only.

pass a new argument tuple to the CommandImpl without exposing implementation.

Definition at line 235 of file command.cpp.

HandlingPattern::ID control::Command::setHandlingPattern ( HandlingPattern::ID  pattID  ) 

define a handling pattern to be used by default

Returns:
ID of the currently defined default pattern

Definition at line 405 of file command.cpp.

Command control::Command::storeDef ( Symbol  newCmdID  )  const

create a clone definition

create an independent clone copy of this command and register it as new command definition under a different ID

Definition at line 170 of file command.cpp.

References activate(), control::CommandRegistry::createCloneImpl(), control::CommandRegistry::instance, and control::CommandRegistry::queryIndex().

Here is the call graph for this function:


Friends And Related Function Documentation

bool operator< ( Command const &  c1,
Command const &  c2 
) [friend]

allow for sets and associative containers

Definition at line 268 of file command.hpp.


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

Generated on Thu Jul 22 00:06:39 2010 for Lumiera by  doxygen 1.5.6