Lumiera  0.pre.03
»edit your freedom«
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 namespace steam {
80 namespace control {
81 
84 
85  using std::string;
86 
87 
88 
94 
96 
97 
98 
99 
102  {
103  public:
104  virtual ~CmdClosure() {}
105  explicit operator bool() const { return isValid(); }
106 
107  virtual operator string() const =0;
108  virtual bool isValid () const =0;
109  virtual bool isCaptured () const =0;
110  virtual void bindArguments (Arguments&) =0;
111  virtual void bindArguments (lib::diff::Rec const&) =0;
112  virtual void unbindArguments() =0;
113  virtual void invoke (CmdFunctor const&) =0;
114  virtual void accept (CommandImplCloneBuilder&) const =0;
115  };
116 
117 
119 
120 
121 
122 }} // namespace steam::control
123 #endif /*CONTROL_COMMAND_CLOSURE_H*/
virtual void accept(CommandImplCloneBuilder &) const =0
assist with creating clone closure without disclosing concrete type
FunErasure< StoreFunction > CmdFunctor
A neutral container internally holding the functor used to implement the Command. ...
Implementation helper to bind Steam-Layer commands with arbitrary argument tuples.
Steam-Layer implementation namespace root.
virtual bool isCaptured() const =0
does this closure hold captured UNDO state?
virtual void invoke(CmdFunctor const &)=0
invoke functor using the stored parameter values
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.
Generic holder for functor objects, concealing the concrete function type.
virtual bool isValid() const =0
does this closure hold a valid argument tuple?
object-like record of data.
Definition: record.hpp:150
virtual void unbindArguments()=0
discard any parameters and return to unbound state
virtual void bindArguments(Arguments &)=0
store a set of parameter values within this closure