ROOTANA
|
#include <TMidasOnline.h>
Public Types | |
typedef void(* | TransitionHandler) (int transition, int run_number, int trans_time) |
User handler for run state transition events. More... | |
typedef void(* | EventHandler) (const void *header, const void *data, int length) |
User handler for data events. More... | |
Public Member Functions | |
int | connect (const char *hostname, const char *exptname, const char *progname) |
Connect to MIDAS experiment. More... | |
int | disconnect () |
Disconnect from MIDAS. More... | |
bool | poll (int mdelay) |
Check for all MIDAS events (new data events, run transitions) More... | |
bool | sleep (int mdelay) |
Sleep while checking for and answering MIDAS RPC requests (run transitions, etc) More... | |
void | registerTransitions () |
Ask MIDAS to tell us about run transitions. More... | |
void | setTransitionHandlers (TransitionHandler start, TransitionHandler stop, TransitionHandler pause, TransitionHandler resume) |
Specify user handlers for run transitions. More... | |
bool | checkTransitions () |
Check for pending transitions, call user handlers. Returns "true" if there were transitions. More... | |
void | setEventHandler (EventHandler handler) |
Specify user handler for data events. More... | |
int | eventRequest (const char *bufferName, int eventId, int triggerMask, int samplingType, bool poll=false) |
Request data for delivery via callback (setEventHandler) or by polling (via receiveEvent) More... | |
void | deleteEventRequest (int requestId) |
Delete data request. More... | |
int | receiveEvent (int requestId, void *pevent, int size, bool async) |
Receive event by polling. More... | |
int | getBufferLevel () |
Get buffer level (ie the number of bytes in buffer) More... | |
int | getBufferSize () |
Get buffer size. More... | |
void | RegisterHandler (TMHandlerInterface *h) |
Static Public Member Functions | |
static TMidasOnline * | instance () |
Data Fields | |
std::string | fHostname |
hostname where the mserver is running, blank if using shared memory More... | |
std::string | fExptname |
experiment name, blank if only one experiment defined in exptab More... | |
HNDLE | fDB |
ODB handle. More... | |
TransitionHandler | fStartHandler |
TransitionHandler | fStopHandler |
TransitionHandler | fPauseHandler |
TransitionHandler | fResumeHandler |
EventRequest * | fEventRequests |
EventHandler | fEventHandler |
std::vector< TMHandlerInterface * > | fHandlers |
Private Member Functions | |
TMidasOnline () | |
default constructor is private for singleton classes More... | |
virtual | ~TMidasOnline () |
destructor is private for singleton classes More... | |
Static Private Attributes | |
static TMidasOnline * | gfMidas = NULL |
Definition at line 43 of file TMidasOnline.h.
typedef void(* TMidasOnline::EventHandler) (const void *header, const void *data, int length) |
User handler for data events.
Definition at line 51 of file TMidasOnline.h.
typedef void(* TMidasOnline::TransitionHandler) (int transition, int run_number, int trans_time) |
User handler for run state transition events.
Definition at line 48 of file TMidasOnline.h.
|
private |
default constructor is private for singleton classes
Definition at line 23 of file TMidasOnline.cxx.
|
privatevirtual |
destructor is private for singleton classes
Definition at line 34 of file TMidasOnline.cxx.
bool TMidasOnline::checkTransitions | ( | ) |
Check for pending transitions, call user handlers. Returns "true" if there were transitions.
Definition at line 122 of file TMidasOnline.cxx.
int TMidasOnline::connect | ( | const char * | hostname, |
const char * | exptname, | ||
const char * | progname | ||
) |
Connect to MIDAS experiment.
Definition at line 48 of file TMidasOnline.cxx.
void TMidasOnline::deleteEventRequest | ( | int | requestId | ) |
Delete data request.
Definition at line 356 of file TMidasOnline.cxx.
int TMidasOnline::disconnect | ( | ) |
Disconnect from MIDAS.
Definition at line 94 of file TMidasOnline.cxx.
int TMidasOnline::eventRequest | ( | const char * | bufferName, |
int | eventId, | ||
int | triggerMask, | ||
int | samplingType, | ||
bool | poll = false |
||
) |
Request data for delivery via callback (setEventHandler) or by polling (via receiveEvent)
Definition at line 292 of file TMidasOnline.cxx.
int TMidasOnline::getBufferLevel | ( | ) |
Get buffer level (ie the number of bytes in buffer)
Definition at line 335 of file TMidasOnline.cxx.
int TMidasOnline::getBufferSize | ( | ) |
Get buffer size.
Definition at line 346 of file TMidasOnline.cxx.
|
static |
TMidasOnline is a singleton class. Call instance() to get a reference to the one instance of this class.
Definition at line 40 of file TMidasOnline.cxx.
bool TMidasOnline::poll | ( | int | mdelay | ) |
Check for all MIDAS events (new data events, run transitions)
Definition at line 165 of file TMidasOnline.cxx.
int TMidasOnline::receiveEvent | ( | int | requestId, |
void * | pevent, | ||
int | size, | ||
bool | async | ||
) |
Receive event by polling.
Definition at line 244 of file TMidasOnline.cxx.
void TMidasOnline::RegisterHandler | ( | TMHandlerInterface * | h | ) |
void TMidasOnline::registerTransitions | ( | ) |
Ask MIDAS to tell us about run transitions.
Definition at line 106 of file TMidasOnline.cxx.
void TMidasOnline::setEventHandler | ( | EventHandler | handler | ) |
Specify user handler for data events.
Definition at line 215 of file TMidasOnline.cxx.
void TMidasOnline::setTransitionHandlers | ( | TransitionHandler | start, |
TransitionHandler | stop, | ||
TransitionHandler | pause, | ||
TransitionHandler | resume | ||
) |
Specify user handlers for run transitions.
Definition at line 114 of file TMidasOnline.cxx.
bool TMidasOnline::sleep | ( | int | mdelay | ) |
Sleep while checking for and answering MIDAS RPC requests (run transitions, etc)
Definition at line 183 of file TMidasOnline.cxx.
HNDLE TMidasOnline::fDB |
ODB handle.
Definition at line 58 of file TMidasOnline.h.
EventHandler TMidasOnline::fEventHandler |
Definition at line 66 of file TMidasOnline.h.
EventRequest* TMidasOnline::fEventRequests |
Definition at line 65 of file TMidasOnline.h.
std::string TMidasOnline::fExptname |
experiment name, blank if only one experiment defined in exptab
Definition at line 56 of file TMidasOnline.h.
std::vector<TMHandlerInterface*> TMidasOnline::fHandlers |
Definition at line 68 of file TMidasOnline.h.
std::string TMidasOnline::fHostname |
hostname where the mserver is running, blank if using shared memory
Definition at line 55 of file TMidasOnline.h.
TransitionHandler TMidasOnline::fPauseHandler |
Definition at line 62 of file TMidasOnline.h.
TransitionHandler TMidasOnline::fResumeHandler |
Definition at line 63 of file TMidasOnline.h.
TransitionHandler TMidasOnline::fStartHandler |
Definition at line 60 of file TMidasOnline.h.
TransitionHandler TMidasOnline::fStopHandler |
Definition at line 61 of file TMidasOnline.h.
|
staticprivate |
TMidasOnline is a singleton class: only one instance is allowed at any time
Definition at line 73 of file TMidasOnline.h.