namespace kw = senf::console::kw;
namespace fty = senf::console::factory;
- dir.add("buffersize", fty::BoundCommand(this, &DVBSectionProtocolWrapper::setBufferSize)
+ dir.add("buffersize", fty::Command(this, &DVBSectionProtocolWrapper::setBufferSize)
.doc("Set the size of the circular buffer used for filtered data.")
.arg("size", "in byte") );
- dir.add("start", fty::BoundCommand(this,&DVBSectionProtocolWrapper::startFiltering)
+ dir.add("start", fty::Command(this,&DVBSectionProtocolWrapper::startFiltering)
.doc("Starts filtering") );
- dir.add("stop", fty::BoundCommand(this, &DVBSectionProtocolWrapper::setBufferSize)
+ dir.add("stop", fty::Command(this, &DVBSectionProtocolWrapper::setBufferSize)
.doc("Stops filtering") );
dir.add("filter",
- fty::BoundCommand<void (unsigned short int,
+ fty::Command<void (unsigned short int,
unsigned,
senf::console::FlagCollection<Flags>,
unsigned,
kw::default_doc = "0x00")
.doc("Sets parameters for section filter.") );
- dir.add("stop", fty::BoundCommand(this, &DVBSectionProtocolWrapper::setBufferSize)
+ dir.add("stop", fty::Command(this, &DVBSectionProtocolWrapper::setBufferSize)
.doc("Stops filtering") );
}
namespace fty = senf::console::factory;
dir.add("filter",
- fty::BoundCommand<void (unsigned short int,
+ fty::Command<void (unsigned short int,
dmx_input_t,
dmx_output_t,
dmx_pes_type_t,
kw::default_doc = "(IMMEDIATE_START CHECK_CRC)")
.doc("Sets parameters for PES filter.") );
- dir.add("start", fty::BoundCommand(this, &DVBPESProtocolWrapper::startFiltering)
+ dir.add("start", fty::Command(this, &DVBPESProtocolWrapper::startFiltering)
.doc("Starts filtering") );
- dir.add("stop", fty::BoundCommand(this, &DVBPESProtocolWrapper::stopFiltering)
+ dir.add("stop", fty::Command(this, &DVBPESProtocolWrapper::stopFiltering)
.doc("Stops filtering") );
}
dir.doc("DVB Controller " + controllerNr);
++controllerNr;
- dir.add("type", fty::BoundCommand(this, &DVBSocketController::getTypeString)
+ dir.add("type", fty::Command(this, &DVBSocketController::getTypeString)
.doc("Shows actual type of card DVB-{T, S, C}") );
- dir.add("info", fty::BoundCommand(this, &DVBSocketController::getTuneInfo)
+ dir.add("info", fty::Command(this, &DVBSocketController::getTuneInfo)
.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"
"and could end in throwing an exception!")
.arg("conf", "Ssbuf", kw::default_value = "Ssbuf") );
- dir.add("tune", fty::BoundCommand(this,&DVBSocketController::tuneToCMD)
+ dir.add("tune", fty::Command(this,&DVBSocketController::tuneToCMD)
.doc("tunes to channel listet in the configfile.")
.arg("channel", "channel to tune")
.arg("mode", "mode 'sync' or 'async'", kw::default_value = "async") );
return node;
}
-///////////////////////////////////////////////////////////////////////////
-
-prefix_ senf::console::SimpleOverloadAttributor
-senf::console::factory::Command(SimpleCommandOverload::Function fn)
-{
- return SimpleOverloadAttributor(fn);
-}
-
/////////////////////////////cci.e///////////////////////////////////////
#undef prefix_
mutable boost::optional<std::string> shortdoc_;
};
-namespace factory {
-
- SimpleOverloadAttributor Command(SimpleCommandOverload::Function fn);
-
-}}}
+}}
///////////////////////////////hh.e////////////////////////////////////////
#include "OverloadedCommand.cci"
}}}
+///////////////////////////////////////////////////////////////////////////
+
+template <class Signature>
+prefix_ senf::console::SimpleOverloadAttributor
+senf::console::factory::
+Command(boost::function<Signature> fn,
+ typename boost::enable_if_c<detail::ParsedCommandTraits<Signature>::is_simple>::type *)
+{
+ return SimpleOverloadAttributor(fn);
+}
+
+template <class Function>
+prefix_ senf::console::SimpleOverloadAttributor
+senf::console::factory::
+Command(Function fn,
+ typename boost::enable_if_c<detail::ParsedCommandTraits<Function>::is_simple>::type *)
+{
+ return SimpleOverloadAttributor(fn);
+}
+
+template <class Owner, class Member>
+prefix_ senf::console::SimpleOverloadAttributor
+senf::console::factory::
+Command(Owner * owner, Member memfn,
+ typename boost::enable_if<boost::is_member_function_pointer<Member> >::type *,
+ typename boost::enable_if_c<detail::ParsedCommandTraits<Member>::is_simple>::type *)
+{
+ return SimpleOverloadAttributor(senf::membind(memfn,owner));
+}
+
+template <class Owner, class Member>
+prefix_ senf::console::SimpleOverloadAttributor
+senf::console::factory::
+Command(Owner const * owner, Member memfn,
+ typename boost::enable_if<boost::is_member_function_pointer<Member> >::type *,
+ typename boost::enable_if_c<detail::ParsedCommandTraits<Member>::is_simple>::type *)
+{
+ return SimpleOverloadAttributor(senf::membind(memfn,owner));
+}
+
template <class CastTo, class Signature>
prefix_ typename senf::console::detail::ParsedCommandTraits<CastTo>::Attributor
-senf::console::factory::Command(boost::function<Signature> fn)
+senf::console::factory::
+Command(boost::function<Signature> fn)
{
return detail::addOverloadedCommandNode<CastTo>(fn);
}
prefix_ typename senf::console::detail::ParsedCommandTraits<CastTo>::Attributor
senf::console::factory::
Command(Function fn,
- typename boost::enable_if_c<detail::ParsedCommandTraits<Function>::is_callable>::type *)
+ typename boost::enable_if_c<detail::ParsedCommandTraits<Function>::is_callable>::type *,
+ typename boost::disable_if<boost::is_member_function_pointer<Function> >::type *)
{
return detail::addOverloadedCommandNode<CastTo>(fn);
}
template <class Signature>
prefix_ typename senf::console::detail::ParsedCommandTraits<Signature>::Attributor
-senf::console::factory::Command(boost::function<Signature> fn)
+senf::console::factory::
+Command(boost::function<Signature> fn)
{
return detail::addOverloadedCommandNode<Signature>(fn);
}
prefix_ typename senf::console::detail::ParsedCommandTraits<Function>::Attributor
senf::console::factory::
Command(Function fn,
- typename boost::enable_if_c<detail::ParsedCommandTraits<Function>::is_callable>::type *)
+ typename boost::enable_if_c<detail::ParsedCommandTraits<Function>::is_callable>::type *,
+ typename boost::disable_if<boost::is_member_function_pointer<Function> >::type *)
{
return detail::addOverloadedCommandNode<Function>(fn);
}
template <class Owner, class Member>
prefix_ typename senf::console::detail::ParsedCommandTraits<Member>::Attributor
-senf::console::factory::BoundCommand(Owner * owner, Member memfn)
+senf::console::factory::
+Command(Owner * owner, Member memfn,
+ typename boost::enable_if<boost::is_member_function_pointer<Member> >::type *)
{
return detail::addOverloadedCommandNode<Member>(senf::membind(memfn,owner));
}
template <class Owner, class Member>
prefix_ typename senf::console::detail::ParsedCommandTraits<Member>::Attributor
-senf::console::factory::BoundCommand(Owner const * owner, Member memfn)
+senf::console::factory::
+Command(Owner const * owner, Member memfn,
+ typename boost::enable_if<boost::is_member_function_pointer<Member> >::type *)
{
return detail::addOverloadedCommandNode<Member>(senf::membind(memfn,owner));
}
template <class CastTo, class Owner, class Member>
prefix_ typename senf::console::detail::ParsedCommandTraits<CastTo>::Attributor
-senf::console::factory::BoundCommand(Owner * owner, Member memfn)
+senf::console::factory::
+Command(Owner * owner, Member memfn,
+ typename boost::enable_if<boost::is_member_function_pointer<Member> >::type *)
{
return detail::addOverloadedCommandNode<CastTo>(senf::membind(memfn,owner));
}
template <class CastTo, class Owner, class Member>
prefix_ typename senf::console::detail::ParsedCommandTraits<CastTo>::Attributor
-senf::console::factory::BoundCommand(Owner const * owner, Member memfn)
+senf::console::factory::
+Command(Owner const * owner, Member memfn,
+ typename boost::enable_if<boost::is_member_function_pointer<Member> >::type *)
{
return detail::addOverloadedCommandNode<CastTo>(senf::membind(memfn,owner));
}
#include <vector>
#include <boost/type_traits/function_traits.hpp>
-#include <boost/type_traits/is_member_pointer.hpp>
+#include <boost/type_traits/is_member_function_pointer.hpp>
#include <boost/mpl/if.hpp>
#include <boost/utility.hpp>
#include <boost/parameter/keyword.hpp>
namespace factory {
+ template <class Signature>
+ SimpleOverloadAttributor
+ Command(boost::function<Signature> fn,
+ typename boost::enable_if_c<detail::ParsedCommandTraits<Signature>::is_simple>::type * = 0);
+
+ template <class Function>
+ SimpleOverloadAttributor
+ Command(Function fn,
+ typename boost::enable_if_c<detail::ParsedCommandTraits<Function>::is_simple>::type * = 0);
+
+ template <class Owner, class Member>
+ SimpleOverloadAttributor
+ Command(Owner * owner, Member memfn,
+ 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,
+ 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 CastTo, class Signature>
typename senf::console::detail::ParsedCommandTraits<CastTo>::Attributor
Command(boost::function<Signature> fn);
template <class CastTo, class Function>
typename senf::console::detail::ParsedCommandTraits<CastTo>::Attributor
Command(Function fn,
- typename boost::enable_if_c<detail::ParsedCommandTraits<Function>::is_callable>::type * = 0);
-
+ typename boost::enable_if_c<detail::ParsedCommandTraits<Function>::is_callable>::type * = 0,
+ typename boost::disable_if<boost::is_member_function_pointer<Function> >::type * = 0);
+
template <class Signature>
typename senf::console::detail::ParsedCommandTraits<Signature>::Attributor
Command(boost::function<Signature> fn);
template <class Function>
typename senf::console::detail::ParsedCommandTraits<Function>::Attributor
Command(Function fn,
- typename boost::enable_if_c<detail::ParsedCommandTraits<Function>::is_callable>::type * = 0);
+ typename boost::enable_if_c<detail::ParsedCommandTraits<Function>::is_callable>::type * = 0,
+ typename boost::disable_if<boost::is_member_function_pointer<Function> >::type * = 0);
template <class Owner, class Member>
typename senf::console::detail::ParsedCommandTraits<Member>::Attributor
- BoundCommand(Owner * owner, Member memfn);
+ Command(Owner * owner, Member memfn,
+ typename boost::enable_if<boost::is_member_function_pointer<Member> >::type * = 0);
template <class Owner, class Member>
typename senf::console::detail::ParsedCommandTraits<Member>::Attributor
- BoundCommand(Owner const * owner, Member memfn);
-
+ Command(Owner const * owner, Member memfn,
+ 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
- BoundCommand(Owner * owner, Member memfn);
+ Command(Owner * owner, Member memfn,
+ 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
- BoundCommand(Owner const * owner, Member memfn);
+ Command(Owner const * owner, Member memfn,
+ typename boost::enable_if<boost::is_member_function_pointer<Member> >::type * = 0);
}}}
{
static const bool is_callable = false;
static const bool is_member = false;
+ static const bool is_simple = false;
};
template <class FunctionP, class Function>
static const bool is_callable = true;
static const bool is_member = boost::is_member_pointer<base_type>::value;
+ static const bool is_simple = false;
typedef typename senf::member_class<base_type>::type class_type;
// Disable auto-parsing for ParseCommandInfo arg -> register manually parsed command
template <class FunctionP>
struct ParsedCommandTraits_i<FunctionP, void (std::ostream &, ParseCommandInfo const &), true>
- {};
+ {
+ static const bool is_simple = true;
+ };
template <class FunctionP>
struct ParsedCommandTraits
senf::console::ScopedDirectory<Self> dir;
TestObject() : dir(this) {
- dir.add("member", senf::console::factory::Command(senf::membind(&Self::member,this)));
+ dir.add("member", senf::console::factory::Command(this, &Self::member));
}
void member(std::ostream & os, senf::console::ParseCommandInfo const &) {
SENF_THROW_SYSTEM_EXCEPTION("logfile open") << ": " << filename;
consoleDir()
.add( "reopen",
- fty::BoundCommand(this, SENF_MEMFNP(void, FileTarget, reopen, ()))
+ fty::Command(this, SENF_MEMFNP(void, FileTarget, reopen, ()))
.doc("Reopen logfile") );
consoleDir()
.add("reopen",
- fty::BoundCommand(this, SENF_MEMFNP(void, FileTarget, reopen, (std::string const &)))
+ fty::Command(this, SENF_MEMFNP(void, FileTarget, reopen, (std::string const &)))
.arg("filename","new filename")
.overloadDoc("Reopen logfile under new name") );
consoleDir()
timeFormat("%Y-%m-%d %H:%M:%S.%f-0000");
- dir.add("showTime", fty::BoundCommand(this, &LogFormat::showTime)
+ dir.add("showTime", fty::Command(this, &LogFormat::showTime)
.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::BoundCommand(this, &LogFormat::showStream)
+ dir.add("showStream", fty::Command(this, &LogFormat::showStream)
.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::BoundCommand(this, &LogFormat::showLevel)
+ dir.add("showLevel", fty::Command(this, &LogFormat::showLevel)
.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::BoundCommand(this, &LogFormat::showArea)
+ dir.add("showArea", fty::Command(this, &LogFormat::showArea)
.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::BoundCommand(this, &LogFormat::timeFormat)
+ dir.add("timeFormat", fty::Command(this, &LogFormat::timeFormat)
.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"
"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::BoundCommand(this, &LogFormat::tag)
+ dir.add("tag", fty::Command(this, &LogFormat::tag)
.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::BoundCommand(this, &LogFormat::consoleFormat)
+ dir.add("format", fty::Command(this, &LogFormat::consoleFormat)
.doc("Show the current log message format.") );
}
consoleDir().remove("format");
consoleDir()
- .add("format", fty::BoundCommand(this, &SyslogUDPTarget::consoleFormat)
+ .add("format", fty::Command(this, &SyslogUDPTarget::consoleFormat)
.doc("Show the current log message format.") );
consoleDir()
- .add("syslog", fty::BoundCommand(this, SENF_MEMFNP(void, SyslogUDPTarget, syslog, (bool)))
+ .add("syslog", fty::Command(this, SENF_MEMFNP(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"
detail::TargetRegistry::instance().registerTarget(this, name);
consoleDir_()
- .add("list", fty::BoundCommand(this, &Target::consoleList)
+ .add("list", fty::Command(this, &Target::consoleList)
.doc("Show routing table\n"
"\n"
"Columns:\n"
" verbose, notice, message, important, critical, fatal\n"
" ACTION action to take: accept or reject") );
consoleDir_()
- .add("route", fty::BoundCommand(this, &Target::consoleRoute)
+ .add("route", fty::Command(this, &Target::consoleRoute)
.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"
.arg("action", kw::default_value=ACCEPT) );
consoleDir_()
.add("unroute",
- fty::BoundCommand(this, static_cast<void (Target::*)(int)>(&Target::unroute))
+ fty::Command(this, static_cast<void (Target::*)(int)>(&Target::unroute))
.arg("index", "index of routing entry to remove")
.overloadDoc("Remove routing entry with the given index") );
consoleDir_()
- .add("unroute", fty::BoundCommand(this, &Target::consoleUnroute)
+ .add("unroute", fty::Command(this, &Target::consoleUnroute)
.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"
kw::default_value=ACCEPT)
.overloadDoc("Remove the routing entry matching the specified arguments.") );
consoleDir_()
- .add("flush", fty::BoundCommand(this, &Target::flush)
+ .add("flush", fty::Command(this, &Target::flush)
.doc("Remove all routing entries clearing the routing table. This will disable all\n"
"logging output on this target.") );
}
console::sysdir().add("log", consoleDir_());
consoleDir_()
- .add("areas", fty::BoundCommand(this, &TargetRegistry::consoleAreas)
+ .add("areas", fty::Command(this, &TargetRegistry::consoleAreas)
.doc("List all areas") );
consoleDir_()
- .add("streams", fty::BoundCommand(this, &TargetRegistry::consoleStreams)
+ .add("streams", fty::Command(this, &TargetRegistry::consoleStreams)
.doc("List all streams") );
consoleDir_()
- .add("message", fty::BoundCommand(this, &TargetRegistry::consoleWrite)
+ .add("message", fty::Command(this, &TargetRegistry::consoleWrite)
.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"
" message (FATAL) \"Program on fire\";\n"
" message (VERBOSE senf::log::Debug) \"Debug message\";") );
consoleDir_()
- .add("self", fty::BoundCommand(this, &TargetRegistry::consoleSelf)
+ .add("self", fty::Command(this, &TargetRegistry::consoleSelf)
.doc("Get the log directory of the current network client. Example usage:\n"
"\n"
"Just get the log config directory\n"
#ifndef SENF_DISABLE_CONSOLE
namespace fty = senf::console::factory;
- dir.add("list", fty::BoundCommand(this,&Statistics::consoleList)
+ dir.add("list", fty::Command(this,&Statistics::consoleList)
.doc("List statistics collection intervals and current values.\n"
"\n"
"Columns:\n"
" 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::BoundCommand(this, &Statistics::consoleCollect)
+ dir.add("collect", fty::Command(this, &Statistics::consoleCollect)
.doc("Add statistics collection groups. The argument gives a sequence of collector\n"
"ranks each building on the preceding collector:\n"
"\n"
"You may call collect multiple times. Any missing collection ranks will be\n"
"added.")
.arg("ranks","chain of collector ranks") );
- dir.add("output", fty::BoundCommand(this, &Statistics::consoleOutput)
+ dir.add("output", fty::Command(this, &Statistics::consoleOutput)
.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"
{
namespace fty = senf::console::factory;
- dir.add("list", fty::BoundCommand(this,&OutputEntry::consoleList)
+ dir.add("list", fty::Command(this,&OutputEntry::consoleList)
.doc("List all known connected targets. This list might not be complete.") );
}