59 using std::make_tuple;
67 Symbol COMMAND1 (
"test.equalityCommand1");
68 Symbol COMMAND2 (
"test.equalityCommand2");
70 const string MARK_1 (
"|_1_");
71 const string MARK_2 (
"|_2_");
73 void oper_1 (
char par) { check_ += MARK_1 + par; }
74 void oper_2 (
char par) { check_ += MARK_2 + par; }
76 string capt_1 (
char par) {
return check_ + MARK_1 +
"|"+par+
"|"; }
77 string capt_2 (
char par) {
return check_ + MARK_2 +
"|"+par+
"|"; }
79 void undo_1 (
char par,
string mem) { check_ = mem + MARK_1 + par +
"|";}
80 void undo_2 (
char par,
string mem) { check_ = mem + MARK_2 + par +
"|";}
83 typedef void Sig_oper(
char);
84 typedef string Sig_capt(
char);
85 typedef void Sig_undo(
char,
string);
87 typedef function<Sig_oper> Fun_o;
88 typedef function<Sig_capt> Fun_c;
89 typedef function<Sig_undo> Fun_u;
117 CHECK (&oper_1 != &oper_2);
118 CHECK (&capt_1 != &capt_2);
119 CHECK (&undo_1 != &undo_2);
123 .captureUndo (capt_1)
124 .undoOperation (undo_1)
128 .captureUndo (capt_2)
129 .undoOperation (undo_2)
141 CHECK (!isSameObject (c1, c2));
144 string protocol1 = execCommand(c1);
145 string protocolX = execCommand(cx);
146 string protocol2 = execCommand(c2);
148 CHECK (protocol1 == protocolX);
149 CHECK (protocol1 != protocol2);
162 cout << com <<
":" << check_ << endl;
164 cout << com <<
":" << check_ << endl;
Helper class used solely for defining a Command-Object.
typename BuildTupleType< TYPES >::Type Tuple
Build a std::tuple from types given as type sequence.
Core of a Steam-Layer command: functor containing the operation to be executed.
Implementation helper to bind Steam-Layer commands with arbitrary argument tuples.
Proof-of-concept implementation of CmdClosure.
static Command get(Symbol cmdID)
Access existing command for use.
Steam-Layer implementation namespace root.
closure to deal with the actual command operation.
Metaprogramming with tuples-of-types and the std::tuple record.
A special binding used by Steam-Layer commands for capturing UNDO state information.
Token or Atom with distinct identity.
Marker types to indicate a literal string and a Symbol.
Simple test class runner.
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...
string execCommand(Command com)
Helper: invoke and undo a command,.
Dummy / proof-of-concept implementation of CmdClosure.
A collection of frequently used helper functions to support unit testing.
Handle object representing a single Command instance to be used by client code.
RET bind()
Accept dummy binding (0 Arg)
Actually defining a command and binding it to execution parameters.
Binding together state capturing and execution of the undo operation.
bool isSameObject(A const &a, B const &b)
compare plain object identity, bypassing any custom comparison operators.
A passive container record holding the actual command arguments & UNDO state.