WIP: settle on the Tangible interface

This commit is contained in:
Fischlurch 2015-11-28 21:43:09 +01:00
parent 9af20b7cf6
commit d4c017fa73
4 changed files with 60 additions and 24 deletions

View file

@ -33,6 +33,8 @@
//#include "lib/symbol.hpp"
//#include "include/logging.h"
#include "gui/model/tangible.hpp"
#include "gui/model/widget.hpp"
#include "gui/model/controller.hpp"
//#include <boost/noncopyable.hpp>
//#include <string>
@ -65,9 +67,8 @@ namespace model {
* @param arguments suitable tuple of values, to be used to outfit the prototype
*/
void
Tangible::prepareCommand (InvocationTrail const& prototype, Rec&& arguments)
Tangible::prepareCommand (Cmd const& prototype, Rec&& arguments)
{
TODO ("invoke some hook for instrumentation?");
uiBus_.act (prototype.bind(std::forward<Rec>(arguments)));
}
@ -78,10 +79,9 @@ namespace model {
* which needs to be outfitted with arguments and ready for invocation.
*/
void
Tangible::issueCommand (InvocationTrail const& preparedAction)
Tangible::issueCommand (Cmd const& preparedAction)
{
TODO ("invoke some hook for instrumentation?");
uiBus_.act (prototype.bang());
uiBus_.act (preparedAction.bang());
}

View file

@ -68,14 +68,15 @@ namespace model {
: boost::noncopyable
{
protected:
using interact::InvocationTrail;
using lib::diff::GenNode;
using lib::diff::Rec;
using GenNode = lib::diff::GenNode;
using Cmd = interact::InvocationTrail;
using Rec = lib::diff::Rec;
using ID = lib::idi::BareEntryID;
ctrl::BusTerm uiBus_;
Tangible(EntryID identity, ctrl::BusTerm nexus)
Tangible(ID identity, ctrl::BusTerm& nexus)
: uiBus_(nexus.attach(identity))
{ }
@ -84,8 +85,8 @@ namespace model {
void reset();
void prepareCommand (InvocationTrail const& prototype, Rec&& arguments);
void issueCommand (InvocationTrail const& preparedAction);
void prepareCommand (Cmd const& prototype, Rec&& arguments);
void issueCommand (Cmd const& preparedAction);
void slotExpand();
void slotReveal();
@ -96,8 +97,14 @@ namespace model {
void noteMark();
protected:
virtual void doExpand() =0;
virtual void doReveal() =0;
virtual void doReset() =0;
virtual void doExpand() =0;
virtual void doReveal() =0;
virtual void doMsg() =0;
virtual void doErr() =0;
virtual void doFlash() =0;
virtual void doMark() =0;
private:
};

View file

@ -47,6 +47,7 @@
#include "lib/test/run.hpp"
#include "lib/test/test-helper.hpp"
#include "test/mock-elm.hpp"
#include "lib/error.hpp"
//#include "gui/model/session-facade.hpp"
//#include "gui/model/diagnostics.hpp"
@ -64,7 +65,6 @@
//using std::cout;
//using std::endl;
using lib::error::LUMIERA_ERROR_ASSERTION;
namespace gui {

View file

@ -47,14 +47,19 @@
//#include "lib/util.hpp"
#include "gui/model/tangible.hpp"
#include "lib/diff/record.hpp"
#include "test/nexus.hpp"
//#include <boost/noncopyable.hpp>
#include <string>
namespace gui {
namespace error = lumiera::error;
using error::LUMIERA_ERROR_ASSERTION;
namespace test{
// using lib::HashVal;
// using util::isnil;
using lib::idi::EntryID;
@ -79,28 +84,52 @@ namespace test{
/* ==== Tangible interface ==== */
virtual void
act (GenNode command) override
virtual void doReset()
{
UNIMPLEMENTED ("");
UNIMPLEMENTED ("mock doReset");
}
virtual void note (GenNode mark) =0;
virtual void mark (GenNode mark) =0;
virtual void act (EntryID subject, GenNode command) =0;
virtual void note (EntryID subject, GenNode mark) =0;
virtual void mark (EntryID subject, GenNode mark) =0;
virtual void doExpand()
{
UNIMPLEMENTED ("mock doExpand");
}
virtual void doReveal()
{
UNIMPLEMENTED ("mock doReveal");
}
virtual void doMsg()
{
UNIMPLEMENTED ("mock doMsg");
}
virtual void doErr()
{
UNIMPLEMENTED ("mock doErr");
}
virtual void doFlash()
{
UNIMPLEMENTED ("mock doFlash");
}
virtual void doMark()
{
UNIMPLEMENTED ("mock doMark");
}
protected:
public:
explicit
MockElm(string id)
: gui::model::Tangible(TODO_generate_identity, TestNexus::hook())
: MockElm(EntryID<MockElm>(id))
{ }
explicit
MockElm(EntryID identity, ctrl::BusTerm&& nexus =TestNexus::hook())
MockElm(ID identity, ctrl::BusTerm& nexus =Nexus::testUI())
: gui::model::Tangible(identity, nexus)
{ }
};