MIDAS
Loading...
Searching...
No Matches
midas.h File Reference
#include <mutex>
#include <atomic>
#include <vector>
#include <string>
Include dependency graph for midas.h:

Go to the source code of this file.

Classes

struct  EVENT_HEADER
 
struct  EVENT_REQUEST
 
struct  BUFFER_CLIENT
 
struct  BUFFER_HEADER
 
struct  BUFFER
 
struct  KEY
 
struct  KEYLIST
 
struct  BUS_DRIVER
 
struct  DD_MT_CHANNEL
 
struct  DD_MT_BUFFER
 
struct  EQUIPMENT_INFO
 
struct  EQUIPMENT_STATS
 
struct  DEVICE_DRIVER
 
struct  eqpmnt
 
struct  BANK_HEADER
 
struct  BANK
 
struct  BANK32
 
struct  BANK32A
 
struct  TAG
 
struct  BANK_LIST
 
struct  ANA_MODULE
 
struct  AR_INFO
 
struct  AR_STATS
 
struct  ANALYZE_REQUEST
 
struct  ANA_OUTPUT_INFO
 
struct  ANA_TEST
 
struct  HIST_RECORD
 
struct  DEF_RECORD
 
struct  INDEX_RECORD
 
struct  history_struct
 
struct  RUNINFO
 
struct  PROGRAM_INFO
 
struct  ALARM_CLASS
 
struct  ALARM
 
struct  RPC_PARAM
 
struct  RPC_LIST
 

Macros

#define DATABASE_VERSION   3
 
#define MIDAS_VERSION   "2.1"
 
#define MIDAS_TYPE_DEFINED
 
#define POINTER_T   int
 
#define PTYPE   POINTER_T
 
#define TRUE   1
 
#define FALSE   0
 
#define DIR_SEPARATOR   '/'
 
#define DIR_SEPARATOR_STR   "/"
 
#define INLINE
 
#define O_LARGEFILE   0
 
#define MATTRPRINTF(a, b)
 
#define MUTEX_T_DEFINED
 
#define DEFAULT_MAX_EVENT_SIZE   (4*1024*1024)
 
#define DEFAULT_BUFFER_SIZE   (32*1024*1024)
 
#define MIN_WRITE_CACHE_SIZE   (10000000)
 
#define MAX_WRITE_CACHE_SIZE_DIV   (3)
 
#define MAX_WRITE_CACHE_EVENT_SIZE_DIV   (10)
 
#define TAPE_BUFFER_SIZE   0x8000
 
#define NET_TCP_SIZE   0xFFFF
 
#define OPT_TCP_SIZE   8192
 
#define EVENT_BUFFER_NAME   "SYSTEM"
 
#define DEFAULT_ODB_SIZE   0x100000
 
#define NAME_LENGTH   32
 
#define HOST_NAME_LENGTH   256
 
#define MAX_CLIENTS   64
 
#define MAX_EVENT_REQUESTS   10
 
#define MAX_OPEN_RECORDS   256
 
#define MAX_ODB_PATH   256
 
#define BANKLIST_MAX   4096
 
#define STRING_BANKLIST_MAX   BANKLIST_MAX * 4
 
#define TRANSITION_ERROR_STRING_LENGTH   256
 
#define MIDAS_TCP_PORT   1175 /* port under which server is listening */
 
#define DEFAULT_RPC_TIMEOUT   10000
 
#define WATCHDOG_INTERVAL   1000
 
#define DEFAULT_WATCHDOG_TIMEOUT   10000
 
#define USE_HIDDEN_EQ
 
#define STATE_STOPPED   1
 
#define STATE_PAUSED   2
 
#define STATE_RUNNING   3
 
#define FORMAT_MIDAS   1
 
#define FORMAT_FIXED   4
 
#define FORMAT_ROOT   7
 
#define GET_ALL   (1<<0)
 
#define GET_NONBLOCKING   (1<<1
 
#define GET_RECENT   (1<<2)
 
#define TID_BYTE   1
 
#define TID_UINT8   1
 
#define TID_SBYTE   2
 
#define TID_INT8   2
 
#define TID_CHAR   3
 
#define TID_WORD   4
 
#define TID_UINT16   4
 
#define TID_SHORT   5
 
#define TID_INT16   5
 
#define TID_DWORD   6
 
#define TID_UINT32   6
 
#define TID_INT   7
 
#define TID_INT32   7
 
#define TID_BOOL   8
 
#define TID_FLOAT   9
 
#define TID_FLOAT32   9
 
#define TID_DOUBLE   10
 
#define TID_FLOAT64   10
 
#define TID_BITFIELD   11
 
#define TID_STRING   12
 
#define TID_ARRAY   13
 
#define TID_STRUCT   14
 
#define TID_KEY   15
 
#define TID_LINK   16
 
#define TID_INT64   17
 
#define TID_UINT64   18
 
#define TID_QWORD   18
 
#define TID_LAST   19
 
#define TR_SYNC   1
 
#define TR_ASYNC   2
 
#define TR_DETACH   4
 
#define TR_MTHREAD   8
 
#define BM_WAIT   0
 
#define BM_NO_WAIT   1
 
#define MODE_READ   (1<<0)
 
#define MODE_WRITE   (1<<1)
 
#define MODE_DELETE   (1<<2)
 
#define MODE_EXCLUSIVE   (1<<3)
 
#define MODE_ALLOC   (1<<6)
 
#define MODE_WATCH   (1<<7)
 
#define RPC_HNDLE_MSERVER   -1
 
#define RPC_HNDLE_CONNECT   -2
 
#define RPC_NO_REPLY   0x80000000l
 
#define WF_WATCH_ME   (1<<0) /* see cm_set_watchdog_flags */
 
#define WF_CALL_WD   (1<<1)
 
#define TR_START   (1<<0)
 
#define TR_STOP   (1<<1)
 
#define TR_PAUSE   (1<<2)
 
#define TR_RESUME   (1<<3)
 
#define TR_STARTABORT   (1<<4)
 
#define TR_DEFERRED   (1<<12)
 
#define EQ_PERIODIC   (1<<0)
 
#define EQ_POLLED   (1<<1)
 
#define EQ_INTERRUPT   (1<<2)
 
#define EQ_MULTITHREAD   (1<<3)
 
#define EQ_SLOW   (1<<4)
 
#define EQ_MANUAL_TRIG   (1<<5)
 
#define EQ_FRAGMENTED   (1<<6)
 
#define EQ_EB   (1<<7)
 
#define EQ_USER   (1<<8)
 
#define RO_RUNNING   (1<<0)
 
#define RO_STOPPED   (1<<1)
 
#define RO_PAUSED   (1<<2)
 
#define RO_BOR   (1<<3)
 
#define RO_EOR   (1<<4)
 
#define RO_PAUSE   (1<<5)
 
#define RO_RESUME   (1<<6)
 
#define RO_TRANSITIONS   (RO_BOR|RO_EOR|RO_PAUSE|RO_RESUME)
 
#define RO_NONTRANS   (RO_RUNNING|RO_STOPPED|RO_PAUSED)
 
#define RO_ALWAYS   (0xFF)
 
#define RO_ODB   (1<<8)
 
#define CH_BS   8
 
#define CH_TAB   9
 
#define CH_LF   10
 
#define CH_CR   13
 
#define CH_EXT   0x100
 
#define CH_HOME   (CH_EXT+0)
 
#define CH_INSERT   (CH_EXT+1)
 
#define CH_DELETE   (CH_EXT+2)
 
#define CH_END   (CH_EXT+3)
 
#define CH_PUP   (CH_EXT+4)
 
#define CH_PDOWN   (CH_EXT+5)
 
#define CH_UP   (CH_EXT+6)
 
#define CH_DOWN   (CH_EXT+7)
 
#define CH_RIGHT   (CH_EXT+8)
 
#define CH_LEFT   (CH_EXT+9)
 
#define LAM_SOURCE(c, s)   (c<<24 | ((s) & 0xFFFFFF))
 
#define LAM_STATION(s)   (1<<(s-1))
 
#define LAM_SOURCE_CRATE(c)   (c>>24)
 
#define LAM_SOURCE_STATION(s)   ((s) & 0xFFFFFF)
 
#define CNAF   0x1 /* normal read/write */
 
#define CNAF_nQ   0x2 /* Repeat read until noQ */
 
#define CNAF_INHIBIT_SET   0x100
 
#define CNAF_INHIBIT_CLEAR   0x101
 
#define CNAF_CRATE_CLEAR   0x102
 
#define CNAF_CRATE_ZINIT   0x103
 
#define CNAF_TEST   0x110
 
#define MAX(a, b)   (((a)>(b))?(a):(b))
 
#define MIN(a, b)   (((a)<(b))?(a):(b))
 
#define ALIGN8(x)   (((x)+7) & ~7)
 
#define VALIGN(adr, align)   (((POINTER_T) (adr)+(align)-1) & ~((align)-1))
 
#define EVENTID_ALL   -1 /* any event id */
 
#define TRIGGER_ALL   -1 /* any type of trigger */
 
#define MT_ERROR   (1<<0)
 
#define MT_INFO   (1<<1)
 
#define MT_DEBUG   (1<<2)
 
#define MT_USER   (1<<3)
 
#define MT_LOG   (1<<4)
 
#define MT_TALK   (1<<5)
 
#define MT_CALL   (1<<6)
 
#define MT_ALL   0xFF
 
#define MT_ERROR_STR   "ERROR"
 
#define MT_INFO_STR   "INFO"
 
#define MT_DEBUG_STR   "DEBUG"
 
#define MT_USER_STR   "USER"
 
#define MT_LOG_STR   "LOG"
 
#define MT_TALK_STR   "TALK"
 
#define MT_CALL_STR   "CALL"
 
#define MERROR   MT_ERROR, __FILE__, __LINE__
 
#define MINFO   MT_INFO, __FILE__, __LINE__
 
#define MDEBUG   MT_DEBUG, __FILE__, __LINE__
 
#define MUSER   MT_USER, __FILE__, __LINE__
 
#define MLOG   MT_LOG, __FILE__, __LINE__
 
#define MTALK   MT_TALK, __FILE__, __LINE__
 
#define MCALL   MT_CALL, __FILE__, __LINE__
 
#define SUCCESS   1
 
#define CM_SUCCESS   1
 
#define CM_SET_ERROR   102
 
#define CM_NO_CLIENT   103
 
#define CM_DB_ERROR   104
 
#define CM_UNDEF_EXP   105
 
#define CM_VERSION_MISMATCH   106
 
#define CM_SHUTDOWN   107
 
#define CM_WRONG_PASSWORD   108
 
#define CM_UNDEF_ENVIRON   109
 
#define CM_DEFERRED_TRANSITION   110
 
#define CM_TRANSITION_IN_PROGRESS   111
 
#define CM_TIMEOUT   112
 
#define CM_INVALID_TRANSITION   113
 
#define CM_TOO_MANY_REQUESTS   114
 
#define CM_TRUNCATED   115
 
#define CM_TRANSITION_CANCELED   116
 
#define BM_SUCCESS   1
 
#define BM_CREATED   202
 
#define BM_NO_MEMORY   203
 
#define BM_INVALID_NAME   204
 
#define BM_INVALID_HANDLE   205
 
#define BM_NO_SLOT   206
 
#define BM_NO_SEMAPHORE   207
 
#define BM_NOT_FOUND   208
 
#define BM_ASYNC_RETURN   209
 
#define BM_TRUNCATED   210
 
#define BM_MULTIPLE_HOSTS   211
 
#define BM_MEMSIZE_MISMATCH   212
 
#define BM_CONFLICT   213
 
#define BM_EXIT   214
 
#define BM_INVALID_PARAM   215
 
#define BM_MORE_EVENTS   216
 
#define BM_INVALID_MIXING   217
 
#define BM_NO_SHM   218
 
#define BM_CORRUPTED   219
 
#define BM_INVALID_SIZE   220
 
#define DB_SUCCESS   1
 
#define DB_CREATED   302
 
#define DB_NO_MEMORY   303
 
#define DB_INVALID_NAME   304
 
#define DB_INVALID_HANDLE   305
 
#define DB_NO_SLOT   306
 
#define DB_NO_SEMAPHORE   307
 
#define DB_MEMSIZE_MISMATCH   308
 
#define DB_INVALID_PARAM   309
 
#define DB_FULL   310
 
#define DB_KEY_EXIST   311
 
#define DB_NO_KEY   312
 
#define DB_KEY_CREATED   313
 
#define DB_TRUNCATED   314
 
#define DB_TYPE_MISMATCH   315
 
#define DB_NO_MORE_SUBKEYS   316
 
#define DB_FILE_ERROR   317
 
#define DB_NO_ACCESS   318
 
#define DB_STRUCT_SIZE_MISMATCH   319
 
#define DB_OPEN_RECORD   320
 
#define DB_OUT_OF_RANGE   321
 
#define DB_INVALID_LINK   322
 
#define DB_CORRUPTED   323
 
#define DB_STRUCT_MISMATCH   324
 
#define DB_TIMEOUT   325
 
#define DB_VERSION_MISMATCH   326
 
#define SS_SUCCESS   1
 
#define SS_CREATED   402
 
#define SS_NO_MEMORY   403
 
#define SS_INVALID_NAME   404
 
#define SS_INVALID_HANDLE   405
 
#define SS_INVALID_ADDRESS   406
 
#define SS_FILE_ERROR   407
 
#define SS_NO_SEMAPHORE   408
 
#define SS_NO_PROCESS   409
 
#define SS_NO_THREAD   410
 
#define SS_SOCKET_ERROR   411
 
#define SS_TIMEOUT   412
 
#define SS_SERVER_RECV   413
 
#define SS_CLIENT_RECV   414
 
#define SS_ABORT   415
 
#define SS_EXIT   416
 
#define SS_NO_TAPE   417
 
#define SS_DEV_BUSY   418
 
#define SS_IO_ERROR   419
 
#define SS_TAPE_ERROR   420
 
#define SS_NO_DRIVER   421
 
#define SS_END_OF_TAPE   422
 
#define SS_END_OF_FILE   423
 
#define SS_FILE_EXISTS   424
 
#define SS_NO_SPACE   425
 
#define SS_INVALID_FORMAT   426
 
#define SS_NO_ROOT   427
 
#define SS_SIZE_MISMATCH   428
 
#define SS_NO_MUTEX   429
 
#define RPC_SUCCESS   1
 
#define RPC_ABORT   SS_ABORT
 
#define RPC_NO_CONNECTION   502
 
#define RPC_NET_ERROR   503
 
#define RPC_TIMEOUT   504
 
#define RPC_EXCEED_BUFFER   505
 
#define RPC_NOT_REGISTERED   506
 
#define RPC_CONNCLOSED   507
 
#define RPC_INVALID_ID   508
 
#define RPC_SHUTDOWN   509
 
#define RPC_NO_MEMORY   510
 
#define RPC_DOUBLE_DEFINED   511
 
#define RPC_MUTEX_TIMEOUT   512
 
#define FE_SUCCESS   1
 
#define FE_ERR_ODB   602
 
#define FE_ERR_HW   603
 
#define FE_ERR_DISABLED   604
 
#define FE_ERR_DRIVER   605
 
#define FE_PARTIALLY_DISABLED   606
 
#define FE_NOT_YET_READ   607
 
#define HS_SUCCESS   1
 
#define HS_FILE_ERROR   702
 
#define HS_NO_MEMORY   703
 
#define HS_TRUNCATED   704
 
#define HS_WRONG_INDEX   705
 
#define HS_UNDEFINED_EVENT   706
 
#define HS_UNDEFINED_VAR   707
 
#define FTP_SUCCESS   1
 
#define FTP_NET_ERROR   802
 
#define FTP_FILE_ERROR   803
 
#define FTP_RESPONSE_ERROR   804
 
#define FTP_INVALID_ARG   805
 
#define EL_SUCCESS   1
 
#define EL_FILE_ERROR   902
 
#define EL_NO_MESSAGE   903
 
#define EL_TRUNCATED   904
 
#define EL_FIRST_MSG   905
 
#define EL_LAST_MSG   906
 
#define AL_SUCCESS   1
 
#define AL_INVALID_NAME   1002
 
#define AL_ERROR_ODB   1003
 
#define AL_RESET   1004
 
#define AL_TRIGGERED   1005
 
#define CMD_INIT   1 /* misc. commands must be below 20 !! */
 
#define CMD_EXIT   2
 
#define CMD_START   3
 
#define CMD_STOP   4
 
#define CMD_IDLE   5
 
#define CMD_GET_THRESHOLD   6
 
#define CMD_GET_THRESHOLD_CURRENT   7
 
#define CMD_GET_THRESHOLD_ZERO   8
 
#define CMD_SET_LABEL   9
 
#define CMD_GET_LABEL   10
 
#define CMD_OPEN   11
 
#define CMD_CLOSE   12
 
#define CMD_MISC_LAST   12 /* update this if you add new commands */
 
#define CMD_SET_FIRST   CMD_MISC_LAST+1 /* set commands */
 
#define CMD_SET   CMD_SET_FIRST
 
#define CMD_SET_VOLTAGE_LIMIT   CMD_SET_FIRST+1
 
#define CMD_SET_CURRENT_LIMIT   CMD_SET_FIRST+2
 
#define CMD_SET_RAMPUP   CMD_SET_FIRST+3
 
#define CMD_SET_RAMPDOWN   CMD_SET_FIRST+4
 
#define CMD_SET_TRIP_TIME   CMD_SET_FIRST+5
 
#define CMD_SET_CHSTATE   CMD_SET_FIRST+6
 
#define CMD_SET_LAST   CMD_SET_FIRST+6 /* update this if you add new commands */
 
#define CMD_GET_FIRST   CMD_SET_LAST+1 /* multithreaded get commands */
 
#define CMD_GET   CMD_GET_FIRST
 
#define CMD_GET_CURRENT   CMD_GET_FIRST+1
 
#define CMD_GET_TRIP   CMD_GET_FIRST+2
 
#define CMD_GET_STATUS   CMD_GET_FIRST+3
 
#define CMD_GET_TEMPERATURE   CMD_GET_FIRST+4
 
#define CMD_GET_DEMAND   CMD_GET_FIRST+5
 
#define CMD_GET_LAST   CMD_GET_FIRST+5 /* update this if you add new commands ! */
 
#define CMD_GET_DIRECT   CMD_GET_LAST+1 /* direct get commands */
 
#define CMD_GET_VOLTAGE_LIMIT   CMD_GET_DIRECT
 
#define CMD_GET_CURRENT_LIMIT   CMD_GET_DIRECT+2
 
#define CMD_GET_RAMPUP   CMD_GET_DIRECT+3
 
#define CMD_GET_RAMPDOWN   CMD_GET_DIRECT+4
 
#define CMD_GET_TRIP_TIME   CMD_GET_DIRECT+5
 
#define CMD_GET_CHSTATE   CMD_GET_DIRECT+6
 
#define CMD_GET_CRATEMAP   CMD_GET_DIRECT+7
 
#define CMD_GET_DEMAND_DIRECT   CMD_GET_DIRECT+8
 
#define CMD_GET_DIRECT_LAST   CMD_GET_DIRECT+8 /* update this if you add new commands ! */
 
#define CMD_ENABLE_COMMAND   (1<<14) /* these two commands can be used to enable/disable */
 
#define CMD_DISABLE_COMMAND   (1<<15) /* one of the other commands */
 
#define CMD_WRITE   100
 
#define CMD_READ   101
 
#define CMD_PUTS   102
 
#define CMD_GETS   103
 
#define CMD_DEBUG   104
 
#define CMD_NAME   105
 
#define CMD_INTERRUPT_ENABLE   100
 
#define CMD_INTERRUPT_DISABLE   101
 
#define CMD_INTERRUPT_ATTACH   102
 
#define CMD_INTERRUPT_DETACH   103
 
#define BD_GETS(s, z, p, t)   info->bd(CMD_GETS, info->bd_info, s, z, p, t)
 
#define BD_READS(s, z, t)   info->bd(CMD_READ, info->bd_info, s, z, t)
 
#define BD_PUTS(s)   info->bd(CMD_PUTS, info->bd_info, s)
 
#define BD_WRITES(s)   info->bd(CMD_WRITE, info->bd_info, s)
 
#define ANA_CONTINUE   1
 
#define ANA_SKIP   0
 
#define TRIGGER_MASK(e)   ((((EVENT_HEADER *) e)-1)->trigger_mask)
 
#define EVENT_ID(e)   ((((EVENT_HEADER *) e)-1)->event_id)
 
#define SERIAL_NUMBER(e)   ((((EVENT_HEADER *) e)-1)->serial_number)
 
#define TIME_STAMP(e)   ((((EVENT_HEADER *) e)-1)->time_stamp)
 
#define DATA_SIZE(e)   ((((EVENT_HEADER *) e)-1)->data_size)
 
#define EVENT_SOURCE(e, o)   (* (INT*) (e+o))
 
#define EVENTID_BOR   ((short int) 0x8000)
 
#define EVENTID_EOR   ((short int) 0x8001)
 
#define EVENTID_MESSAGE   ((short int) 0x8002)
 
#define EVENTID_FRAG1   ((short int) 0xC000) /* first fragment */
 
#define EVENTID_FRAG   ((short int) 0xD000) /* added to real event-id */
 
#define MIDAS_MAGIC   0x494d
 
#define DF_INPUT   (1<<0)
 
#define DF_OUTPUT   (1<<1)
 
#define DF_PRIO_DEVICE   (1<<2)
 
#define DF_READ_ONLY   (1<<3)
 
#define DF_MULTITHREAD   (1<<4)
 
#define DF_HW_RAMP   (1<<5)
 
#define DF_LABELS_FROM_DEVICE   (1<<6)
 
#define DF_REPORT_TEMP   (1<<7)
 
#define DF_REPORT_STATUS   (1<<8)
 
#define DF_REPORT_CHSTATE   (1<<9)
 
#define DF_REPORT_CRATEMAP   (1<<10)
 
#define DF_QUICKSTART   (1<<11)
 
#define DF_POLL_DEMAND   (1<<12)
 
#define DF_PRIORITY_READ   (1<<13)
 
#define EQUIPMENT_COMMON_STR   "\Event ID = WORD : 0\n\Trigger mask = WORD : 0\n\Buffer = STRING : [32] SYSTEM\n\Type = INT : 0\n\Source = INT : 0\n\Format = STRING : [8] FIXED\n\Enabled = BOOL : 0\n\Read on = INT : 0\n\Period = INT : 0\n\Event limit = DOUBLE : 0\n\Num subevents = DWORD : 0\n\Log history = INT : 0\n\Frontend host = STRING : [32] \n\Frontend name = STRING : [32] \n\Frontend file name = STRING : [256] \n\Status = STRING : [256] \n\Status color = STRING : [32] \n\Hidden = BOOL : 0\n\Write cache size = INT : 100000\n\"
 
#define EQUIPMENT_STATISTICS_STR   "\Events sent = DOUBLE : 0\n\Events per sec. = DOUBLE : 0\n\kBytes per sec. = DOUBLE : 0\n\"
 
#define BANK_FORMAT_VERSION   1
 
#define BANK_FORMAT_32BIT   (1<<4)
 
#define BANK_FORMAT_64BIT_ALIGNED   (1<<5)
 
#define ANA_OUTPUT_INFO_STR   "\Filename = STRING : [256] run%05d.asc\n\RWNT = BOOL : 0\n\Histo Dump = BOOL : 0\n\Histo Dump Filename = STRING : [256] his%05d.rz\n\Clear histos = BOOL : 1\n\Last Histo Filename = STRING : [256] last.rz\n\Events to ODB = BOOL : 1\n\Global Memory Name = STRING : [8] ONLN\n\"
 
#define SET_TEST(t, v)   { if (!t.registered) test_register(&t); t.value = (v); }
 
#define TEST(t)   (t.value)
 
#define DEF_TEST(t)   extern ANA_TEST t;
 
#define RT_DATA   (*((DWORD *) "HSDA"))
 
#define RT_DEF   (*((DWORD *) "HSDF"))
 
#define RUNINFO_STR(_name)
 
#define AT_INTERNAL   1
 
#define AT_PROGRAM   2
 
#define AT_EVALUATED   3
 
#define AT_PERIODIC   4
 
#define AT_LAST   4
 
#define PROGRAM_INFO_STR(_name)
 
#define ALARM_CLASS_STR(_name)
 
#define ALARM_ODB_STR(_name)
 
#define ALARM_PERIODIC_STR(_name)
 
#define M_MALLOC(x)   malloc(x)
 
#define M_CALLOC(x, y)   calloc(x,y)
 
#define M_FREE(x)   free(x)
 
#define PAWC_NAME   PAWC
 
#define PAWC_DEFINE(size)
 
#define RPC_IN   (1 << 0)
 
#define RPC_OUT   (1 << 1)
 
#define RPC_POINTER   (1 << 2)
 
#define RPC_FIXARRAY   (1 << 3)
 
#define RPC_VARARRAY   (1 << 4)
 
#define RPC_OUTGOING   (1 << 5)
 
#define MAX_RPC_PARAMS   20
 
#define RPC_MIN_ID   1
 
#define RPC_MAX_ID   9999
 
#define CF_ENDIAN   (1<<0)
 
#define CF_IEEE2VAX   (1<<1)
 
#define CF_VAX2IEEE   (1<<2)
 
#define CBYTE(_i)   (* ((BYTE *) prpc_param[_i]))
 
#define CPBYTE(_i)   ( ((BYTE *) prpc_param[_i]))
 
#define CSHORT(_i)   (* ((short *) prpc_param[_i]))
 
#define CPSHORT(_i)   ( ((short *) prpc_param[_i]))
 
#define CINT(_i)   (* ((INT *) prpc_param[_i]))
 
#define CPINT(_i)   ( ((INT *) prpc_param[_i]))
 
#define CWORD(_i)   (* ((WORD *) prpc_param[_i]))
 
#define CPWORD(_i)   ( ((WORD *) prpc_param[_i]))
 
#define CLONG(_i)   (* ((long *) prpc_param[_i]))
 
#define CPLONG(_i)   ( ((long *) prpc_param[_i]))
 
#define CDWORD(_i)   (* ((DWORD *) prpc_param[_i]))
 
#define CPDWORD(_i)   ( ((DWORD *) prpc_param[_i]))
 
#define CHNDLE(_i)   (* ((HNDLE *) prpc_param[_i]))
 
#define CPHNDLE(_i)   ( ((HNDLE *) prpc_param[_i]))
 
#define CBOOL(_i)   (* ((BOOL *) prpc_param[_i]))
 
#define CPBOOL(_i)   ( ((BOOL *) prpc_param[_i]))
 
#define CFLOAT(_i)   (* ((float *) prpc_param[_i]))
 
#define CPFLOAT(_i)   ( ((float *) prpc_param[_i]))
 
#define CDOUBLE(_i)   (* ((double *) prpc_param[_i]))
 
#define CPDOUBLE(_i)   ( ((double *) prpc_param[_i]))
 
#define CSTRING(_i)   ( ((char *) prpc_param[_i]))
 
#define CARRAY(_i)   ( ((void *) prpc_param[_i]))
 
#define CBYTE(_i)   (* ((BYTE *) prpc_param[_i]))
 
#define CPBYTE(_i)   ( ((BYTE *) prpc_param[_i]))
 
#define CSHORT(_i)   (* ((short *) prpc_param[_i]))
 
#define CPSHORT(_i)   ( ((short *) prpc_param[_i]))
 
#define CINT(_i)   (* ((INT *) prpc_param[_i]))
 
#define CPINT(_i)   ( ((INT *) prpc_param[_i]))
 
#define CWORD(_i)   (* ((WORD *) prpc_param[_i]))
 
#define CPWORD(_i)   ( ((WORD *) prpc_param[_i]))
 
#define CLONG(_i)   (* ((long *) prpc_param[_i]))
 
#define CPLONG(_i)   ( ((long *) prpc_param[_i]))
 
#define CDWORD(_i)   (* ((DWORD *) prpc_param[_i]))
 
#define CPDWORD(_i)   ( ((DWORD *) prpc_param[_i]))
 
#define CHNDLE(_i)   (* ((HNDLE *) prpc_param[_i]))
 
#define CPHNDLE(_i)   ( ((HNDLE *) prpc_param[_i]))
 
#define CBOOL(_i)   (* ((BOOL *) prpc_param[_i]))
 
#define CPBOOL(_i)   ( ((BOOL *) prpc_param[_i]))
 
#define CFLOAT(_i)   (* ((float *) prpc_param[_i]))
 
#define CPFLOAT(_i)   ( ((float *) prpc_param[_i]))
 
#define CDOUBLE(_i)   (* ((double *) prpc_param[_i]))
 
#define CPDOUBLE(_i)   ( ((double *) prpc_param[_i]))
 
#define CSTRING(_i)   ( ((char *) prpc_param[_i]))
 
#define CARRAY(_i)   ( ((void *) prpc_param[_i]))
 
#define cBYTE   (* ((BYTE *) prpc_param[--n_param]))
 
#define cPBYTE   ( ((BYTE *) prpc_param[--n_param]))
 
#define cSHORT   (* ((short *) prpc_param[--n_param]))
 
#define cPSHORT   ( ((short *) prpc_param[--n_param]))
 
#define cINT   (* ((INT *) prpc_param[--n_param]))
 
#define cPINT   ( ((INT *) prpc_param[--n_param]))
 
#define cWORD   (* ((WORD *) prpc_param[--n_param]))
 
#define cPWORD   ( ((WORD *) prpc_param[--n_param]))
 
#define cLONG   (* ((long *) prpc_param[--n_param]))
 
#define cPLONG   ( ((long *) prpc_param[--n_param]))
 
#define cDWORD   (* ((DWORD *) prpc_param[--n_param]))
 
#define cPDWORD   ( ((DWORD *) prpc_param[--n_param]))
 
#define cHNDLE   (* ((HNDLE *) prpc_param[--n_param]))
 
#define cPHNDLE   ( ((HNDLE *) prpc_param[--n_param]))
 
#define cBOOL   (* ((BOOL *) prpc_param[--n_param]))
 
#define cPBOOL   ( ((BOOL *) prpc_param[--n_param]))
 
#define cFLOAT   (* ((float *) prpc_param[--n_param]))
 
#define cPFLOAT   ( ((float *) prpc_param[--n_param]))
 
#define cDOUBLE   (* ((double *) prpc_param[--n_param]))
 
#define cPDOUBLE   ( ((double *) prpc_param[--n_param]))
 
#define cSTRING   ( ((char *) prpc_param[--n_param]))
 
#define cARRAY   ( ((void *) prpc_param[--n_param]))
 
#define JS_LEVEL_0   0
 
#define JS_LEVEL_1   1
 
#define JS_MUST_BE_SUBDIR   1
 
#define JSFLAG_SAVE_KEYS   (1<<1)
 
#define JSFLAG_FOLLOW_LINKS   (1<<2)
 
#define JSFLAG_RECURSE   (1<<3)
 
#define JSFLAG_LOWERCASE   (1<<4)
 
#define JSFLAG_OMIT_NAMES   (1<<5)
 
#define JSFLAG_OMIT_LAST_WRITTEN   (1<<6)
 
#define JSFLAG_OMIT_OLD   (1<<7)
 
#define EXPRT
 
#define HAVE_CM_GET_CLIENT_NAME   1
 
#define HAVE_CM_PERIODIC_TASKS   1
 
#define HAVE_BM_SEND_EVENT_VEC   1
 
#define HAVE_BM_RECEIVE_EVENT_VEC   1
 
#define HAVE_BM_RECEIVE_EVENT_ALLOC   1
 
#define HAVE_DB_GET_VALUE_STRING_CREATE_STRING_LENGTH   1
 

Typedefs

typedef unsigned char BYTE
 
typedef unsigned short int WORD
 
typedef unsigned int DWORD
 
typedef DWORD BOOL
 
typedef int INT
 
typedef INT HNDLE
 
typedef unsigned char UINT8
 
typedef char INT8
 
typedef unsigned short UINT16
 
typedef short INT16
 
typedef unsigned int UINT32
 
typedef int INT32
 
typedef unsigned long long UINT64
 
typedef long long INT64
 
typedef INT midas_thread_t
 
typedef INT MUTEX_T
 
typedef std::vector< std::string > STRING_LIST
 
typedef void() EVENT_HANDLER(HNDLE buffer_handler, HNDLE request_id, EVENT_HEADER *event_header, void *event_data)
 
typedef INT() RPC_HANDLER(INT index, void *prpc_param[])
 
typedef struct eqpmntPEQUIPMENT
 
typedef struct eqpmnt EQUIPMENT
 
typedef struct history_struct HISTORY
 

Functions

INT device_driver (DEVICE_DRIVER *device_driver, INT cmd,...)
 
voiddbg_malloc (unsigned int size, char *file, int line)
 
voiddbg_calloc (unsigned int size, unsigned int count, char *file, int line)
 
void dbg_free (void *adr, char *file, int line)
 
std::string cm_get_error (INT code)
 
const char *EXPRT cm_get_version (void)
 
const char *EXPRT cm_get_revision (void)
 
INT EXPRT cm_get_experiment_name (char *name, int name_size)
 
std::string cm_get_experiment_name ()
 
INT EXPRT cm_get_environment (char *host_name, int host_name_size, char *exp_name, int exp_name_size)
 
INT EXPRT cm_get_environment (std::string *host_name, std::string *exp_name)
 
INT EXPRT cm_list_experiments_local (STRING_LIST *exp_names)
 
INT EXPRT cm_list_experiments_remote (const char *host_name, STRING_LIST *exp_names)
 
INT EXPRT cm_get_exptab_filename (char *filename, int filename_size)
 
std::string cm_get_exptab_filename ()
 
INT EXPRT cm_get_exptab (const char *exp_name, char *expdir, int expdir_size, char *expuser, int expuser_size)
 
INT EXPRT cm_get_exptab (const char *exp_name, std::string *expdir, std::string *expuser)
 
INT EXPRT cm_select_experiment_local (std::string *exp_name)
 
INT EXPRT cm_select_experiment_remote (const char *host_name, std::string *exp_name)
 
INT EXPRT cm_set_experiment_local (const char *exp_name)
 
INT EXPRT cm_connect_experiment (const char *host_name, const char *exp_name, const char *client_name, void(*func)(char *))
 
INT EXPRT cm_connect_experiment1 (const char *host_name, const char *exp_name, const char *client_name, void(*func)(char *), INT odb_size, DWORD watchdog_timeout)
 
INT EXPRT cm_disconnect_experiment (void)
 
INT EXPRT cm_register_transition (INT transition, INT(*func)(INT, char *), int sequence_number)
 
INT EXPRT cm_deregister_transition (INT transition)
 
INT EXPRT cm_set_transition_sequence (INT transition, INT sequence_number)
 
INT EXPRT cm_set_client_run_state (INT state)
 
INT EXPRT cm_query_transition (int *transition, int *run_number, int *trans_time)
 
INT EXPRT cm_register_deferred_transition (INT transition, BOOL(*func)(INT, BOOL))
 
INT EXPRT cm_check_deferred_transition (void)
 
INT EXPRT cm_transition (INT transition, INT run_number, char *error, INT strsize, INT async_flag, INT debug_flag)
 
INT EXPRT cm_transition_cleanup ()
 
std::string EXPRT cm_transition_name (int transition)
 
INT EXPRT cm_register_server (void)
 
INT EXPRT cm_register_function (INT id, INT(*func)(INT, void **))
 
INT EXPRT cm_connect_client (const char *client_name, HNDLE *hConn)
 
INT EXPRT cm_disconnect_client (HNDLE hConn, BOOL bShutdown)
 
INT EXPRT cm_set_experiment_database (HNDLE hDB, HNDLE hKeyClient)
 
INT EXPRT cm_get_experiment_database (HNDLE *hDB, HNDLE *hKeyClient)
 
INT EXPRT cm_set_experiment_semaphore (INT semaphore_alarm, INT semaphore_elog, INT semaphore_history, INT semaphore_msg)
 
INT EXPRT cm_get_experiment_semaphore (INT *semaphore_alarm, INT *semaphore_elog, INT *semaphore_history, INT *semaphore_msg)
 
INT EXPRT cm_set_client_info (HNDLE hDB, HNDLE *hKeyClient, const char *host_name, char *client_name, INT computer_id, const char *password, DWORD watchdog_timeout)
 
std::string EXPRT cm_get_client_name ()
 
INT EXPRT cm_check_client (HNDLE hDB, HNDLE hKeyClient)
 
INT EXPRT cm_set_watchdog_params (BOOL call_watchdog, DWORD timeout)
 
INT EXPRT cm_get_watchdog_params (BOOL *call_watchdog, DWORD *timeout)
 
INT EXPRT cm_get_watchdog_info (HNDLE hDB, const char *client_name, DWORD *timeout, DWORD *last)
 
INT EXPRT cm_watchdog_thread (void *unused)
 
INT EXPRT cm_start_watchdog_thread (void)
 
INT EXPRT cm_stop_watchdog_thread (void)
 
INT EXPRT cm_shutdown (const char *name, BOOL bUnique)
 
INT EXPRT cm_exist (const char *name, BOOL bUnique)
 
INT EXPRT cm_cleanup (const char *client_name, BOOL ignore_timeout)
 
INT EXPRT cm_yield (INT millisec)
 
INT EXPRT cm_periodic_tasks (void)
 
INT EXPRT cm_execute (const char *command, char *result, INT buf_size)
 
INT EXPRT cm_synchronize (DWORD *sec)
 
INT EXPRT cm_asctime (char *str, INT buf_size)
 
std::string EXPRT cm_asctime ()
 
INT EXPRT cm_time (DWORD *t)
 
BOOL EXPRT cm_is_ctrlc_pressed (void)
 
void EXPRT cm_ack_ctrlc_pressed (void)
 
INT EXPRT cm_exec_script (const char *odb_path_to_script)
 
int EXPRT cm_write_event_to_odb (HNDLE hDB, HNDLE hKey, const EVENT_HEADER *pevent, INT format)
 
INT EXPRT cm_set_msg_print (INT system_mask, INT user_mask, int(*func)(const char *))
 
INT EXPRT cm_msg (INT message_type, const char *filename, INT line, const char *routine, const char *format,...) MATTRPRINTF(5
 
INT EXPRT INT EXPRT cm_msg1 (INT message_type, const char *filename, INT line, const char *facility, const char *routine, const char *format,...) MATTRPRINTF(6
 
INT EXPRT INT EXPRT INT EXPRT cm_msg_flush_buffer (void)
 
INT EXPRT cm_msg_register (EVENT_HANDLER *func)
 
INT EXPRT cm_msg_retrieve (INT n_message, char *message, INT buf_size)
 
INT EXPRT cm_msg_retrieve2 (const char *facility, time_t t, int min_messages, char **messages, int *num_messages)
 
INT EXPRT cm_msg_facilities (STRING_LIST *list)
 
void EXPRT cm_msg_get_logfile (const char *facility, time_t t, std::string *filename, std::string *linkname, std::string *linktarget)
 
INT EXPRT cm_msg_open_buffer (void)
 
INT EXPRT cm_msg_close_buffer (void)
 
INT EXPRT cm_msg_early_init (void)
 
BOOL EXPRT equal_ustring (const char *str1, const char *str2)
 
BOOL EXPRT ends_with_ustring (const char *str, const char *suffix)
 
bool EXPRT ends_with_char (const std::string &s, char c)
 
BOOL EXPRT strmatch (char *pattern, char *str)
 
void EXPRT strarrayindex (char *odbpath, int *index1, int *index2)
 
std::string msprintf (const char *format,...) MATTRPRINTF(1
 
std::string std::string cm_expand_env (const char *str)
 
INT EXPRT bm_open_buffer (const char *buffer_name, INT buffer_size, INT *buffer_handle)
 
INT EXPRT bm_get_buffer_handle (const char *buffer_name, INT *buffer_handle)
 
INT EXPRT bm_close_buffer (INT buffer_handle)
 
INT EXPRT bm_close_all_buffers (void)
 
INT EXPRT bm_init_buffer_counters (INT buffer_handle)
 
INT EXPRT bm_get_buffer_info (INT buffer_handle, BUFFER_HEADER *buffer_header)
 
INT EXPRT bm_get_buffer_level (INT buffer_handle, INT *n_bytes)
 
INT EXPRT bm_set_cache_size (INT buffer_handle, size_t read_size, size_t write_size)
 
INT EXPRT bm_compose_event (EVENT_HEADER *event_header, short int event_id, short int trigger_mask, DWORD data_size, DWORD serial)
 
INT EXPRT bm_compose_event_threadsafe (EVENT_HEADER *event_header, short int event_id, short int trigger_mask, DWORD data_size, DWORD *serial)
 
INT EXPRT bm_match_event (short int event_id, short int trigger_mask, const EVENT_HEADER *pevent)
 
INT EXPRT bm_request_event (INT buffer_handle, short int event_id, short int trigger_mask, INT sampling_type, INT *request_id, EVENT_HANDLER *func)
 
INT EXPRT bm_add_event_request (INT buffer_handle, short int event_id, short int trigger_mask, INT sampling_type, EVENT_HANDLER *func, INT request_id)
 
INT EXPRT bm_remove_event_request (INT buffer_handle, INT request_id)
 
INT EXPRT bm_delete_request (INT request_id)
 
INT EXPRT bm_send_event (INT buffer_handle, const EVENT_HEADER *event, int unused, int timeout_msec)
 
INT EXPRT bm_send_event_vec (INT buffer_handle, const std::vector< char > &event, int timeout_msec)
 
INT EXPRT bm_send_event_vec (INT buffer_handle, const std::vector< std::vector< char > > &event, int timeout_msec)
 
INT EXPRT bm_send_event_sg (INT buffer_handle, int sg_n, const char *const sg_ptr[], const size_t sg_len[], int timeout_msec)
 
INT EXPRT bm_receive_event (INT buffer_handle, void *destination, INT *buf_size, int timeout_msec)
 
INT EXPRT bm_receive_event_vec (INT buffer_handle, std::vector< char > *event, int timeout_msec)
 
INT EXPRT bm_receive_event_alloc (INT buffer_handle, EVENT_HEADER **ppevent, int timeout_msec)
 
INT EXPRT bm_skip_event (INT buffer_handle)
 
INT EXPRT bm_flush_cache (INT buffer_handle, int timeout_msec)
 
INT EXPRT bm_poll_event (void)
 
INT EXPRT bm_empty_buffers (void)
 
INT EXPRT bm_check_buffers (void)
 
INT EXPRT bm_write_statistics_to_odb (void)
 
INT db_open_database (const char *xdatabase_name, INT database_size, HNDLE *hDB, const char *client_name)
 
INT db_close_database (HNDLE hDB)
 
INT db_close_all_databases (void)
 
INT db_protect_database (HNDLE hDB)
 
INT db_create_key (HNDLE hDB, HNDLE hKey, const char *key_name, DWORD type)
 
INT db_create_link (HNDLE hDB, HNDLE hKey, const char *link_name, const char *destination)
 
INT db_set_value (HNDLE hDB, HNDLE hKeyRoot, const char *key_name, const void *data, INT data_size, INT num_values, DWORD type)
 
INT db_set_value_index (HNDLE hDB, HNDLE hKeyRoot, const char *key_name, const void *data, INT data_size, INT idx, DWORD type, BOOL trunc)
 
INT db_get_value (HNDLE hDB, HNDLE hKeyRoot, const char *key_name, void *data, INT *buf_size, DWORD type, BOOL create)
 
INT EXPRT db_resize_string (HNDLE hdb, HNDLE hKeyRoot, const char *key_name, int num_values, int max_string_length)
 
INT EXPRT db_get_value_string (HNDLE hdb, HNDLE hKeyRoot, const char *key_name, int index, std::string *s, BOOL create, int create_string_length)
 
INT EXPRT db_set_value_string (HNDLE hDB, HNDLE hKeyRoot, const char *key_name, const std::string *s)
 
INT db_find_key (HNDLE hDB, HNDLE hKey, const char *key_name, HNDLE *subhKey)
 
INT db_find_link (HNDLE hDB, HNDLE hKey, const char *key_name, HNDLE *subhKey)
 
INT db_find_key1 (HNDLE hDB, HNDLE hKey, const char *key_name, HNDLE *subhKey)
 
INT db_find_link1 (HNDLE hDB, HNDLE hKey, const char *key_name, HNDLE *subhKey)
 
INT db_find_keys (HNDLE hDB, HNDLE hKeyRoot, char *odbpath, std::vector< HNDLE > &hKeyVector)
 
INT db_get_parent (HNDLE hDB, HNDLE hKey, HNDLE *parenthKey)
 
INT db_scan_tree (HNDLE hDB, HNDLE hKey, INT level, INT(*callback)(HNDLE, HNDLE, KEY *, INT, void *), void *info)
 
INT db_scan_tree_link (HNDLE hDB, HNDLE hKey, INT level, void(*callback)(HNDLE, HNDLE, KEY *, INT, void *), void *info)
 
INT db_get_path (HNDLE hDB, HNDLE hKey, char *path, INT buf_size)
 
std::string db_get_path (HNDLE hDB, HNDLE hKey)
 
INT db_delete_key (HNDLE hDB, HNDLE hKey, BOOL follow_links)
 
INT db_enum_key (HNDLE hDB, HNDLE hKey, INT idx, HNDLE *subkey_handle)
 
INT db_enum_link (HNDLE hDB, HNDLE hKey, INT idx, HNDLE *subkey_handle)
 
INT db_get_next_link (HNDLE hDB, HNDLE hKey, HNDLE *subkey_handle)
 
INT db_get_key (HNDLE hDB, HNDLE hKey, KEY *key)
 
INT db_get_link (HNDLE hDB, HNDLE hKey, KEY *key)
 
INT db_get_key_info (HNDLE hDB, HNDLE hKey, char *name, INT name_size, INT *type, INT *num_values, INT *item_size)
 
INT db_get_key_time (HNDLE hDB, HNDLE hKey, DWORD *delta)
 
INT db_rename_key (HNDLE hDB, HNDLE hKey, const char *name)
 
INT db_reorder_key (HNDLE hDB, HNDLE hKey, INT idx)
 
INT db_get_data (HNDLE hDB, HNDLE hKey, void *data, INT *buf_size, DWORD type)
 
INT db_get_link_data (HNDLE hDB, HNDLE hKey, void *data, INT *buf_size, DWORD type)
 
INT db_get_data1 (HNDLE hDB, HNDLE hKey, void *data, INT *buf_size, DWORD type, INT *num_values)
 
INT db_get_data_index (HNDLE hDB, HNDLE hKey, void *data, INT *buf_size, INT idx, DWORD type)
 
INT db_set_data (HNDLE hDB, HNDLE hKey, const void *data, INT buf_size, INT num_values, DWORD type)
 
INT db_set_data1 (HNDLE hDB, HNDLE hKey, const void *data, INT buf_size, INT num_values, DWORD type)
 
INT db_notify_clients_array (HNDLE hDB, HNDLE hKeys[], INT size)
 
INT db_set_link_data (HNDLE hDB, HNDLE hKey, const void *data, INT buf_size, INT num_values, DWORD type)
 
INT db_set_data_index (HNDLE hDB, HNDLE hKey, const void *data, INT data_size, INT idx, DWORD type)
 
INT db_set_link_data_index (HNDLE hDB, HNDLE hKey, const void *data, INT data_size, INT idx, DWORD type)
 
INT db_set_data_index1 (HNDLE hDB, HNDLE hKey, const void *data, INT data_size, INT idx, DWORD type, BOOL bNotify)
 
INT db_set_num_values (HNDLE hDB, HNDLE hKey, INT num_values)
 
INT db_merge_data (HNDLE hDB, HNDLE hKeyRoot, const char *name, void *data, INT data_size, INT num_values, INT type)
 
INT db_set_mode (HNDLE hDB, HNDLE hKey, WORD mode, BOOL recurse)
 
INT db_create_record (HNDLE hDB, HNDLE hKey, const char *orig_key_name, const char *init_str)
 
INT db_check_record (HNDLE hDB, HNDLE hKey, const char *keyname, const char *rec_str, BOOL correct)
 
INT db_open_record (HNDLE hDB, HNDLE hKey, void *ptr, INT rec_size, WORD access_mode, void(*dispatcher)(INT, INT, void *), void *info)
 
INT db_open_record1 (HNDLE hDB, HNDLE hKey, void *ptr, INT rec_size, WORD access_mode, void(*dispatcher)(INT, INT, void *), void *info, const char *rec_str)
 
INT db_close_record (HNDLE hDB, HNDLE hKey)
 
INT db_get_record (HNDLE hDB, HNDLE hKey, void *data, INT *buf_size, INT align)
 
INT db_get_record1 (HNDLE hDB, HNDLE hKey, void *data, INT *buf_size, INT align, const char *rec_str)
 
INT db_get_record2 (HNDLE hDB, HNDLE hKey, void *data, INT *xbuf_size, INT align, const char *rec_str, BOOL correct)
 
INT db_get_record_size (HNDLE hDB, HNDLE hKey, INT align, INT *buf_size)
 
INT db_set_record (HNDLE hDB, HNDLE hKey, void *data, INT buf_size, INT align)
 
INT EXPRT db_set_record2 (HNDLE hdb, HNDLE hKey, void *data, INT buf_size, INT align, const char *rec_str)
 
INT db_send_changed_records ()
 
INT db_get_open_records (HNDLE hDB, HNDLE hKey, char *str, INT buf_size, BOOL fix)
 
INT db_add_open_record (HNDLE hDB, HNDLE hKey, WORD access_mode)
 
INT db_remove_open_record (HNDLE hDB, HNDLE hKey, BOOL lock)
 
INT EXPRT db_watch (HNDLE hDB, HNDLE hKey, void(*dispatcher)(INT, INT, INT, void *info), void *info)
 
INT db_unwatch (HNDLE hDB, HNDLE hKey)
 
INT db_unwatch_all ()
 
INT db_load (HNDLE hDB, HNDLE hKeyRoot, const char *filename, BOOL bRemote)
 
INT db_save (HNDLE hDB, HNDLE hKey, const char *filename, BOOL bRemote)
 
INT db_copy (HNDLE hDB, HNDLE hKey, char *buffer, INT *buffer_size, const char *path)
 
INT db_paste (HNDLE hDB, HNDLE hKeyRoot, const char *buffer)
 
INT db_paste_xml (HNDLE hDB, HNDLE hKeyRoot, const char *buffer)
 
INT db_save_struct (HNDLE hDB, HNDLE hKey, const char *file_name, const char *struct_name, BOOL append)
 
INT db_save_string (HNDLE hDB, HNDLE hKey, const char *file_name, const char *string_name, BOOL append)
 
INT db_save_xml (HNDLE hDB, HNDLE hKey, const char *filename)
 
INT db_copy_xml (HNDLE hDB, HNDLE hKey, char *buffer, int *buffer_size, bool header)
 
INT db_save_json (HNDLE hDB, HNDLE hKey, const char *filename, int flags)
 
INT EXPRT db_load_json (HNDLE hdb, HNDLE key_handle, const char *filename)
 
void json_write (char **buffer, int *buffer_size, int *buffer_end, int level, const char *s, int quoted)
 
int EXPRT json_write_anything (HNDLE hDB, HNDLE hKey, char **buffer, int *buffer_size, int *buffer_end, int level, int must_be_subdir, int flags, time_t timestamp)
 
INT db_copy_json_obsolete (HNDLE hDB, HNDLE hKey, char **buffer, int *buffer_size, int *buffer_end, int save_keys, int follow_links, int recurse)
 
INT db_copy_json_save (HNDLE hDB, HNDLE hKey, char **buffer, int *buffer_size, int *buffer_end)
 
INT db_copy_json_ls (HNDLE hDB, HNDLE hKey, char **buffer, int *buffer_size, int *buffer_end)
 
INT db_copy_json_values (HNDLE hDB, HNDLE hKey, char **buffer, int *buffer_size, int *buffer_end, int omit_names, int omit_last_written, time_t omit_old_timestamp, int preserve_case)
 
INT db_copy_json_array (HNDLE hDB, HNDLE hKey, char **buffer, int *buffer_size, int *buffer_end)
 
INT db_copy_json_index (HNDLE hDB, HNDLE hKey, int index, char **buffer, int *buffer_size, int *buffer_end)
 
INT EXPRT db_paste_json (HNDLE hDB, HNDLE hKey, const char *buffer)
 
INT EXPRT db_paste_json_node (HNDLE hDB, HNDLE hKey, int index, const MJsonNode *json_node)
 
MJsonNode * db_sor (HNDLE hDB, const char *root_path)
 
MJsonNode * db_scl (HNDLE hDB)
 
INT db_sprintf (char *string, const void *data, INT data_size, INT idx, DWORD type)
 
INT db_sprintff (char *string, const char *format, const void *data, INT data_size, INT idx, DWORD type)
 
INT db_sprintfh (char *string, const void *data, INT data_size, INT idx, DWORD type)
 
std::string db_sprintf (const void *data, INT data_size, INT idx, DWORD type)
 
std::string db_sprintff (const char *format, const void *data, INT data_size, INT idx, DWORD type)
 
std::string db_sprintfh (const void *data, INT data_size, INT idx, DWORD type)
 
INT db_sscanf (const char *data_str, void *data, INT *data_size, INT i, DWORD tid)
 
INT db_get_watchdog_info (HNDLE hDB, const char *client_name, DWORD *timeout, DWORD *last)
 
INT db_update_last_activity (DWORD millitime)
 
int db_delete_client_info (HNDLE hDB, int pid)
 
charstrcomb (const char **list)
 
std::string strcomb1 (const char **list)
 
void EXPRT bk_init (void *pbh)
 
void EXPRT bk_init32 (void *event)
 
void EXPRT bk_init32a (void *event)
 
BOOL EXPRT bk_is32 (const void *event)
 
BOOL EXPRT bk_is32a (const void *event)
 
INT EXPRT bk_size (const void *pbh)
 
void EXPRT bk_create (void *pbh, const char *name, WORD type, void **pdata)
 
INT EXPRT bk_delete (void *event, const char *name)
 
INT EXPRT bk_close (void *pbh, void *pdata)
 
INT EXPRT bk_list (const void *pbh, char *bklist)
 
INT EXPRT bk_locate (const void *pbh, const char *name, void *pdata)
 
INT EXPRT bk_iterate (const void *pbh, BANK **pbk, void *pdata)
 
INT EXPRT bk_iterate32 (const void *pbh, BANK32 **pbk, void *pdata)
 
INT EXPRT bk_iterate32a (const void *pbh, BANK32A **pbk, void *pdata)
 
INT EXPRT bk_copy (char *pevent, char *psrce, const char *bkname)
 
INT EXPRT bk_swap (void *event, BOOL force)
 
INT EXPRT bk_find (const BANK_HEADER *pbkh, const char *name, DWORD *bklen, DWORD *bktype, void **pdata)
 
INT EXPRT rpc_clear_allowed_hosts (void)
 
INT EXPRT rpc_add_allowed_host (const char *hostname)
 
INT EXPRT rpc_check_allowed_host (const char *hostname)
 
INT EXPRT rpc_register_functions (const RPC_LIST *new_list, RPC_HANDLER func)
 
INT EXPRT rpc_register_function (INT id, RPC_HANDLER func)
 
INT EXPRT rpc_get_hw_type ()
 
INT EXPRT rpc_get_timeout (HNDLE hConn)
 
INT EXPRT rpc_set_timeout (HNDLE hConn, int timeout_msec, int *old_timeout_msec=NULL)
 
INT EXPRT rpc_set_name (const char *name)
 
std::string rpc_get_name ()
 
bool EXPRT rpc_is_remote (void)
 
bool EXPRT rpc_is_connected (void)
 
std::string rpc_get_mserver_hostname ()
 
bool EXPRT rpc_is_mserver (void)
 
INT EXPRT rpc_set_debug (void(*func)(const char *), INT mode)
 
void EXPRT rpc_debug_printf (const char *format,...)
 
INT EXPRT rpc_register_server (int port, int *plsock, int *pport)
 
INT EXPRT rpc_register_client (const char *name, RPC_LIST *list)
 
INT EXPRT rpc_server_loop (void)
 
INT EXPRT rpc_server_shutdown (void)
 
INT EXPRT rpc_client_call (HNDLE hConn, DWORD routine_id,...)
 
INT EXPRT rpc_call (DWORD routine_id,...)
 
INT EXPRT rpc_tid_size (INT id)
 
const char EXPRTrpc_tid_name (INT id)
 
const char EXPRTrpc_tid_name_old (INT id)
 
INT EXPRT rpc_name_tid (const char *name)
 
INT EXPRT rpc_server_connect (const char *host_name, const char *exp_name)
 
INT EXPRT rpc_client_connect (const char *host_name, INT midas_port, const char *client_name, HNDLE *hConnection)
 
INT EXPRT rpc_client_disconnect (HNDLE hConn, BOOL bShutdown)
 
INT EXPRT rpc_send_event (INT buffer_handle, const EVENT_HEADER *event, int unused, INT async_flag, INT mode)
 
INT EXPRT rpc_flush_event (void)
 
INT EXPRT rpc_send_event1 (INT buffer_handle, const EVENT_HEADER *event)
 
INT EXPRT rpc_send_event_sg (INT buffer_handle, int sg_n, const char *const sg_ptr[], const size_t sg_len[])
 
INT EXPRT rpc_test_rpc ()
 
void EXPRT rpc_get_convert_flags (INT *convert_flags)
 
void EXPRT rpc_convert_single (void *data, INT tid, INT flags, INT convert_flags)
 
void EXPRT rpc_convert_data (void *data, INT tid, INT flags, INT size, INT convert_flags)
 
DWORD ss_millitime ()
 
DWORD ss_time ()
 
double ss_time_sec ()
 
DWORD ss_settime (DWORD seconds)
 
void ss_tzset ()
 
time_t ss_mktime (struct tm *tms)
 
std::string ss_asctime ()
 
INT ss_sleep (INT millisec)
 
BOOL ss_kbhit ()
 
std::string ss_getcwd ()
 
double ss_nan ()
 
int ss_isnan (double x)
 
int ss_isfin (double x)
 
void ss_clear_screen ()
 
void ss_printf (INT x, INT y, const char *format,...)
 
void ss_set_screen_size (int x, int y)
 
charss_getpass (const char *prompt)
 
INT ss_getchar (BOOL reset)
 
charss_crypt (const char *buf, const char *salt)
 
charss_gets (char *string, int size)
 
voidss_ctrlc_handler (void(*func)(int))
 
INT ss_write_tcp (int sock, const char *buffer, size_t buffer_size)
 
INT ss_directio_give_port (INT start, INT end)
 
INT ss_directio_lock_port (INT start, INT end)
 
INT ss_tape_open (char *path, INT oflag, INT *channel)
 
INT ss_tape_close (INT channel)
 
INT ss_tape_status (char *path)
 
INT ss_tape_read (INT channel, void *pdata, INT *count)
 
INT ss_tape_write (INT channel, void *pdata, INT count)
 
INT ss_tape_write_eof (INT channel)
 
INT ss_tape_fskip (INT channel, INT count)
 
INT ss_tape_rskip (INT channel, INT count)
 
INT ss_tape_rewind (INT channel)
 
INT ss_tape_spool (INT channel)
 
INT ss_tape_mount (INT channel)
 
INT ss_tape_unmount (INT channel)
 
INT ss_tape_get_blockn (INT channel)
 
double ss_disk_free (const char *path)
 
double ss_file_size (const char *path)
 
time_t ss_file_time (const char *path)
 
int ss_dir_exist (const char *path)
 
int ss_file_exist (const char *path)
 
int ss_file_link_exist (const char *path)
 
INT ss_file_remove (const char *path)
 
INT ss_file_find (const char *path, const char *pattern, char **plist)
 
INT ss_dir_find (const char *path, const char *pattern, char **plist)
 
INT ss_dirlink_find (const char *path, const char *pattern, char **plist)
 
INT ss_file_find (const char *path, const char *pattern, STRING_LIST *plist)
 
INT ss_dir_find (const char *path, const char *pattern, STRING_LIST *plist)
 
INT ss_dirlink_find (const char *path, const char *pattern, STRING_LIST *plist)
 
double ss_disk_size (const char *path)
 
int ss_file_copy (const char *src, const char *dst, bool append)
 
bool ss_is_valid_utf8 (const char *string)
 
bool ss_repair_utf8 (char *string)
 
bool ss_repair_utf8 (std::string &s)
 
INT EXPRT el_retrieve (char *tag, char *date, int *run, char *author, char *type, char *system, char *subject, char *text, int *textsize, char *orig_tag, char *reply_tag, char *attachment1, char *attachment2, char *attachment3, char *encoding)
 
INT EXPRT el_submit (int run, const char *author, const char *type, const char *system, const char *subject, const char *text, const char *reply_to, const char *encoding, const char *afilename1, const char *buffer1, INT buffer_size1, const char *afilename2, const char *buffer2, INT buffer_size2, const char *afilename3, const char *buffer3, INT buffer_size3, char *tag, INT tag_size)
 
INT EXPRT el_search_message (char *tag, int *fh, BOOL walk, char *filename, int filename_size)
 
INT EXPRT el_search_run (int run, char *return_tag)
 
INT EXPRT el_delete_message (const char *tag)
 
INT EXPRT al_check (void)
 
INT EXPRT al_trigger_alarm (const char *alarm_name, const char *alarm_message, const char *default_class, const char *cond_str, INT type)
 
INT EXPRT al_trigger_class (const char *alarm_class, const char *alarm_message, BOOL first)
 
INT EXPRT al_reset_alarm (const char *alarm_name)
 
BOOL EXPRT al_evaluate_condition (const char *alarm_name, const char *condition, std::string *pvalue)
 
INT al_get_alarms (std::string *presult)
 
INT EXPRT al_define_odb_alarm (const char *name, const char *condition, const char *aclass, const char *message)
 
void EXPRT test_register (ANA_TEST *t)
 
void EXPRT add_data_dir (char *result, char *file)
 
void EXPRT lock_histo (INT id)
 
void EXPRT open_subfolder (const char *name)
 
void EXPRT close_subfolder (void)
 
int hs_image_retrieve (std::string image_name, time_t start, time_t stop, std::vector< time_t > &vtime, std::vector< std::string > &vfilename)
 

Detailed Description

dox

The main include file

Definition in file midas.h.

Macro Definition Documentation

◆ ALARM_CLASS_STR

#define ALARM_CLASS_STR (   _name)
Value:
const char *_name[] = {\
"[.]",\
"Write system message = BOOL : y",\
"Write Elog message = BOOL : n",\
"System message interval = INT : 60",\
"System message last = DWORD : 0",\
"Execute command = STRING : [256] ",\
"Execute interval = INT : 0",\
"Execute last = DWORD : 0",\
"Stop run = BOOL : n",\
"Display BGColor = STRING : [32] red",\
"Display FGColor = STRING : [32] black",\
"Alarm sound = BOOL : y"\
"",\
TH1X EXPRT * h1_book(const char *name, const char *title, int bins, double min, double max)
Definition rmidas.h:24

Definition at line 1478 of file midas.h.

1478 {\
1479"[.]",\
1480"Write system message = BOOL : y",\
1481"Write Elog message = BOOL : n",\
1482"System message interval = INT : 60",\
1483"System message last = DWORD : 0",\
1484"Execute command = STRING : [256] ",\
1485"Execute interval = INT : 0",\
1486"Execute last = DWORD : 0",\
1487"Stop run = BOOL : n",\
1488"Display BGColor = STRING : [32] red",\
1489"Display FGColor = STRING : [32] black",\
1490"Alarm sound = BOOL : y"\
1491"",\
1492NULL }

◆ ALARM_ODB_STR

#define ALARM_ODB_STR (   _name)
Value:
const char *_name[] = {\
"[.]",\
"Active = BOOL : n",\
"Triggered = INT : 0",\
"Type = INT : 3",\
"Check interval = INT : 60",\
"Checked last = DWORD : 0",\
"Trigger count = DWORD : 0",\
"Trigger count required = DWORD : 0",\
"Time triggered first = STRING : [32] ",\
"Time triggered last = STRING : [32] ",\
"Condition = STRING : [256] /Runinfo/Run number > 100",\
"Alarm Class = STRING : [32] Alarm",\
"Alarm Message = STRING : [80] Run number became too large",\
"",\

Definition at line 1511 of file midas.h.

1511 {\
1512"[.]",\
1513"Active = BOOL : n",\
1514"Triggered = INT : 0",\
1515"Type = INT : 3",\
1516"Check interval = INT : 60",\
1517"Checked last = DWORD : 0",\
1518"Trigger count = DWORD : 0",\
1519"Trigger count required = DWORD : 0",\
1520"Time triggered first = STRING : [32] ",\
1521"Time triggered last = STRING : [32] ",\
1522"Condition = STRING : [256] /Runinfo/Run number > 100",\
1523"Alarm Class = STRING : [32] Alarm",\
1524"Alarm Message = STRING : [80] Run number became too large",\
1525"",\
1526NULL }

◆ ALARM_PERIODIC_STR

#define ALARM_PERIODIC_STR (   _name)
Value:
const char *_name[] = {\
"[.]",\
"Active = BOOL : n",\
"Triggered = INT : 0",\
"Type = INT : 4",\
"Check interval = INT : 28800",\
"Checked last = DWORD : 0",\
"Trigger count = DWORD : 0",\
"Trigger count required = DWORD : 0",\
"Time triggered first = STRING : [32] ",\
"Time triggered last = STRING : [32] ",\
"Condition = STRING : [256] ",\
"Alarm Class = STRING : [32] Warning",\
"Alarm Message = STRING : [80] Please do your shift checks",\
"",\

Definition at line 1528 of file midas.h.

1528 {\
1529"[.]",\
1530"Active = BOOL : n",\
1531"Triggered = INT : 0",\
1532"Type = INT : 4",\
1533"Check interval = INT : 28800",\
1534"Checked last = DWORD : 0",\
1535"Trigger count = DWORD : 0",\
1536"Trigger count required = DWORD : 0",\
1537"Time triggered first = STRING : [32] ",\
1538"Time triggered last = STRING : [32] ",\
1539"Condition = STRING : [256] ",\
1540"Alarm Class = STRING : [32] Warning",\
1541"Alarm Message = STRING : [80] Please do your shift checks",\
1542"",\
1543NULL }

◆ ANA_CONTINUE

#define ANA_CONTINUE   1

dox dox

Definition at line 839 of file midas.h.

◆ ANA_OUTPUT_INFO_STR

#define ANA_OUTPUT_INFO_STR   "\Filename = STRING : [256] run%05d.asc\n\RWNT = BOOL : 0\n\Histo Dump = BOOL : 0\n\Histo Dump Filename = STRING : [256] his%05d.rz\n\Clear histos = BOOL : 1\n\Last Histo Filename = STRING : [256] last.rz\n\Events to ODB = BOOL : 1\n\Global Memory Name = STRING : [8] ONLN\n\"

Definition at line 1325 of file midas.h.

◆ ANA_SKIP

#define ANA_SKIP   0

Definition at line 840 of file midas.h.

◆ AT_EVALUATED

#define AT_EVALUATED   3

Definition at line 1444 of file midas.h.

◆ AT_INTERNAL

#define AT_INTERNAL   1

Definition at line 1442 of file midas.h.

◆ AT_LAST

#define AT_LAST   4

Definition at line 1446 of file midas.h.

◆ AT_PERIODIC

#define AT_PERIODIC   4

Definition at line 1445 of file midas.h.

◆ AT_PROGRAM

#define AT_PROGRAM   2

Definition at line 1443 of file midas.h.

◆ BANK_FORMAT_32BIT

#define BANK_FORMAT_32BIT   (1<<4)

Definition at line 1204 of file midas.h.

◆ BANK_FORMAT_64BIT_ALIGNED

#define BANK_FORMAT_64BIT_ALIGNED   (1<<5)

Definition at line 1205 of file midas.h.

◆ BANK_FORMAT_VERSION

#define BANK_FORMAT_VERSION   1

Definition at line 1203 of file midas.h.

◆ BANKLIST_MAX

#define BANKLIST_MAX   4096

max # of banks in event

Definition at line 278 of file midas.h.

◆ CARRAY [1/2]

#define CARRAY (   _i)    ( ((void *) prpc_param[_i]))

Definition at line 1647 of file midas.h.

◆ CARRAY [2/2]

#define CARRAY (   _i)    ( ((void *) prpc_param[_i]))

Definition at line 1647 of file midas.h.

◆ cARRAY

#define cARRAY   ( ((void *) prpc_param[--n_param]))

Definition at line 1715 of file midas.h.

◆ CBOOL [1/2]

#define CBOOL (   _i)    (* ((BOOL *) prpc_param[_i]))

Definition at line 1637 of file midas.h.

◆ CBOOL [2/2]

#define CBOOL (   _i)    (* ((BOOL *) prpc_param[_i]))

Definition at line 1637 of file midas.h.

◆ cBOOL

#define cBOOL   (* ((BOOL *) prpc_param[--n_param]))

Definition at line 1705 of file midas.h.

◆ CBYTE [1/2]

#define CBYTE (   _i)    (* ((BYTE *) prpc_param[_i]))

Definition at line 1616 of file midas.h.

◆ CBYTE [2/2]

#define CBYTE (   _i)    (* ((BYTE *) prpc_param[_i]))

Definition at line 1616 of file midas.h.

◆ cBYTE

#define cBYTE   (* ((BYTE *) prpc_param[--n_param]))

Definition at line 1684 of file midas.h.

◆ CDOUBLE [1/2]

#define CDOUBLE (   _i)    (* ((double *) prpc_param[_i]))

Definition at line 1643 of file midas.h.

◆ CDOUBLE [2/2]

#define CDOUBLE (   _i)    (* ((double *) prpc_param[_i]))

Definition at line 1643 of file midas.h.

◆ cDOUBLE

#define cDOUBLE   (* ((double *) prpc_param[--n_param]))

Definition at line 1711 of file midas.h.

◆ CDWORD [1/2]

#define CDWORD (   _i)    (* ((DWORD *) prpc_param[_i]))

Definition at line 1631 of file midas.h.

◆ CDWORD [2/2]

#define CDWORD (   _i)    (* ((DWORD *) prpc_param[_i]))

Definition at line 1631 of file midas.h.

◆ cDWORD

#define cDWORD   (* ((DWORD *) prpc_param[--n_param]))

Definition at line 1699 of file midas.h.

◆ CF_ENDIAN

#define CF_ENDIAN   (1<<0)

Data conversion flags

Definition at line 1611 of file midas.h.

◆ CF_IEEE2VAX

#define CF_IEEE2VAX   (1<<1)

Definition at line 1612 of file midas.h.

◆ CF_VAX2IEEE

#define CF_VAX2IEEE   (1<<2)

Definition at line 1613 of file midas.h.

◆ CFLOAT [1/2]

#define CFLOAT (   _i)    (* ((float *) prpc_param[_i]))

Definition at line 1640 of file midas.h.

◆ CFLOAT [2/2]

#define CFLOAT (   _i)    (* ((float *) prpc_param[_i]))

Definition at line 1640 of file midas.h.

◆ cFLOAT

#define cFLOAT   (* ((float *) prpc_param[--n_param]))

Definition at line 1708 of file midas.h.

◆ CH_BS

#define CH_BS   8

dox special characters

Definition at line 445 of file midas.h.

◆ CH_CR

#define CH_CR   13

Definition at line 448 of file midas.h.

◆ CH_DELETE

#define CH_DELETE   (CH_EXT+2)

Definition at line 454 of file midas.h.

◆ CH_DOWN

#define CH_DOWN   (CH_EXT+7)

Definition at line 459 of file midas.h.

◆ CH_END

#define CH_END   (CH_EXT+3)

Definition at line 455 of file midas.h.

◆ CH_EXT

#define CH_EXT   0x100

Definition at line 450 of file midas.h.

◆ CH_HOME

#define CH_HOME   (CH_EXT+0)

Definition at line 452 of file midas.h.

◆ CH_INSERT

#define CH_INSERT   (CH_EXT+1)

Definition at line 453 of file midas.h.

◆ CH_LEFT

#define CH_LEFT   (CH_EXT+9)

Definition at line 461 of file midas.h.

◆ CH_LF

#define CH_LF   10

Definition at line 447 of file midas.h.

◆ CH_PDOWN

#define CH_PDOWN   (CH_EXT+5)

Definition at line 457 of file midas.h.

◆ CH_PUP

#define CH_PUP   (CH_EXT+4)

Definition at line 456 of file midas.h.

◆ CH_RIGHT

#define CH_RIGHT   (CH_EXT+8)

Definition at line 460 of file midas.h.

◆ CH_TAB

#define CH_TAB   9

Definition at line 446 of file midas.h.

◆ CH_UP

#define CH_UP   (CH_EXT+6)

Definition at line 458 of file midas.h.

◆ CHNDLE [1/2]

#define CHNDLE (   _i)    (* ((HNDLE *) prpc_param[_i]))

Definition at line 1634 of file midas.h.

◆ CHNDLE [2/2]

#define CHNDLE (   _i)    (* ((HNDLE *) prpc_param[_i]))

Definition at line 1634 of file midas.h.

◆ cHNDLE

#define cHNDLE   (* ((HNDLE *) prpc_param[--n_param]))

Definition at line 1702 of file midas.h.

◆ CINT [1/2]

#define CINT (   _i)    (* ((INT *) prpc_param[_i]))

Definition at line 1622 of file midas.h.

◆ CINT [2/2]

#define CINT (   _i)    (* ((INT *) prpc_param[_i]))

Definition at line 1622 of file midas.h.

◆ cINT

#define cINT   (* ((INT *) prpc_param[--n_param]))

Definition at line 1690 of file midas.h.

◆ CLONG [1/2]

#define CLONG (   _i)    (* ((long *) prpc_param[_i]))

Definition at line 1628 of file midas.h.

◆ CLONG [2/2]

#define CLONG (   _i)    (* ((long *) prpc_param[_i]))

Definition at line 1628 of file midas.h.

◆ cLONG

#define cLONG   (* ((long *) prpc_param[--n_param]))

Definition at line 1696 of file midas.h.

◆ CNAF

#define CNAF   0x1 /* normal read/write */

CNAF commands

Definition at line 491 of file midas.h.

◆ CNAF_CRATE_CLEAR

#define CNAF_CRATE_CLEAR   0x102

Definition at line 496 of file midas.h.

◆ CNAF_CRATE_ZINIT

#define CNAF_CRATE_ZINIT   0x103

Definition at line 497 of file midas.h.

◆ CNAF_INHIBIT_CLEAR

#define CNAF_INHIBIT_CLEAR   0x101

Definition at line 495 of file midas.h.

◆ CNAF_INHIBIT_SET

#define CNAF_INHIBIT_SET   0x100

Definition at line 494 of file midas.h.

◆ CNAF_nQ

#define CNAF_nQ   0x2 /* Repeat read until noQ */

Definition at line 492 of file midas.h.

◆ CNAF_TEST

#define CNAF_TEST   0x110

Definition at line 498 of file midas.h.

◆ CPBOOL [1/2]

#define CPBOOL (   _i)    ( ((BOOL *) prpc_param[_i]))

Definition at line 1638 of file midas.h.

◆ CPBOOL [2/2]

#define CPBOOL (   _i)    ( ((BOOL *) prpc_param[_i]))

Definition at line 1638 of file midas.h.

◆ cPBOOL

#define cPBOOL   ( ((BOOL *) prpc_param[--n_param]))

Definition at line 1706 of file midas.h.

◆ CPBYTE [1/2]

#define CPBYTE (   _i)    ( ((BYTE *) prpc_param[_i]))

Definition at line 1617 of file midas.h.

◆ CPBYTE [2/2]

#define CPBYTE (   _i)    ( ((BYTE *) prpc_param[_i]))

Definition at line 1617 of file midas.h.

◆ cPBYTE

#define cPBYTE   ( ((BYTE *) prpc_param[--n_param]))

Definition at line 1685 of file midas.h.

◆ CPDOUBLE [1/2]

#define CPDOUBLE (   _i)    ( ((double *) prpc_param[_i]))

Definition at line 1644 of file midas.h.

◆ CPDOUBLE [2/2]

#define CPDOUBLE (   _i)    ( ((double *) prpc_param[_i]))

Definition at line 1644 of file midas.h.

◆ cPDOUBLE

#define cPDOUBLE   ( ((double *) prpc_param[--n_param]))

Definition at line 1712 of file midas.h.

◆ CPDWORD [1/2]

#define CPDWORD (   _i)    ( ((DWORD *) prpc_param[_i]))

Definition at line 1632 of file midas.h.

◆ CPDWORD [2/2]

#define CPDWORD (   _i)    ( ((DWORD *) prpc_param[_i]))

Definition at line 1632 of file midas.h.

◆ cPDWORD

#define cPDWORD   ( ((DWORD *) prpc_param[--n_param]))

Definition at line 1700 of file midas.h.

◆ CPFLOAT [1/2]

#define CPFLOAT (   _i)    ( ((float *) prpc_param[_i]))

Definition at line 1641 of file midas.h.

◆ CPFLOAT [2/2]

#define CPFLOAT (   _i)    ( ((float *) prpc_param[_i]))

Definition at line 1641 of file midas.h.

◆ cPFLOAT

#define cPFLOAT   ( ((float *) prpc_param[--n_param]))

Definition at line 1709 of file midas.h.

◆ CPHNDLE [1/2]

#define CPHNDLE (   _i)    ( ((HNDLE *) prpc_param[_i]))

Definition at line 1635 of file midas.h.

◆ CPHNDLE [2/2]

#define CPHNDLE (   _i)    ( ((HNDLE *) prpc_param[_i]))

Definition at line 1635 of file midas.h.

◆ cPHNDLE

#define cPHNDLE   ( ((HNDLE *) prpc_param[--n_param]))

Definition at line 1703 of file midas.h.

◆ CPINT [1/2]

#define CPINT (   _i)    ( ((INT *) prpc_param[_i]))

Definition at line 1623 of file midas.h.

◆ CPINT [2/2]

#define CPINT (   _i)    ( ((INT *) prpc_param[_i]))

Definition at line 1623 of file midas.h.

◆ cPINT

#define cPINT   ( ((INT *) prpc_param[--n_param]))

Definition at line 1691 of file midas.h.

◆ CPLONG [1/2]

#define CPLONG (   _i)    ( ((long *) prpc_param[_i]))

Definition at line 1629 of file midas.h.

◆ CPLONG [2/2]

#define CPLONG (   _i)    ( ((long *) prpc_param[_i]))

Definition at line 1629 of file midas.h.

◆ cPLONG

#define cPLONG   ( ((long *) prpc_param[--n_param]))

Definition at line 1697 of file midas.h.

◆ CPSHORT [1/2]

#define CPSHORT (   _i)    ( ((short *) prpc_param[_i]))

Definition at line 1620 of file midas.h.

◆ CPSHORT [2/2]

#define CPSHORT (   _i)    ( ((short *) prpc_param[_i]))

Definition at line 1620 of file midas.h.

◆ cPSHORT

#define cPSHORT   ( ((short *) prpc_param[--n_param]))

Definition at line 1688 of file midas.h.

◆ CPWORD [1/2]

#define CPWORD (   _i)    ( ((WORD *) prpc_param[_i]))

Definition at line 1626 of file midas.h.

◆ CPWORD [2/2]

#define CPWORD (   _i)    ( ((WORD *) prpc_param[_i]))

Definition at line 1626 of file midas.h.

◆ cPWORD

#define cPWORD   ( ((WORD *) prpc_param[--n_param]))

Definition at line 1694 of file midas.h.

◆ CSHORT [1/2]

#define CSHORT (   _i)    (* ((short *) prpc_param[_i]))

Definition at line 1619 of file midas.h.

◆ CSHORT [2/2]

#define CSHORT (   _i)    (* ((short *) prpc_param[_i]))

Definition at line 1619 of file midas.h.

◆ cSHORT

#define cSHORT   (* ((short *) prpc_param[--n_param]))

Definition at line 1687 of file midas.h.

◆ CSTRING [1/2]

#define CSTRING (   _i)    ( ((char *) prpc_param[_i]))

Definition at line 1646 of file midas.h.

◆ CSTRING [2/2]

#define CSTRING (   _i)    ( ((char *) prpc_param[_i]))

Definition at line 1646 of file midas.h.

◆ cSTRING

#define cSTRING   ( ((char *) prpc_param[--n_param]))

Definition at line 1714 of file midas.h.

◆ CWORD [1/2]

#define CWORD (   _i)    (* ((WORD *) prpc_param[_i]))

Definition at line 1625 of file midas.h.

◆ CWORD [2/2]

#define CWORD (   _i)    (* ((WORD *) prpc_param[_i]))

Definition at line 1625 of file midas.h.

◆ cWORD

#define cWORD   (* ((WORD *) prpc_param[--n_param]))

Definition at line 1693 of file midas.h.

◆ DATA_SIZE

#define DATA_SIZE (   e)    ((((EVENT_HEADER *) e)-1)->data_size)

DATA_SIZE Extract or set/reset the data size field pointed by the argument.

Parameters
epointer to the midas event (pevent)

Definition at line 894 of file midas.h.

◆ DATABASE_VERSION

#define DATABASE_VERSION   3

Definition at line 34 of file midas.h.

◆ DEF_TEST

#define DEF_TEST (   t)    extern ANA_TEST t;

Definition at line 1352 of file midas.h.

◆ DEFAULT_BUFFER_SIZE

#define DEFAULT_BUFFER_SIZE   (32*1024*1024)

default event buffer size 32MiB, actual event buffer size is set by ODB /Experiment/Buffer sizes/SYSTEM

Definition at line 255 of file midas.h.

◆ DEFAULT_MAX_EVENT_SIZE

#define DEFAULT_MAX_EVENT_SIZE   (4*1024*1024)

default maximum event size 4MiB, actual maximum event size is set by ODB /Experiment/MAX_EVENT_SIZE

Definition at line 254 of file midas.h.

◆ DEFAULT_ODB_SIZE

#define DEFAULT_ODB_SIZE   0x100000

online database 1M

Definition at line 270 of file midas.h.

◆ DEFAULT_RPC_TIMEOUT

#define DEFAULT_RPC_TIMEOUT   10000

Timeouts [ms]

Definition at line 287 of file midas.h.

◆ DEFAULT_WATCHDOG_TIMEOUT

#define DEFAULT_WATCHDOG_TIMEOUT   10000

Watchdog

Definition at line 290 of file midas.h.

◆ DF_HW_RAMP

#define DF_HW_RAMP   (1<<5)

Definition at line 1055 of file midas.h.

◆ DF_INPUT

#define DF_INPUT   (1<<0)

channel is input

Definition at line 1050 of file midas.h.

◆ DF_LABELS_FROM_DEVICE

#define DF_LABELS_FROM_DEVICE   (1<<6)

Definition at line 1056 of file midas.h.

◆ DF_MULTITHREAD

#define DF_MULTITHREAD   (1<<4)

Definition at line 1054 of file midas.h.

◆ DF_OUTPUT

#define DF_OUTPUT   (1<<1)

channel is output

Definition at line 1051 of file midas.h.

◆ DF_POLL_DEMAND

#define DF_POLL_DEMAND   (1<<12)

Definition at line 1062 of file midas.h.

◆ DF_PRIO_DEVICE

#define DF_PRIO_DEVICE   (1<<2)

get demand values from device instead of ODB

Definition at line 1052 of file midas.h.

◆ DF_PRIORITY_READ

#define DF_PRIORITY_READ   (1<<13)

Definition at line 1063 of file midas.h.

◆ DF_QUICKSTART

#define DF_QUICKSTART   (1<<11)

Definition at line 1061 of file midas.h.

◆ DF_READ_ONLY

#define DF_READ_ONLY   (1<<3)

never write demand values to device

Definition at line 1053 of file midas.h.

◆ DF_REPORT_CHSTATE

#define DF_REPORT_CHSTATE   (1<<9)

Definition at line 1059 of file midas.h.

◆ DF_REPORT_CRATEMAP

#define DF_REPORT_CRATEMAP   (1<<10)

Definition at line 1060 of file midas.h.

◆ DF_REPORT_STATUS

#define DF_REPORT_STATUS   (1<<8)

Definition at line 1058 of file midas.h.

◆ DF_REPORT_TEMP

#define DF_REPORT_TEMP   (1<<7)

Definition at line 1057 of file midas.h.

◆ DIR_SEPARATOR

#define DIR_SEPARATOR   '/'

Definition at line 193 of file midas.h.

◆ DIR_SEPARATOR_STR

#define DIR_SEPARATOR_STR   "/"

Definition at line 194 of file midas.h.

◆ EQUIPMENT_COMMON_STR

#define EQUIPMENT_COMMON_STR   "\Event ID = WORD : 0\n\Trigger mask = WORD : 0\n\Buffer = STRING : [32] SYSTEM\n\Type = INT : 0\n\Source = INT : 0\n\Format = STRING : [8] FIXED\n\Enabled = BOOL : 0\n\Read on = INT : 0\n\Period = INT : 0\n\Event limit = DOUBLE : 0\n\Num subevents = DWORD : 0\n\Log history = INT : 0\n\Frontend host = STRING : [32] \n\Frontend name = STRING : [32] \n\Frontend file name = STRING : [256] \n\Status = STRING : [256] \n\Status color = STRING : [32] \n\Hidden = BOOL : 0\n\Write cache size = INT : 100000\n\"

Definition at line 1112 of file midas.h.

◆ EQUIPMENT_STATISTICS_STR

#define EQUIPMENT_STATISTICS_STR   "\Events sent = DOUBLE : 0\n\Events per sec. = DOUBLE : 0\n\kBytes per sec. = DOUBLE : 0\n\"

Definition at line 1145 of file midas.h.

◆ EVENT_BUFFER_NAME

#define EVENT_BUFFER_NAME   "SYSTEM"

buffer name for commands

Definition at line 269 of file midas.h.

◆ EVENT_ID

#define EVENT_ID (   e)    ((((EVENT_HEADER *) e)-1)->event_id)

EVENT_ID Extract or set the event ID field pointed by the argument..

Parameters
epointer to the midas event (pevent)

Definition at line 873 of file midas.h.

◆ EVENT_SOURCE

#define EVENT_SOURCE (   e,
  o 
)    (* (INT*) (e+o))

Definition at line 896 of file midas.h.

◆ EVENTID_BOR

#define EVENTID_BOR   ((short int) 0x8000)

system event IDs Begin-of-run

Definition at line 900 of file midas.h.

◆ EVENTID_EOR

#define EVENTID_EOR   ((short int) 0x8001)

End-of-run

Definition at line 901 of file midas.h.

◆ EVENTID_FRAG

#define EVENTID_FRAG   ((short int) 0xD000) /* added to real event-id */

Definition at line 907 of file midas.h.

◆ EVENTID_FRAG1

#define EVENTID_FRAG1   ((short int) 0xC000) /* first fragment */

fragmented events

Definition at line 906 of file midas.h.

◆ EVENTID_MESSAGE

#define EVENTID_MESSAGE   ((short int) 0x8002)

Message events

Definition at line 902 of file midas.h.

◆ EXPRT

#define EXPRT

Definition at line 1736 of file midas.h.

◆ FALSE

#define FALSE   0

Definition at line 183 of file midas.h.

◆ HAVE_BM_RECEIVE_EVENT_ALLOC

#define HAVE_BM_RECEIVE_EVENT_ALLOC   1

Definition at line 1871 of file midas.h.

◆ HAVE_BM_RECEIVE_EVENT_VEC

#define HAVE_BM_RECEIVE_EVENT_VEC   1

Definition at line 1869 of file midas.h.

◆ HAVE_BM_SEND_EVENT_VEC

#define HAVE_BM_SEND_EVENT_VEC   1

Definition at line 1864 of file midas.h.

◆ HAVE_CM_GET_CLIENT_NAME

#define HAVE_CM_GET_CLIENT_NAME   1

Definition at line 1788 of file midas.h.

◆ HAVE_CM_PERIODIC_TASKS

#define HAVE_CM_PERIODIC_TASKS   1

Definition at line 1801 of file midas.h.

◆ HOST_NAME_LENGTH

#define HOST_NAME_LENGTH   256

length of TCP/IP names

Definition at line 273 of file midas.h.

◆ INLINE

#define INLINE

Definition at line 205 of file midas.h.

◆ JS_LEVEL_0

#define JS_LEVEL_0   0

flags for db_json_save()

Definition at line 1719 of file midas.h.

◆ JS_LEVEL_1

#define JS_LEVEL_1   1

Definition at line 1720 of file midas.h.

◆ JS_MUST_BE_SUBDIR

#define JS_MUST_BE_SUBDIR   1

Definition at line 1721 of file midas.h.

◆ JSFLAG_FOLLOW_LINKS

#define JSFLAG_FOLLOW_LINKS   (1<<2)

Definition at line 1723 of file midas.h.

◆ JSFLAG_LOWERCASE

#define JSFLAG_LOWERCASE   (1<<4)

Definition at line 1725 of file midas.h.

◆ JSFLAG_OMIT_LAST_WRITTEN

#define JSFLAG_OMIT_LAST_WRITTEN   (1<<6)

Definition at line 1727 of file midas.h.

◆ JSFLAG_OMIT_NAMES

#define JSFLAG_OMIT_NAMES   (1<<5)

Definition at line 1726 of file midas.h.

◆ JSFLAG_OMIT_OLD

#define JSFLAG_OMIT_OLD   (1<<7)

Definition at line 1728 of file midas.h.

◆ JSFLAG_RECURSE

#define JSFLAG_RECURSE   (1<<3)

Definition at line 1724 of file midas.h.

◆ JSFLAG_SAVE_KEYS

#define JSFLAG_SAVE_KEYS   (1<<1)

Definition at line 1722 of file midas.h.

◆ LAM_SOURCE

#define LAM_SOURCE (   c,
 
)    (c<<24 | ((s) & 0xFFFFFF))

Code the LAM crate and LAM station into a bitwise register.

Parameters
cCrate number
sSlot number

Definition at line 469 of file midas.h.

◆ LAM_SOURCE_CRATE

#define LAM_SOURCE_CRATE (   c)    (c>>24)

Convert the coded LAM crate to Crate number.

Parameters
ccoded crate

Definition at line 481 of file midas.h.

◆ LAM_SOURCE_STATION

#define LAM_SOURCE_STATION (   s)    ((s) & 0xFFFFFF)

Convert the coded LAM station to Station number.

Parameters
sSlot number

Definition at line 487 of file midas.h.

◆ LAM_STATION

#define LAM_STATION (   s)    (1<<(s-1))

Code the Station number bitwise for the LAM source.

Parameters
sSlot number

Definition at line 475 of file midas.h.

◆ M_CALLOC

#define M_CALLOC (   x,
 
)    calloc(x,y)

Definition at line 1553 of file midas.h.

◆ M_FREE

#define M_FREE (   x)    free(x)

Definition at line 1554 of file midas.h.

◆ M_MALLOC

#define M_MALLOC (   x)    malloc(x)

Definition at line 1552 of file midas.h.

◆ MATTRPRINTF

#define MATTRPRINTF (   a,
 
)

Definition at line 221 of file midas.h.

◆ MAX_CLIENTS

#define MAX_CLIENTS   64

client processes per buf/db

Definition at line 274 of file midas.h.

◆ MAX_EVENT_REQUESTS

#define MAX_EVENT_REQUESTS   10

event requests per client

Definition at line 275 of file midas.h.

◆ MAX_ODB_PATH

#define MAX_ODB_PATH   256

length of path in ODB

Definition at line 277 of file midas.h.

◆ MAX_OPEN_RECORDS

#define MAX_OPEN_RECORDS   256

number of open DB records

Definition at line 276 of file midas.h.

◆ MAX_RPC_PARAMS

#define MAX_RPC_PARAMS   20

Definition at line 1595 of file midas.h.

◆ MAX_WRITE_CACHE_EVENT_SIZE_DIV

#define MAX_WRITE_CACHE_EVENT_SIZE_DIV   (10)

maximum event size cached in write cache as fraction of write cache size

Definition at line 259 of file midas.h.

◆ MAX_WRITE_CACHE_SIZE_DIV

#define MAX_WRITE_CACHE_SIZE_DIV   (3)

maximum write cache size as fraction of buffer size

Definition at line 258 of file midas.h.

◆ MIDAS_MAGIC

#define MIDAS_MAGIC   0x494d

magic number used in trigger_mask for BOR event 'MI'

Definition at line 911 of file midas.h.

◆ MIDAS_TCP_PORT

#define MIDAS_TCP_PORT   1175 /* port under which server is listening */

Definition at line 283 of file midas.h.

◆ MIDAS_TYPE_DEFINED

#define MIDAS_TYPE_DEFINED

Definition at line 95 of file midas.h.

◆ MIDAS_VERSION

#define MIDAS_VERSION   "2.1"

Definition at line 37 of file midas.h.

◆ MIN_WRITE_CACHE_SIZE

#define MIN_WRITE_CACHE_SIZE   (10000000)

default and minimum write cache size, in bytes

Definition at line 257 of file midas.h.

◆ MUTEX_T_DEFINED

#define MUTEX_T_DEFINED

Definition at line 238 of file midas.h.

◆ NAME_LENGTH

#define NAME_LENGTH   32

length of names, mult.of 8!

Definition at line 272 of file midas.h.

◆ NET_TCP_SIZE

#define NET_TCP_SIZE   0xFFFF

maximum TCP transfer size

Definition at line 266 of file midas.h.

◆ O_LARGEFILE

#define O_LARGEFILE   0

Definition at line 210 of file midas.h.

◆ OPT_TCP_SIZE

#define OPT_TCP_SIZE   8192

optimal TCP buffer size

Definition at line 267 of file midas.h.

◆ PAWC_DEFINE

#define PAWC_DEFINE (   size)
Value:
INT PAWC_NAME[size/4]; \
INT pawc_size = size
INT pawc_size
int INT
Definition midas.h:129
#define PAWC_NAME
Definition midas.h:1566

Definition at line 1569 of file midas.h.

◆ PAWC_NAME

#define PAWC_NAME   PAWC

Definition at line 1566 of file midas.h.

◆ POINTER_T

#define POINTER_T   int

Definition at line 166 of file midas.h.

◆ PROGRAM_INFO_STR

#define PROGRAM_INFO_STR (   _name)
Value:
const char *_name[] = {\
"[.]",\
"Required = BOOL : n",\
"Watchdog timeout = INT : 10000",\
"Check interval = DWORD : 180000",\
"Start command = STRING : [256] ",\
"Auto start = BOOL : n",\
"Auto stop = BOOL : n",\
"Auto restart = BOOL : n",\
"Alarm class = STRING : [32] ",\
"First failed = DWORD : 0",\
"",\

Definition at line 1448 of file midas.h.

1448 {\
1449"[.]",\
1450"Required = BOOL : n",\
1451"Watchdog timeout = INT : 10000",\
1452"Check interval = DWORD : 180000",\
1453"Start command = STRING : [256] ",\
1454"Auto start = BOOL : n",\
1455"Auto stop = BOOL : n",\
1456"Auto restart = BOOL : n",\
1457"Alarm class = STRING : [32] ",\
1458"First failed = DWORD : 0",\
1459"",\
1460NULL }

◆ PTYPE

#define PTYPE   POINTER_T

Definition at line 170 of file midas.h.

◆ RPC_FIXARRAY

#define RPC_FIXARRAY   (1 << 3)

Definition at line 1583 of file midas.h.

◆ RPC_IN

#define RPC_IN   (1 << 0)

flags

Definition at line 1580 of file midas.h.

◆ RPC_MAX_ID

#define RPC_MAX_ID   9999

Definition at line 1607 of file midas.h.

◆ RPC_MIN_ID

#define RPC_MIN_ID   1

IDs allow for users

Definition at line 1606 of file midas.h.

◆ RPC_OUT

#define RPC_OUT   (1 << 1)

Definition at line 1581 of file midas.h.

◆ RPC_OUTGOING

#define RPC_OUTGOING   (1 << 5)

Definition at line 1585 of file midas.h.

◆ RPC_POINTER

#define RPC_POINTER   (1 << 2)

Definition at line 1582 of file midas.h.

◆ RPC_VARARRAY

#define RPC_VARARRAY   (1 << 4)

Definition at line 1584 of file midas.h.

◆ RT_DATA

#define RT_DATA   (*((DWORD *) "HSDA"))

Definition at line 1357 of file midas.h.

◆ RT_DEF

#define RT_DEF   (*((DWORD *) "HSDF"))

Definition at line 1358 of file midas.h.

◆ RUNINFO_STR

#define RUNINFO_STR (   _name)
Value:
const char *_name[] = {\
"[.]",\
"State = INT : 1",\
"Online Mode = INT : 1",\
"Run number = INT : 0",\
"Transition in progress = INT : 0",\
"Start abort = INT : 0",\
"Requested transition = INT : 0",\
"Start time = STRING : [32] Tue Sep 09 15:04:42 1997",\
"Start time binary = DWORD : 0",\
"Stop time = STRING : [32] Tue Sep 09 15:04:42 1997",\
"Stop time binary = DWORD : 0",\
"",\

Definition at line 1410 of file midas.h.

1410 {\
1411"[.]",\
1412"State = INT : 1",\
1413"Online Mode = INT : 1",\
1414"Run number = INT : 0",\
1415"Transition in progress = INT : 0",\
1416"Start abort = INT : 0",\
1417"Requested transition = INT : 0",\
1418"Start time = STRING : [32] Tue Sep 09 15:04:42 1997",\
1419"Start time binary = DWORD : 0",\
1420"Stop time = STRING : [32] Tue Sep 09 15:04:42 1997",\
1421"Stop time binary = DWORD : 0",\
1422"",\
1423NULL }

◆ SERIAL_NUMBER

#define SERIAL_NUMBER (   e)    ((((EVENT_HEADER *) e)-1)->serial_number)

SERIAL_NUMBER Extract or set/reset the serial number field pointed by the argument.

Parameters
epointer to the midas event (pevent)

Definition at line 880 of file midas.h.

◆ SET_TEST

#define SET_TEST (   t,
 
)    { if (!t.registered) test_register(&t); t.value = (v); }

Definition at line 1346 of file midas.h.

◆ STRING_BANKLIST_MAX

#define STRING_BANKLIST_MAX   BANKLIST_MAX * 4

for bk_list()

Definition at line 279 of file midas.h.

◆ TAPE_BUFFER_SIZE

#define TAPE_BUFFER_SIZE   0x8000

buffer size for taping data

Definition at line 264 of file midas.h.

◆ TEST

#define TEST (   t)    (t.value)

Definition at line 1347 of file midas.h.

◆ TIME_STAMP

#define TIME_STAMP (   e)    ((((EVENT_HEADER *) e)-1)->time_stamp)

TIME_STAMP Extract or set/reset the time stamp field pointed by the argument.

Parameters
epointer to the midas event (pevent)

Definition at line 887 of file midas.h.

◆ TRANSITION_ERROR_STRING_LENGTH

#define TRANSITION_ERROR_STRING_LENGTH   256

length of transition error string

Definition at line 280 of file midas.h.

◆ TRIGGER_MASK

#define TRIGGER_MASK (   e)    ((((EVENT_HEADER *) e)-1)->trigger_mask)

TRIGGER_MASK Extract or set the trigger mask field pointed by the argument.

Parameters
epointer to the midas event (pevent)

Definition at line 866 of file midas.h.

◆ TRUE

#define TRUE   1

Definition at line 182 of file midas.h.

◆ USE_HIDDEN_EQ

#define USE_HIDDEN_EQ

Use hidden equipment in status page

Definition at line 292 of file midas.h.

◆ WATCHDOG_INTERVAL

#define WATCHDOG_INTERVAL   1000

Definition at line 288 of file midas.h.

Typedef Documentation

◆ BOOL

Definition at line 105 of file midas.h.

◆ BYTE

Definition at line 97 of file midas.h.

◆ DWORD

Definition at line 100 of file midas.h.

◆ HISTORY

◆ HNDLE

Definition at line 132 of file midas.h.

◆ INT

Definition at line 129 of file midas.h.

◆ INT16

Definition at line 139 of file midas.h.

◆ INT32

Definition at line 141 of file midas.h.

◆ INT64

Definition at line 143 of file midas.h.

◆ INT8

Definition at line 137 of file midas.h.

◆ midas_thread_t

Definition at line 179 of file midas.h.

◆ MUTEX_T

Definition at line 237 of file midas.h.

◆ PEQUIPMENT

Definition at line 1151 of file midas.h.

◆ STRING_LIST

typedef std::vector<std::string> STRING_LIST

Definition at line 246 of file midas.h.

◆ UINT16

Definition at line 138 of file midas.h.

◆ UINT32

Definition at line 140 of file midas.h.

◆ UINT64

Definition at line 142 of file midas.h.

◆ UINT8

Definition at line 136 of file midas.h.

◆ WORD

Definition at line 98 of file midas.h.

Function Documentation

◆ add_data_dir()

void EXPRT add_data_dir ( char result,
char file 
)

Definition at line 424 of file mana.cxx.

425{
426 HNDLE hDB, hkey;
427 char str[256];
428 int size;
429
431 db_find_key(hDB, 0, "/Logger/Data dir", &hkey);
432
433 if (hkey) {
434 size = sizeof(str);
435 db_get_data(hDB, hkey, str, &size, TID_STRING);
436 if (str[strlen(str) - 1] != DIR_SEPARATOR)
438 strcat(str, file);
439 strcpy(result, str);
440 } else
441 strcpy(result, file);
442}
INT cm_get_experiment_database(HNDLE *hDB, HNDLE *hKeyClient)
Definition midas.cxx:3011
#define TID_STRING
Definition midas.h:346
INT db_get_data(HNDLE hDB, HNDLE hKey, void *data, INT *buf_size, DWORD type)
Definition odb.cxx:6539
INT db_find_key(HNDLE hDB, HNDLE hKey, const char *key_name, HNDLE *subhKey)
Definition odb.cxx:4079
HNDLE hDB
main ODB handle
Definition mana.cxx:207
#define DIR_SEPARATOR
Definition midas.h:193
INT HNDLE
Definition midas.h:132
#define DIR_SEPARATOR_STR
Definition midas.h:194
char str[256]
Definition odbhist.cxx:33
Here is the call graph for this function:
Here is the caller graph for this function:

◆ bm_get_buffer_info()

INT EXPRT bm_get_buffer_info ( INT  buffer_handle,
BUFFER_HEADER buffer_header 
)

dox dox

Definition at line 7791 of file midas.cxx.

7813{
7814 if (rpc_is_remote())
7815 return rpc_call(RPC_BM_GET_BUFFER_INFO, buffer_handle, buffer_header);
7816
7817#ifdef LOCAL_ROUTINES
7818
7819 int status = 0;
7820 BUFFER *pbuf = bm_get_buffer("bm_get_buffer_info", buffer_handle, &status);
7821
7822 if (!pbuf)
7823 return status;
7824
7826
7827 if (!pbuf_guard.is_locked())
7828 return pbuf_guard.get_status();
7829
7830 memcpy(buffer_header, pbuf->buffer_header, sizeof(BUFFER_HEADER));
7831
7832#endif /* LOCAL_ROUTINES */
7833
7834 return BM_SUCCESS;
7835}
static BUFFER * bm_get_buffer(const char *who, INT buffer_handle, int *pstatus)
Definition midas.cxx:6622
#define BM_SUCCESS
Definition midas.h:605
#define RPC_BM_GET_BUFFER_INFO
Definition mrpc.h:39
bool rpc_is_remote(void)
Definition midas.cxx:12761
INT rpc_call(DWORD routine_id,...)
Definition midas.cxx:13663
DWORD status
Definition odbhist.cxx:39
Here is the call graph for this function:
Here is the caller graph for this function:

◆ bm_get_buffer_level()

INT EXPRT bm_get_buffer_level ( INT  buffer_handle,
INT n_bytes 
)

Definition at line 7838 of file midas.cxx.

7857{
7858 if (rpc_is_remote())
7859 return rpc_call(RPC_BM_GET_BUFFER_LEVEL, buffer_handle, n_bytes);
7860
7861#ifdef LOCAL_ROUTINES
7862 {
7863 int status = 0;
7864
7865 BUFFER *pbuf = bm_get_buffer("bm_get_buffer_level", buffer_handle, &status);
7866
7867 if (!pbuf)
7868 return status;
7869
7871
7872 if (!pbuf_guard.is_locked())
7873 return pbuf_guard.get_status();
7874
7875 BUFFER_HEADER *pheader = pbuf->buffer_header;
7876
7878
7879 *n_bytes = pheader->write_pointer - pclient->read_pointer;
7880 if (*n_bytes < 0)
7881 *n_bytes += pheader->size;
7882
7883 pbuf_guard.unlock();
7884
7885 if (pbuf->read_cache_size) {
7887 if (status == BM_SUCCESS) {
7888 /* add bytes in cache */
7889 if (pbuf->read_cache_wp > pbuf->read_cache_rp)
7890 *n_bytes += pbuf->read_cache_wp - pbuf->read_cache_rp;
7891 pbuf->read_cache_mutex.unlock();
7892 }
7893 }
7894 }
7895#endif /* LOCAL_ROUTINES */
7896
7897 return BM_SUCCESS;
7898}
static BUFFER_CLIENT * bm_get_my_client_locked(bm_lock_buffer_guard &pbuf_guard)
Definition midas.cxx:5999
static int bm_lock_buffer_read_cache(BUFFER *pbuf)
Definition midas.cxx:7904
#define RPC_BM_GET_BUFFER_LEVEL
Definition mrpc.h:40
INT write_pointer
Definition midas.h:963
Here is the call graph for this function:
Here is the caller graph for this function:

◆ bm_init_buffer_counters()

INT EXPRT bm_init_buffer_counters ( INT  buffer_handle)

Definition at line 8063 of file midas.cxx.

8082{
8083 if (rpc_is_remote())
8084 return rpc_call(RPC_BM_INIT_BUFFER_COUNTERS, buffer_handle);
8085
8086#ifdef LOCAL_ROUTINES
8087
8088 int status = 0;
8089
8090 BUFFER* pbuf = bm_get_buffer("bm_init_buffer_counters", buffer_handle, &status);
8091
8092 if (!pbuf)
8093 return status;
8094
8096
8097 if (!pbuf_guard.is_locked())
8098 return pbuf_guard.get_status();
8099
8100 pbuf->buffer_header->num_in_events = 0;
8101 pbuf->buffer_header->num_out_events = 0;
8102
8103#endif /* LOCAL_ROUTINES */
8104
8105 return BM_SUCCESS;
8106}
#define RPC_BM_INIT_BUFFER_COUNTERS
Definition mrpc.h:41
Here is the call graph for this function:
Here is the caller graph for this function:

◆ close_subfolder()

void EXPRT close_subfolder ( void  )
Here is the caller graph for this function:

◆ cm_msg()

INT EXPRT cm_msg ( INT  message_type,
const char filename,
INT  line,
const char routine,
const char format,
  ... 
)

◆ cm_msg1()

INT EXPRT INT EXPRT cm_msg1 ( INT  message_type,
const char filename,
INT  line,
const char facility,
const char routine,
const char format,
  ... 
)

◆ cm_transition_name()

std::string EXPRT cm_transition_name ( int  transition)

Definition at line 133 of file midas.cxx.

134{
135 if (transition == TR_START) return "START";
136 if (transition == TR_STOP) return "STOP";
137 if (transition == TR_PAUSE) return "PAUSE";
138 if (transition == TR_RESUME) return "RESUME";
139 if (transition == TR_STARTABORT) return "STARTABORT";
140 if (transition == TR_DEFERRED) return "DEFERRED";
141 return msprintf("UNKNOWN TRANSITION %d", transition);
142}
INT transition(INT run_number, char *error)
Definition consume.cxx:35
#define TR_RESUME
Definition midas.h:408
#define TR_PAUSE
Definition midas.h:407
#define TR_START
Definition midas.h:405
#define TR_STARTABORT
Definition midas.h:409
#define TR_DEFERRED
Definition midas.h:410
#define TR_STOP
Definition midas.h:406
std::string msprintf(const char *format,...)
Definition midas.cxx:410
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cm_write_event_to_odb()

int EXPRT cm_write_event_to_odb ( HNDLE  hDB,
HNDLE  hKey,
const EVENT_HEADER pevent,
INT  format 
)

Definition at line 17723 of file midas.cxx.

17724{
17725 if (format == FORMAT_FIXED) {
17726 int status;
17727 status = db_set_record(hDB, hKey, (char *) (pevent + 1), pevent->data_size, 0);
17728 if (status != DB_SUCCESS) {
17729 cm_msg(MERROR, "cm_write_event_to_odb", "event %d ODB record size mismatch, db_set_record() status %d", pevent->event_id, status);
17730 return status;
17731 }
17732 return SUCCESS;
17733 } else if (format == FORMAT_MIDAS) {
17734 INT size, i, status, n_data;
17735 int n;
17736 char *pdata, *pdata0;
17737
17738 char name[5];
17740 BANK *pbk;
17741 BANK32 *pbk32;
17742 BANK32A *pbk32a;
17743 DWORD bkname;
17744 WORD bktype;
17746 KEY key;
17747
17748 pbh = (BANK_HEADER *) (pevent + 1);
17749 pbk = NULL;
17750 pbk32 = NULL;
17751 pbk32a = NULL;
17752
17753 /* count number of banks */
17754 for (n=0 ; ; n++) {
17755 if (bk_is32a(pbh)) {
17757 if (pbk32a == NULL)
17758 break;
17759 } else if (bk_is32(pbh)) {
17761 if (pbk32 == NULL)
17762 break;
17763 } else {
17764 bk_iterate(pbh, &pbk, &pdata);
17765 if (pbk == NULL)
17766 break;
17767 }
17768 }
17769
17770 /* build array of keys */
17771 hKeys = (HNDLE *)malloc(sizeof(HNDLE) * n);
17772
17773 pbk = NULL;
17774 pbk32 = NULL;
17775 n = 0;
17776 do {
17777 /* scan all banks */
17778 if (bk_is32a(pbh)) {
17779 size = bk_iterate32a(pbh, &pbk32a, &pdata);
17780 if (pbk32a == NULL)
17781 break;
17782 bkname = *((DWORD *) pbk32a->name);
17783 bktype = (WORD) pbk32a->type;
17784 } else if (bk_is32(pbh)) {
17785 size = bk_iterate32(pbh, &pbk32, &pdata);
17786 if (pbk32 == NULL)
17787 break;
17788 bkname = *((DWORD *) pbk32->name);
17789 bktype = (WORD) pbk32->type;
17790 } else {
17791 size = bk_iterate(pbh, &pbk, &pdata);
17792 if (pbk == NULL)
17793 break;
17794 bkname = *((DWORD *) pbk->name);
17795 bktype = (WORD) pbk->type;
17796 }
17797
17798 n_data = size;
17799 if (rpc_tid_size(bktype & 0xFF))
17800 n_data /= rpc_tid_size(bktype & 0xFF);
17801
17802 /* get bank key */
17803 *((DWORD *) name) = bkname;
17804 name[4] = 0;
17805 /* record the start of the data in case it is struct */
17806 pdata0 = pdata;
17807 if (bktype == TID_STRUCT) {
17809 if (status != DB_SUCCESS) {
17810 cm_msg(MERROR, "cm_write_event_to_odb", "please define bank \"%s\" in BANK_LIST in frontend", name);
17811 continue;
17812 }
17813
17814 /* write structured bank */
17815 for (i = 0;; i++) {
17818 break;
17819
17820 db_get_key(hDB, hKeyl, &key);
17821
17822 /* adjust for alignment */
17823 if (key.type != TID_STRING && key.type != TID_LINK)
17825
17827 if (status != DB_SUCCESS) {
17828 cm_msg(MERROR, "cm_write_event_to_odb", "cannot write bank \"%s\" to ODB, db_set_data1() status %d", name, status);
17829 continue;
17830 }
17831 hKeys[n++] = hKeyl;
17832
17833 /* shift data pointer to next item */
17835 }
17836 } else {
17837 /* write variable length bank */
17839 if (status != DB_SUCCESS) {
17841 if (status != DB_SUCCESS) {
17842 cm_msg(MERROR, "cm_write_event_to_odb", "cannot create key for bank \"%s\" with tid %d in ODB, db_create_key() status %d", name, bktype, status);
17843 continue;
17844 }
17846 if (status != DB_SUCCESS) {
17847 cm_msg(MERROR, "cm_write_event_to_odb", "cannot find key for bank \"%s\" in ODB, after db_create_key(), db_find_key() status %d", name, status);
17848 continue;
17849 }
17850 }
17851 if (n_data > 0) {
17852 status = db_set_data1(hDB, hKeyRoot, pdata, size, n_data, bktype & 0xFF);
17853 if (status != DB_SUCCESS) {
17854 cm_msg(MERROR, "cm_write_event_to_odb", "cannot write bank \"%s\" to ODB, db_set_data1() status %d", name, status);
17855 }
17856 hKeys[n++] = hKeyRoot;
17857 }
17858 }
17859 } while (1);
17860
17861 /* notify all hot-lined clients in one go */
17863
17864 free(hKeys);
17865
17866 return SUCCESS;
17867 } else {
17868 cm_msg(MERROR, "cm_write_event_to_odb", "event format %d is not supported (see midas.h definitions of FORMAT_xxx)", format);
17869 return CM_DB_ERROR;
17870 }
17871}
INT bk_iterate32a(const void *event, BANK32A **pbk32a, void *pdata)
Definition midas.cxx:17103
BOOL bk_is32a(const void *event)
Definition midas.cxx:16437
BOOL bk_is32(const void *event)
Definition midas.cxx:16415
INT bk_iterate32(const void *event, BANK32 **pbk, void *pdata)
Definition midas.cxx:17067
INT bk_iterate(const void *event, BANK **pbk, void *pdata)
Definition midas.cxx:17046
#define CM_DB_ERROR
Definition midas.h:585
#define DB_SUCCESS
Definition midas.h:631
#define DB_NO_MORE_SUBKEYS
Definition midas.h:646
unsigned short int WORD
Definition mcstd.h:49
unsigned int DWORD
Definition mcstd.h:51
#define SUCCESS
Definition mcstd.h:54
#define FORMAT_FIXED
Definition midas.h:314
#define TID_STRUCT
Definition midas.h:348
#define TID_LINK
Definition midas.h:350
#define MERROR
Definition midas.h:559
#define FORMAT_MIDAS
Definition midas.h:311
#define VALIGN(adr, align)
Definition midas.h:526
#define MIN(a, b)
Definition midas.h:515
INT ss_get_struct_align()
Definition system.cxx:1319
INT cm_msg(INT message_type, const char *filename, INT line, const char *routine, const char *format,...)
Definition midas.cxx:915
INT db_create_key(HNDLE hDB, HNDLE hKey, const char *key_name, DWORD type)
Definition odb.cxx:3308
INT db_get_key(HNDLE hDB, HNDLE hKey, KEY *key)
Definition odb.cxx:6019
INT db_set_data1(HNDLE hDB, HNDLE hKey, const void *data, INT buf_size, INT num_values, DWORD type)
Definition odb.cxx:7313
INT db_notify_clients_array(HNDLE hDB, HNDLE hKeys[], INT size)
Definition odb.cxx:12623
INT db_set_record(HNDLE hDB, HNDLE hKey, void *data, INT buf_size, INT align)
Definition odb.cxx:12291
INT db_enum_key(HNDLE hDB, HNDLE hKey, INT idx, HNDLE *subkey_handle)
Definition odb.cxx:5586
INT rpc_tid_size(INT id)
Definition midas.cxx:11757
HNDLE hKey
DWORD n[4]
Definition mana.cxx:247
KEY key
Definition mdump.cxx:34
INT i
Definition mdump.cxx:32
#define name(x)
Definition midas_macro.h:24
Definition midas.h:1215
short int event_id
Definition midas.h:852
DWORD data_size
Definition midas.h:856
Definition midas.h:1026
INT num_values
Definition midas.h:1028
DWORD type
Definition midas.h:1027
INT item_size
Definition midas.h:1032
Here is the call graph for this function:
Here is the caller graph for this function:

◆ dbg_calloc()

void * dbg_calloc ( unsigned int  size,
unsigned int  count,
char file,
int  line 
)

Definition at line 341 of file midas.cxx.

341 {
342 void *adr;
343
344 adr = dbg_malloc(size * count, file, line);
345 if (adr)
346 memset(adr, 0, size * count);
347
348 return adr;
349}
double count
Definition mdump.cxx:33
void * dbg_malloc(unsigned int size, char *file, int line)
Definition midas.cxx:306
Here is the call graph for this function:

◆ dbg_free()

void dbg_free ( void adr,
char file,
int  line 
)

Definition at line 351 of file midas.cxx.

351 {
352 FILE *f;
353 int i;
354
355 free(adr);
356
357 for (i = 0; i < _n_mem; i++)
358 if (_mem_loc[i].adr == adr)
359 break;
360
361 if (i < _n_mem)
362 _mem_loc[i].adr = NULL;
363
364 f = fopen("mem.txt", "w");
365 for (i = 0; i < _n_mem; i++)
366 if (_mem_loc[i].adr)
367 fprintf(f, "%s:%d %s:%d size=%d adr=%p\n", _mem_loc[i].file, _mem_loc[i].line,
368 file, line, _mem_loc[i].size, _mem_loc[i].adr);
369 fclose(f);
370}
static INT _n_mem
Definition midas.cxx:287
static DBG_MEM_LOC * _mem_loc
Definition midas.cxx:286
void * adr
Definition midas.cxx:280
Here is the call graph for this function:

◆ dbg_malloc()

void * dbg_malloc ( unsigned int  size,
char file,
int  line 
)

Definition at line 306 of file midas.cxx.

306 {
307 FILE *f;
308 void *adr;
309 int i;
310
311 adr = malloc(size);
312
313 /* search for deleted entry */
314 for (i = 0; i < _n_mem; i++)
315 if (_mem_loc[i].adr == NULL)
316 break;
317
318 if (i == _n_mem) {
319 _n_mem++;
320 if (!_mem_loc)
321 _mem_loc = (DBG_MEM_LOC *) malloc(sizeof(DBG_MEM_LOC));
322 else
324 }
325
326 _mem_loc[i].adr = adr;
327 _mem_loc[i].size = size;
328 strcpy(_mem_loc[i].file, file);
329 _mem_loc[i].line = line;
330
331 f = fopen("mem.txt", "w");
332 for (i = 0; i < _n_mem; i++)
333 if (_mem_loc[i].adr)
334 fprintf(f, "%s:%d size=%d adr=%p\n", _mem_loc[i].file, _mem_loc[i].line, _mem_loc[i].size,
335 _mem_loc[i].adr);
336 fclose(f);
337
338 return adr;
339}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ device_driver()

INT device_driver ( DEVICE_DRIVER device_driver,
INT  cmd,
  ... 
)

Definition at line 153 of file device_driver.cxx.

154{
156 HNDLE hKey;
157 INT channel, status, i, j;
158 float value, *pvalue;
159 char *name, *label;
160
161 va_start(argptr, cmd);
163
164 /* don't execute command if driver is disabled */
165 if (!device_drv->enabled)
167
168 switch (cmd) {
169 case CMD_INIT:
171
172 if (device_drv->flags & DF_MULTITHREAD) {
173 status = device_drv->dd(CMD_INIT, hKey, &device_drv->dd_info,
174 device_drv->channels, device_drv->flags,
175 device_drv->bd);
176
177 if (status == FE_SUCCESS && (device_drv->flags & DF_MULTITHREAD)) {
178 /* create inter-thread data exchange buffers */
179 device_drv->mt_buffer = (DD_MT_BUFFER *) calloc(1, sizeof(DD_MT_BUFFER));
180 device_drv->mt_buffer->n_channels = device_drv->channels;
181 device_drv->mt_buffer->channel = (DD_MT_CHANNEL *) calloc(device_drv->channels, sizeof(DD_MT_CHANNEL));
182 assert(device_drv->mt_buffer->channel);
183
184 /* initialize n_read for all channels */
185 for (i=0 ; i<device_drv->channels ; i++)
186 device_drv->mt_buffer->channel[i].n_read = 0;
187
188 /* set all get values to NaN */
189 for (i=0 ; i<device_drv->channels ; i++)
190 for (j=CMD_GET_FIRST ; j<=CMD_GET_LAST ; j++)
191 device_drv->mt_buffer->channel[i].variable[j] = (float) ss_nan();
192
193 /* set all set values to NaN */
194 for (i=0 ; i<device_drv->channels ; i++)
195 for (j=CMD_SET_FIRST ; j<=CMD_SET_LAST ; j++)
196 device_drv->mt_buffer->channel[i].variable[j] = (float)ss_nan();
197
198 /* get default names for this driver already now */
199 for (i = 0; i < device_drv->channels; i++) {
200 device_drv->dd(CMD_GET_LABEL, device_drv->dd_info, i,
201 device_drv->mt_buffer->channel[i].label);
202 }
203 /* create semaphore */
205 if (status != SS_CREATED && status != SS_SUCCESS)
206 return FE_ERR_DRIVER;
208 }
209 } else {
210 status = device_drv->dd(CMD_INIT, hKey, &device_drv->dd_info,
211 device_drv->channels, device_drv->flags,
212 device_drv->bd);
213 }
214 break;
215
216 case CMD_START:
217 if (device_drv->flags & DF_MULTITHREAD && device_drv->mt_buffer != NULL) {
218 /* create dedicated thread for this device */
219 device_drv->mt_buffer->thread_id = ss_thread_create(sc_thread, device_drv);
220 }
221 break;
222
223 case CMD_CLOSE:
224 /* signal all threads to stop */
225 if (device_drv->flags & DF_MULTITHREAD && device_drv->mt_buffer != NULL)
226 device_drv->stop_thread = 1;
227 break;
228
229 case CMD_STOP:
230 if (device_drv->flags & DF_MULTITHREAD && device_drv->mt_buffer != NULL) {
231 if (device_drv->stop_thread == 0)
232 device_drv->stop_thread = 1;
233
234 /* wait for max. 10 seconds until thread has gracefully stopped */
235 for (i = 0; i < 1000; i++) {
236 if (device_drv->stop_thread == 2)
237 break;
238 ss_sleep(10);
239 }
240
241 /* if timeout expired, kill thread */
242 if (i == 1000)
243 ss_thread_kill(device_drv->mt_buffer->thread_id);
244
246 free(device_drv->mt_buffer->channel);
247 free(device_drv->mt_buffer);
248 }
249 break;
250
251 case CMD_EXIT:
252 status = device_drv->dd(CMD_EXIT, device_drv->dd_info);
253 break;
254
255 case CMD_SET_LABEL:
257 label = va_arg(argptr, char *);
258 status = device_drv->dd(CMD_SET_LABEL, device_drv->dd_info, channel, label);
259 break;
260
261 case CMD_GET_LABEL:
263 name = va_arg(argptr, char *);
265 break;
266
267 default:
268
269 if (cmd >= CMD_SET_FIRST && cmd <= CMD_SET_LAST) {
270
271 /* transfer data to sc_thread for SET commands */
273 value = (float) va_arg(argptr, double); // floats are passed as double
274 if (device_drv->flags & DF_MULTITHREAD) {
275 ss_mutex_wait_for(device_drv->mutex, 1000);
276 device_drv->mt_buffer->channel[channel].variable[cmd] = value;
277 status = device_drv->mt_buffer->status;
279 } else {
280 status = device_drv->dd(cmd, device_drv->dd_info, channel, value);
281 }
282
283 } else if (cmd >= CMD_GET_FIRST && cmd <= CMD_GET_LAST) {
284
285 /* transfer data from sc_thread for GET commands */
287 pvalue = va_arg(argptr, float *);
288 if (device_drv->flags & DF_MULTITHREAD) {
289 ss_mutex_wait_for(device_drv->mutex, 1000);
290 *pvalue = device_drv->mt_buffer->channel[channel].variable[cmd];
291 status = device_drv->mt_buffer->status;
292 if (device_drv->mt_buffer->channel[channel].n_read < 1)
295 } else
296 status = device_drv->dd(cmd, device_drv->dd_info, channel, pvalue);
297
298 } else {
299
300 /* all remaining commands which are passed directly to the device driver */
302 pvalue = va_arg(argptr, float *);
303 status = device_drv->dd(cmd, device_drv->dd_info, channel, pvalue);
304 }
305
306 break;
307 }
308
309 va_end(argptr);
310 return status;
311}
#define FALSE
Definition cfortran.h:309
static int sc_thread(void *info)
#define SS_SUCCESS
Definition midas.h:663
#define SS_CREATED
Definition midas.h:664
#define CMD_CLOSE
Definition midas.h:773
#define FE_SUCCESS
Definition midas.h:717
#define CMD_INIT
Definition midas.h:762
#define CMD_SET_LAST
Definition midas.h:784
#define CMD_SET_FIRST
Definition midas.h:776
#define CMD_STOP
Definition midas.h:765
#define FE_NOT_YET_READ
Definition midas.h:723
#define CMD_GET_LAST
Definition midas.h:793
#define CMD_SET_LABEL
Definition midas.h:770
#define FE_PARTIALLY_DISABLED
Definition midas.h:722
#define CMD_START
Definition midas.h:764
#define FE_ERR_DRIVER
Definition midas.h:721
#define CMD_GET_LABEL
Definition midas.h:771
#define CMD_EXIT
Definition midas.h:763
#define CMD_GET_FIRST
Definition midas.h:786
INT ss_mutex_release(MUTEX_T *mutex)
Definition system.cxx:3157
INT ss_thread_kill(midas_thread_t thread_id)
Definition system.cxx:2383
INT ss_mutex_delete(MUTEX_T *mutex)
Definition system.cxx:3211
INT ss_mutex_create(MUTEX_T **mutex, BOOL recursive)
Definition system.cxx:2941
midas_thread_t ss_thread_create(INT(*thread_func)(void *), void *param)
Definition system.cxx:2310
INT ss_sleep(INT millisec)
Definition system.cxx:3628
double ss_nan()
Definition system.cxx:7940
INT ss_mutex_wait_for(MUTEX_T *mutex, INT timeout)
Definition system.cxx:3037
INT channel
#define DF_MULTITHREAD
Definition midas.h:1054
INT j
Definition odbhist.cxx:40
double value[100]
Definition odbhist.cxx:42
Here is the call graph for this function:

◆ ends_with_char()

bool EXPRT ends_with_char ( const std::string &  s,
char  c 
)

Definition at line 403 of file midas.cxx.

404{
405 if (s.length() < 1)
406 return false;
407 return s[s.length()-1] == c;
408}
char c
Definition system.cxx:1310
Here is the caller graph for this function:

◆ hs_image_retrieve()

int hs_image_retrieve ( std::string  image_name,
time_t  start,
time_t  stop,
std::vector< time_t > &  vtime,
std::vector< std::string > &  vfilename 
)

Definition at line 332 of file history_image.cxx.

334{
335 // auto start = usStart();
336 std::string path = history_dir() + image_name;
337
338 std::string mask;
339 if (start_time == stop_time) {
340 ss_tzset(); // required by localtime_r()
341 struct tm ltm;
342 localtime_r(&start_time, &ltm);
343 std::stringstream s;
344 s <<
345 std::setfill('0') << std::setw(2) << ltm.tm_year - 100 <<
346 std::setfill('0') << std::setw(2) << ltm.tm_mon + 1 <<
347 std::setfill('0') << std::setw(2) << ltm.tm_mday <<
348 "_" << "??????.*";
349 mask = s.str();
350 } else {
351 ss_tzset(); // required by localtime_r()
352 struct tm ltStart, ltStop;
353 localtime_r(&start_time, &ltStart);
355 std::stringstream sStart, sStop;
356 std::string mStart, mStop;
357 mask = "??????_??????.*";
358
359 sStart <<
360 std::setfill('0') << std::setw(2) << ltStart.tm_year - 100 <<
361 std::setfill('0') << std::setw(2) << ltStart.tm_mon + 1 <<
362 std::setfill('0') << std::setw(2) << ltStart.tm_mday <<
363 "_" <<
364 std::setfill('0') << std::setw(2) << ltStart.tm_hour <<
365 std::setfill('0') << std::setw(2) << ltStart.tm_min <<
366 std::setfill('0') << std::setw(2) << ltStart.tm_sec;
367 mStart = sStart.str();
368 sStop <<
369 std::setfill('0') << std::setw(2) << ltStop.tm_year - 100 <<
370 std::setfill('0') << std::setw(2) << ltStop.tm_mon + 1 <<
371 std::setfill('0') << std::setw(2) << ltStop.tm_mday <<
372 "_" <<
373 std::setfill('0') << std::setw(2) << ltStop.tm_hour <<
374 std::setfill('0') << std::setw(2) << ltStop.tm_min <<
375 std::setfill('0') << std::setw(2) << ltStop.tm_sec;
376 mStop = sStop.str();
377 for (int i=0 ; i<13 ; i++) {
378 if (mStart[i] == mStop[i])
379 mask[i] = mStart[i];
380 else
381 break;
382 }
383 }
384
386
387 ss_file_find(path.c_str(), mask.c_str(), &vfn);
388
389 if (vfn.size() == 0)
390 ss_file_find(path.c_str(), "??????_??????.*", &vfn);
391
392 std::sort(vfn.begin(), vfn.end());
393
394 time_t minDiff = 1E7;
395 time_t minTime{};
396 int minIndex{};
397
398 for (unsigned i=0 ; i<vfn.size() ; i++) {
399 struct tm ti{};
400 sscanf(vfn[i].c_str(), "%2d%2d%2d_%2d%2d%2d", &ti.tm_year, &ti.tm_mon,
401 &ti.tm_mday, &ti.tm_hour, &ti.tm_min, &ti.tm_sec);
402 ti.tm_year += 100;
403 ti.tm_mon -= 1;
404 ti.tm_isdst = -1;
405 time_t ft = ss_mktime(&ti);
406 time_t now;
407 time(&now);
408
409 if (abs(ft - start_time) < minDiff) {
410 minDiff = abs(ft - start_time);
411 minTime = ft;
412 minIndex = i;
413 }
414
415 if (start_time != stop_time && ft >= start_time && ft <= stop_time) {
416 vtime.push_back(ft);
417 vfilename.push_back(vfn[i]);
418 }
419 }
420
421 // start == stop means return single image closest to them
422 if (start_time == stop_time && vfn.size() > 0) {
423 vtime.push_back(minTime);
424 vfilename.push_back(vfn[minIndex]);
425 }
426
427 //std::cout << "mask = " << mask << ", n = " << n << ", t = " << usSince(start)/1000.0 << " ms" << std::endl;
428
429 return HS_SUCCESS;
430}
#define HS_SUCCESS
Definition midas.h:727
time_t ss_mktime(struct tm *tms)
Definition system.cxx:3365
void ss_tzset()
Definition system.cxx:3355
INT ss_file_find(const char *path, const char *pattern, char **plist)
Definition system.cxx:6713
std::string history_dir()
DWORD stop_time
Definition mevb.cxx:55
std::vector< std::string > STRING_LIST
Definition midas.h:246
#define mask(slot)
Definition midas_macro.h:54
MUTEX_T * tm
Definition odbedit.cxx:39
Here is the call graph for this function:
Here is the caller graph for this function:

◆ lock_histo()

void EXPRT lock_histo ( INT  id)

Definition at line 3523 of file mana.cxx.

3524{
3525 INT i;
3526
3527 for (i = 0; i < 10000; i++)
3528 if (lock_list[i] == 0)
3529 break;
3530
3531 lock_list[i] = id;
3532}
INT lock_list[10000]
Definition mana.cxx:219

◆ msprintf()

std::string msprintf ( const char format,
  ... 
)

◆ open_subfolder()

void EXPRT open_subfolder ( const char name)
Here is the caller graph for this function:

◆ rpc_register_function()

INT EXPRT rpc_register_function ( INT  id,
RPC_HANDLER  func 
)

◆ test_register()

void EXPRT test_register ( ANA_TEST t)

Definition at line 546 of file mana.cxx.

547{
548 int i;
549
550 /* check if test already registered */
551 for (i = 0; i < n_test; i++)
552 if (tl[i] == t)
553 break;
554 if (i < n_test) {
555 t->registered = TRUE;
556 return;
557 }
558
559 /* allocate space for pointer to test */
560 if (n_test == 0) {
561 tl = (ANA_TEST **) malloc(2 * sizeof(void *));
562
563 /* define "always true" test */
564 tl[0] = (ANA_TEST *) malloc(sizeof(ANA_TEST));
565 strcpy(tl[0]->name, "Always true");
566 tl[0]->count = 0;
567 tl[0]->previous_count = 0;
568 tl[0]->value = TRUE;
569 tl[0]->registered = TRUE;
570 n_test++;
571 } else
572 tl = (ANA_TEST **) realloc(tl, (n_test + 1) * sizeof(void *));
573
574 tl[n_test] = t;
575 t->count = 0;
576 t->value = FALSE;
577 t->registered = TRUE;
578
579 n_test++;
580}
ANA_TEST ** tl
Definition mana.cxx:543
int n_test
Definition mana.cxx:544
#define TRUE
Definition midas.h:182
DWORD previous_count
Definition midas.h:1342
DWORD count
Definition midas.h:1341
BOOL registered
Definition midas.h:1340
BOOL value
Definition midas.h:1343
Here is the call graph for this function: