Lumiera
0.pre.03
»edit your freedom«
|
#include "steam/control/command-registry.hpp"
Registry managing command implementation objects (Singleton).
Relies on TypedAllocationManager for pooled custom allocation (TODO: not implemented as of 9/09) Registered command (definitions) are accessible by command ID; as this mapping is bidirectional, it is also possible to find out the ID for a given command.
Definition at line 109 of file command-registry.hpp.
Public Member Functions | |
shared_ptr< CommandImpl > | createCloneImpl (CommandImpl const &refObject) |
create an allocation for holding a clone of the given CommandImpl data. More... | |
Symbol | findDefinition (Command const &cmdInstance) const |
search the command index for a definition More... | |
size_t | index_size () const |
size_t | instance_count () const |
template<typename SIG_OPER , typename SIG_CAPT , typename SIG_UNDO > | |
shared_ptr< CommandImpl > | newCommandImpl (function< SIG_OPER > &operFunctor, function< SIG_CAPT > &captFunctor, function< SIG_UNDO > &undoFunctor) |
set up a new command implementation frame More... | |
Command | queryIndex (Symbol cmdID) |
query the command index by ID More... | |
bool | remove (Symbol cmdID) |
remove the given command registration. More... | |
void | track (Symbol cmdID, Command const &commandHandle) |
register a command (Frontend) under the given ID. More... | |
Static Public Attributes | |
static lib::Depend< CommandRegistry > | instance |
storage for the singleton factory used to access CommandRegistry | |
Private Types | |
typedef unordered_map< Symbol, Command, hash< Symbol > > | CmdIndex |
typedef map< const Command *, Symbol, order_by_impl > | ReverseIndex |
Private Attributes | |
TypedAllocationManager | allocator_ |
CmdIndex | index_ |
ReverseIndex | ridx_ |
Additional Inherited Members | |
Static Public Member Functions inherited from Sync<> | |
static Monitor & | getMonitor (Sync const *forThis) |
Private Member Functions inherited from NonCopyable | |
NonCopyable (NonCopyable const &)=delete | |
NonCopyable & | operator= (NonCopyable const &)=delete |
register a command (Frontend) under the given ID.
error::Logic | when a registration already exists, either under this ID or for the same concrete implementation record but with a different ID. |
Definition at line 143 of file command-registry.hpp.
|
inline |
remove the given command registration.
true
if actually removed an entry Definition at line 165 of file command-registry.hpp.
query the command index by ID
Definition at line 189 of file command-registry.hpp.
Referenced by CommandRegistry_test::checkRegistration().
search the command index for a definition
cmdInstance | using the definition to look up |
NULL
in case of an "anonymous" command Definition at line 201 of file command-registry.hpp.
|
inline |
set up a new command implementation frame
Definition at line 232 of file command-registry.hpp.
shared_ptr< CommandImpl > createCloneImpl | ( | CommandImpl const & | refObject | ) |
create an allocation for holding a clone of the given CommandImpl data.
This is a tricky operation, as the CommandImpl after construction erases the specific type information pertaining the StorageHolder. But this specific type information is vital for determining the exact allocation size for the clone StorageHolder. The only solution is to delegate the cloning of the arguments down into the StorageHolder, passing a reference to the memory manager for allocating the clone. Actually, we perform this operation through the help of a visitor, which re-gains the complete type context and prepares the necessary clone objects; in a final step, we allocate a new CommandImpl frame and initialise it with the prepared clone objects.
Definition at line 219 of file command.cpp.
References CommandImplCloneBuilder::clonedClosuere(), CommandImplCloneBuilder::clonedUndoMutation(), and CommandImpl::prepareClone().