handling patterns usable for now. Close #275

This commit is contained in:
Fischlurch 2009-10-02 15:26:11 +02:00
parent c3d767b444
commit cb7c884293
4 changed files with 18 additions and 37 deletions

View file

@ -34,8 +34,8 @@
using boost::str;
using boost::format;
using namespace lumiera;
using util::cStr;
using util::isnil;
using util::cStr;
namespace control {
@ -48,7 +48,8 @@ namespace control {
}
/** @note: does error handling, but delegates the actual
/** @param name to use in log and error messages
* @note does error handling, but delegates the actual
* execution to the protected (subclass) member */
ExecResult
HandlingPattern::invoke (CommandImpl& command, Symbol name) const

View file

@ -86,7 +86,7 @@ namespace control {
void perform (CommandImpl& command) const { return exec(command); }
class UndoProxyPattern
class UndoProxyPattern ///< standard UNDO implementation by reconfiguring a base Pattern
: public HandlingPattern
{
BasicHandlingPattern& basePatt_;
@ -119,6 +119,7 @@ namespace control {
/**
* Handling Pattern: invoke blocking, translate exceptions into an error state
* @todo describe this pattern in more detail....
* @todo unimplemented...
*/
class InvokeSyncNoThrow
: public BasicHandlingPattern
@ -146,7 +147,9 @@ namespace control {
/**
* Handling Pattern: invoke blocking, propagating any exceptions immediately
* @todo is throwing here helpful, and how to integrate it into ExecResult...?
* @todo describe this pattern in more detail....
* @todo unimplemented...
*/
class InvokeSyncThrow
: public BasicHandlingPattern
@ -174,7 +177,9 @@ namespace control {
/**
* Handling Pattern: just schedule command to be invoked asynchronously
* @todo clarify what "async" means and if we need it.....
* @todo describe this pattern in more detail....
* @todo unimplemented...
*/
class InvokeAsync
: public BasicHandlingPattern

View file

@ -60,7 +60,7 @@ return: 0
END
PLANNED "handling pattern basics" HandlingPatternBasics_test <<END
TEST "handling pattern basics" HandlingPatternBasics_test <<END
return: 0
END

View file

@ -22,50 +22,27 @@
#include "lib/test/run.hpp"
//#include "lib/test/test-helper.hpp"
#include "proc/control/command.hpp"
#include "proc/control/command-impl.hpp"
#include "proc/control/command-registry.hpp"
#include "proc/control/argument-erasure.hpp"
#include "proc/control/handling-pattern.hpp"
//#include "lib/lumitime.hpp"
#include "lib/symbol.hpp"
//#include "lib/util.hpp"
#include "proc/control/test-dummy-commands.hpp"
//#include <tr1/functional>
//#include <boost/ref.hpp>
//#include <boost/format.hpp>
//#include <iostream>
#include <cstdlib>
//#include <string>
namespace control {
namespace test {
// using boost::format;
// using boost::str;
//using lumiera::Time;
//using util::contains;
using std::tr1::function;
// using std::tr1::bind;
// using std::string;
using std::rand;
//using std::cout;
//using std::endl;
// using lib::test::showSizeof;
// using util::isSameObject;
// using util::contains;
using lib::Symbol;
using std::tr1::function;
using std::rand;
//using lumiera::typelist::BuildTupleAccessor;
// using lumiera::error::LUMIERA_ERROR_EXTERNAL;
namespace { // test data and helpers...
Symbol TEST_CMD = "test.command1.handling";
@ -79,13 +56,11 @@ namespace test {
/**********************************************************************************
* @test operate and verify a simple dummy command handling pattern.
* interface. Add/remove a command instance to the index, allocate an
* CommandImpl frame and verify it is removed properly on ref count zero.
* @note this test covers mainly the behaviour of a handling pattern as a concept,
* not so much the behaviour of the (standard) handling pattern implementations.
* not so much the behaviour of the (standard) handling pattern implementations.
*
* @see HandlingPattern
* @see CommandRegistry
* @see BasicHandlingPattern
* @see command.hpp
* @see command-basic-test.cpp
*/
@ -189,6 +164,6 @@ namespace test {
/** Register this test class... */
LAUNCHER (HandlingPatternBasics_test, "function controller");
}} // namespace control::test