Utils/Console: changed order of factory::Command parameters
tho [Wed, 3 Feb 2010 13:12:31 +0000 (13:12 +0000)]
git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@1561 270642c3-0616-0410-b53a-bc976706d245

senf/Socket/Protocols/DVB/DVBProtocolWrapper.cc
senf/Socket/Protocols/DVB/DVBSocketController.cc
senf/Utils/Console/ParsedCommand.cti
senf/Utils/Console/ParsedCommand.hh
senf/Utils/Console/ScopedDirectory.test.cc
senf/Utils/Logger/FileTarget.cc
senf/Utils/Logger/LogFormat.cc
senf/Utils/Logger/SyslogUDPTarget.cc
senf/Utils/Logger/Target.cc
senf/Utils/Statistics.cc
senf/Utils/Statistics.cci

index 733c94d..25abd61 100644 (file)
@@ -36,14 +36,14 @@ prefix_ senf::DVBSectionProtocolWrapper::DVBSectionProtocolWrapper(senf::DVBDemu
     namespace kw = senf::console::kw;
     namespace fty = senf::console::factory;
 
-    dir.add("buffersize", fty::Command(this, &DVBSectionProtocolWrapper::setBufferSize)
+    dir.add("buffersize", fty::Command(&DVBSectionProtocolWrapper::setBufferSize, this)
            .doc("Set the size of the circular buffer used for filtered data.")
            .arg("size", "in byte") );
 
-    dir.add("start", fty::Command(this,&DVBSectionProtocolWrapper::startFiltering)
+    dir.add("start", fty::Command(&DVBSectionProtocolWrapper::startFiltering, this)
            .doc("Starts filtering") );
 
-    dir.add("stop", fty::Command(this, &DVBSectionProtocolWrapper::setBufferSize)
+    dir.add("stop", fty::Command(&DVBSectionProtocolWrapper::setBufferSize, this)
            .doc("Stops filtering") );
 
     dir.add("filter", 
@@ -53,7 +53,7 @@ prefix_ senf::DVBSectionProtocolWrapper::DVBSectionProtocolWrapper(senf::DVBDemu
                                    unsigned, 
                                    unsigned, 
                                    unsigned)
-           >(this, &DVBSectionProtocolWrapper::setSectionFilter)
+           >(&DVBSectionProtocolWrapper::setSectionFilter, this)
            .arg("pid", "pid to filter")
            .arg("filter", "filter", 
                 kw::default_value = 62, 
@@ -72,7 +72,7 @@ prefix_ senf::DVBSectionProtocolWrapper::DVBSectionProtocolWrapper(senf::DVBDemu
                 kw::default_doc = "0x00")
            .doc("Sets parameters for section filter.") );
 
-    dir.add("stop", fty::Command(this, &DVBSectionProtocolWrapper::setBufferSize)
+    dir.add("stop", fty::Command(&DVBSectionProtocolWrapper::setBufferSize, this)
            .doc("Stops filtering") );
 }
 
@@ -89,7 +89,7 @@ prefix_ senf::DVBPESProtocolWrapper::DVBPESProtocolWrapper(senf::DVBDemuxPESHand
                                    dmx_output_t, 
                                    dmx_pes_type_t, 
                                    senf::console::FlagCollection<Flags>)
-           >(this,&DVBPESProtocolWrapper::setPESFilter)
+           >(&DVBPESProtocolWrapper::setPESFilter, this)
            .arg("pid", "pid to filter")
            .arg("input", "input-filter: DMX_IN_FRONTEND DMX_IN_DVR ")
            .arg("output", "output-filter: DMX_OUT_DECODER DMX_OUT_TAP DMX_OUT_TS_TAP ")
@@ -101,10 +101,10 @@ prefix_ senf::DVBPESProtocolWrapper::DVBPESProtocolWrapper(senf::DVBDemuxPESHand
                 kw::default_doc = "(IMMEDIATE_START CHECK_CRC)")
            .doc("Sets parameters for PES filter.") );
     
-    dir.add("start", fty::Command(this, &DVBPESProtocolWrapper::startFiltering)
+    dir.add("start", fty::Command(&DVBPESProtocolWrapper::startFiltering, this)
            .doc("Starts filtering") );
 
-    dir.add("stop", fty::Command(this, &DVBPESProtocolWrapper::stopFiltering)
+    dir.add("stop", fty::Command(&DVBPESProtocolWrapper::stopFiltering, this)
            .doc("Stops filtering") );
 }
 
index 21c18ab..a525fad 100644 (file)
@@ -431,10 +431,10 @@ prefix_ void senf::DVBSocketController::initConsole()
     dir.doc("DVB Controller " + controllerNr);
     ++controllerNr;
 
-    dir.add("type", fty::Command(this, &DVBSocketController::getTypeString)
+    dir.add("type", fty::Command(&DVBSocketController::getTypeString, this)
            .doc("Shows actual type of card DVB-{T, S, C}") );
 
-    dir.add("info", fty::Command(this, &DVBSocketController::getTuneInfo)
+    dir.add("info", fty::Command(&DVBSocketController::getTuneInfo, this)
            .doc("Returns a string which shows actual tuning status.\n"
                 "'S' prints signal strength (in hex)\n"
                 "'s' prints singal to noise ration (in hex)\n"
@@ -446,7 +446,7 @@ prefix_ void senf::DVBSocketController::initConsole()
                 "and could end in throwing an exception!")
            .arg("conf", "Ssbuf", kw::default_value = "Ssbuf") );
 
-    dir.add("tune", fty::Command(this,&DVBSocketController::tuneToCMD)
+    dir.add("tune", fty::Command(&DVBSocketController::tuneToCMD, this)
            .doc("tunes to channel listet in the configfile.")
            .arg("channel", "channel to tune")
            .arg("mode", "mode 'sync' or 'async'", kw::default_value = "async") );
index b7c7cfc..d6d6048 100644 (file)
@@ -384,7 +384,7 @@ Command(Function fn,
 template <class Owner, class Member>
 prefix_ senf::console::SimpleOverloadAttributor 
 senf::console::factory::
-Command(Owner * owner, Member memfn,
+Command(Member memfn, Owner * owner,
         typename boost::enable_if<boost::is_member_function_pointer<Member> >::type *,
         typename boost::enable_if_c<detail::ParsedCommandTraits<Member>::is_simple>::type *)
 {
@@ -394,7 +394,7 @@ Command(Owner * owner, Member memfn,
 template <class Owner, class Member>
 prefix_ senf::console::SimpleOverloadAttributor 
 senf::console::factory::
-Command(Owner const * owner, Member memfn,
+Command(Member memfn, Owner const * owner,
         typename boost::enable_if<boost::is_member_function_pointer<Member> >::type *,
         typename boost::enable_if_c<detail::ParsedCommandTraits<Member>::is_simple>::type *)
 {
@@ -440,7 +440,7 @@ Command(Function fn,
 template <class Owner, class Member>
 prefix_ typename senf::console::detail::ParsedCommandTraits<Member>::Attributor
 senf::console::factory::
-Command(Owner * owner, Member memfn,
+Command(Member memfn, Owner * owner,
              typename boost::enable_if<boost::is_member_function_pointer<Member> >::type *)
 {
     return detail::addOverloadedCommandNode<Member>(senf::membind(memfn,owner));
@@ -449,7 +449,7 @@ Command(Owner * owner, Member memfn,
 template <class Owner, class Member>
 prefix_ typename senf::console::detail::ParsedCommandTraits<Member>::Attributor
 senf::console::factory::
-Command(Owner const * owner, Member memfn,
+Command(Member memfn, Owner const * owner,
              typename boost::enable_if<boost::is_member_function_pointer<Member> >::type *)
 {
     return detail::addOverloadedCommandNode<Member>(senf::membind(memfn,owner));
@@ -458,7 +458,7 @@ Command(Owner const * owner, Member memfn,
 template <class CastTo, class Owner, class Member>
 prefix_ typename senf::console::detail::ParsedCommandTraits<CastTo>::Attributor
 senf::console::factory::
-Command(Owner * owner, Member memfn,
+Command(Member memfn, Owner * owner,
              typename boost::enable_if<boost::is_member_function_pointer<Member> >::type *)
 {
     return detail::addOverloadedCommandNode<CastTo>(senf::membind(memfn,owner));
@@ -467,7 +467,7 @@ Command(Owner * owner, Member memfn,
 template <class CastTo, class Owner, class Member>
 prefix_ typename senf::console::detail::ParsedCommandTraits<CastTo>::Attributor
 senf::console::factory::
-Command(Owner const * owner, Member memfn,
+Command(Member memfn, Owner const * owner,
              typename boost::enable_if<boost::is_member_function_pointer<Member> >::type *)
 {
     return detail::addOverloadedCommandNode<CastTo>(senf::membind(memfn,owner));
index 0e96d8f..7571904 100644 (file)
@@ -584,13 +584,13 @@ namespace factory {
 
     template <class Owner, class Member>
     SimpleOverloadAttributor
-    Command(Owner * owner, Member memfn,
+    Command(Member memfn, Owner * owner,
             typename boost::enable_if<boost::is_member_function_pointer<Member> >::type * = 0,
             typename boost::enable_if_c<detail::ParsedCommandTraits<Member>::is_simple>::type * = 0);
 
     template <class Owner, class Member>
     SimpleOverloadAttributor
-    Command(Owner const * owner, Member memfn,
+    Command(Member memfn, Owner const * owner,
             typename boost::enable_if<boost::is_member_function_pointer<Member> >::type * = 0,
             typename boost::enable_if_c<detail::ParsedCommandTraits<Member>::is_simple>::type * = 0);
 
@@ -616,22 +616,22 @@ namespace factory {
 
     template <class Owner, class Member>
     typename senf::console::detail::ParsedCommandTraits<Member>::Attributor
-    Command(Owner * owner, Member memfn,
+    Command(Member memfn, Owner * owner,
             typename boost::enable_if<boost::is_member_function_pointer<Member> >::type * = 0);
 
     template <class Owner, class Member>
     typename senf::console::detail::ParsedCommandTraits<Member>::Attributor
-    Command(Owner const * owner, Member memfn,
+    Command(Member memfn, Owner const * owner,
             typename boost::enable_if<boost::is_member_function_pointer<Member> >::type * = 0);
     
     template <class CastTo, class Owner, class Member>
     typename senf::console::detail::ParsedCommandTraits<CastTo>::Attributor
-    Command(Owner * owner, Member memfn,
+    Command(Member memfn, Owner * owner,
             typename boost::enable_if<boost::is_member_function_pointer<Member> >::type * = 0);
 
     template <class CastTo, class Owner, class Member>
     typename senf::console::detail::ParsedCommandTraits<CastTo>::Attributor
-    Command(Owner const * owner, Member memfn,
+    Command(Member memfn, Owner const * owner,
             typename boost::enable_if<boost::is_member_function_pointer<Member> >::type * = 0);
 
 
index 0197408..8a8f203 100644 (file)
@@ -43,7 +43,7 @@ namespace {
 
         senf::console::ScopedDirectory<Self> dir;
         TestObject() : dir(this) {
-            dir.add("member", senf::console::factory::Command(this, &Self::member));
+            dir.add("member", senf::console::factory::Command(&Self::member, this));
         }
 
         void member(std::ostream & os, senf::console::ParseCommandInfo const &) {
index e4bf38f..33d64e2 100644 (file)
@@ -58,11 +58,11 @@ prefix_ senf::log::FileTarget::FileTarget(std::string const & filename,
         SENF_THROW_SYSTEM_EXCEPTION("logfile open") << ": " << filename;
     consoleDir()
         .add( "reopen",
-              fty::Command(this, SENF_MEMFNP(void, FileTarget, reopen, ()))
+              fty::Command(SENF_MEMBINDFNP(void, FileTarget, reopen, ()))
               .doc("Reopen logfile") );
     consoleDir()
         .add("reopen", 
-             fty::Command(this, SENF_MEMFNP(void, FileTarget, reopen, (std::string const &)))
+             fty::Command(SENF_MEMBINDFNP(void, FileTarget, reopen, (std::string const &)))
              .arg("filename","new filename")
              .overloadDoc("Reopen logfile under new name") );
     consoleDir()
index 55304a9..f77ca72 100644 (file)
@@ -54,24 +54,24 @@ prefix_ senf::log::detail::LogFormat::LogFormat(console::ScopedDirectory<> & dir
 
     timeFormat("%Y-%m-%d %H:%M:%S.%f-0000");
 
-    dir.add("showTime", fty::Command(this, &LogFormat::showTime)
+    dir.add("showTime", fty::Command(&LogFormat::showTime, this)
             .arg("flag","whether to display the time in log messages",
                  kw::default_value = true)
             .doc("Set time display in log messages. If time display is enabled, see the 'timeFormat'\n"
                  "command to set the time format.") );
-    dir.add("showStream", fty::Command(this, &LogFormat::showStream)
+    dir.add("showStream", fty::Command(&LogFormat::showStream, this)
             .arg("flag","whether to display the stream in log messages",
                  kw::default_value = true)
             .doc("Set strean display in log messages.") );
-    dir.add("showLevel", fty::Command(this, &LogFormat::showLevel)
+    dir.add("showLevel", fty::Command(&LogFormat::showLevel, this)
             .arg("flag","whether to display the log level in log messages",
                  kw::default_value = true)
             .doc("Set log level display in log messages.") );
-    dir.add("showArea", fty::Command(this, &LogFormat::showArea)
+    dir.add("showArea", fty::Command(&LogFormat::showArea, this)
             .arg("flag","whether to display the area in log messages",
                  kw::default_value = true)
             .doc("Set area display in log messages.") );
-    dir.add("timeFormat", fty::Command(this, &LogFormat::timeFormat)
+    dir.add("timeFormat", fty::Command(&LogFormat::timeFormat, this)
             .arg("format","time format")
             .doc("Set time format. The time format is specified using a format string. This format\n"
                  "string follows the strftime format.\n"
@@ -79,11 +79,11 @@ prefix_ senf::log::detail::LogFormat::LogFormat(console::ScopedDirectory<> & dir
                  "As additional option, the format string may be set to the empty string. In this\n"
                  "case the time will be displayed as 'second.nanosecond' value. IN this case, the\n"
                  "time is displayed relative to the first message after changing the format.") );
-    dir.add("tag", fty::Command(this, &LogFormat::tag)
+    dir.add("tag", fty::Command(&LogFormat::tag, this)
             .arg("tag","log message tag prefix")
             .doc("Every log message is optionally prefixed with a tag value. This value defaults to\n"
                  "the executable name and pid.") );
-    dir.add("format", fty::Command(this, &LogFormat::consoleFormat)
+    dir.add("format", fty::Command(&LogFormat::consoleFormat, this)
             .doc("Show the current log message format.") );
 }
 
index b5a04e5..28eccd0 100644 (file)
@@ -43,10 +43,10 @@ prefix_ void senf::log::SyslogUDPTarget::init()
 
     consoleDir().remove("format");
     consoleDir()
-        .add("format", fty::Command(this, &SyslogUDPTarget::consoleFormat)
+        .add("format", fty::Command(&SyslogUDPTarget::consoleFormat, this)
              .doc("Show the current log message format.") );
     consoleDir()
-        .add("syslog", fty::Command(this, SENF_MEMFNP(void, SyslogUDPTarget, syslog, (bool)))
+        .add("syslog", fty::Command(SENF_MEMBINDFNP(void, SyslogUDPTarget, syslog, (bool)))
              .arg("flag","new syslog format state",
                   kw::default_value=true)
              .doc("Change the syslog format flag. By default, syslog formating is enabled. In this\n"
index 1069656..40af9e2 100644 (file)
@@ -60,7 +60,7 @@ prefix_ senf::log::Target::Target(std::string const & name)
 
     detail::TargetRegistry::instance().registerTarget(this, name);
     consoleDir_()
-        .add("list", fty::Command(this, &Target::consoleList)
+        .add("list", fty::Command(&Target::consoleList, this)
              .doc("Show routing table\n"
                   "\n"
                   "Columns:\n"
@@ -72,7 +72,7 @@ prefix_ senf::log::Target::Target(std::string const & name)
                   "                verbose, notice, message, important, critical, fatal\n"
                   "    ACTION  action to take: accept or reject") );
     consoleDir_()
-        .add("route", fty::Command(this, &Target::consoleRoute)
+        .add("route", fty::Command(&Target::consoleRoute, this)
              .arg("index", "index at which to insert new rule")
              .arg("parameters", "log parameters. The log parameters select the log stream, log area\n"
                   "              and log level. You may specify any combination of these parameterse\n"
@@ -108,11 +108,11 @@ prefix_ senf::log::Target::Target(std::string const & name)
              .arg("action", kw::default_value=ACCEPT) );
     consoleDir_()
         .add("unroute",
-             fty::Command(this, static_cast<void (Target::*)(int)>(&Target::unroute))
+             fty::Command(static_cast<void (Target::*)(int)>(&Target::unroute), this)
              .arg("index", "index of routing entry to remove")
              .overloadDoc("Remove routing entry with the given index") );
     consoleDir_()
-        .add("unroute", fty::Command(this, &Target::consoleUnroute)
+        .add("unroute", fty::Command(&Target::consoleUnroute, this)
              .arg("parameters", "log parameters. The log parameters select the log stream, log area\n"
                   "              and log level. You may specify any combination of these parameterse\n"
                   "              in any order. Use the '/sys/log/stream' and '/sys/log/areas' commands\n"
@@ -122,7 +122,7 @@ prefix_ senf::log::Target::Target(std::string const & name)
                   kw::default_value=ACCEPT)
              .overloadDoc("Remove the routing entry matching the specified arguments.") );
     consoleDir_()
-        .add("flush", fty::Command(this, &Target::flush)
+        .add("flush", fty::Command(&Target::flush, this)
              .doc("Remove all routing entries clearing the routing table. This will disable all\n"
                   "logging output on this target.") );
 }
@@ -402,13 +402,13 @@ prefix_ senf::log::detail::TargetRegistry::TargetRegistry()
 
     console::sysdir().add("log", consoleDir_());
     consoleDir_()
-        .add("areas", fty::Command(this, &TargetRegistry::consoleAreas)
+        .add("areas", fty::Command(&TargetRegistry::consoleAreas, this)
              .doc("List all areas") );
     consoleDir_()
-        .add("streams", fty::Command(this, &TargetRegistry::consoleStreams)
+        .add("streams", fty::Command(&TargetRegistry::consoleStreams, this)
              .doc("List all streams") );
     consoleDir_()
-        .add("message", fty::Command(this, &TargetRegistry::consoleWrite)
+        .add("message", fty::Command(&TargetRegistry::consoleWrite, this)
              .arg("parameters", "log parameters. The log parameters select the log stream, log area\n"
                   "              and log level. You may specify any combination of these parameterse\n"
                   "              in any order. Use the '/sys/log/stream' and '/sys/log/areas' commands\n"
@@ -424,7 +424,7 @@ prefix_ senf::log::detail::TargetRegistry::TargetRegistry()
                   "    message (FATAL) \"Program on fire\";\n"
                   "    message (VERBOSE senf::log::Debug) \"Debug message\";") );
     consoleDir_()
-        .add("self", fty::Command(this, &TargetRegistry::consoleSelf)
+        .add("self", fty::Command(&TargetRegistry::consoleSelf, this)
              .doc("Get the log directory of the current network client. Example usage:\n"
                   "\n"
                   "Just get the log config directory\n"
index 3dd6d89..0e1965f 100644 (file)
@@ -155,7 +155,7 @@ prefix_ senf::Statistics::Statistics()
 #ifndef SENF_DISABLE_CONSOLE
     namespace fty = senf::console::factory;
 
-    dir.add("list", fty::Command(this,&Statistics::consoleList)
+    dir.add("list", fty::Command(&Statistics::consoleList, this)
             .doc("List statistics collection intervals and current values.\n"
                  "\n"
                  "Columns:\n"
@@ -166,7 +166,7 @@ prefix_ senf::Statistics::Statistics()
                  "    AVG     Last entered average value.\n"
                  "    DEV     Standard deviation of average value over the collector rank.\n"
                  "    MAX     Last entered maximum value.") );
-    dir.add("collect", fty::Command(this, &Statistics::consoleCollect)
+    dir.add("collect", fty::Command(&Statistics::consoleCollect, this)
             .doc("Add statistics collection groups. The argument gives a sequence of collector\n"
                  "ranks each building on the preceding collector:\n"
                  "\n"
@@ -181,7 +181,7 @@ prefix_ senf::Statistics::Statistics()
                  "You may call collect multiple times. Any missing collection ranks will be\n"
                  "added.")
             .arg("ranks","chain of collector ranks") );
-    dir.add("output", fty::Command(this, &Statistics::consoleOutput)
+    dir.add("output", fty::Command(&Statistics::consoleOutput, this)
             .doc("Generate statistics output. This statement will add an additional output\n"
                  "generator. This generator will be attached to the collector specified by\n"
                  "the {rank} parameter. This parameter is a chain of successive rank values\n"
index 27c953d..5a31e36 100644 (file)
@@ -67,7 +67,7 @@ prefix_ void senf::StatisticsBase::OutputEntry::initDir()
 {
     namespace fty = senf::console::factory;
 
-    dir.add("list", fty::Command(this,&OutputEntry::consoleList)
+    dir.add("list", fty::Command(&OutputEntry::consoleList, this)
             .doc("List all known connected targets. This list might not be complete.") );
 }