From da8be6861c61a200060a573ac254b2e2d92988bd Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Tue, 29 Sep 2009 04:47:09 +0200 Subject: [PATCH] WIP some musing about opening the session interface --- src/proc/control/handling-patterns.hpp | 3 +- src/proc/control/proc-dispatcher.cpp | 56 ++++++++++++++++++++++++++ src/proc/control/proc-dispatcher.hpp | 12 ++++++ 3 files changed, 69 insertions(+), 2 deletions(-) diff --git a/src/proc/control/handling-patterns.hpp b/src/proc/control/handling-patterns.hpp index f4d62cc7b..dc35d7ea4 100644 --- a/src/proc/control/handling-patterns.hpp +++ b/src/proc/control/handling-patterns.hpp @@ -47,7 +47,6 @@ #include "lib/singleton-subclass.hpp" #include "proc/control/handling-pattern.hpp" #include "proc/control/command-impl.hpp" -#include "proc/mobject/session.hpp" #include "include/lifecycle.h" //#include "lib/symbol.hpp" @@ -187,7 +186,7 @@ namespace control { } - lumiera::LifecycleHook _schedule (mobject::ON_SESSION_START, &prepareCommandHandlingPatterns); + lumiera::LifecycleHook _schedule (lumiera::ON_GLOBAL_INIT, &prepareCommandHandlingPatterns); } // (END) definition of concrete handling patterns diff --git a/src/proc/control/proc-dispatcher.cpp b/src/proc/control/proc-dispatcher.cpp index a20fabe90..6d2a8e41c 100644 --- a/src/proc/control/proc-dispatcher.cpp +++ b/src/proc/control/proc-dispatcher.cpp @@ -23,6 +23,8 @@ #include "proc/control/proc-dispatcher.hpp" +#include "proc/mobject/session.hpp" +#include "include/logging.h" //#include "proc/mobject/mobject-ref.hpp" //#include "proc/mobject/mobject.hpp" //#include "proc/mobject/placement.hpp" @@ -32,7 +34,61 @@ namespace control { + + namespace { + + /** when session gets ready, + * open the command processing interface. + */ + void + activateCommandProcessing() + { + ProcDispatcher::instance().activate(); + } + + + lumiera::LifecycleHook _schedule (mobject::ON_SESSION_INIT, &activateCommandProcessing); + + } + + /** storage for Singleton access */ + lumiera::Singleton ProcDispatcher::instance; + + + /** */ + void + ProcDispatcher::activate() + { + INFO (command, "Session command processing activated."); + TODO ("implement command processing queue"); + } + + + void + ProcDispatcher::deactivate() + { + INFO (command, "Session command interface closed."); + TODO ("implement command processing queue"); + } + + + void + ProcDispatcher::clear() + { + if (!empty()) + WARN (command, "DISCARDING pending Session commands."); + TODO ("implement command processing queue"); + } + + + bool + ProcDispatcher::empty() const + { + TODO ("implement command processing queue"); + return true; + } + diff --git a/src/proc/control/proc-dispatcher.hpp b/src/proc/control/proc-dispatcher.hpp index 61352bc47..02227d6b2 100644 --- a/src/proc/control/proc-dispatcher.hpp +++ b/src/proc/control/proc-dispatcher.hpp @@ -38,6 +38,7 @@ //#include "pre.hpp" //#include "lib/symbol.hpp" #include "proc/control/command.hpp" +#include "lib/singleton.hpp" //#include @@ -56,6 +57,17 @@ namespace control { { public: + static lumiera::Singleton instance; + + void activate(); + void deactivate(); + void clear(); + + + /* == diagnostics == */ + +// size_t size() const ; + bool empty() const ; }; ////////////////TODO currently just fleshing out the API....