|
| JDAQDriver (const std::string &name, const std::string &server, JLogger *logger, const int level, const int timeout_s) |
| Constructor. More...
|
|
virtual bool | enter () |
| Enter the state machine. More...
|
|
void | actionExit () |
| Exit the state machine. More...
|
|
void | enterState (const CHSM::state &state, const CHSM::event &event) |
| Action when entering state. More...
|
|
bool | update (const bool no_wait) |
| Update client list with incoming ControlHost message. More...
|
|
virtual void | actionStart (int, const char *) |
|
virtual void | actionStop (int, const char *) |
|
void | run () |
| Run driver with user input. More...
|
|
void | run (std::istream &in) |
| Run driver. More...
|
|
void | update () |
| Update client list with incoming ControlHost messages until the client list is synchronised with the current state or until the timeout. More...
|
|
void | synchronise () |
| Synchronise clients. More...
|
|
void | filter (const std::string &target="") |
| Filter client list by putting failing clients to sleep. More...
|
|
virtual bool | enter (const JArgs &args) |
| Enter the state machine. More...
|
|
virtual bool | exit () |
| Exit the state machine. More...
|
|
const std::string & | getFullName () const |
| Get full name of this run control client. More...
|
|
const JNET::JTag & | getUniqueTag () const |
| Get unique tag of this run control client. More...
|
|
int | getEventNumber () const |
| Get last event number. More...
|
|
bool | isRunning () const |
| Check if this client is in runnig state. More...
|
|
void | replaceEvent (const JNET::JTag &oldTag, const JNET::JTag &newTag, JDAQEvent_t &event) |
| Replace tag of given event in event table. More...
|
|
JDAQEvent_t * | findEvent (const JNET::JTag &tag, const std::string &event_name) |
| Find event in event table. More...
|
|
template<class T > |
void | addParameter (const char option, T ¶meter) |
| Add parameter to parser used in method enter(). More...
|
|
template<class T > |
void | addParameter (const char option, T ¶meter, const T &value) |
| Add parameter to parser used in method enter(). More...
|
|
long long int | getClockDelay () const |
| Get total delay time. More...
|
|
const std::string & | getHostname () const |
| Get hostname. More...
|
|
long long int | getClockInterval () const |
| Get interval time. More...
|
|
void | setClockInterval (const long long int interval_us) |
| Set interval time. More...
|
|
void | resetClock () |
| Reset clock. More...
|
|
void | setSelect () |
| Set the file descriptor mask for the select call. More...
|
|
virtual void | setSelect (JFileDescriptorMask &mask) const |
| Set the file descriptor mask for the select call. More...
|
|
virtual void | actionSelect (const JFileDescriptorMask &mask) |
| Action method following last select call. More...
|
|
virtual void | actionRunning () |
| This method is repeatedly called when this client machine is in state Running and the clock interval time is non-zero. More...
|
|
virtual void | actionInput (int length, const char *buffer) |
| This method is called at ev_input . More...
|
|
virtual bool | filter (const std::string &tag, int length, const char *buffer) |
| Filter message. More...
|
|
void | run (const int port) |
| Run for ever. More...
|
|
Simple driver for run control clients.
This class can be used to start a set of run control clients, trigger events and eventually stop the clients.
Definition at line 35 of file JDAQDriver.hh.
void KM3NETDAQ::JDAQDriver::run |
( |
std::istream & |
in | ) |
|
|
inline |
Run driver.
Example input format:
# comment line.
process <process name> <host name> [<start command>];
# The following tokens in <start command> will be substituted:
# $HOST$ by <host name>;
# $NAME$ by <process name>;
# $SERVER$ by JClient::SERVER;
# $LOGGER$ by JClient::LOGGER;
# $ARGS$ by part following '/' in <process name>;
# enter state machine.
enter
# trigger event
# data can be provided online and mixed with data from a separate file (optional).
# multiple tags should be separated by a new line.
event <event name> {
[<tag 1> [data]]
[<tag 2> [data][%<file name>%][data]]
}
# optionally quit before end of input
[quit]
# optionally kill processes that did not properly terminate.
[exit]
- Parameters
-
Definition at line 360 of file JDAQDriver.hh.
364 for (
string key; in >> key; ) {
368 in.ignore(numeric_limits<streamsize>::max(),
'\n');
370 }
else if (key ==
"enter") {
375 cerr <<
"State machine not entered; abort." << endl;
379 }
else if (key ==
"exit") {
384 }
else if (key ==
"quit") {
388 }
else if (key ==
"sleep") {
396 }
else if (key ==
"process") {
402 istringstream is(buffer);
408 client.setMode(JClient::ACTIVE);
411 JWarningStream(
logger) <<
"Process already exists " << client;
415 JErrorStream(
logger) <<
"Error reading key word process.";
418 }
else if (key ==
"event" || key ==
"event*") {
423 const char eol =
'\n';
425 if (in >> event >> c && c ==
'{' &&
getline(in, buffer,
'}')) {
431 if (pev->active() || key ==
"event*") {
433 istringstream is(buffer);
435 for (
string tag; is >> tag; ) {
443 server->PutFullString(tag, os.str());
446 if (key !=
"event*") {
451 JErrorStream(
logger) <<
"Inactive event " << event;
455 JErrorStream(
logger) <<
"Unknown event " << event;
459 JErrorStream(
logger) <<
"Error reading key word event.";
462 }
else if (key ==
"print") {
465 JNoticeStream(
logger) << i->getFullName() <<
' '
466 << i->getStartCommand() <<
' '
467 << i->getAlive() <<
' '
468 << i->getStatename();
471 }
else if (key ==
"filter") {
478 for (istringstream is(buffer); is >> client; ) {
482 }
else if (key ==
"sync") {
488 JErrorStream(
logger) <<
"Unknown key: " << key;
490 in.ignore(numeric_limits<streamsize>::max(),
'\n');
int timeout_s
timeout of state transitions [s]
ControlHost client manager.
virtual bool enter()
Enter the state machine.
static void copy(std::istream &in, std::ostream &out, const char eol= '\n')
Copy data from input to output stream.
Structure to store the ToT mean and standard deviation of the hits produced by a nanobeacon in a sour...
JSharedPointer< JControlHost > server
message server
void synchronise()
Synchronise clients.
std::istream & getline(std::istream &in, JString &object)
Read string from input stream until end of line.
virtual bool exit()
Exit the state machine.
char getTokenDelimeter()
Get the token delimeter for command messages.
void filter(const std::string &target="")
Filter client list by putting failing clients to sleep.
JMessageLogger logger
message logger
static const JNET::JTag RC_CMD
JDAQStateMachine::ev_daq_event JDAQEvent_t
Type definition of a DAQ event.
JDAQEvent_t * findEvent(const JNET::JTag &tag, const std::string &event_name)
Find event in event table.
virtual void KM3NETDAQ::JDAQClient::actionRunning |
( |
| ) |
|
|
inlinevirtualinherited |