ROOTANA
Loading...
Searching...
No Matches
test_mvodb.cxx
Go to the documentation of this file.
1//
2// test_mvodb.cxx --- test ODB access functions
3//
4// K.Olchanski
5//
6
7#include <stdio.h>
8#include <sys/time.h>
9#include <iostream>
10#include <assert.h>
11#include <signal.h>
12#include <string.h>
13#include <stdlib.h> // exit()
14
15#ifdef HAVE_MIDAS
16#include "TMidasOnline.h"
17#endif
18#include "midasio.h"
19#include "TMidasEvent.h"
20#include "mvodb.h"
21
22std::string toString(int i)
23{
24 char buf[256];
25 sprintf(buf, "%d", i);
26 return buf;
27}
28
29void print_ia(const std::vector<int> &ia)
30{
31 int size = ia.size();
32 printf("int[%d] has [", size);
33 for (int i=0; i<size; i++) {
34 if (i>0)
35 printf(", ");
36 printf("%d", ia[i]);
37 }
38 printf("]");
39}
40
41void print_da(const std::vector<double> &da)
42{
43 int size = da.size();
44 printf("int[%d] has [", size);
45 for (int i=0; i<size; i++) {
46 if (i>0)
47 printf(", ");
48 printf("%f", da[i]);
49 }
50 printf("]");
51}
52
53static int gCountFail = 0;
54
55void report_fail(const char* text)
56{
57 printf("FAIL: %s\n", text);
58 gCountFail++;
59}
60
61// Main function call
62
63int main(int argc, char *argv[])
64{
65 setbuf(stdout,NULL);
66 setbuf(stderr,NULL);
67
68 signal(SIGILL, SIG_DFL);
69 signal(SIGBUS, SIG_DFL);
70 signal(SIGSEGV, SIG_DFL);
71 signal(SIGPIPE, SIG_DFL);
72
73#ifdef HAVE_MIDAS
74 const char* hostname = NULL;
75 const char* exptname = NULL;
76#endif
77 const char* filename = argv[1];
78 bool online = false;
79 bool xmlfile = false;
80 bool jsonfile = false;
81 bool nullodb = false;
82
83 if (!filename)
84 online = true;
85 else if (strstr(filename, ".xml")!=0)
86 xmlfile = true;
87 else if (strstr(filename, ".json")!=0)
88 jsonfile = true;
89 else if (strstr(filename, "null")!=0)
90 nullodb = true;
91 else
92 nullodb = true;
93
94#ifdef HAVE_MIDAS
95 TMidasOnline *midas = NULL;
96#endif
97
98 MVOdb* odb = NULL;
99 MVOdbError odberror;
100
101 if (nullodb)
102 {
103 printf("Using NullOdb\n");
104 odb = MakeNullOdb();
105 }
106 else if (online)
107 {
108#ifdef HAVE_MIDAS
109 printf("Using MidasOdb\n");
110 midas = TMidasOnline::instance();
111
112 int err = midas->connect(hostname, exptname, "test_mvodb");
113 if (err != 0)
114 {
115 fprintf(stderr,"Cannot connect to MIDAS, error %d\n", err);
116 return -1;
117 }
118
119 odb = MakeMidasOdb(midas->fDB, &odberror);
120#else
121 printf("Using MidasOdb: MIDAS support not available, sorry.\n");
122 exit(1);
123#endif
124 }
125 else if (xmlfile)
126 {
127 printf("Using XmlOdb\n");
128 odb = MakeXmlFileOdb(filename, &odberror);
129 }
130 else if (jsonfile)
131 {
132 printf("Using JsonOdb\n");
133 odb = MakeJsonFileOdb(filename, &odberror);
134 }
135 else
136 {
137 printf("Using FileDumpOdb\n");
138 TMReaderInterface* reader = TMNewReader(filename);
139
140 if (reader->fError) {
141 printf("Cannot open input file \"%s\"\n",filename);
142 delete reader;
143 return -1;
144 }
145
146 while (1) {
147 TMidasEvent event;
148 if (!TMReadEvent(reader, &event))
149 break;
150
151 int eventId = event.GetEventId();
152 //printf("Have an event of type %d\n",eventId);
153
154 if ((eventId & 0xFFFF) != 0x8000)
155 continue;
156
157 // begin run
158 //event.Print();
159
160 odb = MakeFileDumpOdb(event.GetData(),event.GetDataSize(), &odberror);
161 break;
162 }
163
164 reader->Close();
165 delete reader;
166
167 if (!odb) {
168 printf("Failed to load ODB from input file \"%s\"\n",filename);
169 return -1;
170 }
171 }
172
173 if (odberror.fError) {
174 fprintf(stderr, "Cannot make MVOdb object, error: %s\n", odberror.fErrorString.c_str());
175 exit(1);
176 }
177
178 printf("\n");
179 printf("Starting tests:\n");
180 printf("\n");
181
182 int runno = 1234;
183
184 odb->RI("runinfo/run number", &runno);
185
186 printf("read run number (RI): %d\n", runno);
187
188 MVOdb* test = odb->Chdir("test_mvodb", true);
189
190 assert(test != NULL);
191
192 test->SetPrintError(true);
193
194 bool isreadonly = test->IsReadOnly();
195
196 if (isreadonly) {
197 printf("\n");
198 printf("This ODB is read-only!\n");
199 }
200
201 printf("\n");
202 printf("Test create-and-read of all data types (set default values):\n");
203 printf("\n");
204
205 int cycle = 1;
206 test->RI("cycle", &cycle, true);
207 printf("RI() cycle: %d\n", cycle);
208
209 int ivalue = 1;
210 test->RI("int", &ivalue, true);
211 printf("RI() int: %d\n", ivalue);
212
213 float fvalue = 2.2;
214 test->RF("float", &fvalue, true);
215 printf("RF() float: %f\n", fvalue);
216
217 double dvalue = 3.3;
218 test->RD("double", &dvalue, true);
219 printf("RD() double: %f\n", dvalue);
220
221 bool bvalue_a = false;
222 test->RB("bool_a", &bvalue_a, true);
223 printf("bool_a: %d\n", bvalue_a);
224
225 bool bvalue_b = true;
226 test->RB("bool_b", &bvalue_b, true);
227 printf("bool_b: %d\n", bvalue_b);
228
229 uint16_t u16value = 0xabcd;
230 test->RU16("u16", &u16value, true);
231 printf("RU16() u16: 0x%04x\n", u16value);
232
233 uint32_t u32value = 0x12345678;
234 test->RU32("u32", &u32value, true);
235 printf("RU32() u32: 0x%08x\n", u32value);
236
237 std::string svalue = "test string";
238 test->RS("string", &svalue, true);
239 printf("RS() string: \"%s\"\n", svalue.c_str());
240
241 printf("\n");
242 printf("Test write of all data types (overwrite default values):\n");
243 printf("\n");
244
245 test->WI("cycle", cycle+1);
246
247 int wi = 10 + 100*cycle;
248 test->WI("int", wi);
249 float wf = 11.1 + 100*cycle;
250 test->WF("float", wf);
251 double wd = 22.2 + 100*cycle;
252 test->WD("double", wd);
253 bool wba = true;
254 test->WB("bool_a", wba);
255 bool wbb = false;
256 test->WB("bool_b", wbb);
257 uint16_t wu16 = 0xcdef;
258 test->WU16("u16", wu16);
259 uint32_t wu32 = 0xdeadf00d;
260 test->WU32("u32", wu32);
261 std::string ws = "write test string cycle " + toString(cycle);
262 test->WS("string", ws.c_str());
263
264 printf("\n");
265 printf("Test read of new values for all data types:\n");
266 printf("\n");
267
268 int ri = 1;
269 test->RI("int", &ri);
270 printf("int: %d -> %d -> %d\n", ivalue, wi, ri);
271
272 float rf = 2.2;
273 test->RF("float", &rf);
274 printf("float: %f -> %f -> %f\n", fvalue, wf, rf);
275
276 double rd = 3.3;
277 test->RD("double", &rd);
278 printf("double: %f -> %f -> %f\n", dvalue, wd, rd);
279
280 bool rba = false;
281 test->RB("bool_a", &rba);
282 printf("bool_a: %d -> %d -> %d\n", bvalue_a, wba, rba);
283
284 bool rbb = false;
285 test->RB("bool_b", &rbb);
286 printf("bool_b: %d -> %d -> %d\n", bvalue_b, wbb, rbb);
287
288 uint16_t ru16 = 0x4444;
289 test->RU16("u16", &ru16);
290 printf("u16: 0x%04x -> 0x%04x -> 0x%04x\n", u16value, wu16, ru16);
291
292 uint32_t ru32 = 0x55555555;
293 test->RU32("u32", &ru32);
294 printf("u32: 0x%08x -> 0x%08x -> 0x%08x\n", u32value, wu32, ru32);
295
296 std::string rs = "rs";
297 test->RS("string", &rs);
298 printf("string: \"%s\" -> \"%s\" -> \"%s\"\n", svalue.c_str(), ws.c_str(), rs.c_str());
299
300 printf("\n");
301 printf("Test read arrays of all data types:\n");
302 printf("\n");
303
304 {
305 printf("read int array ia:\n");
306 std::vector<int> ia;
307 ia.push_back(1);
308 ia.push_back(2);
309 ia.push_back(3);
310 test->RIA("ia", &ia, true);
311 printf("RIA() returned: ");
312 print_ia(ia);
313 printf("\n");
314 }
315
316 {
317 printf("read non-existant array ia-noexist:\n");
318 std::vector<int> ia;
319 ia.push_back(1);
320 ia.push_back(2);
321 ia.push_back(3);
322 test->RIA("ia-noexist", &ia);
323 printf("RIA() returned: ");
324 print_ia(ia);
325 printf("\n");
326 }
327
328 {
329 // create 10 element array, init to zero (ia is empty)
330 std::vector<int> ia;
331 test->RIA("ia10zero", &ia, true, 10);
332 // create 10 element array, init from ia
333 ia.clear();
334 ia.push_back(11);
335 ia.push_back(22);
336 test->RIA("ia10", &ia, true, 10);
337 }
338
339 {
340 // create 10 element array, init to zero (passed NULL instead of &ia)
341 test->RIA("createia10", NULL, true, 10);
342 }
343
344 {
345 std::vector<uint32_t> u32a;
346 u32a.push_back(0x11110000);
347 u32a.push_back(0x22220000);
348 u32a.push_back(0x33330000);
349 u32a.push_back(0x44440000);
350 test->RU32A("dwa", &u32a, true);
351 }
352
353 {
354 std::vector<double> da;
355 da.push_back(1.1);
356 da.push_back(1.2);
357 da.push_back(1.3);
358 da.push_back(1.4);
359 test->RDA("da", &da, true, 0);
360 }
361
362 {
363 std::vector<float> fa;
364 fa.push_back(2.1);
365 fa.push_back(2.2);
366 fa.push_back(2.3);
367 fa.push_back(20.3);
368 fa.push_back(21.3);
369 test->RFA("fa", &fa, true, 0);
370 }
371
372 {
373 std::vector<bool> ba;
374 ba.push_back(true);
375 ba.push_back(false);
376 ba.push_back(true);
377 test->RBA("ba", &ba, true, 0);
378 }
379
380 {
381 std::vector<std::string> sa;
382 sa.push_back("line1");
383 sa.push_back("line2");
384 sa.push_back("line3");
385 sa.push_back("line4");
386 test->RSA("sa", &sa, true, 0, 32);
387
388 // create 10 element array, init from ia
389 sa.clear();
390 sa.push_back("xx1");
391 sa.push_back("xx2");
392 test->RSA("sa10", &sa, true, 10, 32);
393 // create 10 element array, init to zero (passed NULL instead of &sa)
394 test->RSA("createsa10", NULL, true, 10, 32);
395 }
396
397 printf("\n");
398 printf("Test string sizes:\n");
399 printf("\n");
400
401 {
402 test->WS("test_size", "12345");
403 std::string s;
404 test->RS("test_size", &s);
405 printf("read test_size [%s]\n", s.c_str());
406 }
407 {
408 test->WS("test_size_32", "1234567890", 32);
409 std::string s;
410 test->RS("test_size_32", &s);
411 printf("read test_size_32 [%s]\n", s.c_str());
412 }
413 {
414 test->WS("test_size_5", "1234567890", 5);
415 std::string s;
416 test->RS("test_size_5", &s);
417 printf("read test_size_5 [%s]\n", s.c_str());
418 }
419 {
420 std::string s = "1234567890";
421 test->RS("test_rsize", &s, true);
422 printf("read test_rsize [%s]\n", s.c_str());
423 }
424 {
425 std::string s = "123456";
426 test->RS("test_size_r32", &s, true, 32);
427 printf("read test_size_r32 [%s]\n", s.c_str());
428 }
429 {
430 std::string s = "1234567890";
431 test->RS("test_size_r8", &s, true, 8);
432 printf("read test_size_r8 [%s]\n", s.c_str());
433 }
434 {
435 test->RSA("test_size_a8", NULL, true, 2, 8);
436 std::string s = "1234567890";
437 test->WSAI("test_size_a8", 0, s.c_str());
438 test->RSAI("test_size_a8", 0, &s);
439 printf("read test_size_a8 [%s]\n", s.c_str());
440 }
441
442 printf("\n");
443 printf("Test creating and resizing arrays:\n");
444 printf("\n");
445
446 {
447 test->RIA("create_ia15", NULL, true, 15);
448 test->RBA("create_ba12", NULL, true, 12);
449 test->RSA("create_sa5", NULL, true, 5, 32);
450 }
451 {
452 test->RIA("resize_ia10", NULL, true, 5);
453 test->RIA("resize_ia10", NULL, true, 10);
454 test->RSA("resize_sa3", NULL, true, 5, 32);
455 test->WSAI("resize_sa3", 0, "00000000");
456 test->WSAI("resize_sa3", 1, "11111111");
457 test->WSAI("resize_sa3", 2, "22222222");
458 test->WSAI("resize_sa3", 3, "33333333");
459 test->WSAI("resize_sa3", 4, "44444444");
460 test->RSA("resize_sa3", NULL, true, 3, 5);
461 }
462
463 printf("\n");
464 printf("Test array index access:\n");
465 printf("\n");
466
467 {
468 std::vector<int> ia;
469 ia.push_back(10);
470 ia.push_back(11);
471 ia.push_back(12);
472 test->WIA("index_ia", ia);
473 for (int i=0; i<5; i++) {
474 int ivalue = 999;
475 test->RIAI("index_ia", i, &ivalue);
476 printf("index %d value %d\n", i, ivalue);
477 }
478 for (int i=0; i<4; i++) {
479 int ivalue = 20+i;
480 test->WIAI("index_ia", i, ivalue);
481 }
482 for (int i=0; i<5; i++) {
483 int ivalue = 999;
484 test->RIAI("index_ia", i, &ivalue);
485 printf("index %d value %d\n", i, ivalue);
486 }
487 }
488
489 printf("\n");
490 printf("Test string array index access:\n");
491 printf("\n");
492
493 {
494 std::vector<std::string> sa;
495 sa.push_back("sa0");
496 sa.push_back("sa1");
497 sa.push_back("sa2");
498 test->WSA("index_sa", sa, 32);
499 for (int i=0; i<5; i++) {
500 std::string s = "aaa";
501 test->RSAI("index_sa", i, &s);
502 printf("index %d value [%s]\n", i, s.c_str());
503 }
504 for (int i=0; i<4; i++) {
505 std::string s = "sa_qqq";
506 s += toString(i);
507 test->WSAI("index_sa", i, s.c_str());
508 }
509 for (int i=0; i<5; i++) {
510 std::string s = "bbb";
511 test->RSAI("index_sa", i, &s);
512 printf("index %d value [%s]\n", i, s.c_str());
513 }
514 }
515
516 printf("\n");
517 printf("Test string truncation:\n");
518 printf("\n");
519
520 {
521 std::vector<std::string> sa;
522 sa.push_back("1234567890");
523 sa.push_back("aaa1");
524 sa.push_back("aaa2");
525 test->WSA("trunc_sa5", sa, 5);
526 test->WSAI("trunc_sa5", 1, "1234567890");
527 for (int i=0; i<5; i++) {
528 std::string s = "bbb";
529 test->RSAI("trunc_sa5", i, &s);
530 printf("index %d value [%s]\n", i, s.c_str());
531 }
532 }
533
534 printf("\n");
535 printf("Test against subdirectory:\n");
536 printf("\n");
537
538 {
539 printf("Creating subdir\n");
540 MVOdb* subdir = test->Chdir("subdir", true);
541 printf("Creating subdir/i\n");
542 subdir->WI("i", 10); // write something into subdir
543 int i = 1111;
544 printf("RI(subdir)\n");
545 test->RI("subdir", &i); // invalid read from a non-int
546 printf("WI(subdir)\n");
547 test->WI("subdir", 10); // invalid write into existing subdir
548 std::vector<int> ia;
549 ia.push_back(111);
550 ia.push_back(222);
551 ia.push_back(333);
552 printf("WIA(subdir)\n");
553 test->WIA("subdir", ia); // invalid write into existing subdir
554 printf("RIA(subdir)\n");
555 test->RIA("subdir", &ia); // invalid read from non-int-array
556 printf("RIA() returned: ");
557 print_ia(ia);
558 printf("\n");
559 printf("RIA(subdir, create=true)\n");
560 test->RIA("subdir", &ia, true); // invalid read from non-int-array
561 printf("RIA() returned: ");
562 print_ia(ia);
563 printf("\n");
564 }
565
566 printf("\n");
567 printf("Test special cases:\n");
568 printf("\n");
569
570 {
571 printf("test RI() of non existant variable:\n");
572 int ivalue = 999;
573 test->RI("nonexistant", &ivalue);
574 printf("RI() returned ivalue %d\n", ivalue);
575 printf("\n");
576
577 {
578 std::vector<double> da;
579 printf("test RDA() of integer array:\n");
580 // wrong data type: ODB is INT, we ask for DOUBLE
581 test->RDA("ia10", &da, false, 0);
582 printf("RDA() returned: ");
583 print_da(da);
584 printf("\n");
585 }
586
587 {
588 printf("test RD() of integer array:\n");
589 // wrong data type: ODB is INT, we ask for DOUBLE
590 double v = 999.9;
591 test->RD("ia10", &v);
592 printf("RD() returned %f\n", v);
593 printf("\n");
594 }
595
596 {
597 printf("test RI() of array ia10:\n");
598 int ivalue = 999;
599 test->RI("ia10", &ivalue);
600 printf("RI() returned ivalue %d\n", ivalue);
601 printf("\n");
602 }
603
604 {
605 printf("test RIA() of non-array int:\n");
606 std::vector<int> ia;
607 test->RIA("int", &ia);
608 printf("RIA() returned: ");
609 print_ia(ia);
610 printf("\n");
611 }
612
613 {
614 printf("test index 0 of non-array int:\n");
615 int ivalue = 999;
616 test->RIAI("int", 0, &ivalue);
617 printf("RIAI() returned ivalue %d\n", ivalue);
618 printf("\n");
619 }
620
621 {
622 printf("test index of non-array int:\n");
623 int ivalue = 999;
624 test->RIAI("int", 10, &ivalue);
625 printf("RIAI() returned ivalue %d\n", ivalue);
626 printf("\n");
627 }
628
629 {
630 printf("test invalid index -1 of array ia10:\n");
631 int ivalue = 999;
632 test->RIAI("ia10", -1, &ivalue);
633 printf("RIAI() returned ivalue %d\n", ivalue);
634 printf("\n");
635 }
636
637 {
638 printf("test invalid index 999 of array ia10:\n");
639 int ivalue = 999;
640 test->RIAI("ia10", 999, &ivalue);
641 printf("RIAI() returned ivalue %d\n", ivalue);
642 printf("\n");
643 }
644
645 printf("test string array invalid index -1:\n");
646 svalue = "aaa";
647 test->RSAI("sa10", -1, &svalue);
648 printf("RSAI() returned [%s]\n", svalue.c_str());
649 printf("\n");
650
651 printf("test string array invalid index 999:\n");
652 svalue = "aaa";
653 test->RSAI("sa10", 999, &svalue);
654 printf("RSAI() returned [%s]\n", svalue.c_str());
655 printf("\n");
656
657 printf("test write invalid index -1:\n");
658 test->WIAI("ia10", -1, 10);
659 printf("\n");
660
661 printf("test string write invalid index -1:\n");
662 test->WSAI("sa10", -1, "aaa");
663 printf("\n");
664
665 printf("\n");
666 printf("Test Chdir():\n");
667 printf("\n");
668
669 {
670 printf("test Chdir(true):\n");
671 MVOdb* dir = test->Chdir("test_subdir", true);
672 printf("Chdir() returned %p\n", dir);
673 if (dir == NULL) report_fail("Chdir(new directory, true)");
674 }
675
676 {
677 printf("test Chdir(false):\n");
678 MVOdb* dir = test->Chdir("non-existant-subdir", false);
679 printf("Chdir() returned %p\n", dir);
680 if (dir != NULL) report_fail("Chdir(new directory, false)");
681 }
682
683 {
684 printf("test Chdir(\"not a dir\", true):\n");
685 MVOdb* dir = test->Chdir("ia10", true);
686 printf("Chdir() returned %p\n", dir);
687 if (dir == NULL) report_fail("Chdir(not a directory, true)");
688 }
689
690 {
691 printf("test Chdir(\"not a dir\", false):\n");
692 MVOdb* dir = test->Chdir("ia10", false);
693 printf(" returned %p\n", dir);
694 if (dir != NULL) report_fail("Chdir(not a directory, false)");
695 }
696 }
697
698#ifdef HAVE_MIDAS
699 if (midas)
700 midas->disconnect();
701#endif
702
703 printf("\n");
704 printf("Number of FAILED tests: %d\n", gCountFail);
705 printf("\n");
706
707 return 0;
708}
709
710//end
711/* emacs
712 * Local Variables:
713 * tab-width: 8
714 * c-basic-offset: 3
715 * indent-tabs-mode: nil
716 * End:
717 */
bool fError
Definition mvodb.h:190
std::string fErrorString
Definition mvodb.h:191
Definition mvodb.h:21
virtual void WI(const char *varname, int v, MVOdbError *error=NULL)=0
virtual void RIA(const char *varname, std::vector< int > *value, bool create=false, int create_size=0, MVOdbError *error=NULL)=0
virtual void WSAI(const char *varname, int index, const char *v, MVOdbError *error=NULL)=0
virtual void WIAI(const char *varname, int index, int v, MVOdbError *error=NULL)=0
virtual void WU16(const char *varname, uint16_t v, MVOdbError *error=NULL)=0
virtual void RS(const char *varname, std::string *value, bool create=false, int create_string_length=0, MVOdbError *error=NULL)=0
virtual MVOdb * Chdir(const char *subdirname, bool create=false, MVOdbError *error=NULL)=0
virtual void WF(const char *varname, float v, MVOdbError *error=NULL)=0
virtual void RU32(const char *varname, uint32_t *value, bool create=false, MVOdbError *error=NULL)=0
virtual void WSA(const char *varname, const std::vector< std::string > &v, int string_length, MVOdbError *error=NULL)=0
virtual void WU32(const char *varname, uint32_t v, MVOdbError *error=NULL)=0
virtual void RU16(const char *varname, uint16_t *value, bool create=false, MVOdbError *error=NULL)=0
virtual bool IsReadOnly() const =0
virtual void RBA(const char *varname, std::vector< bool > *value, bool create=false, int create_size=0, MVOdbError *error=NULL)=0
virtual void RSAI(const char *varname, int index, std::string *value, MVOdbError *error=NULL)=0
virtual void SetPrintError(bool v)=0
virtual void WIA(const char *varname, const std::vector< int > &v, MVOdbError *error=NULL)=0
virtual void RIAI(const char *varname, int index, int *value, MVOdbError *error=NULL)=0
virtual void WD(const char *varname, double v, MVOdbError *error=NULL)=0
virtual void RSA(const char *varname, std::vector< std::string > *value, bool create=false, int create_size=0, int create_string_length=0, MVOdbError *error=NULL)=0
virtual void RI(const char *varname, int *value, bool create=false, MVOdbError *error=NULL)=0
virtual void RB(const char *varname, bool *value, bool create=false, MVOdbError *error=NULL)=0
virtual void RDA(const char *varname, std::vector< double > *value, bool create=false, int create_size=0, MVOdbError *error=NULL)=0
virtual void WS(const char *varname, const char *v, int string_length=0, MVOdbError *error=NULL)=0
virtual void RF(const char *varname, float *value, bool create=false, MVOdbError *error=NULL)=0
virtual void RFA(const char *varname, std::vector< float > *value, bool create=false, int create_size=0, MVOdbError *error=NULL)=0
virtual void RD(const char *varname, double *value, bool create=false, MVOdbError *error=NULL)=0
virtual void WB(const char *varname, bool v, MVOdbError *error=NULL)=0
virtual void RU32A(const char *varname, std::vector< uint32_t > *value, bool create=false, int create_size=0, MVOdbError *error=NULL)=0
virtual int Close()=0
MIDAS event.
Definition TMidasEvent.h:22
uint32_t GetDataSize() const
return the event size
uint16_t GetEventId() const
return the event id
char * GetData()
return pointer to the data buffer
int disconnect()
Disconnect from MIDAS.
static TMidasOnline * instance()
int connect(const char *hostname, const char *exptname, const char *progname)
Connect to MIDAS experiment.
HNDLE fDB
ODB handle.
TMEvent * TMReadEvent(TMReaderInterface *reader)
Definition midasio.cxx:585
TMReaderInterface * TMNewReader(const char *source)
Definition midasio.cxx:447
MVOdb * MakeMidasOdb(int hDB, MVOdbError *error=NULL)
Definition midasodb.cxx:924
MVOdb * MakeFileDumpOdb(const char *buf, int bufsize, MVOdbError *error=NULL)
Access ODB from a midas file dump. FOrmat could be .xml, .json or .odb.
Definition mvodb.cxx:91
MVOdb * MakeNullOdb()
Definition nullodb.cxx:129
MVOdb * MakeXmlFileOdb(const char *filename, MVOdbError *error=NULL)
Definition mxmlodb.cxx:689
MVOdb * MakeJsonFileOdb(const char *filename, MVOdbError *error=NULL)
Definition mjsonodb.cxx:536
void print_da(const std::vector< double > &da)
int main(int argc, char *argv[])
static int gCountFail
void report_fail(const char *text)
void print_ia(const std::vector< int > &ia)
std::string toString(int i)