Lumiera  0.pre.03
»edityourfreedom«
command-closure.hpp
Go to the documentation of this file.
1 /*
2  COMMAND-CLOSURE.hpp - defining execution targets and parameters for commands
3 
4  Copyright (C) Lumiera.org
5  2009, 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 
68 #ifndef CONTROL_COMMAND_CLOSURE_H
69 #define CONTROL_COMMAND_CLOSURE_H
70 
73 #include "lib/diff/gen-node.hpp"
74 
75 #include <memory>
76 #include <string>
77 
78 
79 
80 
81 namespace proc {
82 namespace control {
83 
86 
87  using std::string;
88 
89 
90 
91  LUMIERA_ERROR_DECLARE (UNBOUND_ARGUMENTS);
92 
93 
99 
101 
102 
103 
104 
107  {
108  public:
109  virtual ~CmdClosure() {}
110  explicit operator bool() const { return isValid(); }
111 
112  virtual operator string() const =0;
113  virtual bool isValid () const =0;
114  virtual bool isCaptured () const =0;
115  virtual bool equals (CmdClosure const&) const =0;
116  virtual void bindArguments (Arguments&) =0;
117  virtual void bindArguments (lib::diff::Rec const&) =0;
118  virtual void unbindArguments() =0;
119  virtual void invoke (CmdFunctor const&) =0;
120  virtual void accept (CommandImplCloneBuilder&) const =0;
121  };
122 
123 
125 
126 
127 
128 }} // namespace proc::control
129 #endif /*CONTROL_COMMAND_CLOSURE_H*/
LUMIERA_ERROR_DECLARE(INVALID_ARGUMENTS)
Arguments provided for binding doesn&#39;t match stored command function parameters.
virtual bool equals(CmdClosure const &) const =0
is equivalent to the given other closure?
Implementation helper to bind Proc-Layer commands with arbitrary argument tuples. ...
FunErasure< StoreFunction > CmdFunctor
A neutral container internally holding the functor used to implement the Command. ...
virtual void bindArguments(Arguments &)=0
store a set of parameter values within this closure
Generic wrapper carrying a function object while hiding the actual function signature.
Policy for FunErasure: store an embedded std::function Using this policy allows to store arbitrary co...
Generic building block for tree shaped (meta)data structures.
Visitor to support creating a CommandImpl clone.
virtual void unbindArguments()=0
discard any parameters and return to unbound state
Generic holder for functor objects, concealing the concrete function type.
virtual bool isValid() const =0
does this closure hold a valid argument tuple?
Proc-Layer implementation namespace root.
Definition: id-scheme.hpp:63
object-like record of data.
Definition: record.hpp:143
virtual bool isCaptured() const =0
does this closure hold captured UNDO state?
virtual void accept(CommandImplCloneBuilder &) const =0
assist with creating clone closure without disclosing concrete type
virtual void invoke(CmdFunctor const &)=0
invoke functor using the stored parameter values