Lumiera  0.pre.03
»edit your freedom«
command-instance-manager.hpp
Go to the documentation of this file.
1 /*
2  COMMAND-INSTANCE-MANAGER.hpp - Service to manage command instances for actual invocation
3 
4  Copyright (C)
5  2017, Hermann Vosseler <Ichthyostega@web.de>
6 
7   **Lumiera** is free software; you can redistribute it and/or modify it
8   under the terms of the GNU General Public License as published by the
9   Free Software Foundation; either version 2 of the License, or (at your
10   option) any later version. See the file COPYING for further details.
11 
12 */
13 
14 
48 #ifndef CONTROL_COMMAND_INSTANCE_MANAGER_H
49 #define CONTROL_COMMAND_INSTANCE_MANAGER_H
50 
51 #include "lib/error.hpp"
52 #include "lib/nocopy.hpp"
55 #include "lib/diff/gen-node.hpp"
56 #include "lib/symbol.hpp"
57 
58 #include <unordered_map>
59 #include <string>
60 
61 
62 
63 namespace steam {
64 namespace control {
65 
66  using std::string;
67  using lib::Symbol;
68  using lib::diff::Rec;
69 
70 
92  {
93  CommandDispatch& dispatcher_;
94  std::unordered_map<Symbol,Command> table_;
95 
96  public:
99 
100  Symbol newInstance (Symbol prototypeID, string const& invocationID);
101  Command getInstance(Symbol instanceID);
102  void dispatch (Symbol instanceID);
103  void bindAndDispatch (Symbol instanceID, Rec const& argSeq);
104 
105  bool contains (Symbol instanceID) const;
106 
107  private:
109  void handOver (Command&&);
110  };
111 
112 
113 
114 }} // namespace steam::control
115 #endif /*CONTROL_COMMAND_INSTANCE_MANAGER_H*/
Symbol newInstance(Symbol prototypeID, string const &invocationID)
Create and thus "open" a new anonymous command instance.
Interface to abstract the SteamDispatcher&#39;s ability to handle command messages.
Any copy and copy construction prohibited.
Definition: nocopy.hpp:37
Maintain a current command instance for parametrisation.
Steam-Layer implementation namespace root.
Command getInstance(Symbol instanceID)
access the currently "opened" instance with the given instanceID
Token or Atom with distinct identity.
Definition: symbol.hpp:117
Mix-Ins to allow or prohibit various degrees of copying and cloning.
Marker types to indicate a literal string and a Symbol.
Interface of a service to perform Commands on the session.
Generic building block for tree shaped (meta)data structures.
Steam-Layer command frontend.
Lumiera error handling (C++ interface).
Handle object representing a single Command instance to be used by client code.
Definition: command.hpp:115
void bindAndDispatch(Symbol instanceID, Rec const &argSeq)
fire and forget anonymous command instance.
void dispatch(Symbol instanceID)
hand over the designated command instance to the dispatcher installed on construction.
object-like record of data.
Definition: record.hpp:141
CommandInstanceManager(CommandDispatch &)
create a CommandInstanceManager and wire it with the given CommandDispatch implementation.