This is Unofficial EPICS BASE Doxygen Site
tool_lib.h
Go to the documentation of this file.
1 /*************************************************************************\
2 * Copyright (c) 2002 The University of Chicago, as Operator of Argonne
3 * National Laboratory.
4 * Copyright (c) 2002 The Regents of the University of California, as
5 * Operator of Los Alamos National Laboratory.
6 * Copyright (c) 2002 Berliner Elektronenspeicherringgesellschaft fuer
7 * Synchrotronstrahlung.
8 * EPICS BASE is distributed subject to a Software License Agreement found
9 * in file LICENSE that is included with this distribution.
10 \*************************************************************************/
11 
12 /*
13  * Author: Ralph Lange (BESSY)
14  *
15  * Modification History
16  * 2009/03/31 Larry Hoff (BNL)
17  * Added field separators
18  *
19  */
20 
21 #ifndef INCLtool_libh
22 #define INCLtool_libh
23 
24 #include <epicsTime.h>
25 
26 /* Convert status and severity to strings */
27 #define stat_to_str(stat) \
28  ((stat) >= 0 && (stat) <= (signed)lastEpicsAlarmCond) ? \
29  epicsAlarmConditionStrings[stat] : "??"
30 
31 #define sevr_to_str(stat) \
32  ((stat) >= 0 && (stat) <= (signed)lastEpicsAlarmSev) ? \
33  epicsAlarmSeverityStrings[stat] : "??"
34 
35 #define stat_to_str_unsigned(stat) \
36  ((stat) <= lastEpicsAlarmCond) ? \
37  epicsAlarmConditionStrings[stat] : "??"
38 
39 #define sevr_to_str_unsigned(stat) \
40  ((stat) <= lastEpicsAlarmSev) ? \
41  epicsAlarmSeverityStrings[stat] : "??"
42 
43 /* The different versions are necessary because stat and sevr are
44  * defined unsigned in CA's DBR_STSACK structure and signed in all the
45  * others. Some compilers generate warnings if you check an unsigned
46  * being >=0 */
47 
48 
49 #define DEFAULT_CA_PRIORITY 0 /* Default CA priority */
50 #define DEFAULT_TIMEOUT 1.0 /* Default CA timeout */
51 
52 #ifndef _WIN32
53 # define LINE_BUFFER(stream) setvbuf(stream, NULL, _IOLBF, BUFSIZ)
54 #else
55 /* Windows doesn't support line mode, turn buffering off completely */
56 # define LINE_BUFFER(stream) setvbuf(stream, NULL, _IONBF, 0)
57 #endif
58 
59 
60 /* Type of timestamp */
62 
63 /* Output formats for integer data types */
64 typedef enum { dec, bin, oct, hex } IntFormatT;
65 
66 /* Structure representing one PV (= channel) */
67 typedef struct
68 {
69  char* name;
71  long dbfType;
72  long dbrType;
73  unsigned long nElems; // True length of data in value
74  unsigned long reqElems; // Requested length of data
75  int status;
76  void* value;
82 } pv;
83 
84 
85 extern TimeT tsType; /* Timestamp type flag (-t option) */
86 extern int tsSrcServer; /* Timestamp source flag (-t option) */
87 extern int tsSrcClient; /* Timestamp source flag (-t option) */
88 extern IntFormatT outTypeI; /* Flag used for -0.. output format option */
89 extern IntFormatT outTypeF; /* Flag used for -l.. output format option */
90 extern int enumAsNr; /* Used for -n option (get DBF_ENUM as number) */
91 extern int charArrAsStr; /* used for -S option - treat char array as (long) string */
92 extern double caTimeout; /* Wait time default (see -w option) */
93 extern char dblFormatStr[]; /* Format string to print doubles (see -e -f option) */
94 extern char fieldSeparator; /* Output field separator */
95 extern capri caPriority; /* CA priority */
96 
97 extern char *val2str (const void *v, unsigned type, int index);
98 extern char *dbr2str (const void *value, unsigned type);
99 extern void print_time_val_sts (pv *pv, unsigned long reqElems);
100 extern int create_pvs (pv *pvs, int nPvs, caCh *pCB );
101 extern int connect_pvs (pv *pvs, int nPvs );
102 
103 /*
104  * no additions below this endif
105  */
106 #endif /* ifndef INCLtool_libh */
IntFormatT
Definition: tool_lib.h:64
Definition: link.h:174
void caCh(struct connection_handler_args args)
Definition: cadef.h:57
int tsSrcClient
Definition: tool_lib.c:45
long dbfType
Definition: tool_lib.h:71
int create_pvs(pv *pvs, int nPvs, caCh *pCB)
Definition: tool_lib.c:574
Definition: tool_lib.h:67
char firstStampPrinted
Definition: tool_lib.h:79
pvd::StructureConstPtr type
void * value
Definition: tool_lib.h:76
int enumAsNr
Definition: tool_lib.c:53
chid chid
Definition: tool_lib.h:70
IntFormatT outTypeF
Definition: tool_lib.c:47
int status
Definition: tool_lib.h:75
char fieldSeparator
Definition: tool_lib.c:51
double caTimeout
Definition: tool_lib.c:55
epicsTimeStamp tsPreviousC
Definition: tool_lib.h:77
long dbrType
Definition: tool_lib.h:72
unsigned capri
Definition: cadef.h:189
char onceConnected
Definition: tool_lib.h:80
TimeT
Definition: tool_lib.h:61
unsigned long nElems
Definition: tool_lib.h:73
void print_time_val_sts(pv *pv, unsigned long reqElems)
Definition: tool_lib.c:503
capri caPriority
Definition: tool_lib.c:56
evid evid
Definition: tool_lib.h:81
int charArrAsStr
Definition: tool_lib.c:54
EPICS time stamp, for use from C code.
Definition: epicsTime.h:33
Definition: tool_lib.h:64
unsigned long reqElems
Definition: tool_lib.h:74
Definition: tool_lib.h:64
Definition: tool_lib.h:64
int tsSrcServer
Definition: tool_lib.c:44
TimeT tsType
Definition: tool_lib.c:43
char * dbr2str(const void *value, unsigned type)
Definition: tool_lib.c:333
char * name
Definition: tool_lib.h:69
EPICS time-stamps (epicsTimeStamp), epicsTime C++ class and C functions for handling wall-clock times...
IntFormatT outTypeI
Definition: tool_lib.c:46
Definition: tool_lib.h:64
int connect_pvs(pv *pvs, int nPvs)
Definition: tool_lib.c:621
char dblFormatStr[]
Definition: tool_lib.c:49
epicsTimeStamp tsPreviousS
Definition: tool_lib.h:78
char * val2str(const void *v, unsigned type, int index)
Definition: tool_lib.c:109