MIDAS
Loading...
Searching...
No Matches
get_record_test.cxx File Reference
#include <assert.h>
#include "midas.h"
#include "msystem.h"
#include "history.h"
#include "mstrlcpy.h"
Include dependency graph for get_record_test.cxx:

Go to the source code of this file.

Classes

struct  test1_struct
 
struct  test2_struct
 

Macros

#define test1_STR   "\ivalue = INT : 1\n\iarray = INT[2] : \n\[0] 1\n\[1] 2\n\svalue = STRING : [20] /Runinfo/Run number\n\sarray = STRING[2] : \n\[32] str1\n\[32] str2\n\"
 
#define test2_STR   "\wvalue = WORD : 1\n\dwvalue = DWORD : 2\n\dvalue = DOUBLE : 3.3\n\cvalue = CHAR : 4\n\dwvalue2 = DWORD : 5\n\fvalue = FLOAT : 6.6\n\dvalue2 = DOUBLE : 7.7\n\cvalue2 = CHAR : 8\n\svalue = STRING : [10] 99999\n\dvalue3 = DOUBLE : 10.01\n\"
 

Functions

void print_test1 (const test1_struct *s)
 
void test1 (HNDLE hDB, HNDLE hKey)
 
void test1a (HNDLE hDB, HNDLE hKey)
 
void test1b (HNDLE hDB, HNDLE hKey)
 
void test1c (HNDLE hDB, HNDLE hKey)
 
void test1d (HNDLE hDB, HNDLE hKey)
 
void print_test2 (const test2_struct *s)
 
void test2 (HNDLE hDB, HNDLE hKey)
 
void test2b (HNDLE hDB, HNDLE hKey)
 
void test2d (HNDLE hDB, HNDLE hKey)
 
int main (int argc, char *argv[])
 

Macro Definition Documentation

◆ test1_STR

#define test1_STR   "\ivalue = INT : 1\n\iarray = INT[2] : \n\[0] 1\n\[1] 2\n\svalue = STRING : [20] /Runinfo/Run number\n\sarray = STRING[2] : \n\[32] str1\n\[32] str2\n\"

Definition at line 28 of file get_record_test.cxx.

◆ test2_STR

#define test2_STR   "\wvalue = WORD : 1\n\dwvalue = DWORD : 2\n\dvalue = DOUBLE : 3.3\n\cvalue = CHAR : 4\n\dwvalue2 = DWORD : 5\n\fvalue = FLOAT : 6.6\n\dvalue2 = DOUBLE : 7.7\n\cvalue2 = CHAR : 8\n\svalue = STRING : [10] 99999\n\dvalue3 = DOUBLE : 10.01\n\"

Definition at line 134 of file get_record_test.cxx.

Function Documentation

◆ main()

int main ( int  argc,
char argv[] 
)

Definition at line 197 of file get_record_test.cxx.

198{
199 int status = 0;
200 HNDLE hDB;
201 char host_name[256];
202 char expt_name[256];
203 host_name[0] = 0;
204 expt_name[0] = 0;
205
207
209 assert(status == CM_SUCCESS);
210
212 assert(status == CM_SUCCESS);
213
214 HNDLE hKey = 0;
215
216 test1(hDB, hKey);
217 //test1a(hDB, hKey);
218 //test1b(hDB, hKey);
219 test1b(hDB, hKey);
220 test1d(hDB, hKey);
221
222 test2(hDB, hKey);
223 test2b(hDB, hKey);
224 test2d(hDB, hKey);
225
227 assert(status == CM_SUCCESS);
228
229 return 0;
230}
void test1(HNDLE hDB, HNDLE hKey)
void test2(HNDLE hDB, HNDLE hKey)
void test2b(HNDLE hDB, HNDLE hKey)
void test1d(HNDLE hDB, HNDLE hKey)
void test2d(HNDLE hDB, HNDLE hKey)
void test1b(HNDLE hDB, HNDLE hKey)
INT cm_get_experiment_database(HNDLE *hDB, HNDLE *hKeyClient)
Definition midas.cxx:3011
INT cm_connect_experiment1(const char *host_name, const char *default_exp_name, const char *client_name, void(*func)(char *), INT odb_size, DWORD watchdog_timeout)
Definition midas.cxx:2297
INT cm_disconnect_experiment(void)
Definition midas.cxx:2846
INT cm_get_environment(char *host_name, int host_name_size, char *exp_name, int exp_name_size)
Definition midas.cxx:2134
#define CM_SUCCESS
Definition midas.h:582
HNDLE hKey
HNDLE hDB
main ODB handle
Definition mana.cxx:207
char host_name[HOST_NAME_LENGTH]
Definition mana.cxx:242
char expt_name[NAME_LENGTH]
Definition mevb.cxx:44
INT HNDLE
Definition midas.h:132
#define DEFAULT_ODB_SIZE
Definition midas.h:270
DWORD status
Definition odbhist.cxx:39
TH1X EXPRT * h1_book(const char *name, const char *title, int bins, double min, double max)
Definition rmidas.h:24
Here is the call graph for this function:

◆ print_test1()

void print_test1 ( const test1_struct s)

Definition at line 23 of file get_record_test.cxx.

24{
25 printf("test1_struct: ivalue %d, iarray %d %d, svalue [%s], sarray [%s] [%s]\n", s->ivalue, s->iarray[0], s->iarray[1], s->svalue, s->sarray[0], s->sarray[1]);
26}
char sarray[2][32]
Here is the call graph for this function:
Here is the caller graph for this function:

◆ print_test2()

void print_test2 ( const test2_struct s)

Definition at line 129 of file get_record_test.cxx.

130{
131 printf("test2_struct: wvalue %d, dwvalue %d, dvalue %f, cvalue %d, dwvalue2 %d, fvalue %f, dvalue2 %f, cvalue2 %d, svalue [%s], dvalue3 %f\n", s->wvalue, s->dwvalue, s->dvalue, s->cvalue, s->dwvalue2, s->fvalue, s->dvalue2, s->cvalue2, s->svalue, s->dvalue3);
132}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test1()

void test1 ( HNDLE  hDB,
HNDLE  hKey 
)

Definition at line 39 of file get_record_test.cxx.

40{
41 int status;
42 printf("test1!\n");
43
44 HNDLE hh;
45 db_find_key(hDB, hKey, "test1", &hh);
46 if (hh) {
47 printf("already exists, skipping!\n");
48 return;
49 }
50 printf("create test1\n");
52 printf("db_create_record status %d\n", status);
53}
#define test1_STR
INT db_find_key(HNDLE hDB, HNDLE hKey, const char *key_name, HNDLE *subhKey)
Definition odb.cxx:4079
INT db_create_record(HNDLE hDB, HNDLE hKey, const char *orig_key_name, const char *init_str)
Definition odb.cxx:12800
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test1a()

void test1a ( HNDLE  hDB,
HNDLE  hKey 
)

Definition at line 55 of file get_record_test.cxx.

56{
57 int status;
58 printf("test1a!\n");
59
60 printf("check test1\n");
62 printf("db_check_record status %d\n", status);
63}
INT db_check_record(HNDLE hDB, HNDLE hKey, const char *keyname, const char *rec_str, BOOL correct)
Definition odb.cxx:12972
#define TRUE
Definition midas.h:182
Here is the call graph for this function:

◆ test1b()

void test1b ( HNDLE  hDB,
HNDLE  hKey 
)

Definition at line 65 of file get_record_test.cxx.

66{
67 int status;
68 printf("test1b!\n");
69
71
72 HNDLE hh;
73 db_find_key(hDB, hKey, "test1", &hh);
74
75 printf("get test1\n");
76 int size = sizeof(s);
77 status = db_get_record(hDB, hh, &s, &size, 0);
78 printf("db_get_record status %d, size %d/%d\n", status, (int)sizeof(s), size);
79 print_test1(&s);
80}
void print_test1(const test1_struct *s)
INT db_get_record(HNDLE hDB, HNDLE hKey, void *data, INT *buf_size, INT align)
Definition odb.cxx:11709
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test1c()

void test1c ( HNDLE  hDB,
HNDLE  hKey 
)

Definition at line 82 of file get_record_test.cxx.

83{
84 int status;
85 printf("test1c - db_get_record1!\n");
86
88
89 HNDLE hh;
90 db_find_key(hDB, hKey, "test1", &hh);
91
92 printf("get test1\n");
93 int size = sizeof(s);
94 status = db_get_record1(hDB, hh, &s, &size, 0, test1_STR);
95 printf("db_get_record1 status %d, size %d/%d\n", status, (int)sizeof(s), size);
96 print_test1(&s);
97}
INT db_get_record1(HNDLE hDB, HNDLE hKey, void *data, INT *buf_size, INT align, const char *rec_str)
Definition odb.cxx:11805
Here is the call graph for this function:

◆ test1d()

void test1d ( HNDLE  hDB,
HNDLE  hKey 
)

Definition at line 99 of file get_record_test.cxx.

100{
101 int status;
102 printf("test1d - db_get_record2!\n");
103
104 test1_struct s;
105
106 HNDLE hh;
107 db_find_key(hDB, hKey, "test1", &hh);
108
109 printf("get test1\n");
110 int size = sizeof(s);
111 status = db_get_record2(hDB, hh, &s, &size, 0, test1_STR, 0);
112 printf("db_get_record2 status %d, size %d/%d\n", status, (int)sizeof(s), size);
113 print_test1(&s);
114}
INT db_get_record2(HNDLE hDB, HNDLE hKey, void *data, INT *xbuf_size, INT align, const char *rec_str, BOOL correct)
Definition odb.cxx:12169
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test2()

void test2 ( HNDLE  hDB,
HNDLE  hKey 
)

Definition at line 147 of file get_record_test.cxx.

148{
149 int status;
150 printf("test2!\n");
151
152 HNDLE hh;
153 db_find_key(hDB, hKey, "test2", &hh);
154 if (hh) {
155 printf("already exists, skipping!\n");
156 return;
157 }
158 printf("create test2\n");
160 printf("db_create_record status %d\n", status);
161}
#define test2_STR
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test2b()

void test2b ( HNDLE  hDB,
HNDLE  hKey 
)

Definition at line 163 of file get_record_test.cxx.

164{
165 int status;
166 printf("test2b!\n");
167
168 test2_struct s;
169
170 HNDLE hh;
171 db_find_key(hDB, hKey, "test2", &hh);
172
173 printf("get test2\n");
174 int size = sizeof(s);
175 status = db_get_record(hDB, hh, &s, &size, 0);
176 printf("db_get_record status %d, size %d/%d\n", status, (int)sizeof(s), size);
177 print_test2(&s);
178}
void print_test2(const test2_struct *s)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test2d()

void test2d ( HNDLE  hDB,
HNDLE  hKey 
)

Definition at line 180 of file get_record_test.cxx.

181{
182 int status;
183 printf("test2d - db_get_record2!\n");
184
185 test2_struct s;
186
187 HNDLE hh;
188 db_find_key(hDB, hKey, "test2", &hh);
189
190 printf("get test2\n");
191 int size = sizeof(s);
192 status = db_get_record2(hDB, hh, &s, &size, 0, test2_STR, 0);
193 printf("db_get_record2 status %d, size %d/%d\n", status, (int)sizeof(s), size);
194 print_test2(&s);
195}
Here is the call graph for this function:
Here is the caller graph for this function: