AlcapDAQ  1
Functions | Variables
odb_wrapper.cpp File Reference
#include <stdio.h>
#include <stdarg.h>
#include "midas.h"
#include "odb_wrapper.h"

Go to the source code of this file.

Functions

int odb_connect (char *format,...)
 
int odb_find_key (char *format,...)
 
int odb_get_int (char *format,...)
 
WORD odb_get_word (char *format,...)
 
DWORD odb_get_dword (char *format,...)
 
BOOL odb_get_bool (char *format,...)
 
void odb_get_boolarray (BOOL *array_out, int num_array_elements, char *format,...)
 

Variables

HNDLE hDB
 

Function Documentation

int odb_connect ( char *  format,
  ... 
)

Definition at line 11 of file odb_wrapper.cpp.

12 {
13  char s[MAX_ODB_PATH];
14  int status;
15  HNDLE hKey;
16 
17  va_list argp;
18  va_start(argp, format);
19  vsprintf(s, format, argp);
20  va_end(argp);
21 
22  /* connect to experiment */
23  status = cm_connect_experiment("pc620", "muCap", s, NULL);
24  if (status != CM_SUCCESS)
25  return 0;
26 
27  /* get handle to online database */
28  cm_get_experiment_database(&hDB, &hKey);
29 
30  return SUCCESS;
31 }
int odb_find_key ( char *  format,
  ... 
)

Definition at line 34 of file odb_wrapper.cpp.

Referenced by caenV767_bor(), caenV767_pre_bor(), dl403_init(), dl40x_bor(), lrs2249_bor(), rpc_master_bor(), rpc_slave_bor(), s500_bor(), setupRegs(), sis3600_bor(), and vmic_ttl_init().

35 {
36  char s[MAX_ODB_PATH];
37  int status;
38  HNDLE hKey;
39 
40  va_list argp;
41  va_start(argp, format);
42  vsprintf(s, format, argp);
43  va_end(argp);
44 
45  status = db_find_key(hDB, 0, s, &hKey);
46 
47  if (status != DB_SUCCESS)
48  return 0;
49 
50  return SUCCESS;
51 }
BOOL odb_get_bool ( char *  format,
  ... 
)

Definition at line 107 of file odb_wrapper.cpp.

Referenced by caenV767_bor(), caenV767_bor1(), caenV767_pre_bor(), dl40x_bor(), lrs2249_bor(), rpc_master_bor(), rpc_master_init(), rpc_slave_bor(), s500_bor(), setupRegs(), sis3600_bor(), and sis3600_bor1().

108 {
109  char s[MAX_ODB_PATH];
110  int size, status;
111  BOOL retval;
112 
113  va_list argp;
114  va_start(argp, format);
115  vsprintf(s, format, argp);
116  va_end(argp);
117 
118  size = sizeof(retval);
119  status = db_get_value(hDB, 0, s, &retval, &size,
120  TID_BOOL, TRUE);
121  return retval;
122 }
void odb_get_boolarray ( BOOL *  array_out,
int  num_array_elements,
char *  format,
  ... 
)

Definition at line 125 of file odb_wrapper.cpp.

Referenced by caenV767_bor1().

128 {
129  char s[MAX_ODB_PATH];
130  int size, status;
131  BOOL rettype;
132 
133  va_list argp;
134  va_start(argp, format);
135  vsprintf(s, format, argp);
136  va_end(argp);
137 
138  size = sizeof(rettype) * num_array_elements;
139  status = db_get_value(hDB, 0, s, array_out, &size,
140  TID_BOOL, TRUE);
141 }
DWORD odb_get_dword ( char *  format,
  ... 
)

Definition at line 89 of file odb_wrapper.cpp.

Referenced by caenV767_bor1(), dl401_bor1(), and sis3600_bor1().

90 {
91  char s[MAX_ODB_PATH];
92  int size, status;
93  DWORD retval;
94 
95  va_list argp;
96  va_start(argp, format);
97  vsprintf(s, format, argp);
98  va_end(argp);
99 
100  size = sizeof(retval);
101  status = db_get_value(hDB, 0, s, &retval, &size,
102  TID_DWORD, TRUE);
103  return retval;
104 }
int odb_get_int ( char *  format,
  ... 
)

Definition at line 54 of file odb_wrapper.cpp.

Referenced by caenV767_bor1(), diag_print_setup(), dl403_init(), frontend_init(), lrs2249_bor1(), s500_bor1(), and setupRegs().

55 {
56  char s[MAX_ODB_PATH];
57  int retval, size, status;
58 
59  va_list argp;
60  va_start(argp, format);
61  vsprintf(s, format, argp);
62  va_end(argp);
63 
64  size = sizeof(retval);
65  status = db_get_value(hDB, 0, s, &retval, &size,
66  TID_INT, TRUE);
67  return retval;
68 }
WORD odb_get_word ( char *  format,
  ... 
)

Definition at line 71 of file odb_wrapper.cpp.

Referenced by dl401_bor1(), dl403_init(), and vmic_ttl_init().

72 {
73  char s[MAX_ODB_PATH];
74  int size, status;
75  WORD retval;
76 
77  va_list argp;
78  va_start(argp, format);
79  vsprintf(s, format, argp);
80  va_end(argp);
81 
82  size = sizeof(retval);
83  status = db_get_value(hDB, 0, s, &retval, &size,
84  TID_WORD, TRUE);
85  return retval;
86 }

Variable Documentation

HNDLE hDB

Definition at line 9 of file odb_wrapper.cpp.