![]() |
Lumiera 0.pre.04~rc.1
»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.
Static Public Attributes | |
| static lib::Depend< CommandRegistry > | instance |
| storage for the singleton factory used to access CommandRegistry | |
Public Member Functions | |
| ~CommandRegistry () | |
| void | track (Symbol cmdID, Command const &commandHandle) |
| register a command (Frontend) under the given ID. | |
| bool | remove (Symbol cmdID) |
| remove the given command registration. | |
| Command | queryIndex (Symbol cmdID) |
| query the command index by ID | |
| Symbol | findDefinition (Command const &cmdInstance) const |
| search the command index for a definition | |
| 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 | |
| shared_ptr< CommandImpl > | createCloneImpl (CommandImpl const &refObject) |
| create an allocation for holding a clone of the given CommandImpl data. | |
Private Types | |
| using | CmdIndex = unordered_map< Symbol, Command, hash< Symbol > > |
| using | ReverseIndex = map< const Command *, Symbol, order_by_impl > |
Private Attributes | |
| TypedAllocationManager | allocator_ |
| CmdIndex | index_ |
| ReverseIndex | ridx_ |
Additional Inherited Members | |
Static Public Member Functions inherited from Sync< CONF > | |
| static Monitor & | getMonitor (Sync const *forThis) |
Private Member Functions inherited from NonCopyable | |
| ~NonCopyable ()=default | |
| NonCopyable ()=default | |
| NonCopyable (NonCopyable const &)=delete | |
| NonCopyable & | operator= (NonCopyable const &)=delete |
|
inline |
Definition at line 126 of file command-registry.hpp.
References CommandRegistry::index_, CommandRegistry::index_size(), and CommandRegistry::ridx_.
Here is the call graph for this function:Definition at line 114 of file command-registry.hpp.
|
private |
Definition at line 115 of file command-registry.hpp.
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.
References CommandRegistry::index_, and CommandRegistry::ridx_.
Referenced by CommandRegistry_test::checkRegistration().
Here is the caller graph for this function:remove the given command registration.
true if actually removed an entry Definition at line 165 of file command-registry.hpp.
References CommandRegistry::index_, and CommandRegistry::ridx_.
Referenced by CommandRegistry_test::checkRegistration().
Here is the caller graph for this function:query the command index by ID
Definition at line 189 of file command-registry.hpp.
References CommandRegistry::index_.
Referenced by CommandRegistry_test::checkRegistration(), and Command::storeDef().
Here is the caller graph for this function: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.
References Symbol::BOTTOM, and CommandRegistry::ridx_.
Referenced by CommandRegistry_test::checkRegistration().
Here is the caller graph for this function:
|
inline |
Definition at line 209 of file command-registry.hpp.
References CommandRegistry::index_.
Referenced by CommandRegistry::~CommandRegistry(), CommandRegistry_test::checkRegistration(), and CommandRegistry_test::run().
Here is the caller graph for this function:
|
inline |
Definition at line 216 of file command-registry.hpp.
References CommandRegistry::allocator_, and TypedAllocationManager::numSlots().
Referenced by CommandRegistry_test::checkAllocation(), CommandRegistry_test::checkRegistration(), CommandCloneBuilder_test::run(), CommandRegistry_test::run(), HandlingPatternBasics_test::run(), and HandlingPatternStandardImpl_test::run().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
set up a new command implementation frame
Definition at line 232 of file command-registry.hpp.
References CommandRegistry::allocator_, and TypedAllocationManager::create().
Referenced by HandlingPatternBasics_test::buildTestCommand(), CommandCloneBuilder_test::buildTestImplFrame(), CommandRegistry_test::checkAllocation(), and UndoDefinition< SIG, MEM >::undoOperation().
Here is the call graph for this function:
Here is the caller graph for this function:| 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 CommandRegistry::allocator_, and TypedAllocationManager::create().
Referenced by CommandRegistry_test::checkAllocation(), Command::newInstance(), CommandCloneBuilder_test::run(), and Command::storeDef().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 117 of file command-registry.hpp.
Referenced by CommandRegistry::createCloneImpl(), CommandRegistry::instance_count(), and CommandRegistry::newCommandImpl().
|
private |
Definition at line 118 of file command-registry.hpp.
Referenced by CommandRegistry::~CommandRegistry(), CommandRegistry::index_size(), CommandRegistry::queryIndex(), CommandRegistry::remove(), and CommandRegistry::track().
|
private |
Definition at line 119 of file command-registry.hpp.
Referenced by CommandRegistry::~CommandRegistry(), CommandRegistry::findDefinition(), CommandRegistry::remove(), and CommandRegistry::track().
|
static |
storage for the singleton factory used to access CommandRegistry
Definition at line 123 of file command-registry.hpp.
Referenced by CommandDef::~CommandDef(), Command::activate(), Command::definition_count(), Command::fetchDef(), Command::get(), Command::instance_count(), Command::isAnonymous(), Command::maybeGetNewInstance(), Command::newInstance(), steam::control::anonymous_namespace{command.cpp}::registered_for(), Command::remove(), CommandCloneBuilder_test::run(), CommandRegistry_test::run(), HandlingPatternBasics_test::run(), HandlingPatternStandardImpl_test::run(), Command::storeDef(), and UndoDefinition< SIG, MEM >::undoOperation().
Inheritance diagram for CommandRegistry:
Collaboration diagram for CommandRegistry: