DABC (Data Acquisition Backbone Core)  2.9.9
Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes
saftdabc::Input Class Reference

The saftlib timing message input implementation for DABC. More...

#include <saftdabc/Input.h>

Inheritance diagram for saftdabc::Input:
dabc::DataInput

Public Member Functions

void EventHandler (guint64 event, guint64 param, guint64 deadline, guint64 executed, guint16 flags=0xF)
 This is the signalhandler that treats condition events from saftlib. More...
 
 Input (const saftdabc::DeviceRef &owner)
 
void OverflowHandler (guint64 count)
 This is a signalhandler that treats overflow counter events. More...
 
virtual unsigned Read_Complete (dabc::Buffer &buf)
 Complete reading of the buffer from source,. More...
 
virtual bool Read_Init (const dabc::WorkerRef &wrk, const dabc::Command &cmd)
 Initialize data input, using port and command. More...
 
virtual unsigned Read_Size ()
 Defines required buffer size for next operation. More...
 
virtual unsigned Read_Start (dabc::Buffer &buf)
 Prepare buffer for reading (if required) More...
 
virtual double Read_Timeout ()
 Provide timeout value. More...
 
void SetTransportRef (dabc::InputTransport *trans)
 
virtual ~Input ()
 
- Public Member Functions inherited from dabc::DataInput
virtual bool Read_Stat (dabc::Command cmd)
 Provide timeout value. More...
 
Buffer ReadBuffer ()
 Reads complete buffer. More...
 
virtual ~DataInput ()
 

Protected Member Functions

void ClearEventQueue ()
 clear input queue of timing events More...
 
bool Close ()
 
void ResetDescriptors ()
 
bool SetupConditions ()
 set up saftlib conditions from the configuration. More...
 
unsigned Write_Hadaq (dabc::Buffer &buf)
 Fill output buffer with hadaq formatted data. More...
 
unsigned Write_Mbs (dabc::Buffer &buf)
 Fill output buffer with mbs formatted data. More...
 
unsigned Write_Raw (dabc::Buffer &buf)
 Fill output buffer with raw timing events. More...
 
- Protected Member Functions inherited from dabc::DataInput
virtual WorkerAddonRead_GetAddon ()
 Returns addon, provided by data input If specified, supposed that I/O object is double-deriver from DataInput and Addon. More...
 

Protected Attributes

DeviceRef fDevice
 use dabc reference instead of direct pointer here. More...
 
EventFormats_t fEventFormat
 
long fEventNumber
 Event number. More...
 
std::vector< std::string > fInput_Names
 contains names of all hardware inputs to be latched More...
 
bool fSingleEvents
 single events for each mbs container More...
 
std::vector< uint64_t > fSnoop_Flags
 
std::vector< uint64_t > fSnoop_Ids
 contains event ids of all events to be snooped More...
 
std::vector< uint64_t > fSnoop_Masks
 contains masks of all events to be snooped More...
 
std::vector< uint64_t > fSnoop_Offsets
 
unsigned fSubeventId
 full mbs id number for saft subevent More...
 
double fTimeout
 timeout (in seconds) for readout polling. More...
 
dabc::Reference fTransport
 worker that is running this data input. More...
 
bool fUseCallbackMode
 switch to work with time out polling or transport call back mode More...
 
bool fVerbose
 verbose mode for timing events More...
 

Private Attributes

uint64_t fLastOverflowCount
 previous overflow counter of all configured inputs More...
 
uint64_t fOverflowCount
 current overflow counter of all configured inputs More...
 
dabc::Mutex fQueueMutex
 Mutex to protect timingeventqueue. More...
 
std::queue< saftdabc::Timing_EventfTimingEventQueue
 this contains single queue for all snooped WR events. More...
 
bool fWaitingForCallback
 flag to avoid invoking transport callback before transport done More...
 

Detailed Description

The saftlib timing message input implementation for DABC.

Inputs to snoop/latch timestamps can be configured. When a signal occurs, timing message is captured and will be transported in mbs or hadaq subevent container. Alternatively, WR events may be captured by event id and mask

Definition at line 64 of file Input.h.

Constructor & Destructor Documentation

◆ Input()

saftdabc::Input::Input ( const saftdabc::DeviceRef owner)

Definition at line 31 of file Input.cxx.

◆ ~Input()

saftdabc::Input::~Input ( )
virtual

Definition at line 40 of file Input.cxx.

Member Function Documentation

◆ SetupConditions()

bool saftdabc::Input::SetupConditions ( )
protected

set up saftlib conditions from the configuration.

Definition at line 427 of file Input.cxx.

◆ ResetDescriptors()

void saftdabc::Input::ResetDescriptors ( )
inlineprotected

Definition at line 150 of file Input.h.

◆ ClearEventQueue()

void saftdabc::Input::ClearEventQueue ( )
protected

clear input queue of timing events

Definition at line 128 of file Input.cxx.

◆ Close()

bool saftdabc::Input::Close ( )
protected

Definition at line 115 of file Input.cxx.

◆ Write_Mbs()

unsigned saftdabc::Input::Write_Mbs ( dabc::Buffer buf)
protected

Fill output buffer with mbs formatted data.

Definition at line 254 of file Input.cxx.

◆ Write_Hadaq()

unsigned saftdabc::Input::Write_Hadaq ( dabc::Buffer buf)
protected

Fill output buffer with hadaq formatted data.

Definition at line 332 of file Input.cxx.

◆ Write_Raw()

unsigned saftdabc::Input::Write_Raw ( dabc::Buffer buf)
protected

Fill output buffer with raw timing events.

Definition at line 415 of file Input.cxx.

◆ Read_Init()

bool saftdabc::Input::Read_Init ( const dabc::WorkerRef wrk,
const dabc::Command cmd 
)
virtual

Initialize data input, using port and command.

This is generic virtual method to initialize input, using configurations from Port and (or) from the Command

Parameters
[in]wrkreference on input port
[in]cmdreference on command object
Returns
false when method fails

Reimplemented from dabc::DataInput.

Definition at line 52 of file Input.cxx.

◆ SetTransportRef()

void saftdabc::Input::SetTransportRef ( dabc::InputTransport trans)

Definition at line 47 of file Input.cxx.

◆ Read_Size()

unsigned saftdabc::Input::Read_Size ( )
virtual

Defines required buffer size for next operation.

Returns
  • 0..di_ValidSize - size of buffer for next read operation (di_ValidSize = 0xFFFFFFF0)
  • di_EndOfStream - this is end of stream, normal close of the input
  • di_DfltBufSize - any non-zero buffer can be provided
  • di_Repeat - nothing to read now, try again as soon as possible
  • di_RepeatTimeOut - nothing to read now, try again after timeout
  • di_CallBack - input will activate transport via callback
  • di_Error - error, close input

Reimplemented from dabc::DataInput.

Definition at line 135 of file Input.cxx.

◆ Read_Start()

unsigned saftdabc::Input::Read_Start ( dabc::Buffer buf)
virtual

Prepare buffer for reading (if required)

Returns
  • di_Ok - buffer must be filled in Read_Complete call
  • di_CallBack - input will do readout and activate transport via callback
  • di_Error (or other) - error, skip buffer

Reimplemented from dabc::DataInput.

Definition at line 177 of file Input.cxx.

◆ Read_Complete()

unsigned saftdabc::Input::Read_Complete ( dabc::Buffer buf)
virtual

Complete reading of the buffer from source,.

Returns
  • di_Ok - buffer filled and ready
  • di_EndOfStream - this is end of stream, normal close of the input
  • di_SkipBuffer - skip buffer
  • di_Error - error, skip buffer and close input
  • di_Repeat - not ready, call again as soon as possible
  • di_RepeatTimeOut - not ready, call again after timeout

Reimplemented from dabc::DataInput.

Definition at line 210 of file Input.cxx.

◆ Read_Timeout()

virtual double saftdabc::Input::Read_Timeout ( )
inlinevirtual

Provide timeout value.

Returns
timeout in seconds

When Read_Size or Read_Complete operations returns di_RepeatTimeout argument, specified timeout will be used before next operation will be done

Reimplemented from dabc::DataInput.

Definition at line 185 of file Input.h.

◆ EventHandler()

void saftdabc::Input::EventHandler ( guint64  event,
guint64  param,
guint64  deadline,
guint64  executed,
guint16  flags = 0xF 
)

This is the signalhandler that treats condition events from saftlib.

Disable set info, since info parameter can not be monitored due to blocked device thread in glib mainloop

Definition at line 492 of file Input.cxx.

◆ OverflowHandler()

void saftdabc::Input::OverflowHandler ( guint64  count)

This is a signalhandler that treats overflow counter events.

Definition at line 584 of file Input.cxx.

Field Documentation

◆ fTimingEventQueue

std::queue<saftdabc::Timing_Event> saftdabc::Input::fTimingEventQueue
private

this contains single queue for all snooped WR events.

events are queued until read out by dabc

Definition at line 73 of file Input.h.

◆ fQueueMutex

dabc::Mutex saftdabc::Input::fQueueMutex
private

Mutex to protect timingeventqueue.

Definition at line 77 of file Input.h.

◆ fWaitingForCallback

bool saftdabc::Input::fWaitingForCallback
private

flag to avoid invoking transport callback before transport done

Definition at line 80 of file Input.h.

◆ fOverflowCount

uint64_t saftdabc::Input::fOverflowCount
private

current overflow counter of all configured inputs

Definition at line 84 of file Input.h.

◆ fLastOverflowCount

uint64_t saftdabc::Input::fLastOverflowCount
private

previous overflow counter of all configured inputs

Definition at line 87 of file Input.h.

◆ fDevice

DeviceRef saftdabc::Input::fDevice
protected

use dabc reference instead of direct pointer here.

Definition at line 96 of file Input.h.

◆ fTransport

dabc::Reference saftdabc::Input::fTransport
protected

worker that is running this data input.

Should be the InputTransport assigned

Definition at line 99 of file Input.h.

◆ fTimeout

double saftdabc::Input::fTimeout
protected

timeout (in seconds) for readout polling.

Definition at line 102 of file Input.h.

◆ fUseCallbackMode

bool saftdabc::Input::fUseCallbackMode
protected

switch to work with time out polling or transport call back mode

Definition at line 105 of file Input.h.

◆ fSubeventId

unsigned saftdabc::Input::fSubeventId
protected

full mbs id number for saft subevent

Definition at line 109 of file Input.h.

◆ fEventNumber

long saftdabc::Input::fEventNumber
protected

Event number.

Definition at line 112 of file Input.h.

◆ fVerbose

bool saftdabc::Input::fVerbose
protected

verbose mode for timing events

Definition at line 116 of file Input.h.

◆ fSingleEvents

bool saftdabc::Input::fSingleEvents
protected

single events for each mbs container

Definition at line 119 of file Input.h.

◆ fEventFormat

EventFormats_t saftdabc::Input::fEventFormat
protected

Definition at line 122 of file Input.h.

◆ fInput_Names

std::vector<std::string> saftdabc::Input::fInput_Names
protected

contains names of all hardware inputs to be latched

Definition at line 125 of file Input.h.

◆ fSnoop_Masks

std::vector<uint64_t> saftdabc::Input::fSnoop_Masks
protected

contains masks of all events to be snooped

Definition at line 133 of file Input.h.

◆ fSnoop_Ids

std::vector<uint64_t> saftdabc::Input::fSnoop_Ids
protected

contains event ids of all events to be snooped

Definition at line 136 of file Input.h.

◆ fSnoop_Offsets

std::vector<uint64_t> saftdabc::Input::fSnoop_Offsets
protected

Definition at line 139 of file Input.h.

◆ fSnoop_Flags

std::vector<uint64_t> saftdabc::Input::fSnoop_Flags
protected

Definition at line 144 of file Input.h.


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