Console: Move into Scheduler as subdirectory
g0dil [Sat, 4 Oct 2008 21:41:36 +0000 (21:41 +0000)]
Scheduler/Console: Add 'sys' directory
Scheduler: Implement EventManager and 'sys/scheduler/events' command

git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@926 270642c3-0616-0410-b53a-bc976706d245

102 files changed:
Console/SConscript [deleted file]
PPI/IdleEvent.cci
PPI/IntervalTimer.cci
Scheduler/Console/Config.cc [moved from Console/Config.cc with 99% similarity]
Scheduler/Console/Config.cci [moved from Console/Config.cci with 99% similarity]
Scheduler/Console/Config.cti [moved from Console/Config.cti with 100% similarity]
Scheduler/Console/Config.hh [moved from Console/Config.hh with 100% similarity]
Scheduler/Console/Config.ih [moved from Console/Config.ih with 99% similarity]
Scheduler/Console/Config.test.cc [moved from Console/Config.test.cc with 98% similarity]
Scheduler/Console/ConfigFile.cc [copied from Console/ConfigFile.cc with 100% similarity]
Scheduler/Console/ConfigFile.cci [moved from Console/ConfigFile.cci with 100% similarity]
Scheduler/Console/ConfigFile.hh [moved from Console/ConfigFile.hh with 100% similarity]
Scheduler/Console/ConfigFile.ih [moved from Console/ConfigFile.ih with 100% similarity]
Scheduler/Console/ConfigFile.test.cc [moved from Console/ConfigFile.test.cc with 99% similarity]
Scheduler/Console/Console.hh [copied from Console/Console.hh with 98% similarity]
Scheduler/Console/Doxyfile [moved from Console/Doxyfile with 100% similarity]
Scheduler/Console/Example.dox [moved from Console/Example.dox with 100% similarity]
Scheduler/Console/Executor.cc [moved from Console/Executor.cc with 98% similarity]
Scheduler/Console/Executor.cci [moved from Console/Executor.cci with 100% similarity]
Scheduler/Console/Executor.hh [moved from Console/Executor.hh with 99% similarity]
Scheduler/Console/Executor.test.cc [moved from Console/Executor.test.cc with 98% similarity]
Scheduler/Console/LazyDirectory.cc [copied from Console/Server.test.cc with 74% similarity]
Scheduler/Console/LazyDirectory.hh [moved from Console/Console.hh with 68% similarity]
Scheduler/Console/Mainpage.dox [moved from Console/Mainpage.dox with 100% similarity]
Scheduler/Console/Node.cc [moved from Console/Node.cc with 100% similarity]
Scheduler/Console/Node.cci [moved from Console/Node.cci with 99% similarity]
Scheduler/Console/Node.cti [moved from Console/Node.cti with 100% similarity]
Scheduler/Console/Node.hh [moved from Console/Node.hh with 99% similarity]
Scheduler/Console/Node.ih [copied from Console/Node.ih with 100% similarity]
Scheduler/Console/Node.test.cc [moved from Console/Node.test.cc with 98% similarity]
Scheduler/Console/OverloadedCommand.cc [moved from Console/OverloadedCommand.cc with 100% similarity]
Scheduler/Console/OverloadedCommand.cci [moved from Console/OverloadedCommand.cci with 100% similarity]
Scheduler/Console/OverloadedCommand.cti [copied from Console/OverloadedCommand.cti with 100% similarity]
Scheduler/Console/OverloadedCommand.hh [moved from Console/OverloadedCommand.hh with 99% similarity]
Scheduler/Console/OverloadedCommand.test.cc [moved from Console/OverloadedCommand.test.cc with 98% similarity]
Scheduler/Console/Parse.cc [moved from Console/Parse.cc with 99% similarity]
Scheduler/Console/Parse.cci [moved from Console/Parse.cci with 99% similarity]
Scheduler/Console/Parse.hh [moved from Console/Parse.hh with 99% similarity]
Scheduler/Console/Parse.ih [moved from Console/Parse.ih with 99% similarity]
Scheduler/Console/Parse.test.cc [moved from Console/Parse.test.cc with 99% similarity]
Scheduler/Console/ParsedCommand.cc [moved from Console/ParsedCommand.cc with 100% similarity]
Scheduler/Console/ParsedCommand.cci [moved from Console/ParsedCommand.cci with 100% similarity]
Scheduler/Console/ParsedCommand.ct [moved from Console/ParsedCommand.ct with 97% similarity]
Scheduler/Console/ParsedCommand.cti [moved from Console/ParsedCommand.cti with 98% similarity]
Scheduler/Console/ParsedCommand.hh [moved from Console/ParsedCommand.hh with 99% similarity]
Scheduler/Console/ParsedCommand.ih [moved from Console/ParsedCommand.ih with 100% similarity]
Scheduler/Console/ParsedCommand.mpp [moved from Console/ParsedCommand.mpp with 100% similarity]
Scheduler/Console/ParsedCommand.test.cc [moved from Console/ParsedCommand.test.cc with 99% similarity]
Scheduler/Console/ProgramOptions.cc [moved from Console/ProgramOptions.cc with 100% similarity]
Scheduler/Console/ProgramOptions.cci [moved from Console/ProgramOptions.cci with 100% similarity]
Scheduler/Console/ProgramOptions.cti [moved from Console/ProgramOptions.cti with 100% similarity]
Scheduler/Console/ProgramOptions.hh [moved from Console/ProgramOptions.hh with 100% similarity]
Scheduler/Console/ProgramOptions.ih [moved from Console/ProgramOptions.ih with 100% similarity]
Scheduler/Console/ProgramOptions.test.cc [moved from Console/ProgramOptions.test.cc with 99% similarity]
Scheduler/Console/Readline.cc [moved from Console/Readline.cc with 98% similarity]
Scheduler/Console/Readline.cci [moved from Console/Readline.cci with 100% similarity]
Scheduler/Console/Readline.hh [moved from Console/Readline.hh with 98% similarity]
Scheduler/Console/SConscript [new file with mode: 0644]
Scheduler/Console/ScopedDirectory.cci [moved from Console/ScopedDirectory.cci with 100% similarity]
Scheduler/Console/ScopedDirectory.cti [moved from Console/ScopedDirectory.cti with 100% similarity]
Scheduler/Console/ScopedDirectory.hh [moved from Console/ScopedDirectory.hh with 98% similarity]
Scheduler/Console/ScopedDirectory.test.cc [moved from Console/ScopedDirectory.test.cc with 99% similarity]
Scheduler/Console/Server.cc [moved from Console/Server.cc with 96% similarity]
Scheduler/Console/Server.cci [moved from Console/Server.cci with 100% similarity]
Scheduler/Console/Server.hh [moved from Console/Server.hh with 96% similarity]
Scheduler/Console/Server.ih [moved from Console/Server.ih with 100% similarity]
Scheduler/Console/Server.test.cc [moved from Console/Server.test.cc with 97% similarity]
Scheduler/Console/Sysdir.cci [moved from Console/OverloadedCommand.cti with 67% similarity]
Scheduler/Console/Sysdir.hh [moved from Console/main.test.cc with 72% similarity]
Scheduler/Console/Sysdir.ih [moved from Console/Node.ih with 77% similarity]
Scheduler/Console/Traits.cc [copied from Console/Traits.cc with 98% similarity]
Scheduler/Console/Traits.cci [moved from Console/Traits.cci with 100% similarity]
Scheduler/Console/Traits.ct [moved from Console/Traits.ct with 100% similarity]
Scheduler/Console/Traits.cti [moved from Console/Traits.cti with 98% similarity]
Scheduler/Console/Traits.hh [moved from Console/Traits.hh with 99% similarity]
Scheduler/Console/Traits.ih [moved from Console/Traits.ih with 99% similarity]
Scheduler/Console/Traits.test.cc [moved from Console/Traits.test.cc with 99% similarity]
Scheduler/Console/Variables.cti [moved from Console/Variables.cti with 100% similarity]
Scheduler/Console/Variables.hh [moved from Console/Variables.hh with 100% similarity]
Scheduler/Console/Variables.ih [moved from Console/Variables.ih with 100% similarity]
Scheduler/Console/Variables.test.cc [moved from Console/Variables.test.cc with 98% similarity]
Scheduler/Console/testServer.cc [moved from Console/testServer.cc with 100% similarity]
Scheduler/EventManager.cc [moved from Console/Traits.cc with 52% similarity]
Scheduler/EventManager.cci [new file with mode: 0644]
Scheduler/EventManager.hh [new file with mode: 0644]
Scheduler/EventManager.test.cc [moved from Console/ConfigFile.cc with 55% similarity]
Scheduler/FIFORunner.cc
Scheduler/FIFORunner.cci
Scheduler/FIFORunner.hh
Scheduler/FdEvent.cc
Scheduler/FdEvent.hh
Scheduler/SConscript
Scheduler/SignalEvent.cc
Scheduler/SignalEvent.cci
Scheduler/SignalEvent.hh
Scheduler/TimerEvent.cc
Scheduler/TimerEvent.hh
Socket/SConscript
Utils/Daemon/Daemon.cc
Utils/Daemon/Daemon.cci
Utils/Daemon/SConscript
include/senf/Console.hh

diff --git a/Console/SConscript b/Console/SConscript
deleted file mode 100644 (file)
index fb3fe30..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-# -*- python -*-
-
-Import('env')
-import SENFSCons
-
-###########################################################################
-
-sources = SENFSCons.GlobSources( exclude = [ 'testServer.cc' ] )
-SENFSCons.StandardTargets(env)
-
-SENFSCons.Lib(env,
-              library = 'Console',
-              sources = sources,
-              LIBS = [ 'Socket', 'Scheduler', 'Utils' ])
-
-SENFSCons.Binary(env, 'testServer',
-                 sources = [ 'testServer.cc' ],
-                 no_includes = True,
-                 LIBS = [ 'Console', 'Socket', 'Scheduler', 'Utils' ])
-
-SENFSCons.Doxygen(env)
index 898c14b..7c43754 100644 (file)
@@ -32,7 +32,7 @@
 // senf::ppi::IdleEvent
 
 prefix_ senf::ppi::IdleEvent::IdleEvent()
-    : timer_ ("PPI idle event", boost::bind(&IdleEvent::cb,this))
+    : timer_ ("senf::ppi::IdleEvent", boost::bind(&IdleEvent::cb,this))
 {}
 
 ///////////////////////////////cci.e///////////////////////////////////////
index 35c7ce2..afa7ba3 100644 (file)
@@ -34,7 +34,7 @@
 prefix_ senf::ppi::IntervalTimer::IntervalTimer(ClockService::clock_type interval,
                                                 unsigned eventsPerInterval)
     : interval_ (interval), eventsPerInterval_ (eventsPerInterval),
-      timer_("PPI interval timer",  boost::bind(&IntervalTimer::cb,this))
+      timer_("senf::ppi::IntervalTimer",  boost::bind(&IntervalTimer::cb,this))
 {}
 
 ///////////////////////////////cci.e///////////////////////////////////////
similarity index 99%
rename from Console/Config.cc
rename to Scheduler/Console/Config.cc
index 1895d16..77d712a 100644 (file)
@@ -27,7 +27,7 @@
 #include "Config.ih"
 
 // Custom includes
-#include "../Utils/membind.hh"
+#include "../../Utils/membind.hh"
 
 //#include "Config.mpp"
 #define prefix_
similarity index 99%
rename from Console/Config.cci
rename to Scheduler/Console/Config.cci
index 1f41ebf..46cb12f 100644 (file)
@@ -26,7 +26,7 @@
 #include "Config.ih"
 
 // Custom includes
-#include "../Utils/membind.hh"
+#include "../../Utils/membind.hh"
 
 #define prefix_ inline
 ///////////////////////////////cci.p///////////////////////////////////////
similarity index 99%
rename from Console/Config.ih
rename to Scheduler/Console/Config.ih
index 7ee336b..208abb2 100644 (file)
@@ -30,7 +30,7 @@
 #include <boost/utility.hpp>
 #include <boost/intrusive_ptr.hpp>
 #include "Executor.hh"
-#include "../Utils/intrusive_refcount.hh"
+#include "../../Utils/intrusive_refcount.hh"
 
 ///////////////////////////////ih.p////////////////////////////////////////
 
similarity index 98%
rename from Console/Config.test.cc
rename to Scheduler/Console/Config.test.cc
index 58d5c1b..8d55c84 100644 (file)
@@ -34,7 +34,7 @@
 #include "ProgramOptions.hh"
 #include <boost/filesystem/operations.hpp>
 
-#include "../Utils/auto_unit_test.hh"
+#include "../../Utils/auto_unit_test.hh"
 #include <boost/test/test_tools.hpp>
 
 #define prefix_
similarity index 99%
rename from Console/ConfigFile.test.cc
rename to Scheduler/Console/ConfigFile.test.cc
index b8e68b9..b1976c2 100644 (file)
@@ -33,7 +33,7 @@
 #include "ParsedCommand.hh"
 #include <boost/filesystem/operations.hpp>
 
-#include "../Utils/auto_unit_test.hh"
+#include "../../Utils/auto_unit_test.hh"
 #include <boost/test/test_tools.hpp>
 
 #define prefix_
similarity index 98%
copy from Console/Console.hh
copy to Scheduler/Console/Console.hh
index d459701..276e4fa 100644 (file)
@@ -38,6 +38,7 @@
 #include "Config.hh"
 #include "ConfigFile.hh"
 #include "ProgramOptions.hh"
+#include "Sysdir.hh"
 
 ///////////////////////////////hh.e////////////////////////////////////////
 //#include "Console.cci"
similarity index 100%
rename from Console/Doxyfile
rename to Scheduler/Console/Doxyfile
similarity index 98%
rename from Console/Executor.cc
rename to Scheduler/Console/Executor.cc
index 5000104..80d632f 100644 (file)
@@ -30,9 +30,9 @@
 #include <boost/utility.hpp>
 #include <boost/range/iterator_range.hpp>
 #include <boost/bind.hpp>
-#include "../Utils/senfassert.hh"
-#include "../Utils/Range.hh"
-#include "../Utils/String.hh"
+#include "../../Utils/senfassert.hh"
+#include "../../Utils/Range.hh"
+#include "../../Utils/String.hh"
 
 //#include "Executor.mpp"
 #define prefix_
similarity index 99%
rename from Console/Executor.hh
rename to Scheduler/Console/Executor.hh
index 02cff18..1f27f48 100644 (file)
@@ -29,7 +29,7 @@
 // Custom includes
 #include <boost/utility.hpp>
 #include "Parse.hh"
-#include "../Utils/Logger/SenfLog.hh"
+#include "../../Utils/Logger/SenfLog.hh"
 #include "Node.hh"
 
 //#include "Executor.mpp"
similarity index 98%
rename from Console/Executor.test.cc
rename to Scheduler/Console/Executor.test.cc
index 1266ae0..a2b98ab 100644 (file)
@@ -31,7 +31,7 @@
 #include <vector>
 #include "Executor.hh"
 
-#include "../Utils/auto_unit_test.hh"
+#include "../../Utils/auto_unit_test.hh"
 #include <boost/test/test_tools.hpp>
 
 #define prefix_
@@ -99,7 +99,7 @@ BOOST_AUTO_UNIT_TEST(executor)
         parser.parse("ls", &setCommand);
         executor(os, commands.back());
         BOOST_CHECK_EQUAL( commands.back().builtin(), senf::console::ParseCommandInfo::BuiltinLS );
-        BOOST_CHECK_EQUAL( os.str(), "dir1/\ndir2/\n" );
+        BOOST_CHECK_EQUAL( os.str(), "dir1/\ndir2/\nsys/\n" );
     }
 
     {
similarity index 74%
copy from Console/Server.test.cc
copy to Scheduler/Console/LazyDirectory.cc
index 7c54f39..02f2e5d 100644 (file)
 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
 /** \file
-    \brief Server.test unit tests */
+    \brief LazyDirectory non-inline non-template implementation */
 
-//#include "Server.test.hh"
-//#include "Server.test.ih"
+#include "LazyDirectory.hh"
+//#include "LazyDirectory.ih"
 
 // Custom includes
-#include "Server.hh"
-
-#include "../Utils/auto_unit_test.hh"
-#include <boost/test/test_tools.hpp>
+#include "Console.hh"
 
+//#include "LazyDirectory.mpp"
 #define prefix_
 ///////////////////////////////cc.p////////////////////////////////////////
 
-BOOST_AUTO_UNIT_TEST(server)
+prefix_ senf::console::LazyDirectory::LazyDirectory()
+    : p_( new ScopedDirectory<>() )
+{}
+
+prefix_ senf::console::LazyDirectory::~LazyDirectory()
 {}
 
+prefix_ senf::console::ScopedDirectory<> & senf::console::LazyDirectory::operator()()
+{
+    return *p_;
+}
+
 ///////////////////////////////cc.e////////////////////////////////////////
 #undef prefix_
+//#include "LazyDirectory.mpp"
 
 \f
 // Local Variables:
similarity index 68%
rename from Console/Console.hh
rename to Scheduler/Console/LazyDirectory.hh
index d459701..041bc42 100644 (file)
 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
 /** \file
-    \brief Console public header */
+    \brief LazyDirectory public header */
 
-#ifndef HH_Console_
-#define HH_Console_ 1
+#ifndef HH_LazyDirectory_
+#define HH_LazyDirectory_ 1
 
 // Custom includes
+#include <boost/utility.hpp>
+#include <boost/scoped_ptr.hpp>
 
-//#include "Console.mpp"
+//#include "LazyDirectory.mpp"
 ///////////////////////////////hh.p////////////////////////////////////////
 
-#include "Server.hh"
-#include "ParsedCommand.hh"
-#include "ScopedDirectory.hh"
-#include "OverloadedCommand.hh"
-#include "Config.hh"
-#include "ConfigFile.hh"
-#include "ProgramOptions.hh"
+namespace senf {
+namespace console {
+
+    template <class Owner=void> class ScopedDirectory;
+
+    class LazyDirectory
+        : boost::noncopyable
+    {
+    public:
+        LazyDirectory();
+        ~LazyDirectory();
+
+        ScopedDirectory<> & operator()();
+
+    private:
+        boost::scoped_ptr< ScopedDirectory<> > p_;
+    };
+
+}}
 
 ///////////////////////////////hh.e////////////////////////////////////////
-//#include "Console.cci"
-//#include "Console.ct"
-//#include "Console.cti"
+//#include "LazyDirectory.cci"
+//#include "LazyDirectory.ct"
+//#include "LazyDirectory.cti"
 #endif
 
 \f
similarity index 100%
rename from Console/Node.cc
rename to Scheduler/Console/Node.cc
similarity index 99%
rename from Console/Node.cci
rename to Scheduler/Console/Node.cci
index 1fe834d..dabaec9 100644 (file)
@@ -26,7 +26,7 @@
 #include "Node.ih"
 
 // Custom includes
-#include "../Utils/senfassert.hh"
+#include "../../Utils/senfassert.hh"
 
 #define prefix_ inline
 ///////////////////////////////cci.p///////////////////////////////////////
similarity index 100%
rename from Console/Node.cti
rename to Scheduler/Console/Node.cti
similarity index 99%
rename from Console/Node.hh
rename to Scheduler/Console/Node.hh
index e284998..05a4e92 100644 (file)
 #include <boost/range/iterator_range.hpp>
 #include <boost/typeof/typeof.hpp>
 #include <boost/type_traits/remove_reference.hpp>
-#include "../Utils/Exception.hh"
-#include "../Utils/mpl.hh"
-#include "../Utils/Logger/SenfLog.hh"
-#include "../Utils/type_traits.hh"
+#include "../../Utils/Exception.hh"
+#include "../../Utils/mpl.hh"
+#include "../../Utils/Logger/SenfLog.hh"
+#include "../../Utils/type_traits.hh"
 #include "Parse.hh"
 
 //#include "Node.mpp"
similarity index 100%
copy from Console/Node.ih
copy to Scheduler/Console/Node.ih
similarity index 98%
rename from Console/Node.test.cc
rename to Scheduler/Console/Node.test.cc
index cab82e3..cc786dc 100644 (file)
@@ -31,7 +31,7 @@
 #include "Node.hh"
 #include <boost/iterator/transform_iterator.hpp>
 
-#include "../Utils/auto_unit_test.hh"
+#include "../../Utils/auto_unit_test.hh"
 #include <boost/test/test_tools.hpp>
 
 #define prefix_
@@ -89,7 +89,7 @@ BOOST_AUTO_UNIT_TEST(directoryNode)
     BOOST_CHECK( &senf::console::root().get("dir1") == p.get() );
     
     senf::console::root().mkdir("dir2").mkdir("dir3");
-    char const * const children[] = { "dir1", "dir2", "fn" };
+    char const * const children[] = { "dir1", "dir2", "fn", "sys" };
     BOOST_CHECK_EQUAL_COLLECTIONS( 
         boost::make_transform_iterator(senf::console::root().children().begin(), 
                                        select1st<std::string const &>()),
@@ -116,7 +116,7 @@ BOOST_AUTO_UNIT_TEST(directoryNode)
     senf::console::root().remove("dir2");
     senf::console::root().remove("fn");
 
-    BOOST_CHECK_EQUAL( senf::console::root().children().size(), 0u );
+    BOOST_CHECK_EQUAL( senf::console::root().children().size(), 1u );
 }
 
 BOOST_AUTO_UNIT_TEST(linkNode)
similarity index 99%
rename from Console/OverloadedCommand.hh
rename to Scheduler/Console/OverloadedCommand.hh
index db94afe..c39ff51 100644 (file)
@@ -29,7 +29,7 @@
 // Custom includes
 #include "Node.hh"
 #include <boost/intrusive_ptr.hpp>
-#include "../Utils/intrusive_refcount.hh"
+#include "../../Utils/intrusive_refcount.hh"
 
 //#include "OverloadedCommand.mpp"
 ///////////////////////////////hh.p////////////////////////////////////////
similarity index 98%
rename from Console/OverloadedCommand.test.cc
rename to Scheduler/Console/OverloadedCommand.test.cc
index ad68f57..67d22de 100644 (file)
@@ -30,7 +30,7 @@
 #include <sstream>
 #include "OverloadedCommand.hh"
 
-#include "../Utils/auto_unit_test.hh"
+#include "../../Utils/auto_unit_test.hh"
 #include <boost/test/test_tools.hpp>
 
 #define prefix_
similarity index 99%
rename from Console/Parse.cc
rename to Scheduler/Console/Parse.cc
index 83ff10c..48cd0a5 100644 (file)
@@ -31,8 +31,8 @@
 #include <boost/iterator/transform_iterator.hpp>
 #include <boost/spirit/iterator/file_iterator.hpp>
 #include <boost/spirit/iterator/position_iterator.hpp>
-#include "../Utils/Exception.hh"
-#include "../Utils/senfassert.hh"
+#include "../../Utils/Exception.hh"
+#include "../../Utils/senfassert.hh"
 
 //#include "Parse.mpp"
 #define prefix_
similarity index 99%
rename from Console/Parse.cci
rename to Scheduler/Console/Parse.cci
index b5a71be..563cd6f 100644 (file)
@@ -27,7 +27,7 @@
 // (disabled) #include "Parse.ih"
 
 // Custom includes
-#include "../Utils/senfassert.hh"
+#include "../../Utils/senfassert.hh"
 
 #define prefix_ inline
 ///////////////////////////////cci.p///////////////////////////////////////
similarity index 99%
rename from Console/Parse.hh
rename to Scheduler/Console/Parse.hh
index 1c11053..59b0a3b 100644 (file)
 #include <boost/range/iterator_range.hpp>
 #include <boost/iterator/iterator_facade.hpp>
 #include <boost/function.hpp>
-#include "../Utils/safe_bool.hh"
-#include "../Utils/Exception.hh"
+#include "../../Utils/safe_bool.hh"
+#include "../../Utils/Exception.hh"
 
 //#include "Parse.mpp"
 ///////////////////////////////hh.p////////////////////////////////////////
similarity index 99%
rename from Console/Parse.ih
rename to Scheduler/Console/Parse.ih
index 70791d4..7816764 100644 (file)
@@ -32,7 +32,7 @@
 #include <boost/spirit/utility/grammar_def.hpp>
 #include <boost/spirit/dynamic.hpp>
 #include <boost/spirit/phoenix.hpp>
-#include "../Utils/Phoenix.hh"
+#include "../../Utils/Phoenix.hh"
 
 ///////////////////////////////ih.p////////////////////////////////////////
 
similarity index 99%
rename from Console/Parse.test.cc
rename to Scheduler/Console/Parse.test.cc
index 3981972..472b9a3 100644 (file)
@@ -33,9 +33,9 @@
 #include <sstream>
 #include "Parse.hh"
 #include "Parse.ih"
-#include "../Utils/String.hh"
+#include "../../Utils/String.hh"
 
-#include "../Utils/auto_unit_test.hh"
+#include "../../Utils/auto_unit_test.hh"
 #include <boost/test/test_tools.hpp>
 
 #define prefix_
similarity index 97%
rename from Console/ParsedCommand.ct
rename to Scheduler/Console/ParsedCommand.ct
index f0469de..b3acb01 100644 (file)
@@ -34,7 +34,7 @@
 // senf::console::ParsedCommandOverload<FunctionTraits,n>
 
 #define BOOST_PP_ITERATION_PARAMS_1 (4, (0, SENF_CONSOLE_MAX_COMMAND_ARITY,                       \
-                                         SENF_ABSOLUTE_INCLUDE_PATH(Console/ParsedCommand.mpp),   \
+                                         SENF_ABSOLUTE_INCLUDE_PATH(Scheduler/Console/ParsedCommand.mpp),   \
                                          3))
 #include BOOST_PP_ITERATE()
 
similarity index 98%
rename from Console/ParsedCommand.cti
rename to Scheduler/Console/ParsedCommand.cti
index b6d140f..a3f2618 100644 (file)
@@ -26,9 +26,9 @@
 #include "ParsedCommand.ih"
 
 // Custom includes
-#include "../Utils/membind.hh"
+#include "../../Utils/membind.hh"
 #include <boost/format.hpp>
-#include "../Utils/parameter.hh"
+#include "../../Utils/parameter.hh"
 
 #define prefix_ inline
 ///////////////////////////////cti.p///////////////////////////////////////
@@ -69,7 +69,7 @@ prefix_ void senf::console::ParsedCommandOverloadBase::addParameter()
 // senf::console::ParsedCommandOverload<FunctionTraits,n>
 
 #define BOOST_PP_ITERATION_PARAMS_1 (4, (0, SENF_CONSOLE_MAX_COMMAND_ARITY,                       \
-                                         SENF_ABSOLUTE_INCLUDE_PATH(Console/ParsedCommand.mpp),   \
+                                         SENF_ABSOLUTE_INCLUDE_PATH(Scheduler/Console/ParsedCommand.mpp),   \
                                          2))
 #include BOOST_PP_ITERATE()
 
@@ -343,7 +343,7 @@ namespace detail {
     };
 
 #   define BOOST_PP_ITERATION_PARAMS_1 (4, (0, SENF_CONSOLE_MAX_COMMAND_ARITY,                     \
-                                            SENF_ABSOLUTE_INCLUDE_PATH(Console/ParsedCommand.mpp), \
+                                            SENF_ABSOLUTE_INCLUDE_PATH(Scheduler/Console/ParsedCommand.mpp), \
                                             4))
 #   include BOOST_PP_ITERATE()
 
similarity index 99%
rename from Console/ParsedCommand.hh
rename to Scheduler/Console/ParsedCommand.hh
index db85451..107ed65 100644 (file)
 #include <boost/utility.hpp>
 #include <boost/parameter/keyword.hpp>
 #include <boost/parameter/parameters.hpp>
-#include "../config.hh"
+#include "../../config.hh"
 #include "OverloadedCommand.hh"
 #include "Traits.hh"
-#include "../Utils/type_traits.hh"
+#include "../../Utils/type_traits.hh"
 
 #include "ParsedCommand.ih"
 #include "ParsedCommand.mpp"
@@ -183,7 +183,7 @@ namespace console {
 #ifndef DOXYGEN
 
 #   define BOOST_PP_ITERATION_PARAMS_1 (4, (0, SENF_CONSOLE_MAX_COMMAND_ARITY,                     \
-                                            SENF_ABSOLUTE_INCLUDE_PATH(Console/ParsedCommand.mpp), \
+                                            SENF_ABSOLUTE_INCLUDE_PATH(Scheduler/Console/ParsedCommand.mpp), \
                                             1))
 #   include BOOST_PP_ITERATE()
 
@@ -492,7 +492,7 @@ namespace console {
 
 #       define BOOST_PP_ITERATION_PARAMS_1                                                        \
             (4, (1, BOOST_PARAMETER_MAX_ARITY,                                                    \
-                 SENF_ABSOLUTE_INCLUDE_PATH(Console/ParsedCommand.mpp),                           \
+                 SENF_ABSOLUTE_INCLUDE_PATH(Scheduler/Console/ParsedCommand.mpp),                 \
                  5))
 #       include BOOST_PP_ITERATE()
 
similarity index 99%
rename from Console/ParsedCommand.test.cc
rename to Scheduler/Console/ParsedCommand.test.cc
index 223a3e3..0ad7fc6 100644 (file)
@@ -34,7 +34,7 @@
 #include "Parse.hh"
 #include "ScopedDirectory.hh"
 
-#include "../Utils/auto_unit_test.hh"
+#include "../../Utils/auto_unit_test.hh"
 #include <boost/test/test_tools.hpp>
 
 #define prefix_
similarity index 99%
rename from Console/ProgramOptions.test.cc
rename to Scheduler/Console/ProgramOptions.test.cc
index f630141..cf1e12f 100644 (file)
@@ -31,7 +31,7 @@
 #include "ScopedDirectory.hh"
 #include "ParsedCommand.hh"
 
-#include "../Utils/auto_unit_test.hh"
+#include "../../Utils/auto_unit_test.hh"
 #include <boost/test/test_tools.hpp>
 
 #define prefix_
similarity index 98%
rename from Console/Readline.cc
rename to Scheduler/Console/Readline.cc
index 188bc77..87efd87 100644 (file)
@@ -32,7 +32,7 @@
 #include <readline/history.h>
 #include <boost/algorithm/string/trim.hpp>
 #include <boost/algorithm/string/replace.hpp>
-#include "../Utils/membind.hh"
+#include "../../Utils/membind.hh"
 
 //#include "Readline.mpp"
 #define prefix_
@@ -116,7 +116,7 @@ namespace {
 
 prefix_ senf::console::detail::ReadlineClientReader::ReadlineClientReader(Client & client)
     : ClientReader(client), ch_ (-1), skipChars_ (0), 
-      readevent_ ( "ReadlineClientReader", senf::membind(&ReadlineClientReader::charEvent, this),
+      readevent_ ( "senf::console::detail::ReadlineClientReader", senf::membind(&ReadlineClientReader::charEvent, this),
                    client.handle(), scheduler::FdEvent::EV_READ, false ),
       terminate_ (false)
 {
similarity index 98%
rename from Console/Readline.hh
rename to Scheduler/Console/Readline.hh
index 69ae87d..3daf490 100644 (file)
@@ -29,8 +29,8 @@
 // Custom includes
 #include <boost/scoped_ptr.hpp>
 #include "Server.hh"
-#include "../Utils/Exception.hh"
-#include "../Scheduler/Scheduler.hh"
+#include "../../Utils/Exception.hh"
+#include "../Scheduler.hh"
 
 //#include "Readline.mpp"
 ///////////////////////////////hh.p////////////////////////////////////////
diff --git a/Scheduler/Console/SConscript b/Scheduler/Console/SConscript
new file mode 100644 (file)
index 0000000..20e0cab
--- /dev/null
@@ -0,0 +1,10 @@
+# -*- python -*-
+
+Import('env')
+import SENFSCons
+
+###########################################################################
+
+env.Command(env.File('test'), '../test', [])
+
+SENFSCons.Doxygen(env)
similarity index 98%
rename from Console/ScopedDirectory.hh
rename to Scheduler/Console/ScopedDirectory.hh
index 04a33ec..c0f3bb9 100644 (file)
@@ -30,6 +30,7 @@
 #include <boost/utility.hpp>
 #include <boost/type_traits/is_convertible.hpp>
 #include "Node.hh"
+#include "LazyDirectory.hh" // For ScopedDirectory template default arg
 
 //#include "ScopedDirectory.mpp"
 ///////////////////////////////hh.p////////////////////////////////////////
@@ -131,7 +132,7 @@ namespace console {
 
         \ingroup node_tree
       */
-    template <class Owner=void>
+    template <class Owner>
     class ScopedDirectory : public ScopedDirectoryBase
     {
     public:
@@ -144,7 +145,7 @@ namespace console {
         ///\name Structors and default members
         ///@{
 
-        ScopedDirectory(Owner * owner);
+        explicit ScopedDirectory(Owner * owner);
 
         ///@}
         ///////////////////////////////////////////////////////////////////////////
similarity index 99%
rename from Console/ScopedDirectory.test.cc
rename to Scheduler/Console/ScopedDirectory.test.cc
index 45f70cd..60b665e 100644 (file)
@@ -31,7 +31,7 @@
 #include "ScopedDirectory.hh"
 #include <boost/iterator/transform_iterator.hpp>
 
-#include "../Utils/auto_unit_test.hh"
+#include "../../Utils/auto_unit_test.hh"
 #include <boost/test/test_tools.hpp>
 
 #define prefix_
similarity index 96%
rename from Console/Server.cc
rename to Scheduler/Console/Server.cc
index e69bca1..ef885ba 100644 (file)
@@ -32,9 +32,9 @@
 #include <boost/iostreams/device/file_descriptor.hpp>
 #include <boost/iostreams/stream.hpp>
 #include <boost/bind.hpp>
-#include "../Utils/senfassert.hh"
-#include "../Utils/membind.hh"
-#include "../Utils/Logger/SenfLog.hh"
+#include "../../Utils/senfassert.hh"
+#include "../../Utils/membind.hh"
+#include "../../Utils/Logger/SenfLog.hh"
 #include "Readline.hh"
 
 //#include "Server.mpp"
@@ -92,7 +92,7 @@ prefix_ senf::console::Server & senf::console::Server::start(ServerHandle handle
 
 prefix_ senf::console::Server::Server(ServerHandle handle)
     : handle_ (handle), 
-      event_ ("console::Server", senf::membind(&Server::newClient, this),
+      event_ ("senf::console::Server", senf::membind(&Server::newClient, this),
               handle_, scheduler::FdEvent::EV_READ),
       root_ (senf::console::root().thisptr()), mode_ (Automatic)
 {}
@@ -179,7 +179,7 @@ prefix_ void senf::console::detail::DumbClientReader::v_translate(std::string &
 prefix_
 senf::console::detail::NoninteractiveClientReader::NoninteractiveClientReader(Client & client)
     : ClientReader (client), 
-      readevent_ ("NoninteractiveClientReader", 
+      readevent_ ("senf::console::detail::NoninteractiveClientReader", 
                   senf::membind(&NoninteractiveClientReader::newData, this),
                   handle(), senf::scheduler::FdEvent::EV_READ)
 {}
@@ -217,9 +217,10 @@ senf::console::detail::NoninteractiveClientReader::newData(int event)
 prefix_ senf::console::Client::Client(Server & server, ClientHandle handle)
     : out_t(boost::ref(*this)), senf::log::IOStreamTarget(out_t::member), server_ (server),
       handle_ (handle), 
-      readevent_ ("senf::console::Client", boost::bind(&Client::setNoninteractive,this), 
+      readevent_ ("senf::console::Client::interactive_check", 
+                  boost::bind(&Client::setNoninteractive,this), 
                   handle, scheduler::FdEvent::EV_READ, false),
-      timer_ ("senf::console::Client interactive timeout", 
+      timer_ ("senf::console::Client::interactive_timer", 
               boost::bind(&Client::setInteractive, this),
               scheduler::eventTime() + ClockService::milliseconds(INTERACTIVE_TIMEOUT),
               false),
similarity index 96%
rename from Console/Server.hh
rename to Scheduler/Console/Server.hh
index 1974a74..ac86ca2 100644 (file)
 #include <boost/utility.hpp>
 #include <boost/scoped_ptr.hpp>
 #include <boost/shared_ptr.hpp>
-#include "../Utils/intrusive_refcount.hh"
-#include "../Socket/Protocols/INet/TCPSocketHandle.hh"
-#include "../Socket/ServerSocketHandle.hh"
-#include "../Scheduler/Scheduler.hh"
-#include "../Scheduler/ReadHelper.hh"
+#include "../../Utils/intrusive_refcount.hh"
+#include "../../Socket/Protocols/INet/TCPSocketHandle.hh"
+#include "../../Socket/ServerSocketHandle.hh"
+#include "../Scheduler.hh"
+#include "../ReadHelper.hh"
 #include "Parse.hh"
 #include "Executor.hh"
-#include "../Socket/Protocols/INet/INetAddressing.hh"
-#include "../Utils/Logger.hh"
+#include "../../Socket/Protocols/INet/INetAddressing.hh"
+#include "../../Utils/Logger.hh"
 
 //#include "Server.mpp"
 #include "Server.ih"
similarity index 97%
rename from Console/Server.test.cc
rename to Scheduler/Console/Server.test.cc
index 7c54f39..84599f0 100644 (file)
@@ -29,7 +29,7 @@
 // Custom includes
 #include "Server.hh"
 
-#include "../Utils/auto_unit_test.hh"
+#include "../../Utils/auto_unit_test.hh"
 #include <boost/test/test_tools.hpp>
 
 #define prefix_
similarity index 67%
rename from Console/OverloadedCommand.cti
rename to Scheduler/Console/Sysdir.cci
index b5e7a75..9b97ea9 100644 (file)
 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
 /** \file
-    \brief OverloadedCommand inline template implementation */
+    \brief Sysdir inline non-template implementation */
 
-//#include "OverloadedCommand.ih"
+#include "Sysdir.ih"
 
 // Custom includes
+#include "ScopedDirectory.hh"
 
 #define prefix_ inline
-///////////////////////////////cti.p///////////////////////////////////////
+///////////////////////////////cci.p///////////////////////////////////////
 
-///////////////////////////////////////////////////////////////////////////
-// senf::console::OverloadedCommandNode
+prefix_ senf::console::ScopedDirectory<> & senf::console::sysdir()
+{
+    return detail::SysdirManager::instance().sysdir();
+}
+
+prefix_ senf::console::ScopedDirectory<> &
+senf::console::detail::SysdirManager::sysdir()
+{
+    return sysdir_;
+}
 
-template <class Command>
-prefix_ Command &
-senf::console::OverloadedCommandNode::add(boost::intrusive_ptr<Command> overload)
+prefix_ senf::console::detail::SysdirManager::SysdirManager()
 {
-    overloads_.push_back(overload);
-    overload->node_ = this;
-    return *overload;
+    senf::console::root().add("sys", sysdir_);
 }
 
-///////////////////////////////cti.e///////////////////////////////////////
+///////////////////////////////cci.e///////////////////////////////////////
 #undef prefix_
 
 \f
similarity index 72%
rename from Console/main.test.cc
rename to Scheduler/Console/Sysdir.hh
index b6d1686..06fb086 100644 (file)
@@ -1,6 +1,6 @@
 // $Id$
 //
-// Copyright (C) 2006
+// Copyright (C) 2008 
 // Fraunhofer Institute for Open Communication Systems (FOKUS)
 // Competence Center NETwork research (NET), St. Augustin, GERMANY
 //     Stefan Bund <g0dil@berlios.de>
 // Free Software Foundation, Inc.,
 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
-// Definition of non-inline non-template functions
+/** \file
+    \brief Sysdir public header */
 
-//#include "test.hh"
-//#include "test.ih"
+#ifndef HH_Sysdir_
+#define HH_Sysdir_ 1
 
 // Custom includes
-#define BOOST_AUTO_TEST_MAIN
-#include "../Utils/auto_unit_test.hh"
-#include <boost/test/test_tools.hpp>
+#include "Node.hh"
 
-#define prefix_
-///////////////////////////////cc.p////////////////////////////////////////
+//#include "Sysdir.mpp"
+///////////////////////////////hh.p////////////////////////////////////////
 
+namespace senf {
+namespace console {
 
-///////////////////////////////cc.e////////////////////////////////////////
-#undef prefix_
+    ScopedDirectory<> & sysdir();
+
+}}
+
+///////////////////////////////hh.e////////////////////////////////////////
+#include "Sysdir.cci"
+//#include "Sysdir.ct"
+//#include "Sysdir.cti"
+#endif
 
 \f
 // Local Variables:
 // mode: c++
 // fill-column: 100
+// comment-column: 40
 // c-file-style: "senf"
 // indent-tabs-mode: nil
 // ispell-local-dictionary: "american"
 // compile-command: "scons -u test"
-// comment-column: 40
 // End:
similarity index 77%
rename from Console/Node.ih
rename to Scheduler/Console/Sysdir.ih
index 1a02bdd..56ab1fc 100644 (file)
 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
 /** \file
-    \brief Node internal header */
+    \brief Sysdir internal header */
 
-#ifndef IH_Node_
-#define IH_Node_ 1
+#ifndef IH_Sysdir_
+#define IH_Sysdir_ 1
 
 // Custom includes
 
@@ -34,26 +34,22 @@ namespace senf {
 namespace console {
 namespace detail {
 
-#ifndef DOXYGEN
-
-    class NodeTraverser
+    class SysdirManager
+        : public singleton<SysdirManager>
     {
     public:
-        NodeTraverser(DirectoryNode & root, DirectoryNode & dir, bool autocomplete);
+        using singleton<SysdirManager>::instance;
+        using singleton<SysdirManager>::alive;
         
-        void operator()(std::string const & name);
+        ScopedDirectory<> & sysdir();
         
-        GenericNode & node();
-      
     private:
-        DirectoryNode & root_;
-        DirectoryNode::ptr dir_;
-        bool autocomplete_;
-        std::string elt_;
-        bool init_;
-    };
+        SysdirManager();
 
-#endif
+        ScopedDirectory<> sysdir_;
+
+        friend class singleton<SysdirManager>;
+    };
 
 }}}
 
similarity index 98%
copy from Console/Traits.cc
copy to Scheduler/Console/Traits.cc
index 81acbe7..1f082eb 100644 (file)
@@ -27,7 +27,7 @@
 #include "Traits.ih"
 
 // Custom includes
-#include "../Utils/senfassert.hh"
+#include "../../Utils/senfassert.hh"
 
 //#include "Traits.mpp"
 #define prefix_
similarity index 98%
rename from Console/Traits.cti
rename to Scheduler/Console/Traits.cti
index 4ffa5a7..afaa43b 100644 (file)
@@ -28,7 +28,7 @@
 // Custom includes
 #include <sstream>
 #include <boost/lexical_cast.hpp>
-#include "../Utils/TypeInfo.hh"
+#include "../../Utils/TypeInfo.hh"
 
 #define prefix_ inline
 ///////////////////////////////cti.p///////////////////////////////////////
similarity index 99%
rename from Console/Traits.hh
rename to Scheduler/Console/Traits.hh
index b647dd4..900b2b1 100644 (file)
@@ -29,7 +29,7 @@
 // Custom includes
 #include <iostream>
 #include <boost/intrusive_ptr.hpp>
-#include "../Utils/intrusive_refcount.hh"
+#include "../../Utils/intrusive_refcount.hh"
 #include "Parse.hh"
 #include "Node.hh"
 
similarity index 99%
rename from Console/Traits.ih
rename to Scheduler/Console/Traits.ih
index 2e46835..7d97e70 100644 (file)
@@ -33,7 +33,7 @@
 #include <boost/preprocessor/facilities/empty.hpp>
 #include <boost/bimap.hpp>
 #include <boost/assign/list_inserter.hpp>
-#include "../Utils/singleton.hh"
+#include "../../Utils/singleton.hh"
 
 ///////////////////////////////ih.p////////////////////////////////////////
 
similarity index 99%
rename from Console/Traits.test.cc
rename to Scheduler/Console/Traits.test.cc
index bc122ea..b8d366b 100644 (file)
@@ -33,7 +33,7 @@
 #include "Parse.hh"
 #include "ScopedDirectory.hh"
 
-#include "../Utils/auto_unit_test.hh"
+#include "../../Utils/auto_unit_test.hh"
 #include <boost/test/test_tools.hpp>
 
 #define prefix_
similarity index 98%
rename from Console/Variables.test.cc
rename to Scheduler/Console/Variables.test.cc
index 502474d..0bcebc7 100644 (file)
@@ -34,7 +34,7 @@
 #include "Parse.hh"
 #include "ScopedDirectory.hh"
 
-#include "../Utils/auto_unit_test.hh"
+#include "../../Utils/auto_unit_test.hh"
 #include <boost/test/test_tools.hpp>
 
 #define prefix_
similarity index 52%
rename from Console/Traits.cc
rename to Scheduler/EventManager.cc
index 81acbe7..0743cb6 100644 (file)
 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
 /** \file
-    \brief Traits non-inline non-template implementation */
+    \brief EventManager non-inline non-template implementation */
 
-#include "Traits.hh"
-#include "Traits.ih"
+//#include "EventManager.hh"
+//#include "EventManager.ih"
 
 // Custom includes
-#include "../Utils/senfassert.hh"
+#include <boost/format.hpp>
+#include "../Utils/membind.hh"
+#include "Console/Console.hh"
+#include "FIFORunner.hh"
 
-//#include "Traits.mpp"
+//#include "EventManager.mpp"
 #define prefix_
 ///////////////////////////////cc.p////////////////////////////////////////
 
-prefix_ long senf::console::detail::parseEnum(EnumTable const & table,
-                                              ParseCommandInfo::TokensRange const & tokens)
+prefix_ senf::scheduler::detail::EventManager::EventManager()
 {
-    if (tokens.size() != 1)
-        throw SyntaxErrorException("parameter syntax error");
-
-    EnumTable::left_map::const_iterator i (table.left.find(tokens.begin()[0].value()));
-    if (i == table.left.end())
-        throw SyntaxErrorException("parameter syntax error: invalid enum value");
-    return i->second;
+#ifndef SENF_DISABLE_CONSOLE
+    consoleDir_().add("events", senf::membind(&EventManager::consoleEvents, this));
+    senf::console::sysdir().add("scheduler", consoleDir_());
+#endif
 }
 
-prefix_ std::string senf::console::detail::formatEnum(EnumTable const & table, long value)
+prefix_ void senf::scheduler::detail::EventManager::consoleEvents(std::ostream & os)
 {
-    EnumTable::right_map::const_iterator i (table.right.find(value));
-    SENF_ASSERT( i != table.right.end() );
-    return i->second;
+    iterator i (begin());
+    iterator const i_end (end());
+    // On an 80 column display, this wraps nicely directly before the RUN column
+    os << boost::format("%-6s %-52s %-10s %-8s %7s %s\n")
+        % "TYPE"
+        % "NAME"
+        % "ADDRESS"
+        % "ACTIVE?"
+        % "RUN"
+        % "INFO";
+    for (; i != i_end; ++i)
+        os << boost::format("%-6.6s %-52.52s 0x%08x %-8.8s %7d %s\n")
+            % i->type()
+            % i->name() 
+            % reinterpret_cast<unsigned long>(&(*i))
+            % (i->enabled() ? "enabled" : "disabled")
+            % i->runCount()
+            % i->info();
 }
 
 ///////////////////////////////cc.e////////////////////////////////////////
 #undef prefix_
-//#include "Traits.mpp"
+//#include "EventManager.mpp"
 
 \f
 // Local Variables:
diff --git a/Scheduler/EventManager.cci b/Scheduler/EventManager.cci
new file mode 100644 (file)
index 0000000..010e8f2
--- /dev/null
@@ -0,0 +1,128 @@
+// $Id$
+//
+// Copyright (C) 2008 
+// Fraunhofer Institute for Open Communication Systems (FOKUS)
+// Competence Center NETwork research (NET), St. Augustin, GERMANY
+//     Stefan Bund <g0dil@berlios.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.,
+// 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+/** \file
+    \brief EventManager inline non-template implementation */
+
+//#include "EventManager.ih"
+
+// Custom includes
+
+#define prefix_ inline
+///////////////////////////////cci.p///////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////////////
+// senf::scheduler::detail::Event
+
+prefix_ senf::scheduler::detail::Event::Event(std::string const & name)
+    : name_ (name), runCount_ (0u)
+{
+    EventManager::instance().add(*this);
+}
+
+prefix_ senf::scheduler::detail::Event::~Event()
+{
+    EventManager::instance().remove(*this);
+}
+
+prefix_ void senf::scheduler::detail::EventManager::add(Event & event)
+{
+    events_.push_back(event);
+}
+
+prefix_ void senf::scheduler::detail::EventManager::remove(Event & event)
+{
+    events_.erase(EventList::current(event));
+}
+
+prefix_ std::string const & senf::scheduler::detail::Event::name()
+    const
+{
+    return name_;
+}
+
+prefix_ bool senf::scheduler::detail::Event::enabled()
+    const
+{
+    return v_enabled();
+}
+
+prefix_ unsigned senf::scheduler::detail::Event::runCount()
+    const
+{
+    return runCount_;
+}
+
+prefix_ char const * senf::scheduler::detail::Event::type()
+    const
+{
+    return v_type();
+}
+
+prefix_ std::string senf::scheduler::detail::Event::info()
+    const
+{
+    return v_info();
+}
+
+prefix_ void senf::scheduler::detail::Event::countRun()
+{
+    ++ runCount_;
+}
+
+///////////////////////////////////////////////////////////////////////////
+// senf::scheduler::detail::EventManager
+
+prefix_ bool senf::scheduler::detail::EventManager::IteratorFilter::operator()(Event const & e)
+{
+    return e.type() != 0;
+}
+
+prefix_ senf::scheduler::detail::EventManager::iterator
+senf::scheduler::detail::EventManager::begin()
+    const
+{
+    // We need to filter out elements with e.type() == 0 ... the NullTask temporarily added
+    // by the FIFORunner is such an element and must be skipped.
+    return boost::make_filter_iterator(IteratorFilter(), events_.begin(), events_.end());
+}
+
+prefix_ senf::scheduler::detail::EventManager::iterator
+senf::scheduler::detail::EventManager::end()
+    const
+{
+    return boost::make_filter_iterator(IteratorFilter(), events_.end(), events_.end());
+}
+
+///////////////////////////////cci.e///////////////////////////////////////
+#undef prefix_
+
+\f
+// Local Variables:
+// mode: c++
+// fill-column: 100
+// comment-column: 40
+// c-file-style: "senf"
+// indent-tabs-mode: nil
+// ispell-local-dictionary: "american"
+// compile-command: "scons -u test"
+// End:
diff --git a/Scheduler/EventManager.hh b/Scheduler/EventManager.hh
new file mode 100644 (file)
index 0000000..56a32ae
--- /dev/null
@@ -0,0 +1,140 @@
+// $Id$
+//
+// Copyright (C) 2008 
+// Fraunhofer Institute for Open Communication Systems (FOKUS)
+// Competence Center NETwork research (NET), St. Augustin, GERMANY
+//     Stefan Bund <g0dil@berlios.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.,
+// 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+/** \file
+    \brief EventManager public header */
+
+#ifndef HH_SchedulerEventManager_
+#define HH_SchedulerEventManager_ 1
+
+// Custom includes
+#include <string>
+#include <boost/iterator/filter_iterator.hpp>
+#include "../boost/intrusive/ilist.hpp"
+#include "../boost/intrusive/ilist_hook.hpp"
+#include "../Utils/singleton.hh"
+#include "Console/LazyDirectory.hh"
+
+//#include "EventManager.mpp"
+///////////////////////////////hh.p////////////////////////////////////////
+
+namespace senf {
+namespace scheduler {
+namespace detail {
+
+    class Event;
+    struct EventListTag;
+    typedef boost::intrusive::ilist_base_hook<EventListTag> EventListBase;
+    typedef boost::intrusive::ilist<EventListBase::value_traits<Event>, false> EventList;
+
+    /** \brief
+      */
+    class Event
+        : public EventListBase
+    {
+    public:
+        ///////////////////////////////////////////////////////////////////////////
+        // Types
+
+        ///////////////////////////////////////////////////////////////////////////
+        ///\name Structors and default members
+        ///@{
+        
+        explicit Event(std::string const & name);
+        virtual ~Event();
+
+        ///@}
+        ///////////////////////////////////////////////////////////////////////////
+
+        std::string const & name() const;
+        bool enabled() const;
+        unsigned runCount() const;
+        char const * type() const;
+        std::string info() const;
+
+    protected:
+        void countRun();
+
+    private:
+        virtual bool v_enabled() const = 0;
+        virtual char const * v_type() const = 0;
+        virtual std::string v_info() const = 0;
+
+        std::string name_;
+        unsigned runCount_;
+    };
+
+    /** \brief
+      */
+    class EventManager
+        : public singleton<EventManager>
+    {
+        struct IteratorFilter {
+            bool operator()(Event const & e);
+        };
+
+    public:
+        using singleton<EventManager>::instance;
+        using singleton<EventManager>::alive;
+        
+        typedef boost::filter_iterator<IteratorFilter, EventList::const_iterator> iterator;
+
+        void add(Event & event);
+        void remove(Event & event);
+
+        iterator begin() const;
+        iterator end() const;
+
+    protected:
+
+    private:
+        EventManager();
+
+        EventList events_;
+
+        friend class singleton<EventManager>;
+
+#ifndef SENF_DISABLE_CONSOLE
+        void consoleEvents(std::ostream & os);
+        
+        console::LazyDirectory consoleDir_;
+#endif
+    };
+
+}}}
+
+///////////////////////////////hh.e////////////////////////////////////////
+#include "EventManager.cci"
+//#include "EventManager.ct"
+//#include "EventManager.cti"
+#endif
+
+\f
+// Local Variables:
+// mode: c++
+// fill-column: 100
+// comment-column: 40
+// c-file-style: "senf"
+// indent-tabs-mode: nil
+// ispell-local-dictionary: "american"
+// compile-command: "scons -u test"
+// End:
similarity index 55%
rename from Console/ConfigFile.cc
rename to Scheduler/EventManager.test.cc
index 45e0eee..806c89c 100644 (file)
 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
 /** \file
-    \brief ConfigFile non-inline non-template implementation */
+    \brief EventManager.test unit tests */
 
-#include "ConfigFile.hh"
-#include "ConfigFile.ih"
+//#include "EventManager.test.hh"
+//#include "EventManager.test.ih"
 
 // Custom includes
+#include "EventManager.hh"
+#include "FdEvent.hh"
+#include "TimerEvent.hh"
+#include "SignalEvent.hh"
+
+#include <boost/test/auto_unit_test.hpp>
+#include <boost/test/test_tools.hpp>
 
-//#include "ConfigFile.mpp"
 #define prefix_
 ///////////////////////////////cc.p////////////////////////////////////////
 
-///////////////////////////////////////////////////////////////////////////
-// senf::console::detail::ConfigFileSource
-
-prefix_ void senf::console::detail::ConfigFileSource::v_parse(RestrictedExecutor & executor)
+BOOST_AUTO_UNIT_TEST(eventManager)
 {
-     parser_.parseFile(filename_, boost::bind( boost::ref(executor),
-                                               boost::ref(std::cerr),
-                                               _1 ));
-}
+    senf::scheduler::FdEvent fdEvent ("fdEvent", 0);
+    senf::scheduler::TimerEvent timer ("timer", 0);
+    senf::scheduler::SignalEvent signal (SIGUSR2, 0, false);
 
-///////////////////////////////////////////////////////////////////////////
+    senf::scheduler::detail::EventManager & em (senf::scheduler::detail::EventManager::instance());
 
-prefix_ void senf::console::parseFile(std::string const & filename, DirectoryNode & root)
-{
-    ConfigFile cfg (filename, root);
-    cfg.parse();
+    senf::scheduler::detail::EventManager::iterator i (em.begin());
+    BOOST_REQUIRE( i != em.end() );
+    BOOST_CHECK( &(*i) == static_cast<senf::scheduler::detail::Event*>(&fdEvent) );
+    ++i;
+    BOOST_REQUIRE( i != em.end() );
+    BOOST_CHECK( &(*i) == static_cast<senf::scheduler::detail::Event*>(&timer) );
+    ++i;
+    BOOST_REQUIRE( i != em.end() );
+    BOOST_CHECK( &(*i) == static_cast<senf::scheduler::detail::Event*>(&signal) );
+    ++i;
+    BOOST_CHECK( i == em.end() );
 }
 
 ///////////////////////////////cc.e////////////////////////////////////////
 #undef prefix_
-//#include "ConfigFile.mpp"
 
 \f
 // Local Variables:
index 2b54eb6..8510c04 100644 (file)
@@ -102,7 +102,9 @@ namespace {
         : public senf::scheduler::detail::FIFORunner::TaskInfo
     {
         NullTask() : senf::scheduler::detail::FIFORunner::TaskInfo ("<null>") {}
-        void run() {};
+        virtual void v_run() {};
+        virtual char const * v_type() const { return 0; }
+        virtual std::string v_info() const { return ""; }
     };
 }
 
@@ -133,7 +135,7 @@ prefix_ void senf::scheduler::detail::FIFORunner::run()
             TaskInfo & task (*next_);
             if (task.runnable_) {
                 task.runnable_ = false;
-                runningName_ = task.name_;
+                runningName_ = task.name();
 #           ifdef SENF_DEBUG
                 runningBacktrace_ = task.backtrace_;
 #           endif
index 536865c..fb08059 100644 (file)
@@ -35,7 +35,7 @@
 ///////////////////////////////cci.p///////////////////////////////////////
 
 prefix_ senf::scheduler::detail::FIFORunner::TaskInfo::TaskInfo(std::string const & name)
-    : runnable_ (false), name_ (name)
+    : Event(name), runnable_ (false)
 {}
 
 prefix_ senf::scheduler::detail::FIFORunner::TaskInfo::~TaskInfo()
@@ -46,6 +46,18 @@ prefix_ void senf::scheduler::detail::FIFORunner::TaskInfo::setRunnable()
     runnable_ = true;
 }
 
+prefix_ void senf::scheduler::detail::FIFORunner::TaskInfo::run()
+{
+    v_run();
+    countRun();
+}
+
+prefix_ bool senf::scheduler::detail::FIFORunner::TaskInfo::v_enabled()
+    const
+{
+    return TaskListBase::linked();
+}
+
 prefix_ void senf::scheduler::detail::FIFORunner::enqueue(TaskInfo * task)
 {
     tasks_.push_back(*task);
index a6db0a5..49d62fa 100644 (file)
@@ -32,6 +32,7 @@
 #include "../boost/intrusive/ilist.hpp"
 #include "../boost/intrusive/ilist_hook.hpp"
 #include "../Utils/singleton.hh"
+#include "EventManager.hh"
 
 //#include "FIFORunner.mpp"
 ///////////////////////////////hh.p////////////////////////////////////////
@@ -56,26 +57,30 @@ namespace detail {
 
     public:
         class TaskInfo 
-            : public TaskListBase
+            : public Event, 
+              public TaskListBase
         {
         public:
             explicit TaskInfo(std::string const & name);
             virtual ~TaskInfo();
 
+            void run();
+
         protected:
             void setRunnable();
             
         private:
-            virtual void run() = 0;
+            virtual void v_run() = 0;
+            virtual bool v_enabled() const;
 
             bool runnable_;
-            std::string name_;
 #       ifdef SENF_DEBUG
             std::string backtrace_;
 #       endif
 
             friend class FIFORunner;
         };
+
         using singleton<FIFORunner>::instance;
         using singleton<FIFORunner>::alive;
 
@@ -87,11 +92,7 @@ namespace detail {
         void taskTimeout(unsigned ms);
         unsigned taskTimeout() const;
 
-        unsigned hangCount() const;     ///< Number of task expirations
-                                        /**< The FIFORunner manages a watchdog which checks, that a
-                                             single task does not run continuously for a longer time
-                                             or block. If a task runs for more than 1s, a warning is
-                                             printed  and the hangCount is increased. */
+        unsigned hangCount() const;
 
     protected:
 
index f6a6396..e3500ca 100644 (file)
@@ -27,6 +27,7 @@
 #include "FdEvent.ih"
 
 // Custom includes
+#include <sstream>
 #include "../Utils/senfassert.hh"
 
 //#include "FdEvent.mpp"
@@ -168,11 +169,34 @@ prefix_ void senf::scheduler::FdEvent::signal(int events)
     }
 }
 
-prefix_ void senf::scheduler::FdEvent::run()
+prefix_ void senf::scheduler::FdEvent::v_run()
 {
     cb_(signaledEvents_);
 }
 
+prefix_ char const * senf::scheduler::FdEvent::v_type()
+    const
+{
+    return "fd";
+}
+
+prefix_ std::string senf::scheduler::FdEvent::v_info()
+    const
+{
+    std::stringstream ss;
+
+    ss << "fd " << fd_;
+    if (! pollable_)
+        ss << " (NOT pollable)";
+    if (events_ & EV_READ)
+        ss << " READ";
+    if (events_ & EV_PRIO)
+        ss << " PRIO";
+    if (events_ & EV_WRITE)
+        ss << " WRITE";
+    return ss.str();
+}
+
 ///////////////////////////////cc.e////////////////////////////////////////
 #undef prefix_
 //#include "FdEvent.mpp"
index d574351..ff3642d 100644 (file)
@@ -157,7 +157,9 @@ namespace scheduler {
 
     private:
        virtual void signal(int events);
-       virtual void run();
+       virtual void v_run();
+        virtual char const * v_type() const;
+        virtual std::string v_info() const;
 
        Callback cb_;
        int fd_;
index 3b58ec6..f9804fc 100644 (file)
@@ -5,10 +5,19 @@ import SENFSCons
 
 ###########################################################################
 
-sources = SENFSCons.GlobSources()
+sources = SENFSCons.GlobSources(subdirs=[ 'Console' ], exclude=[ 'Console/testServer.cc' ])
 SENFSCons.StandardTargets(env)
+
 SENFSCons.Lib(env,
              library = 'Scheduler',
              sources = sources,
-             LIBS = [ 'Utils' ])
+             LIBS = [ 'Socket', 'Utils' ])
+
+SENFSCons.Binary(env, 'Console/testServer',
+                 sources = [ 'Console/testServer.cc' ],
+                 no_includes = True,
+                 LIBS = [ 'Scheduler', 'Socket', 'Utils' ])
+
 SENFSCons.Doxygen(env)
+
+SConscript("Console/SConscript")
index 32c5461..d66d506 100644 (file)
@@ -119,6 +119,23 @@ prefix_ void senf::scheduler::detail::SignalDispatcher::sigHandler(int signal, :
     write(instance().sigPipe_[1], siginfo, sizeof(*siginfo));
 }
 
+prefix_ void senf::scheduler::SignalEvent::v_run()
+{
+    cb_(siginfo_);
+}
+
+prefix_ char const * senf::scheduler::SignalEvent::v_type()
+    const
+{
+    return "signal";
+}
+
+prefix_ std::string senf::scheduler::SignalEvent::v_info()
+    const
+{
+    return "";
+}
+
 ///////////////////////////////cc.e////////////////////////////////////////
 #undef prefix_
 //#include "SignalEvent.mpp"
index 71b224c..b11e5f1 100644 (file)
@@ -93,11 +93,6 @@ prefix_ void senf::scheduler::SignalEvent::action(Callback const & cb)
     cb_ = cb;
 }
 
-prefix_ void senf::scheduler::SignalEvent::run()
-{
-    cb_(siginfo_);
-}
-
 ///////////////////////////////cci.e///////////////////////////////////////
 #undef prefix_
 
index bd6540d..cb78b15 100644 (file)
@@ -95,7 +95,9 @@ namespace scheduler {
         void action(Callback const & cb); ///< Change signal event callback
 
     private:
-        virtual void run();
+        virtual void v_run();
+        virtual char const * v_type() const;
+        virtual std::string v_info() const;
         
         int signal_;
         Callback cb_;
index 6e75a3d..572b3c1 100644 (file)
@@ -27,6 +27,7 @@
 #include "TimerEvent.ih"
 
 // Custom includes
+#include <sstream>
 
 //#include "TimerEvent.mpp"
 #define prefix_
@@ -163,12 +164,28 @@ prefix_ void senf::scheduler::detail::TimerDispatcher::reschedule()
 ///////////////////////////////////////////////////////////////////////////
 // senf::scheduler::detail::TimerDispatcher::TimerEvent
 
-prefix_ void senf::scheduler::TimerEvent::run()
+prefix_ void senf::scheduler::TimerEvent::v_run()
 {
     disable();
     cb_();
 }
 
+prefix_ char const * senf::scheduler::TimerEvent::v_type()
+    const
+{
+    return "timer";
+}
+
+prefix_ std::string senf::scheduler::TimerEvent::v_info()
+    const
+{
+    std::stringstream ss;
+    ss.imbue( std::locale(ss.getloc(),
+                          new boost::posix_time::time_facet("%Y-%m-%d %H:%M:%S.%f-0000")) );
+    ss << "expire " << ClockService::abstime(timeout_);
+    return ss.str();
+}
+
 ///////////////////////////////cc.e////////////////////////////////////////
 #undef prefix_
 //#include "TimerEvent.mpp"
index b228890..4c06dfc 100644 (file)
@@ -116,7 +116,9 @@ namespace scheduler {
                                                  enable callback automatically. */
 
     private:
-        virtual void run();
+        virtual void v_run();
+        virtual char const * v_type() const;
+        virtual std::string v_info() const;
 
         Callback cb_;
         ClockService::clock_type timeout_;
index 67b1bdc..3177782 100644 (file)
@@ -21,7 +21,7 @@ SENFSCons.Lib(env,
               library = 'Socket',
               sources = sources + subob,
               testSources = testSources,
-              LIBS = [ 'Scheduler', 'Utils' ])
+              LIBS = [ 'Utils' ])
 
 SENFSCons.Doxygen(env, extra_sources = [
     env.Dia2Png('SocketLibrary-classes.dia'),
index d6b8d91..2326897 100644 (file)
@@ -572,7 +572,7 @@ prefix_ senf::detail::DaemonWatcher::DaemonWatcher(int pid, int coutpipe, int ce
     : childPid_(pid), coutpipe_(coutpipe), cerrpipe_(cerrpipe), stdout_(stdout),
       stderr_(stderr), sigChld_(false),
       cldSignal_ (SIGCHLD, senf::membind(&DaemonWatcher::sigChld, this)),
-      timer_ ("DaemanWatcher watchdog", senf::membind(&DaemonWatcher::childOk, this)),
+      timer_ ("senf::detail::DaemonWatcher::childOk", senf::membind(&DaemonWatcher::childOk, this)),
       coutForwarder_(coutpipe_, boost::bind(&DaemonWatcher::pipeClosed, this, 1)), 
       cerrForwarder_(cerrpipe_, boost::bind(&DaemonWatcher::pipeClosed, this, 2)) 
 {
@@ -640,7 +640,7 @@ prefix_ void senf::detail::DaemonWatcher::childOk()
 
 prefix_ senf::detail::DaemonWatcher::Forwarder::Forwarder(int src, Callback cb)
     : src_(src), cb_(cb), 
-      readevent_("DaemanWatcher::Forwarder", senf::membind(&Forwarder::readData, this),
+      readevent_("senf::detail::DaemonWatcher::Forwarder::readevent", senf::membind(&Forwarder::readData, this),
                  src_, scheduler::FdEvent::EV_READ)
 {}
 
index 36e0f2f..50c8c6c 100644 (file)
@@ -33,7 +33,7 @@
 
 prefix_ senf::detail::DaemonWatcher::Forwarder::Target::Target(Forwarder & fwd, int fd_)
     : fd (fd_), offset (0),
-      writeevent ("DaemonWatcher::Forwarder::Target",
+      writeevent ("senf::detail::DaemonWatcher::Forwarder::Target::writeevent",
                   boost::bind(&Forwarder::writeData, &fwd, _1, this),
                   fd, scheduler::FdEvent::EV_WRITE, false)
 {}
index d7d4586..db6cfbe 100644 (file)
@@ -12,6 +12,6 @@ sources = SENFSCons.GlobSources()
 SENFSCons.Lib( env,
                library = 'Utils_Daemon',
                sources = sources,
-               LIBS = [ 'Scheduler', 'Utils' ] )
+               LIBS = [ 'Scheduler', 'Socket', 'Utils' ] )
 
 SENFSCons.Doxygen(env)
index 2b11670..38936b1 100644 (file)
@@ -20,7 +20,7 @@
 // Free Software Foundation, Inc.,
 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
-#include "Console/Console.hh"
+#include "Scheduler/Console/Console.hh"
 
 \f
 // Local Variables: