1 #ifndef TMidasOnline_hxx_seen
2 #define TMidasOnline_hxx_seen
39 virtual void Transition(
int transition,
int run_number,
int transition_time) = 0;
40 virtual void Event(
const void* data,
int data_size) = 0;
51 typedef void (*
EventHandler)(
const void*header,
const void*data,
int length);
85 int connect(
const char*hostname,
const char*exptname,
const char*progname);
91 bool poll(
int mdelay);
94 bool sleep(
int mdelay);
113 int eventRequest(
const char* bufferName,
int eventId,
int triggerMask,
int samplingType,
bool poll=
false);
119 int receiveEvent(
int requestId,
void* pevent,
int size,
bool async);
MIDAS online connection, including access to online ODB.
virtual void Event(const void *data, int data_size)=0
virtual ~TMHandlerInterface()
virtual void Transition(int transition, int run_number, int transition_time)=0
std::vector< TMHandlerInterface * > fHandlers
void RegisterHandler(TMHandlerInterface *h)
void setEventHandler(EventHandler handler)
Specify user handler for data events.
int receiveEvent(int requestId, void *pevent, int size, bool async)
Receive event by polling.
void registerTransitions()
Ask MIDAS to tell us about run transitions.
bool checkTransitions()
Check for pending transitions, call user handlers. Returns "true" if there were transitions.
TMidasOnline()
default constructor is private for singleton classes
std::string fExptname
experiment name, blank if only one experiment defined in exptab
TransitionHandler fPauseHandler
void deleteEventRequest(int requestId)
Delete data request.
TransitionHandler fStartHandler
bool sleep(int mdelay)
Sleep while checking for and answering MIDAS RPC requests (run transitions, etc)
int disconnect()
Disconnect from MIDAS.
TransitionHandler fStopHandler
TransitionHandler fResumeHandler
static TMidasOnline * instance()
EventRequest * fEventRequests
int getBufferLevel()
Get buffer level (ie the number of bytes in buffer)
int connect(const char *hostname, const char *exptname, const char *progname)
Connect to MIDAS experiment.
void(* EventHandler)(const void *header, const void *data, int length)
User handler for data events.
void setTransitionHandlers(TransitionHandler start, TransitionHandler stop, TransitionHandler pause, TransitionHandler resume)
Specify user handlers for run transitions.
virtual ~TMidasOnline()
destructor is private for singleton classes
void(* TransitionHandler)(int transition, int run_number, int trans_time)
User handler for run state transition events.
int getBufferSize()
Get buffer size.
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)
EventHandler fEventHandler
static TMidasOnline * gfMidas
std::string fHostname
hostname where the mserver is running, blank if using shared memory
bool poll(int mdelay)
Check for all MIDAS events (new data events, run transitions)
Request events from online shared memory data buffer.
int fTriggerMask
request trigger mask
int fRequestId
request ID assigned by midas
int fEventId
request event ID
std::string fBufferName
name of the midas data buffer, e.g. "SYSTEM"
EventRequest * fNext
(internal use) list of all requests
HNDLE fBufferHandle
buffer handle from bm_open_buffer()
int fSamplingType
sampling type