43 Symbol TEST_CMD =
"test.command1.1";
44 Symbol TEST_CMD2 =
"test.command1.2";
74 cnt_defs = registry.index_size();
75 cnt_inst = registry.instance_count();
79 .operation (command1::operate)
80 .captureUndo (command1::capture)
81 .undoOperation (command1::undoIt)
86 CHECK (++cnt_inst == registry.instance_count());
87 CHECK (++cnt_defs == registry.index_size());
92 CHECK (cnt_inst == registry.instance_count());
93 CHECK (cnt_defs == registry.index_size());
95 Command::remove (TEST_CMD);
96 CHECK (--cnt_inst == registry.instance_count());
107 CHECK (cnt_inst == registry.instance_count());
114 CHECK (!nonexistant);
118 CHECK (cmd2 != cmd1);
120 CHECK (cm2x != cmd1);
121 CHECK (cm2x == cmd2);
124 CHECK (1+cnt_inst == registry.instance_count());
125 CHECK (1+cnt_defs == registry.index_size());
130 CHECK (cmdX == cmd2);
131 CHECK (cmdX != cmd1);
133 CHECK (registry.
remove(TEST_CMD2));
135 CHECK (cnt_defs == registry.index_size());
136 CHECK (1+cnt_inst == registry.instance_count());
138 CHECK (cmdX.isAnonymous());
140 CHECK (!cmd1.isAnonymous());
143 registry.
track(TEST_CMD2, cmd2);
145 CHECK (1+cnt_defs == registry.index_size());
146 CHECK (cmdX == cmd2);
147 CHECK (cmdX != cmd1);
153 CHECK ( registry.
remove(TEST_CMD2));
154 CHECK (!registry.
remove(
"miraculous"));
158 CHECK (cnt_defs == registry.index_size());
160 CHECK (1+cnt_inst == registry.instance_count());
162 CHECK (1+cnt_inst == registry.instance_count());
165 CHECK (0+cnt_inst == registry.instance_count());
179 typedef void Sig_oper(
int);
180 typedef long Sig_capt(
int);
181 typedef void Sig_undo(
int,
long);
183 function<Sig_oper> o_Fun (command1::operate);
184 function<Sig_capt> c_Fun (command1::capture);
185 function<Sig_undo> u_Fun (command1::undoIt);
187 CHECK (o_Fun && c_Fun && u_Fun);
188 CHECK (cnt_inst == registry.instance_count());
196 CHECK (1+cnt_inst == registry.instance_count());
199 CHECK (pImpl->isValid());
200 CHECK (!pImpl->canExec());
201 CHECK (1 == pImpl.use_count());
204 CHECK (clone->isValid());
205 CHECK (!clone->canExec());
206 CHECK (1 == clone.use_count());
207 CHECK (1 == pImpl.use_count());
208 CHECK (2+cnt_inst == registry.instance_count());
210 CHECK (!isSameObject (*pImpl, *clone));
212 CHECK (!pImpl->canExec());
215 pImpl->setArguments(arg);
216 CHECK (pImpl->canExec());
218 CHECK (!clone->canExec());
222 CHECK (2+cnt_inst == registry.instance_count());
223 CHECK (clone->canExec());
228 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.
Simplistic 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, based directly on the referee's memory identities. ...