artdaq::cmd_ Class Reference

The "cmd_" class serves as the base class for all artdaq's XML-RPC commands. More...

Inheritance diagram for artdaq::cmd_:
artdaq::init_ artdaq::legal_commands_ artdaq::meta_command_ artdaq::pause_ artdaq::register_monitor_ artdaq::reinit_ artdaq::report_ artdaq::resume_ artdaq::shutdown_ artdaq::soft_init_ artdaq::start_ artdaq::status_ artdaq::stop_ artdaq::trace_get_ artdaq::trace_set_ artdaq::unregister_monitor_

List of all members.

Public Member Functions

 cmd_ (xmlrpc_commander &c, const std::string &signature, const std::string &description)
 cmd_ Constructor
void execute (const xmlrpc_c::paramList &paramList, 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 >
getParam (const xmlrpc_c::paramList &paramList, int index)
 Get a parameter from the parameter list.
template<typename T >
getParam (const xmlrpc_c::paramList &paramList, 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.

Detailed Description

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 201 of file xmlrpc_commander.cc.


Constructor & Destructor Documentation

artdaq::cmd_::cmd_ ( xmlrpc_commander c,
const std::string &  signature,
const std::string &  description 
) [inline]

cmd_ Constructor

Parameters:
c xmlrpc_commander instance
signature Signature of the command
description Description of the command

Definition at line 212 of file xmlrpc_commander.cc.


Member Function Documentation

void artdaq::cmd_::execute ( const xmlrpc_c::paramList &  paramList,
xmlrpc_c::value *const   retvalP 
)

Execute trhe command with the given parameters.

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 384 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

Parameters:
retvalP Pointer to the return value (usually a string describing result of command)
Returns:
Whether the command succeeded
template<typename T >
T artdaq::cmd_::getParam ( const xmlrpc_c::paramList &  paramList,
int  index,
default_value 
) [inline, protected]

Get a parameter from the parameter list, returning a default value if not found at specified location.

Template Parameters:
T Type of the parameter
Parameters:
paramList The parameter list
index Index of the parameter in the parameter list
default_value Default value to return if exception retrieving parameter
Returns:
The requested parameter, or the default value if there was an exception retrieving the 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 366 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.

Template Parameters:
T Type of the parameter
Parameters:
paramList The parameter list
index Index of the parameter in the parameter list
Returns:
The requested parameter

Template specilization is used to provide valid overloads

Parameters:
paramList The parameter list
index Index of the parameter in the parameter list
Returns:
The requested parameter

This specialized cmd_getParam for the uint64_t type

Definition at line 279 of file xmlrpc_commander.cc.


The documentation for this class was generated from the following file:

Generated on 19 Feb 2018 for artdaq by  doxygen 1.6.1