51 HandlingPattern::ID TEST_HANDLING_PATTERN = HandlingPattern::DUMMY;
82 uint cnt_inst = registry.instance_count();
85 PCmdImpl source = buildTestImplFrame (registry);
88 verifySeparation (source, clone);
91 CHECK (cnt_inst == registry.instance_count());
100 typedef void Sig_oper(
int);
101 typedef long Sig_capt(
int);
102 typedef void Sig_undo(
int,
long);
104 function<Sig_oper> o_Fun (command1::operate);
105 function<Sig_capt> c_Fun (command1::capture);
106 function<Sig_undo> u_Fun (command1::undoIt);
108 CHECK (o_Fun && c_Fun && u_Fun);
112 bindRandArgument (*cmd);
113 CHECK (cmd->canExec());
124 cmd.setArguments (arg);
137 CHECK (orig && copy);
138 CHECK (orig->canExec());
139 CHECK (copy->canExec());
144 command1::check_ = 0;
146 bindRandArgument (*orig);
147 CHECK ( orig->canExec());
148 CHECK (!orig->canUndo());
149 testExec.exec (*orig,
"Execute original");
150 long state_after_exec1 = command1::check_;
151 CHECK (command1::check_ > 0);
152 CHECK (orig->canUndo());
154 CHECK (!copy->canUndo());
155 testExec.exec (*copy,
"Execute clone");
156 CHECK (command1::check_ != state_after_exec1);
157 CHECK (copy->canUndo());
160 testExec.undo (*copy,
"Undo clone");
161 CHECK (command1::check_ == state_after_exec1);
164 testExec.undo (*orig,
"Undo original");
165 CHECK (command1::check_ ==0);
Implementation helper to bind Steam-Layer commands with arbitrary argument tuples.
shared_ptr< CommandImpl > newCommandImpl(function< SIG_OPER > &operFunctor, function< SIG_CAPT > &captFunctor, function< SIG_UNDO > &undoFunctor)
set up a new command implementation frame
bool canExec() const
< state check: sufficiently defined to be invoked
Top level of the command implementation.
Managing command definitions and the storage of individual command objects.
Customised refcounting smart pointer.
Registry managing command implementation objects (Singleton).
Steam-Layer implementation namespace root.
Metaprogramming with tuples-of-types and the std::tuple record.
Marker types to indicate a literal string and a Symbol.
Simple test class runner.
void verifySeparation(PCmdImpl orig, PCmdImpl copy)
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...
void bindRandArgument(CommandImpl &cmd)
Helper: create random command parameter binding.
Pre-defined command execution skeletons.
Some dummy command functions used for building unit test cases.
shared_ptr< CommandImpl > createCloneImpl(CommandImpl const &refObject)
create an allocation for holding a clone of the given CommandImpl data.
Steam-Layer Command implementation.
Customised refcounting smart pointer template, built upon std::shared_ptr, but forwarding type relati...
static HandlingPattern const & get(ID id)
retrieve the pre-configured pattern
Interface: Operation Skeleton how to invoke or undo a command.
static lib::Depend< CommandRegistry > instance
storage for the singleton factory used to access CommandRegistry