![]() |
Lumiera 0.pre.04
»edit your freedom«
|
Managing command definitions and the storage of individual command objects. More...
Go to the source code of this file.
Managing command definitions and the storage of individual command objects.
The CommandRegistry is an singleton object, accessible only at the implementation level of control::Command (note: CommandImpl isn't tied to the registry). For the other parts of the command system, it provides all "get me this command object"-services. Actually, these can be decomposed into two distinct parts:
Each command starts out as command definition, accessed by client code through CommandDef. While collecting the necessary parts of such a definition, there is just an empty (pending) Command (smart-ptr frontend), which is not yet usable, being held within the CommandDef. When the definition is complete, a CommandImpl frame is allocated, configured and used to activate the Command (smart-ptr frontend), at which point it also gets accessible through the CommandRegistry.
Later on, client code is assumed to re-access the command by ID. It may bind arguments, which are stored in the already allocated StorageHolder. (-->Ticket #269). As the Command frontend is a smart-ptr, commands may be copied, stored away and passed on. When finally the ref-count of a given definition goes to zero, de-allocation happens automatically. This can't happen for a registered command definition though, as a Command instance is stored within the index table, keeping the linked data alive. Thus, any registered commands will remain in memory until de-registered explicitly, or until application shutdown.
Definition in file command-registry.hpp.
#include "lib/error.hpp"#include "lib/depend.hpp"#include "lib/sync.hpp"#include "include/logging.h"#include "lib/nocopy.hpp"#include "lib/util.hpp"#include "steam/control/command.hpp"#include "steam/control/command-signature.hpp"#include "steam/control/command-storage-holder.hpp"#include "lib/typed-allocation-manager.hpp"#include <boost/functional/hash.hpp>#include <unordered_map>#include <memory>#include <string>#include <map>Namespaces | |
| namespace | steam |
| Steam-Layer implementation namespace root. | |
| namespace | steam::control |
| Steam-Layer dispatcher, controller and administrative facilities. | |
Classes | |
| struct | order_by_impl |
| Helper for building a std::map with Command* as keys. More... | |
| class | CommandRegistry |
| Registry managing command implementation objects (Singleton). More... | |