Lumiera  0.pre.03
»edityourfreedom«
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) Lumiera.org
5  2017, Hermann Vosseler <Ichthyostega@web.de>
6 
7  This program is free software; you can redistribute it and/or
8  modify it under the terms of the GNU General Public License as
9  published by the Free Software Foundation; either version 2 of
10  the License, or (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program; if not, write to the Free Software
19  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 
21 */
22 
23 
57 #ifndef CONTROL_COMMAND_INSTANCE_MANAGER_H
58 #define CONTROL_COMMAND_INSTANCE_MANAGER_H
59 
60 #include "lib/error.hpp"
61 #include "lib/nocopy.hpp"
62 #include "proc/control/command.hpp"
64 #include "lib/diff/gen-node.hpp"
65 #include "lib/symbol.hpp"
66 
67 #include <unordered_map>
68 #include <string>
69 
70 
71 
72 namespace proc {
73 namespace control {
74 
75  using std::string;
76  using lib::Symbol;
77  using lib::diff::Rec;
78 
79 
101  {
103  std::unordered_map<Symbol,Command> table_;
104 
105  public:
108 
109  Symbol newInstance (Symbol prototypeID, string const& invocationID);
110  Command getInstance(Symbol instanceID);
111  void dispatch (Symbol instanceID);
112  void bindAndDispatch (Symbol instanceID, Rec const& argSeq);
113 
114  bool contains (Symbol instanceID) const;
115 
116  private:
118  void handOver (Command&&);
119  };
120 
121 
122 
123 }} // namespace proc::control
124 #endif /*CONTROL_COMMAND_INSTANCE_MANAGER_H*/
Record< GenNode > Rec
Definition: gen-node.hpp:133
Command getCloneOrInstance(Symbol, bool)
Interface to abstract the ProcDispatcher&#39;s ability to handle command messages.
Any copy and copy construction prohibited.
Definition: nocopy.hpp:46
Symbol newInstance(Symbol prototypeID, string const &invocationID)
Create and thus "open" a new anonymous command instance.
Command getInstance(Symbol instanceID)
access the currently "opened" instance with the given instanceID
bool contains(Symbol instanceID) const
Maintain a current command instance for parametrisation.
void dispatch(Symbol instanceID)
hand over the designated command instance to the dispatcher installed on construction.
Token or Atom with distinct identity.
Definition: symbol.hpp:116
void bindAndDispatch(Symbol instanceID, Rec const &argSeq)
fire and forget anonymous command instance.
Mix-Ins to allow or prohibit various degrees of copying and cloning.
Marker types to indicate a literal string and a Symbol.
std::unordered_map< Symbol, Command > table_
Generic building block for tree shaped (meta)data structures.
Proc-Layer command frontend.
Lumiera error handling (C++ interface).
CommandInstanceManager(CommandDispatch &)
create a CommandInstanceManager and wire it with the given CommandDispatch implementation.
Handle object representing a single Command instance to be used by client code.
Definition: command.hpp:125
Interface of a service to perform Commands on the session.
Proc-Layer implementation namespace root.
Definition: id-scheme.hpp:63