$treeview $search $mathjax $extrastylesheet
artdaq
v3_04_00
$projectbrief
|
$projectbrief
|
$searchbox |
The "cmd_" class serves as the base class for all artdaq's XML-RPC commands. More...
Public Member Functions | |
cmd_ (xmlrpc_commander &c, const std::string &signature, const std::string &description) | |
cmd_ Constructor | |
void | execute (const xmlrpc_c::paramList ¶mList, xmlrpc_c::value *const retvalP) final |
Execute trhe command with the given parameters. | |
Protected Member Functions | |
virtual bool | execute_ (const xmlrpc_c::paramList &, xmlrpc_c::value *const retvalP)=0 |
"execute_" is a wrapper function around the call to the commandable object's function | |
template<typename T > | |
T | getParam (const xmlrpc_c::paramList ¶mList, int index) |
Get a parameter from the parameter list. | |
template<typename T > | |
T | getParam (const xmlrpc_c::paramList ¶mList, int index, T default_value) |
Get a parameter from the parameter list, returning a default value if not found at specified location. | |
Protected Attributes | |
xmlrpc_commander & | _c |
The xmlrpc_commander instance that the command will be sent to. |
The "cmd_" class serves as the base class for all artdaq's XML-RPC commands.
JCF, 9/5/14
The "cmd_" class serves as the base class for all artdaq's XML-RPC commands, all of which use the code in the "execute()" function; each specific command type deriving from cmd_ is implemented in the execute_() function which execute() calls (notice the underscore), and optionally sets the retvalP parameter
cmd_ contains a set of template functions, getParam<T>(), which are designed to prevent implementors of derived classes from having to worry about interfacing directly with xmlrpc_c's parameter-getting functionality
Definition at line 206 of file xmlrpc_commander.cc.
artdaq::cmd_::cmd_ | ( | xmlrpc_commander & | c, | |
const std::string & | signature, | |||
const std::string & | description | |||
) | [inline] |
cmd_ Constructor
c | xmlrpc_commander instance | |
signature | Signature of the command | |
description | Description of the command |
Definition at line 217 of file xmlrpc_commander.cc.
void artdaq::cmd_::execute | ( | const xmlrpc_c::paramList & | paramList, | |
xmlrpc_c::value *const | retvalP | |||
) |
Execute trhe command with the given parameters.
paramList | List of parameters for the command (i.e. a fhicl string for init transitions) | |
retvalP | Pointer to the return value (usually a string describing result of command) |
Definition at line 397 of file xmlrpc_commander.cc.
virtual bool artdaq::cmd_::execute_ | ( | const xmlrpc_c::paramList & | , | |
xmlrpc_c::value *const | retvalP | |||
) | [protected, pure virtual] |
"execute_" is a wrapper function around the call to the commandable object's function
retvalP | Pointer to the return value (usually a string describing result of command) |
T artdaq::cmd_::getParam | ( | const xmlrpc_c::paramList & | paramList, | |
int | index, | |||
T | default_value | |||
) | [inline, protected] |
Get a parameter from the parameter list, returning a default value if not found at specified location.
T | Type of the parameter |
paramList | The parameter list | |
index | Index of the parameter in the parameter list | |
default_value | Default value to return if exception retrieving parameter |
JCF, 9/5/14
Here, if getParam throws an exception due to a lack of an existing parameter, swallow the exception and return the default value passed to the function
Surprisingly, if an invalid index is supplied, although getParam throws an exception that exception is neither xmlrpc_c's girerr:error nor boost::bad_lexical_cast. Although it's less than ideal, we'll swallow almost all exceptions in the call to getParam, as an invalid index value simply means the user wishes to employ the default_value. I say "almost" because the only exception we don't swallow here is if an invalid parameter type "T" was supplied
Definition at line 379 of file xmlrpc_commander.cc.
uint64_t artdaq::cmd_::getParam< uint64_t > | ( | const xmlrpc_c::paramList & | paramList, | |
int | index | |||
) | [inline, protected] |
Get a parameter from the parameter list.
T | Type of the parameter |
paramList | The parameter list | |
index | Index of the parameter in the parameter list |
Template specilization is used to provide valid overloads
paramList | The parameter list | |
index | Index of the parameter in the parameter list |
This specialized cmd_getParam for the uint64_t type
Definition at line 284 of file xmlrpc_commander.cc.