52 Symbol TEST_CMD =
"test.command1.1";
53 Symbol TEST_CMD2 =
"test.command1.2";
83 cnt_defs = registry.index_size();
84 cnt_inst = registry.instance_count();
88 .operation (command1::operate)
89 .captureUndo (command1::capture)
90 .undoOperation (command1::undoIt)
95 CHECK (++cnt_inst == registry.instance_count());
96 CHECK (++cnt_defs == registry.index_size());
101 CHECK (cnt_inst == registry.instance_count());
102 CHECK (cnt_defs == registry.index_size());
104 Command::remove (TEST_CMD);
105 CHECK (--cnt_inst == registry.instance_count());
116 CHECK (cnt_inst == registry.instance_count());
123 CHECK (!nonexistant);
127 CHECK (cmd2 != cmd1);
129 CHECK (cm2x != cmd1);
130 CHECK (cm2x == cmd2);
133 CHECK (1+cnt_inst == registry.instance_count());
134 CHECK (1+cnt_defs == registry.index_size());
139 CHECK (cmdX == cmd2);
140 CHECK (cmdX != cmd1);
142 CHECK (registry.
remove(TEST_CMD2));
144 CHECK (cnt_defs == registry.index_size());
145 CHECK (1+cnt_inst == registry.instance_count());
147 CHECK (cmdX.isAnonymous());
149 CHECK (!cmd1.isAnonymous());
152 registry.
track(TEST_CMD2, cmd2);
154 CHECK (1+cnt_defs == registry.index_size());
155 CHECK (cmdX == cmd2);
156 CHECK (cmdX != cmd1);
162 CHECK ( registry.
remove(TEST_CMD2));
163 CHECK (!registry.
remove(
"miraculous"));
167 CHECK (cnt_defs == registry.index_size());
169 CHECK (1+cnt_inst == registry.instance_count());
171 CHECK (1+cnt_inst == registry.instance_count());
174 CHECK (0+cnt_inst == registry.instance_count());
188 typedef void Sig_oper(
int);
189 typedef long Sig_capt(
int);
190 typedef void Sig_undo(
int,
long);
192 function<Sig_oper> o_Fun (command1::operate);
193 function<Sig_capt> c_Fun (command1::capture);
194 function<Sig_undo> u_Fun (command1::undoIt);
196 CHECK (o_Fun && c_Fun && u_Fun);
197 CHECK (cnt_inst == registry.instance_count());
205 CHECK (1+cnt_inst == registry.instance_count());
208 CHECK (pImpl->isValid());
209 CHECK (!pImpl->canExec());
210 CHECK (1 == pImpl.use_count());
213 CHECK (clone->isValid());
214 CHECK (!clone->canExec());
215 CHECK (1 == clone.use_count());
216 CHECK (1 == pImpl.use_count());
217 CHECK (2+cnt_inst == registry.instance_count());
219 CHECK (!isSameObject (*pImpl, *clone));
221 CHECK (!pImpl->canExec());
224 pImpl->setArguments(arg);
225 CHECK (pImpl->canExec());
227 CHECK (!clone->canExec());
231 CHECK (2+cnt_inst == registry.instance_count());
232 CHECK (clone->canExec());
237 CHECK (cnt_inst == registry.instance_count());
Helper class used solely for defining a Command-Object.
typename BuildTupleType< TYPES >::Type Tuple
Build a std::tuple from types given as type sequence.
bool remove(Symbol cmdID)
remove the given command registration.
shared_ptr< CommandImpl > newCommandImpl(function< SIG_OPER > &operFunctor, function< SIG_CAPT > &captFunctor, function< SIG_UNDO > &undoFunctor)
set up a new command implementation frame
void checkAllocation(CommandRegistry ®istry)
Managing command definitions and the storage of individual command objects.
Command storeDef(Symbol newCmdID) const
create a clone definition
Registry managing command implementation objects (Singleton).
Steam-Layer implementation namespace root.
Symbol findDefinition(Command const &cmdInstance) const
search the command index for a definition
Token or Atom with distinct identity.
Command queryIndex(Symbol cmdID)
query the command index by ID
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...
A collection of frequently used helper functions to support unit testing.
void close()
deactivate this handle, so it isn't tied any longer to the associated implementation or service objec...
void checkRegistration(CommandRegistry ®istry)
Some dummy command functions used for building unit test cases.
Handle object representing a single Command instance to be used by client code.
shared_ptr< CommandImpl > createCloneImpl(CommandImpl const &refObject)
create an allocation for holding a clone of the given CommandImpl data.
RET bind()
Accept dummy binding (0 Arg)
void track(Symbol cmdID, Command const &commandHandle)
register a command (Frontend) under the given ID.
Actually defining a command and binding it to execution parameters.
static lib::Depend< CommandRegistry > instance
storage for the singleton factory used to access CommandRegistry
bool isSameObject(A const &a, B const &b)
compare plain object identity, bypassing any custom comparison operators.