Midas C++ API - data structures
This page contains the full API reference for the public midas data structures.
For how events and banks are laid out, see Event data format.
Public Structure Declarations
Classes
BANK
Defined in include/midas.h:1214
Attributes
data_size
WORD data_size
Defined in include/midas.h:1217
name
char name[4]
Defined in include/midas.h:1215
type
WORD type
Defined in include/midas.h:1216
BANK32
Defined in include/midas.h:1220
Attributes
data_size
DWORD data_size
Defined in include/midas.h:1223
name
char name[4]
Defined in include/midas.h:1221
type
DWORD type
Defined in include/midas.h:1222
BANK32A
Defined in include/midas.h:1226
Attributes
data_size
DWORD data_size
Defined in include/midas.h:1229
name
char name[4]
Defined in include/midas.h:1227
reserved
DWORD reserved
Defined in include/midas.h:1230
type
DWORD type
Defined in include/midas.h:1228
BANK_HEADER
Defined in include/midas.h:1209
Attributes
data_size
DWORD data_size
Size in bytes
Defined in include/midas.h:1210
flags
DWORD flags
internal flag
Defined in include/midas.h:1211
BANK_LIST
Defined in include/midas.h:1239
Attributes
addr
void *addr
Defined in include/midas.h:1245
def_key
HNDLE def_key
Defined in include/midas.h:1247
init_str
char **init_str
Defined in include/midas.h:1243
n_data
DWORD n_data
Defined in include/midas.h:1246
name
char name[9]
Defined in include/midas.h:1240
output_flag
BOOL output_flag
Defined in include/midas.h:1244
size
DWORD size
Defined in include/midas.h:1242
type
WORD type
Defined in include/midas.h:1241
BUFFER
Defined in include/midas.h:986
Attributes
attached
std::atomic_bool attached {false}
TRUE if buffer is attached
Defined in include/midas.h:988
buffer_header
BUFFER_HEADER *buffer_header = NULL
pointer to buffer header
Defined in include/midas.h:993
buffer_mutex
std::timed_mutex buffer_mutex
buffer mutex
Defined in include/midas.h:989
buffer_name
char buffer_name[NAME_LENGTH]
name of buffer
Defined in include/midas.h:992
bytes_read
double bytes_read = 0
count how many bytes we read
Defined in include/midas.h:1022
bytes_sent
double bytes_sent = 0
count how many bytes we sent
Defined in include/midas.h:1014
callback
BOOL callback = false
callback defined for this buffer
Defined in include/midas.h:1007
client_count_write_wait
int client_count_write_wait[MAX_CLIENTS]
per-client count_write_wait
Defined in include/midas.h:1023
client_index
INT client_index = 0
index to CLIENT str. in buf.
Defined in include/midas.h:990
client_name
char client_name[NAME_LENGTH]
name of client
Defined in include/midas.h:991
client_time_write_wait
DWORD client_time_write_wait[MAX_CLIENTS]
per-client time_write_wait
Defined in include/midas.h:1024
count_lock
int count_lock = 0
count how many times we locked the buffer
Defined in include/midas.h:1012
count_read
int count_read = 0
count how many events we read
Defined in include/midas.h:1021
count_sent
int count_sent = 0
count how many events we sent
Defined in include/midas.h:1013
count_write_wait
int count_write_wait = 0
count how many times we waited for free space
Defined in include/midas.h:1015
get_all_flag
BOOL get_all_flag = false
this is a get_all reader
Defined in include/midas.h:1009
last_count_lock
int last_count_lock = 0
avoid writing statistics to odb if lock count did not change
Defined in include/midas.h:1017
locked
BOOL locked = false
buffer is currently locked by us
Defined in include/midas.h:1008
max_requested_space
int max_requested_space = 0
waiting for this many bytes of free space
Defined in include/midas.h:1020
read_cache
char *read_cache = NULL
cache for burst read
Defined in include/midas.h:996
read_cache_mutex
std::timed_mutex read_cache_mutex
cache read mutex
Defined in include/midas.h:994
read_cache_rp
size_t read_cache_rp = 0
cache read pointer
Defined in include/midas.h:997
read_cache_size
std::atomic<size_t> read_cache_size {0}
cache size in bytes
Defined in include/midas.h:995
read_cache_wp
size_t read_cache_wp = 0
cache write pointer
Defined in include/midas.h:998
semaphore
HNDLE semaphore = 0
semaphore handle
Defined in include/midas.h:1004
shm_handle
INT shm_handle = 0
handle to shared memory
Defined in include/midas.h:1005
shm_size
size_t shm_size = 0
size of shared memory
Defined in include/midas.h:1006
time_write_wait
DWORD time_write_wait = 0
count for how long we waited for free space, in units of ss_millitime()
Defined in include/midas.h:1016
wait_client_index
int wait_client_index = 0
waiting for which client
Defined in include/midas.h:1019
wait_start_time
DWORD wait_start_time = 0
time when we started the wait
Defined in include/midas.h:1018
write_cache
char *write_cache = NULL
cache for burst read
Defined in include/midas.h:1001
write_cache_mutex
std::timed_mutex write_cache_mutex
cache write mutex
Defined in include/midas.h:999
write_cache_rp
size_t write_cache_rp = 0
cache read pointer
Defined in include/midas.h:1002
write_cache_size
std::atomic<size_t> write_cache_size {0}
cache size in bytes
Defined in include/midas.h:1000
write_cache_wp
size_t write_cache_wp = 0
cache write pointer
Defined in include/midas.h:1003
BUFFER_CLIENT
Defined in include/midas.h:935
Attributes
all_flag
event_request
EVENT_REQUEST event_request[MAX_EVENT_REQUESTS]
Defined in include/midas.h:954
last_activity
DWORD last_activity
time of last activity
Defined in include/midas.h:951
max_request_index
INT max_request_index
index of last request
Defined in include/midas.h:942
name
char name[NAME_LENGTH]
name of client
Defined in include/midas.h:936
num_received_events
INT num_received_events
no of received events
Defined in include/midas.h:943
num_sent_events
INT num_sent_events
no of sent events
Defined in include/midas.h:944
pid
INT pid
process ID
Defined in include/midas.h:937
port
INT port
UDP port for wake up
Defined in include/midas.h:940
read_pointer
INT read_pointer
read pointer to buffer
Defined in include/midas.h:941
read_wait
BOOL read_wait
wait for read - flag
Defined in include/midas.h:947
unused
INT unused
was thread handle
Defined in include/midas.h:939
unused0
INT unused0
was thread ID
Defined in include/midas.h:938
unused1
INT unused1
was num_waiting_events
Defined in include/midas.h:945
unused2
float unused2
was data_rate
Defined in include/midas.h:946
wake_up
BOOL wake_up
client got a wake-up msg
Defined in include/midas.h:949
watchdog_timeout
DWORD watchdog_timeout
timeout in ms
Defined in include/midas.h:952
write_wait
INT write_wait
wait for write # bytes
Defined in include/midas.h:948
BUFFER_HEADER
Defined in include/midas.h:958
Attributes
client
BUFFER_CLIENT client[MAX_CLIENTS]
entries for clients
Defined in include/midas.h:968
max_client_index
INT max_client_index
index of last client + 1
Defined in include/midas.h:961
name
char name[NAME_LENGTH]
name of buffer
Defined in include/midas.h:959
num_clients
INT num_clients
no of active clients
Defined in include/midas.h:960
num_in_events
INT num_in_events
no of received events
Defined in include/midas.h:965
num_out_events
INT num_out_events
no of distributed events
Defined in include/midas.h:966
read_pointer
INT read_pointer
read pointer
Defined in include/midas.h:963
size
INT size
size of data area in bytes
Defined in include/midas.h:962
write_pointer
INT write_pointer
write pointer
Defined in include/midas.h:964
BUS_DRIVER
Defined in include/midas.h:1069
Attributes
bd
INT(*bd) (INT cmd, ...)
Device driver entry point
Defined in include/midas.h:1071
bd_info
void *bd_info
Private info for bus driver
Defined in include/midas.h:1072
name
char name[NAME_LENGTH]
Driver name
Defined in include/midas.h:1070
DD_MT_BUFFER
Defined in include/midas.h:1081
Attributes
channel
DD_MT_CHANNEL *channel
One data set for each channel
Defined in include/midas.h:1085
n_channels
INT n_channels
Number of channels
Defined in include/midas.h:1082
status
INT status
Status passed from device thread
Defined in include/midas.h:1084
thread_id
midas_thread_t thread_id
Thread ID
Defined in include/midas.h:1083
DD_MT_CHANNEL
Defined in include/midas.h:1075
Attributes
label
char label[NAME_LENGTH]
Array for channel labels
Defined in include/midas.h:1077
n_read
int n_read
Number of reads
Defined in include/midas.h:1078
variable
float variable[CMD_GET_LAST+1]
Array for various values
Defined in include/midas.h:1076
DEVICE_DRIVER
Defined in include/midas.h:1155
Attributes
bd
INT(*bd) (INT cmd, ...)
Bus driver entry point
Defined in include/midas.h:1159
channels
INT channels
Number of channels
Defined in include/midas.h:1158
dd
INT(*dd) (INT cmd, ...)
Device driver entry point
Defined in include/midas.h:1157
dd_info
void *dd_info
Private info for device driver
Defined in include/midas.h:1162
enabled
BOOL enabled
Enable flag
Defined in include/midas.h:1161
flags
DWORD flags
Combination of DF_xx
Defined in include/midas.h:1160
mt_buffer
DD_MT_BUFFER *mt_buffer
pointer to multithread buffer
Defined in include/midas.h:1163
mutex
MUTEX_T *mutex
mutex for buffer
Defined in include/midas.h:1165
name
char name[NAME_LENGTH]
Driver name
Defined in include/midas.h:1156
pequipment
EQUIPMENT_INFO *pequipment
pointer to equipment
Defined in include/midas.h:1166
pequipment_name
std::string *pequipment_name
name of equipment
Defined in include/midas.h:1167
priority_read
BOOL priority_read
read channel with priority after set
Defined in include/midas.h:1168
stop_thread
INT stop_thread
flag used to stop the thread
Defined in include/midas.h:1164
eqpmnt
Defined in include/midas.h:1171
Attributes
buffer_handle
HNDLE buffer_handle
MIDAS buffer handle
Defined in include/midas.h:1184
bytes_sent
DWORD bytes_sent
number of bytes sent
Defined in include/midas.h:1190
cd
INT(*cd) (INT cmd, PEQUIPMENT)
Class driver routine
Defined in include/midas.h:1175
cd_info
void *cd_info
private data for class driver
Defined in include/midas.h:1178
driver
DEVICE_DRIVER *driver
Device driver list
Defined in include/midas.h:1176
event_descrip
void *event_descrip
Init string for fixed events or bank list
Defined in include/midas.h:1177
events_collected
events_sent
DWORD events_sent
number of events sent
Defined in include/midas.h:1191
format
INT format
FORMAT_xxx
Defined in include/midas.h:1183
hkey_variables
HNDLE hkey_variables
Key to variables subtree in ODB
Defined in include/midas.h:1185
info
EQUIPMENT_INFO info
From above
Defined in include/midas.h:1173
last_called
DWORD last_called
Last time event was read
Defined in include/midas.h:1180
last_idle
DWORD last_idle
Last time idle func was called
Defined in include/midas.h:1181
name
char name[NAME_LENGTH]
Equipment name
Defined in include/midas.h:1172
odb_in
DWORD odb_in
# updated ODB -> FE
Defined in include/midas.h:1189
odb_out
DWORD odb_out
# updates FE -> ODB
Defined in include/midas.h:1188
poll_count
DWORD poll_count
Needed to poll 'period'
Defined in include/midas.h:1182
readout
INT(*readout) (char *, INT)
Pointer to user readout routine
Defined in include/midas.h:1174
serial_number
DWORD serial_number
event serial number
Defined in include/midas.h:1186
stats
EQUIPMENT_STATS stats
Defined in include/midas.h:1193
status
INT status
One of FE_xxx
Defined in include/midas.h:1179
subevent_number
DWORD subevent_number
subevent number
Defined in include/midas.h:1187
EQUIPMENT_INFO
Defined in include/midas.h:1089
Attributes
buffer
char buffer[NAME_LENGTH]
Event buffer to send events into
Defined in include/midas.h:1092
enabled
BOOL enabled
Enable flag
Defined in include/midas.h:1096
eq_type
INT eq_type
One of EQ_xxx
Defined in include/midas.h:1093
event_id
WORD event_id
Event ID associated with equipm.
Defined in include/midas.h:1090
event_limit
double event_limit
Stop run when limit is reached
Defined in include/midas.h:1099
format
char format[8]
Data format to produce
Defined in include/midas.h:1095
frontend_file_name
char frontend_file_name[256]
Source file used for user FE
Defined in include/midas.h:1104
frontend_host
char frontend_host[NAME_LENGTH]
Host on which FE is running
Defined in include/midas.h:1102
frontend_name
char frontend_name[NAME_LENGTH]
Frontend name
Defined in include/midas.h:1103
hidden
BOOL hidden
Hidden flag
Defined in include/midas.h:1107
history
INT history
Log history
Defined in include/midas.h:1101
num_subevents
DWORD num_subevents
Number of events in super event
Defined in include/midas.h:1100
period
INT period
Readout interval/Polling time in ms
Defined in include/midas.h:1098
read_on
INT read_on
Combination of Read-On flags RO_xxx
Defined in include/midas.h:1097
source
INT source
Event source (LAM/IRQ)
Defined in include/midas.h:1094
status
char status[256]
Current status of equipment
Defined in include/midas.h:1105
status_color
char status_color[NAME_LENGTH]
Color or class to be used by mhttpd for status
Defined in include/midas.h:1106
trigger_mask
WORD trigger_mask
Trigger mask
Defined in include/midas.h:1091
EQUIPMENT_STATS
Defined in include/midas.h:1136
Attributes
events_per_sec
double events_per_sec
Defined in include/midas.h:1138
events_sent
double events_sent
Defined in include/midas.h:1137
kbytes_per_sec
double kbytes_per_sec
Defined in include/midas.h:1139
EVENT_HEADER
Event header
Defined in include/midas.h:852
Attributes
data_size
DWORD data_size
size of event in bytes w/o header
Defined in include/midas.h:857
event_id
short int event_id
event ID starting from one
Defined in include/midas.h:853
serial_number
DWORD serial_number
serial number starting from one
Defined in include/midas.h:855
time_stamp
DWORD time_stamp
time of production of event
Defined in include/midas.h:856
trigger_mask
short int trigger_mask
hardware trigger mask
Defined in include/midas.h:854
EVENT_REQUEST
Buffer structure
Defined in include/midas.h:927
Attributes
event_id
short int event_id
event ID
Defined in include/midas.h:930
id
INT id
request id
Defined in include/midas.h:928
sampling_type
trigger_mask
short int trigger_mask
trigger mask
Defined in include/midas.h:931
valid
BOOL valid
indicating a valid entry
Defined in include/midas.h:929
KEY
Defined in include/midas.h:1027
Attributes
access_mode
WORD access_mode
Access mode
Defined in include/midas.h:1034
data
INT data
Address of variable (offset)
Defined in include/midas.h:1031
item_size
INT item_size
Size of single data item
Defined in include/midas.h:1033
last_written
INT last_written
Time of last write action
Defined in include/midas.h:1038
name
char name[NAME_LENGTH]
name of variable
Defined in include/midas.h:1030
next_key
INT next_key
Address of next key
Defined in include/midas.h:1036
notify_count
WORD notify_count
Notify counter
Defined in include/midas.h:1035
num_values
INT num_values
number of values
Defined in include/midas.h:1029
parent_keylist
INT parent_keylist
keylist to which this key belongs
Defined in include/midas.h:1037
total_size
INT total_size
Total size of data block
Defined in include/midas.h:1032
type
DWORD type
TID_xxx type
Defined in include/midas.h:1028
KEYLIST
Defined in include/midas.h:1041
Attributes
first_key
INT first_key
Address of first key
Defined in include/midas.h:1044
num_keys
INT num_keys
number of keys
Defined in include/midas.h:1043
parent
INT parent
Address of parent key
Defined in include/midas.h:1042
TAG
Defined in include/midas.h:1233
Attributes
n_data
DWORD n_data
Defined in include/midas.h:1236
name
char name[NAME_LENGTH]
Defined in include/midas.h:1234
type
DWORD type
Defined in include/midas.h:1235
Type definitions
EQUIPMENT
typedef struct eqpmnt EQUIPMENT
Defined in include/midas.h:1171
EVENT_HANDLER
typedef void (EVENT_HANDLER)(HNDLE buffer_handler, HNDLE request_id, EVENT_HEADER* event_header, void* event_data)
Handler for event requests
Defined in include/midas.h:919
RPC_HANDLER
typedef INT (RPC_HANDLER)(INT index, void *prpc_param[])
Handler for rpc requests
Defined in include/midas.h:923
Other structures
These structures are declared in midas.h outside the group above. ALARM, ALARM_CLASS, PROGRAM_INFO and RUNINFO describe the layout of ODB directories, and RPC_LIST and RPC_PARAM describe an RPC call and its parameters (see RPC definitions).
ALARM
Alarm structure
Defined in include/midas.h:1465
Attributes
active
BOOL active
Defined in include/midas.h:1466
alarm_class
char alarm_class[32]
Defined in include/midas.h:1476
alarm_message
char alarm_message[80]
Defined in include/midas.h:1477
check_interval
INT check_interval
Defined in include/midas.h:1469
checked_last
DWORD checked_last
Defined in include/midas.h:1470
condition
char condition[256]
Defined in include/midas.h:1475
time_triggered_first
char time_triggered_first[32]
Defined in include/midas.h:1473
time_triggered_last
char time_triggered_last[32]
Defined in include/midas.h:1474
trigger_count
DWORD trigger_count
Defined in include/midas.h:1471
trigger_count_required
DWORD trigger_count_required
Defined in include/midas.h:1472
triggered
INT triggered
Defined in include/midas.h:1467
type
INT type
Defined in include/midas.h:1468
ALARM_CLASS
Alarm class structure
Defined in include/midas.h:1449
Attributes
alarm_sound
BOOL alarm_sound
Defined in include/midas.h:1460
display_bgcolor
char display_bgcolor[32]
Defined in include/midas.h:1458
display_fgcolor
char display_fgcolor[32]
Defined in include/midas.h:1459
execute_command
char execute_command[256]
Defined in include/midas.h:1454
execute_interval
INT execute_interval
Defined in include/midas.h:1455
execute_last
DWORD execute_last
Defined in include/midas.h:1456
stop_run
BOOL stop_run
Defined in include/midas.h:1457
system_message_interval
INT system_message_interval
Defined in include/midas.h:1452
system_message_last
DWORD system_message_last
Defined in include/midas.h:1453
write_elog_message
BOOL write_elog_message
Defined in include/midas.h:1451
write_system_message
BOOL write_system_message
Defined in include/midas.h:1450
PROGRAM_INFO
Program information structure
Defined in include/midas.h:1429
Attributes
alarm_class
char alarm_class[32]
Defined in include/midas.h:1437
auto_restart
BOOL auto_restart
Defined in include/midas.h:1436
auto_start
BOOL auto_start
Defined in include/midas.h:1434
auto_stop
BOOL auto_stop
Defined in include/midas.h:1435
check_interval
DWORD check_interval
Defined in include/midas.h:1432
first_failed
DWORD first_failed
Defined in include/midas.h:1438
required
BOOL required
Defined in include/midas.h:1430
start_command
char start_command[256]
Defined in include/midas.h:1433
watchdog_timeout
INT watchdog_timeout
Defined in include/midas.h:1431
RPC_LIST
Defined in include/midas.h:1533
Attributes
dispatch
RPC_HANDLER *dispatch
Defined in include/midas.h:1537
id
INT id
Defined in include/midas.h:1534
name
const char *name
Defined in include/midas.h:1535
param
RPC_PARAM param[MAX_RPC_PARAMS]
Defined in include/midas.h:1536
RPC_PARAM
function list
Defined in include/midas.h:1525
Attributes
flags
WORD flags
Defined in include/midas.h:1527
n
INT n
Defined in include/midas.h:1528
tid
WORD tid
Defined in include/midas.h:1526
RUNINFO
Defined in include/midas.h:1396
Attributes
online_mode
INT online_mode
Mode of operation online/offline
Defined in include/midas.h:1398
requested_transition
INT requested_transition
Deferred transition request
Defined in include/midas.h:1402
run_number
INT run_number
Current processing run number
Defined in include/midas.h:1399
start_abort
INT start_abort
Set if run start was aborted
Defined in include/midas.h:1401
start_time
char start_time[32]
ASCII of the last start time
Defined in include/midas.h:1403
start_time_binary
DWORD start_time_binary
Bin of the last start time
Defined in include/midas.h:1404
state
INT state
Current run condition
Defined in include/midas.h:1397
stop_time
char stop_time[32]
ASCII of the last stop time
Defined in include/midas.h:1405
stop_time_binary
DWORD stop_time_binary
ASCII of the last stop time
Defined in include/midas.h:1406
transition_in_progress
INT transition_in_progress
Intermediate state during transition
Defined in include/midas.h:1400
Event header macros
To read or change the fields of an event's EVENT_HEADER from a frontend's readout function, use the event header macros (TRIGGER_MASK(), EVENT_ID(), SERIAL_NUMBER(), TIME_STAMP() and DATA_SIZE()).