command-closure-design(#301): better naming of implementation classes
Seems this was part of the confusion when looking at the inheritance graph: Names where almost reversed to the meaning. the ArgumentHolder was *not* the argument holder, but the top level closure. And the class "Closure" was not "the" Closure, but just the argument holder. ;-)
This commit is contained in:
parent
dfc28ca2a0
commit
be2179ea81
14 changed files with 104 additions and 151 deletions
|
|
@ -29,9 +29,9 @@
|
|||
**
|
||||
** Most of the command machinery accesses this function closure through the generic
|
||||
** interface CmdClosure, while, when defining a command, subclasses typed to the specific
|
||||
** function arguments are created. Especially, there is an ArgumentHolder template,
|
||||
** which is used to define the storage for the concrete arguments. This ArgumentHolder
|
||||
** internally contains an Closure<SIG> instance (where SIG is the signature of the
|
||||
** function arguments are created. Especially, there is an StorageHolder template,
|
||||
** which is used to define the storage for the concrete arguments. This StorageHolder
|
||||
** internally contains an OpClosure<SIG> instance (where SIG is the signature of the
|
||||
** actual command operation function), which implements the invocation of the
|
||||
** operation function with the stored argument tuple.
|
||||
**
|
||||
|
|
@ -44,9 +44,9 @@
|
|||
** Later on, any command needs to be made ready for execution by binding it to a specific
|
||||
** execution environment, which especially includes the target objects to be mutated by the
|
||||
** command. Effectively, this means "closing" the Mutation (and UNDO) functor(s)) with the
|
||||
** actual function arguments. These arguments are stored embedded within an ArgumentHolder,
|
||||
** which thereby acts as closure. Besides, the ArgumentHolder also has to accommodate for
|
||||
** storage holding the captured UNDO state (memento). Internally the ArgumentHolder
|
||||
** actual function arguments. These arguments are stored embedded within an StorageHolder,
|
||||
** which thereby acts as closure. Besides, the StorageHolder also has to accommodate for
|
||||
** storage holding the captured UNDO state (memento). Internally the StorageHolder
|
||||
** has to keep track of the actual types, thus allowing to re-construct the concrete
|
||||
** function signature when closing the Mutation.
|
||||
**
|
||||
|
|
@ -222,7 +222,7 @@ namespace control {
|
|||
|
||||
|
||||
template<typename SIG>
|
||||
class Closure
|
||||
class OpClosure
|
||||
: public AbstractClosure
|
||||
{
|
||||
using Args = typename FunctionSignature< function<SIG> >::Args;
|
||||
|
|
@ -235,7 +235,7 @@ namespace control {
|
|||
public:
|
||||
typedef Tuple<Args> ArgTuple;
|
||||
|
||||
Closure (ArgTuple const& args)
|
||||
OpClosure (ArgTuple const& args)
|
||||
: params_(args)
|
||||
{ }
|
||||
|
||||
|
|
@ -243,7 +243,7 @@ namespace control {
|
|||
PClo
|
||||
createClone (TypedAllocationManager& storageManager)
|
||||
{
|
||||
return storageManager.create<Closure> (*this);
|
||||
return storageManager.create<OpClosure> (*this);
|
||||
}
|
||||
|
||||
/** assign a new parameter tuple to this */
|
||||
|
|
@ -285,10 +285,10 @@ namespace control {
|
|||
operator string() const override
|
||||
{
|
||||
std::ostringstream buff;
|
||||
params_.dump (buff << "Closure(" );
|
||||
params_.dump (buff << "OpClosure(" );
|
||||
|
||||
string dumped (buff.str());
|
||||
if (8 < dumped.length())
|
||||
if (10 < dumped.length())
|
||||
// remove trailing comma...
|
||||
return dumped.substr (0, dumped.length()-1) +")";
|
||||
else
|
||||
|
|
@ -299,13 +299,13 @@ namespace control {
|
|||
bool isValid () const override { return true; }
|
||||
|
||||
/// Supporting equality comparisons...
|
||||
friend bool operator== (Closure const& c1, Closure const& c2) { return compare (c1.params_, c2.params_); }
|
||||
friend bool operator!= (Closure const& c1, Closure const& c2) { return not (c1 == c2); }
|
||||
friend bool operator== (OpClosure const& c1, OpClosure const& c2) { return compare (c1.params_, c2.params_); }
|
||||
friend bool operator!= (OpClosure const& c1, OpClosure const& c2) { return not (c1 == c2); }
|
||||
|
||||
bool
|
||||
equals (CmdClosure const& other) const override
|
||||
{
|
||||
const Closure* toCompare = dynamic_cast<const Closure*> (&other);
|
||||
const OpClosure* toCompare = dynamic_cast<const OpClosure*> (&other);
|
||||
return (toCompare)
|
||||
&& (*this == *toCompare);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@
|
|||
**
|
||||
** @see CommandRegistry#createCloneImpl
|
||||
** @see CommandImpl
|
||||
** @see ArgumentHolder#createClone
|
||||
** @see StorageHolder#createClone
|
||||
** @see command-clone-builder-test.cpp
|
||||
**
|
||||
*/
|
||||
|
|
@ -145,7 +145,7 @@ namespace control {
|
|||
|
||||
|
||||
/** to be executed from within the specifically typed context
|
||||
* of a concrete command ArgumentHolder; allocate a clone copy
|
||||
* of a concrete command StorageHolder; allocate a clone copy
|
||||
* and then prepare a new UNDO-Functor, which is correctly wired
|
||||
* with the memento holder within this new \em clone closure.
|
||||
* After that point, these prepared parts can be retrieved
|
||||
|
|
@ -173,7 +173,7 @@ namespace control {
|
|||
}
|
||||
|
||||
|
||||
/** after visitation: provide cloned ArgumentHolder,
|
||||
/** after visitation: provide cloned StorageHolder,
|
||||
* but already stripped down to the generic usage type */
|
||||
PClo const&
|
||||
clonedClosuere ()
|
||||
|
|
|
|||
|
|
@ -1,59 +0,0 @@
|
|||
/*
|
||||
CommandImpl - Proc-Layer command implementation (top level)
|
||||
|
||||
Copyright (C) Lumiera.org
|
||||
2009, Hermann Vosseler <Ichthyostega@web.de>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
* *****************************************************/
|
||||
|
||||
|
||||
/** @file command-impl.cpp
|
||||
** //TODO
|
||||
**
|
||||
** @see command.hpp
|
||||
** @see command-registry.hpp
|
||||
**
|
||||
*/
|
||||
|
||||
|
||||
#include "proc/control/command-impl.hpp"
|
||||
#include "proc/control/command-argument-holder.hpp"
|
||||
//#include "proc/mobject/mobject-ref.hpp"
|
||||
//#include "proc/mobject/mobject.hpp"
|
||||
//#include "proc/mobject/placement.hpp"
|
||||
|
||||
//#include <boost/format.hpp>
|
||||
//using boost::str;
|
||||
|
||||
namespace proc {
|
||||
namespace control {
|
||||
|
||||
|
||||
|
||||
/** */
|
||||
CommandImpl::~CommandImpl() { }
|
||||
|
||||
|
||||
/////////////////////////////////////////TODO: is this impl file actually necessary??
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}} // namespace proc::control
|
||||
|
|
@ -51,7 +51,6 @@
|
|||
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <boost/operators.hpp>
|
||||
|
||||
#include <memory>
|
||||
#include <functional>
|
||||
|
||||
|
|
@ -71,6 +70,14 @@ namespace control {
|
|||
* - command operation functor
|
||||
* - a functor to UNDO the command effect
|
||||
* - closure holding actual parameters and UNDO state
|
||||
* @remarks the ctor is templated on the concrete type of operation arguments.
|
||||
* This information is erased (discarded) immediately after construction.
|
||||
* Usually, CommandImpl instances are created
|
||||
* [within the registry](\ref CommandRegistry::newCommandImpl()).
|
||||
* The implementation type of the closure is `StorageHolder<SIG_OPER,Mem>`
|
||||
* @see CmdClosure Closure interface
|
||||
* @see StorageHolder
|
||||
* @see Mutation
|
||||
*/
|
||||
class CommandImpl
|
||||
: public lib::BoolCheckable<CommandImpl
|
||||
|
|
@ -205,20 +212,20 @@ namespace control {
|
|||
isValid() const ///< validity self-check: is basically usable.
|
||||
{
|
||||
return bool(pClo_)
|
||||
&& HandlingPattern::get(defaultPatt_).isValid();
|
||||
and HandlingPattern::get(defaultPatt_).isValid();
|
||||
}
|
||||
|
||||
bool
|
||||
canExec() const ///< state check: sufficiently defined to be invoked
|
||||
{
|
||||
return isValid()
|
||||
&& pClo_->isValid();
|
||||
and pClo_->isValid();
|
||||
}
|
||||
|
||||
bool
|
||||
canUndo() const ///< state check: has undo state been captured?
|
||||
{
|
||||
return isValid() && pClo_->isCaptured();
|
||||
return isValid() and pClo_->isCaptured();
|
||||
}
|
||||
|
||||
operator string() const
|
||||
|
|
@ -236,11 +243,11 @@ namespace control {
|
|||
operator== (CommandImpl const& ci1, CommandImpl const& ci2)
|
||||
{
|
||||
return (ci1.do_ == ci2.do_)
|
||||
// && (ci1.undo_ == ci2.undo_) // causes failure regularly, due to the missing equality on boost::function. See Ticket #294
|
||||
&& (ci1.defaultPatt_ == ci2.defaultPatt_)
|
||||
&& (ci1.canExec() == ci2.canExec())
|
||||
&& (ci1.canUndo() == ci2.canUndo())
|
||||
&& (ci1.pClo_->equals(*ci2.pClo_))
|
||||
// and (ci1.undo_ == ci2.undo_) // causes failure regularly, due to the missing equality on boost::function. See Ticket #294
|
||||
and (ci1.defaultPatt_ == ci2.defaultPatt_)
|
||||
and (ci1.canExec() == ci2.canExec())
|
||||
and (ci1.canUndo() == ci2.canUndo())
|
||||
and (ci1.pClo_->equals(*ci2.pClo_))
|
||||
;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@
|
|||
** through the CommandRegistry.
|
||||
**
|
||||
** Later on, client code is assumed to re-access the command by ID. It may bind arguments, which are
|
||||
** stored in the already allocated ArgumentHolder. (-->Ticket #269). As the Command frontend is a
|
||||
** stored in the already allocated StorageHolder. (-->Ticket #269). As the Command frontend is a
|
||||
** smart-ptr, commands may be copied, stored away and passed on. When finally the ref-count of
|
||||
** a given definition goes to zero, de-allocation happens automatically. This can't happen for
|
||||
** a registered command definition though, as a Command instance is stored within the index
|
||||
|
|
@ -65,7 +65,7 @@
|
|||
|
||||
#include "proc/control/command.hpp"
|
||||
#include "proc/control/command-signature.hpp"
|
||||
#include "proc/control/command-argument-holder.hpp"
|
||||
#include "proc/control/command-storage-holder.hpp"
|
||||
#include "lib/typed-allocation-manager.hpp"
|
||||
|
||||
#include <boost/functional/hash.hpp>
|
||||
|
|
@ -238,7 +238,7 @@ namespace control {
|
|||
// derive the storage type necessary
|
||||
// to hold the command arguments and UNDO memento
|
||||
typedef typename UndoSignature<SIG_CAPT>::Memento Mem;
|
||||
typedef ArgumentHolder<SIG_OPER,Mem> Arguments;
|
||||
typedef StorageHolder<SIG_OPER,Mem> Arguments;
|
||||
|
||||
shared_ptr<Arguments> pArg (allocator_.create<Arguments>());
|
||||
|
||||
|
|
@ -250,10 +250,10 @@ namespace control {
|
|||
|
||||
/** create an allocation for holding a clone of the given CommandImpl data.
|
||||
* This is a tricky operation, as the CommandImpl after construction erases the
|
||||
* specific type information pertaining the ArgumentHolder. But this specific
|
||||
* specific type information pertaining the StorageHolder. But this specific
|
||||
* type information is vital for determining the exact allocation size for
|
||||
* the clone ArgumentHolder. The only solution is to delegate the cloning
|
||||
* of the arguments down into the ArgumentHolder, passing a reference
|
||||
* the clone StorageHolder. The only solution is to delegate the cloning
|
||||
* of the arguments down into the StorageHolder, passing a reference
|
||||
* to the memory manager for allocating the clone. Actually, we perform
|
||||
* this operation through the help of a visitor, which re-gains the
|
||||
* complete type context and prepares the necessary clone objects;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
COMMAND-ARGUMENT-HOLDER.hpp - specifically typed container for storage of command arguments
|
||||
COMMAND-STORAGE-HOLDER.hpp - specifically typed container for storage of command arguments
|
||||
|
||||
Copyright (C) Lumiera.org
|
||||
2009, Hermann Vosseler <Ichthyostega@web.de>
|
||||
|
|
@ -21,8 +21,10 @@
|
|||
*/
|
||||
|
||||
|
||||
/** @file command-argument-holder.hpp
|
||||
/** @file command-storage-holder.hpp
|
||||
** A passive container record holding the actual command arguments & UNDO state.
|
||||
** Effectively, this is the top level CmdClosure Implementation, which in turn
|
||||
** delegates to sub-closures for the operation arguments and for UNDO management.
|
||||
** While all command objects themselves have a common type (type erasure),
|
||||
** the actual argument tuple and the state memento for UNDO can't. Especially,
|
||||
** the size of arguments and memento will depend on their respective types.
|
||||
|
|
@ -39,8 +41,8 @@
|
|||
|
||||
|
||||
|
||||
#ifndef CONTROL_COMMAND_ARGUMENT_HOLDER_H
|
||||
#define CONTROL_COMMAND_ARGUMENT_HOLDER_H
|
||||
#ifndef CONTROL_COMMAND_STORAGE_HOLDER_H
|
||||
#define CONTROL_COMMAND_STORAGE_HOLDER_H
|
||||
|
||||
#include "lib/typed-allocation-manager.hpp"
|
||||
#include "proc/control/command-closure.hpp"
|
||||
|
|
@ -59,16 +61,16 @@ namespace control {
|
|||
using std::string;
|
||||
|
||||
|
||||
namespace { // empty state marker objects for ArgumentHolder
|
||||
namespace { // empty state marker objects for StorageHolder
|
||||
|
||||
template<typename SIG>
|
||||
struct MissingArguments
|
||||
: Closure<SIG>
|
||||
: OpClosure<SIG>
|
||||
{
|
||||
typedef typename Closure<SIG>::ArgTuple ArgTuple;
|
||||
typedef typename OpClosure<SIG>::ArgTuple ArgTuple;
|
||||
|
||||
MissingArguments ()
|
||||
: Closure<SIG> (ArgTuple ())
|
||||
: OpClosure<SIG> (ArgTuple ())
|
||||
{ }
|
||||
|
||||
private:
|
||||
|
|
@ -94,24 +96,25 @@ namespace control {
|
|||
|
||||
|
||||
/**
|
||||
* Specifically typed CmdClosure, which serves for
|
||||
* This is "the" top level CmdClosure implementation.
|
||||
* It is a specifically typed CmdClosure, which serves for
|
||||
* actually allocating storage to hold the command arguments
|
||||
* and the UNDO state (memento) for Proc-Layer commands.
|
||||
* Both the contained components within ArgumentHolder
|
||||
* Both the contained components within StorageHolder
|
||||
* can be in \em empty state; there are no distinct
|
||||
* lifecycle limitations. ArgumentHolder is part
|
||||
* lifecycle limitations. StorageHolder is part
|
||||
* of Proc-Layer command's implementation
|
||||
* and should not be used standalone.
|
||||
*/
|
||||
template<typename SIG, typename MEM>
|
||||
class ArgumentHolder
|
||||
class StorageHolder
|
||||
: public AbstractClosure
|
||||
{
|
||||
/** copy construction allowed(but no assignment)*/
|
||||
ArgumentHolder& operator= (ArgumentHolder const&);
|
||||
StorageHolder& operator= (StorageHolder const&);
|
||||
|
||||
|
||||
using ArgHolder = Closure<SIG>;
|
||||
using ArgHolder = OpClosure<SIG>;
|
||||
using MemHolder = MementoTie<SIG,MEM>;
|
||||
|
||||
using ArgumentBuff = InPlaceBuffer<ArgHolder, sizeof(ArgHolder), MissingArguments<SIG>>;
|
||||
|
|
@ -193,18 +196,18 @@ namespace control {
|
|||
|
||||
|
||||
|
||||
/** per default, all data within ArgumentHolder
|
||||
/** per default, all data within StorageHolder
|
||||
* is set up in \em empty state. Later on, the
|
||||
* command arguments are to be provided by #bind ,
|
||||
* whereas the undo functions will be wired by #tie
|
||||
*/
|
||||
ArgumentHolder ()
|
||||
StorageHolder ()
|
||||
: arguments_()
|
||||
, memento_()
|
||||
{ }
|
||||
|
||||
/** copy construction allowed(but no assignment) */
|
||||
ArgumentHolder (ArgumentHolder const& oAh)
|
||||
StorageHolder (StorageHolder const& oAh)
|
||||
: arguments_()
|
||||
, memento_()
|
||||
{
|
||||
|
|
@ -229,7 +232,7 @@ namespace control {
|
|||
bool empty () const { return !arguments_->isValid(); }
|
||||
|
||||
|
||||
/** store a new argument tuple within this ArgumentHolder,
|
||||
/** store a new argument tuple within this StorageHolder,
|
||||
* discarding any previously stored arguments */
|
||||
void
|
||||
storeTuple (ArgTuple const& argTup)
|
||||
|
|
@ -274,14 +277,14 @@ namespace control {
|
|||
bool
|
||||
equals (CmdClosure const& other) const
|
||||
{
|
||||
const ArgumentHolder* toCompare = dynamic_cast<const ArgumentHolder*> (&other);
|
||||
const StorageHolder* toCompare = dynamic_cast<const StorageHolder*> (&other);
|
||||
return (toCompare)
|
||||
&& (*this == *toCompare);
|
||||
}
|
||||
|
||||
/// Supporting equality comparisons...
|
||||
friend bool
|
||||
operator== (ArgumentHolder const& a1, ArgumentHolder const& a2)
|
||||
operator== (StorageHolder const& a1, StorageHolder const& a2)
|
||||
{
|
||||
return (a1.arguments_->isValid() == a2.arguments_->isValid())
|
||||
&& (*a1.arguments_ == *a2.arguments_)
|
||||
|
|
@ -291,7 +294,7 @@ namespace control {
|
|||
}
|
||||
|
||||
friend bool
|
||||
operator!= (ArgumentHolder const& a1, ArgumentHolder const& a2)
|
||||
operator!= (StorageHolder const& a1, StorageHolder const& a2)
|
||||
{
|
||||
return not (a1 == a2);
|
||||
}
|
||||
|
|
@ -300,4 +303,4 @@ namespace control {
|
|||
|
||||
|
||||
}} // namespace proc::control
|
||||
#endif
|
||||
#endif /*CONTROL_COMMAND_STORAGE_HOLDER_H*/
|
||||
|
|
@ -109,6 +109,8 @@ namespace control {
|
|||
|
||||
|
||||
Command::~Command() { }
|
||||
CommandImpl::~CommandImpl() { }
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -206,7 +208,7 @@ namespace control {
|
|||
|
||||
/** @note this bit of implementation from CommandRegistry rather
|
||||
* heavily relies on implementation details from CommandImpl and
|
||||
* the help of CommandImplCloneBuilder and ArgumentHolder. It's
|
||||
* the help of CommandImplCloneBuilder and StorageHolder. It's
|
||||
* implemented within command.cpp to keep the includes of
|
||||
* the handling patterns clean. */
|
||||
shared_ptr<CommandImpl>
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ namespace control {
|
|||
* Binding together state capturing and execution of the undo operation.
|
||||
* MementoTie itself is a passive container object with a very specific type,
|
||||
* depending on the type of the operation arguments and the type of the memento.
|
||||
* It is to be allocated within the ArgumentHolder of the command, thereby wrapping
|
||||
* It is to be allocated within the StorageHolder of the command, thereby wrapping
|
||||
* the undo and capture function, setting up the necessary bindings and closures for
|
||||
* allowing them to cooperate behind the scenes to carry out the UNDO functionality.
|
||||
* On construction, the UndoMutation functor retrieves the wired up functions,
|
||||
|
|
|
|||
|
|
@ -11,26 +11,26 @@ END
|
|||
TEST "Argument & Memento handling" CommandArgument_test <<END
|
||||
out: Command-State. arguments=unbound, ·noUNDO·.
|
||||
out: capture state...
|
||||
out: Command-State. arguments=Closure\(\), ·noUNDO·.
|
||||
out: Command-State. arguments=Closure\(.\), ·noUNDO·.
|
||||
out: Command-State. arguments=Closure\(.,.+s.*\), ·noUNDO·.
|
||||
out: Command-State. arguments=Closure\(.+s.*,glorious,..\), <mem: destruction>.
|
||||
out: would be serialised.....Command-State. arguments=Closure\(\), ·noUNDO·.
|
||||
out: would be serialised.....Command-State. arguments=Closure\(.\), ·noUNDO·.
|
||||
out: would be serialised.....Command-State. arguments=Closure\(.,.+s.*\), ·noUNDO·.
|
||||
out: would be serialised.....Command-State. arguments=Closure\(.+s.*,glorious,..\), <mem: destruction>.
|
||||
out: sizeof\( control::ArgumentHolder<void \(Tracker<TimeVar>, Tracker<string>, int\), Tracker<string> > \) = [0-9]{2,3}
|
||||
out: Command-State. arguments=Closure\(.+s.*,Lumiera rocks,..\), ·noUNDO·.
|
||||
out: Command-State. arguments=OpClosure\(\), ·noUNDO·.
|
||||
out: Command-State. arguments=OpClosure\(.\), ·noUNDO·.
|
||||
out: Command-State. arguments=OpClosure\(.,.+s.*\), ·noUNDO·.
|
||||
out: Command-State. arguments=OpClosure\(.+s.*,glorious,..\), <mem: destruction>.
|
||||
out: would be serialised.....Command-State. arguments=OpClosure\(\), ·noUNDO·.
|
||||
out: would be serialised.....Command-State. arguments=OpClosure\(.\), ·noUNDO·.
|
||||
out: would be serialised.....Command-State. arguments=OpClosure\(.,.+s.*\), ·noUNDO·.
|
||||
out: would be serialised.....Command-State. arguments=OpClosure\(.+s.*,glorious,..\), <mem: destruction>.
|
||||
out: sizeof\( control::StorageHolder<void \(Tracker<TimeVar>, Tracker<string>, int\), Tracker<string> > \) = [0-9]{2,3}
|
||||
out: Command-State. arguments=OpClosure\(.+s.*,Lumiera rocks,..\), ·noUNDO·.
|
||||
out: capture state...
|
||||
out: captured state: START...Lumiera rocks
|
||||
out: Command-State. arguments=Closure\(.+s.*,Lumiera rocks,..\), <mem: START...Lumiera rocks>.
|
||||
out: Command-State. arguments=OpClosure\(.+s.*,Lumiera rocks,..\), <mem: START...Lumiera rocks>.
|
||||
out: invoke operation...
|
||||
out: START...doIt\( Time=.+s.* "Lumiera rocks" rand=.. \)
|
||||
out: undo... memento=START...Lumiera rocks
|
||||
out: START...doIt\( Time=.+s.* "Lumiera rocks" rand=.. \)undoIt\(time=.+s\)----memento-:START...Lumiera rocks
|
||||
out: capture state...
|
||||
out: modified: Command-State. arguments=Closure\(123ms,unbelievable,..\), <mem: START...doIt\( Time=.+s.* "Lumiera rocks" rand=.. \)undoIt\(time=.+s\)----memento-:START...Lumiera rocksLumiera rocks>.
|
||||
out: copied : Command-State. arguments=Closure\(.+s.*,Lumiera rocks,..\), <mem: START...Lumiera rocks>.
|
||||
out: modified: Command-State. arguments=OpClosure\(123ms,unbelievable,..\), <mem: START...doIt\( Time=.+s.* "Lumiera rocks" rand=.. \)undoIt\(time=.+s\)----memento-:START...Lumiera rocksLumiera rocks>.
|
||||
out: copied : Command-State. arguments=OpClosure\(.+s.*,Lumiera rocks,..\), <mem: START...Lumiera rocks>.
|
||||
out: undo... memento=START...doIt\( Time=.+s.* "Lumiera rocks" rand=.. \)undoIt\(time=.+s\)----memento-:START...Lumiera rocksLumiera rocks
|
||||
out: RESET...undoIt\(time=.+s\)----memento-:START...doIt\( Time=.+s.* "Lumiera rocks" rand=.. \)undoIt\(time=.+s\)----memento-:START...Lumiera rocksLumiera rocks
|
||||
return: 0
|
||||
|
|
@ -46,8 +46,8 @@ END
|
|||
|
||||
|
||||
TEST "Command functor and UNDO functor" CommandMutation_test <<END
|
||||
out: empty placeholder closure: Closure\(0\)
|
||||
out: param values: Closure\(23\)
|
||||
out: empty placeholder closure: OpClosure\(0\)
|
||||
out: param values: OpClosure\(23\)
|
||||
out: saved state: 11
|
||||
return: 0
|
||||
END
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ namespace test {
|
|||
* @test Build a test object, which accepts a bind(...) call
|
||||
* with specifically typed arguments.
|
||||
*
|
||||
* @see control::CommandArgumentHolder
|
||||
* @see control::CommandStorageHolder
|
||||
*/
|
||||
class ArgumentTupleAccept_test : public Test
|
||||
{
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
#include "lib/test/run.hpp"
|
||||
#include "lib/test/test-helper.hpp"
|
||||
#include "proc/control/command-argument-holder.hpp"
|
||||
#include "proc/control/command-storage-holder.hpp"
|
||||
#include "lib/scoped-ptrvect.hpp"
|
||||
#include "lib/format-string.hpp"
|
||||
#include "lib/format-cout.hpp"
|
||||
|
|
@ -181,7 +181,7 @@ namespace test {
|
|||
/***********************************************************************//**
|
||||
* @test Check storage handling of the command parameters and state memento.
|
||||
*
|
||||
* @see control::CommandArgumentHolder
|
||||
* @see control::CommandStorageHolder
|
||||
* @see command-basic-test.hpp
|
||||
*/
|
||||
class CommandArgument_test : public Test
|
||||
|
|
@ -217,12 +217,12 @@ namespace test {
|
|||
void
|
||||
createTuples (ArgTuples& tup)
|
||||
{
|
||||
typedef ArgumentHolder<void(), bool> A1;
|
||||
typedef ArgumentHolder<void(int), void*> A2;
|
||||
typedef ArgumentHolder<void(int,TimeVar), int> A3;
|
||||
typedef ArgumentHolder<void(int,TimeVar), Sint5> A4;
|
||||
typedef StorageHolder<void(), bool> A1;
|
||||
typedef StorageHolder<void(int), void*> A2;
|
||||
typedef StorageHolder<void(int,TimeVar), int> A3;
|
||||
typedef StorageHolder<void(int,TimeVar), Sint5> A4;
|
||||
|
||||
typedef ArgumentHolder<void(TTime,Tstr,int), Tstr> A5;
|
||||
typedef StorageHolder<void(TTime,Tstr,int), Tstr> A5;
|
||||
|
||||
|
||||
A1* arg1 = new A1(); tup.manage (arg1);
|
||||
|
|
@ -277,7 +277,7 @@ namespace test {
|
|||
void
|
||||
checkArgumentComparison ()
|
||||
{
|
||||
ArgumentHolder<void(int,int), int> one, two;
|
||||
StorageHolder<void(int,int), int> one, two;
|
||||
CHECK (one == two); // empty, identically typed argument holders -->equal
|
||||
|
||||
one.tie(dummyU,dummyC)
|
||||
|
|
@ -324,8 +324,8 @@ namespace test {
|
|||
simulateCmdLifecycle()
|
||||
{
|
||||
typedef void SIG_do(Tracker<TimeVar>, Tracker<string>, int);
|
||||
typedef ArgumentHolder<SIG_do, Tracker<string> > Args;
|
||||
typedef MementoTie<SIG_do, Tracker<string> > MemHolder;
|
||||
using Args = StorageHolder<SIG_do, Tracker<string>>;
|
||||
using MemHolder = MementoTie<SIG_do, Tracker<string>>;
|
||||
|
||||
Args args;
|
||||
CHECK (isnil (args));
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ namespace test {
|
|||
* This includes verifying sane allocation management.
|
||||
* @note this test covers a very specific low-level perspective, but on an
|
||||
* integration level, involving TypedAllocationManager, CommandRegistry,
|
||||
* CommandImpl, CmdClosure, ArgumentHolder, UndoMutation, MementoTie.
|
||||
* CommandImpl, CmdClosure, StorageHolder, UndoMutation, MementoTie.
|
||||
* Closes: Ticket #298
|
||||
*
|
||||
* @see Command
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
#include "proc/control/command-def.hpp"
|
||||
#include "proc/control/command-mutation.hpp"
|
||||
#include "proc/control/argument-erasure.hpp"
|
||||
#include "proc/control/command-argument-holder.hpp"
|
||||
#include "proc/control/command-storage-holder.hpp"
|
||||
#include "proc/control/memento-tie.hpp"
|
||||
#include "lib/meta/tuple-helper.hpp"
|
||||
#include "lib/format-cout.hpp"
|
||||
|
|
@ -84,7 +84,7 @@ namespace test {
|
|||
typedef function<Sig_undo> Fun_u;
|
||||
|
||||
using ArgTuple = Tuple<Types<char>>;
|
||||
using ArgHolder = Closure<Sig_oper>;
|
||||
using ArgHolder = OpClosure<Sig_oper>;
|
||||
using MemHolder = MementoTie<Sig_oper, string>;
|
||||
}
|
||||
|
||||
|
|
@ -181,9 +181,9 @@ namespace test {
|
|||
CHECK (a1 == a2);
|
||||
CHECK (a2 == a1);
|
||||
|
||||
typedef ArgumentHolder<Sig_oper,string> AHImpl;
|
||||
AHImpl abuff1;
|
||||
AHImpl abuff2;
|
||||
typedef StorageHolder<Sig_oper,string> Storage;
|
||||
Storage abuff1;
|
||||
Storage abuff2;
|
||||
CHECK (abuff1 == abuff2);
|
||||
abuff1.bindArguments(newArgs);
|
||||
CHECK (abuff1 != abuff2);
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
#include "lib/test/run.hpp"
|
||||
#include "lib/test/test-helper.hpp"
|
||||
#include "proc/control/command-mutation.hpp"
|
||||
#include "proc/control/command-argument-holder.hpp"
|
||||
#include "proc/control/command-storage-holder.hpp"
|
||||
#include "proc/control/memento-tie.hpp"
|
||||
#include "lib/meta/tuple-helper.hpp"
|
||||
#include "lib/meta/typelist.hpp"
|
||||
|
|
@ -110,7 +110,7 @@ hich is bound to our \c testFunc(int) .
|
|||
|
||||
// now create a real closure....
|
||||
Tuple<Types<int> > param = std::make_tuple (23);
|
||||
Closure<void(int)> close_over (param);
|
||||
OpClosure<void(int)> close_over (param);
|
||||
|
||||
CmdClosure& closure (close_over);
|
||||
CHECK (closure);
|
||||
|
|
@ -138,7 +138,7 @@ hich is bound to our \c testFunc(int) .
|
|||
* @note Mutation and UndoMutation are value objects, but they refer
|
||||
* to a common command state, which for this test is modelled
|
||||
* by local variables and which for the real commands is
|
||||
* contained in a CommandArgumentHolder
|
||||
* contained in a Command-StorageHolder
|
||||
*/
|
||||
void
|
||||
checkUndoMutation ()
|
||||
|
|
@ -157,7 +157,7 @@ hich is bound to our \c testFunc(int) .
|
|||
VERIFY_ERROR (UNBOUND_ARGUMENTS, undoFunctor.captureState(nullClosure) );
|
||||
|
||||
Tuple<Types<> > param;
|
||||
Closure<void()> clo (param);
|
||||
OpClosure<void()> clo (param);
|
||||
|
||||
CHECK (!mementoHolder);
|
||||
VERIFY_ERROR (MISSING_MEMENTO, undoFunctor (clo) );
|
||||
|
|
|
|||
Loading…
Reference in a new issue