ROOTANA
nullodb.cxx
Go to the documentation of this file.
1 /********************************************************************\
2 
3  Name: nullodb.cxx
4  Created by: K.Olchanski
5 
6  Contents: NULL implementation of MVOdb ODB interface
7 
8  Discussion: Writing to NULL ODB has no effect, reading from NULL ODB leaves the default values unchanged
9 
10 \********************************************************************/
11 
12 //#include <stdio.h>
13 //#include <string.h> // strlen()
14 //#include <assert.h>
15 //#include <stdlib.h> // malloc()
16 
17 #include "mvodb.h"
18 
19 class NullOdb: public MVOdb
20 {
21 public:
23 
24  NullOdb() // ctor
25  {
26  fPrintError = true;
27  }
28 
29  void SetPrintError(bool v)
30  {
31  fPrintError = true;
32  }
33 
34  bool GetPrintError() const
35  {
36  return fPrintError;
37  }
38 
39  bool IsReadOnly() const
40  {
41  return true;
42  }
43 
44  MVOdb* Chdir(const char* subdir, bool create, MVOdbError* error)
45  {
46  SetOk(error);
47  if (create)
48  return new NullOdb;
49  else
50  return NULL;
51  }
52 
53  //void RAInfo(const char* varname, int* num_elements, int* element_size, MVOdbError* error)
54  //{
55  // SetOk(error);
56  //};
57 
58  void ReadKey(const char* varname, int *tid, int *num_values, int *total_size, int *item_size, MVOdbError* error)
59  {
60  if (tid) *tid = 0;
61  if (num_values) *num_values = 0;
62  if (total_size) *total_size = 0;
63  if (item_size) *item_size = 0;
64  SetOk(error);
65  }
66 
67  void ReadDir(std::vector<std::string>* varname, std::vector<int> *tid, std::vector<int> *num_values, std::vector<int> *total_size, std::vector<int> *item_size, MVOdbError* error)
68  {
69  SetOk(error);
70  }
71 
72  void RB(const char* varname, bool *value, bool create, MVOdbError* error) { SetOk(error); };
73  void RI(const char* varname, int *value, bool create, MVOdbError* error) { SetOk(error); };
74  void RD(const char* varname, double *value, bool create, MVOdbError* error) { SetOk(error); };
75  void RF(const char* varname, float *value, bool create, MVOdbError* error) { SetOk(error); };
76  void RS(const char* varname, std::string *value, bool create, int create_string_length, MVOdbError* error) { SetOk(error); };
77  void RU16(const char* varname, uint16_t *value, bool create, MVOdbError* error) { SetOk(error); };
78  void RU32(const char* varname, uint32_t *value, bool create, MVOdbError* error) { SetOk(error); };
79 
80  void RBA(const char* varname, std::vector<bool> *value, bool create, int create_size, MVOdbError* error) { SetOk(error); };
81  void RIA(const char* varname, std::vector<int> *value, bool create, int create_size, MVOdbError* error) { SetOk(error); };
82  void RDA(const char* varname, std::vector<double> *value, bool create, int create_size, MVOdbError* error) { SetOk(error); };
83  void RFA(const char* varname, std::vector<float> *value, bool create, int create_size, MVOdbError* error) { SetOk(error); };
84  void RSA(const char* varname, std::vector<std::string> *value, bool create, int create_size, int create_string_length, MVOdbError* error) { SetOk(error); };
85  void RU16A(const char* varname, std::vector<uint16_t> *value, bool create, int create_size, MVOdbError* error) { SetOk(error); };
86  void RU32A(const char* varname, std::vector<uint32_t> *value, bool create, int create_size, MVOdbError* error) { SetOk(error); };
87 
88  void RBAI(const char* varname, int index, bool *value, MVOdbError* error) { SetOk(error); };
89  void RIAI(const char* varname, int index, int *value, MVOdbError* error) { SetOk(error); };
90  void RDAI(const char* varname, int index, double *value, MVOdbError* error) { SetOk(error); };
91  void RFAI(const char* varname, int index, float *value, MVOdbError* error) { SetOk(error); };
92  void RSAI(const char* varname, int index, std::string *value, MVOdbError* error) { SetOk(error); };
93  void RU16AI(const char* varname, int index, uint16_t *value, MVOdbError* error) { SetOk(error); };
94  void RU32AI(const char* varname, int index, uint32_t *value, MVOdbError* error) { SetOk(error); };
95 
96  void WB(const char* varname, bool v, MVOdbError* error) { SetOk(error); };
97  void WI(const char* varname, int v, MVOdbError* error) { SetOk(error); };
98  void WD(const char* varname, double v, MVOdbError* error) { SetOk(error); };
99  void WF(const char* varname, float v, MVOdbError* error) { SetOk(error); };
100  void WS(const char* varname, const char* v, int string_length, MVOdbError* error) { SetOk(error); };
101  void WU16(const char* varname, uint16_t v, MVOdbError* error) { SetOk(error); };
102  void WU32(const char* varname, uint32_t v, MVOdbError* error) { SetOk(error); };
103 
104  void WBA(const char* varname, const std::vector<bool>& v, MVOdbError* error) { SetOk(error); };
105  void WIA(const char* varname, const std::vector<int>& v, MVOdbError* error) { SetOk(error); };
106  void WDA(const char* varname, const std::vector<double>& v, MVOdbError* error) { SetOk(error); };
107  void WFA(const char* varname, const std::vector<float>& v, MVOdbError* error) { SetOk(error); };
108  void WSA(const char* varname, const std::vector<std::string>& data, int odb_string_length, MVOdbError* error) { SetOk(error); };
109  void WU16A(const char* varname, const std::vector<uint16_t>& v, MVOdbError* error) { SetOk(error); };
110  void WU32A(const char* varname, const std::vector<uint32_t>& v, MVOdbError* error) { SetOk(error); };
111 
112  void WBAI(const char* varname, int index, bool v, MVOdbError* error) { SetOk(error); };
113  void WIAI(const char* varname, int index, int v, MVOdbError* error) { SetOk(error); };
114  void WDAI(const char* varname, int index, double v, MVOdbError* error) { SetOk(error); };
115  void WFAI(const char* varname, int index, float v, MVOdbError* error) { SetOk(error); };
116  void WSAI(const char* varname, int index, const char* v, MVOdbError* error) { SetOk(error); };
117  void WU16AI(const char* varname, int index, uint16_t v, MVOdbError* error) { SetOk(error); };
118  void WU32AI(const char* varname, int index, uint32_t v, MVOdbError* error) { SetOk(error); };
119 
120  void Delete(const char* odbname, MVOdbError* error) { SetOk(error); };
121 };
122 
124 {
125  return new NullOdb();
126 }
127 
128 /* emacs
129  * Local Variables:
130  * tab-width: 8
131  * c-basic-offset: 3
132  * indent-tabs-mode: nil
133  * End:
134  */
Definition: mvodb.h:21
void RFAI(const char *varname, int index, float *value, MVOdbError *error)
Definition: nullodb.cxx:91
void RBA(const char *varname, std::vector< bool > *value, bool create, int create_size, MVOdbError *error)
Definition: nullodb.cxx:80
void RDA(const char *varname, std::vector< double > *value, bool create, int create_size, MVOdbError *error)
Definition: nullodb.cxx:82
void WSA(const char *varname, const std::vector< std::string > &data, int odb_string_length, MVOdbError *error)
Definition: nullodb.cxx:108
void WB(const char *varname, bool v, MVOdbError *error)
Definition: nullodb.cxx:96
bool fPrintError
Definition: nullodb.cxx:22
void RIA(const char *varname, std::vector< int > *value, bool create, int create_size, MVOdbError *error)
Definition: nullodb.cxx:81
void WD(const char *varname, double v, MVOdbError *error)
Definition: nullodb.cxx:98
void ReadDir(std::vector< std::string > *varname, std::vector< int > *tid, std::vector< int > *num_values, std::vector< int > *total_size, std::vector< int > *item_size, MVOdbError *error)
Definition: nullodb.cxx:67
void RU32A(const char *varname, std::vector< uint32_t > *value, bool create, int create_size, MVOdbError *error)
Definition: nullodb.cxx:86
void WF(const char *varname, float v, MVOdbError *error)
Definition: nullodb.cxx:99
void WFAI(const char *varname, int index, float v, MVOdbError *error)
Definition: nullodb.cxx:115
void RD(const char *varname, double *value, bool create, MVOdbError *error)
Definition: nullodb.cxx:74
MVOdb * Chdir(const char *subdir, bool create, MVOdbError *error)
Definition: nullodb.cxx:44
void WSAI(const char *varname, int index, const char *v, MVOdbError *error)
Definition: nullodb.cxx:116
bool GetPrintError() const
Definition: nullodb.cxx:34
void WIA(const char *varname, const std::vector< int > &v, MVOdbError *error)
Definition: nullodb.cxx:105
void RIAI(const char *varname, int index, int *value, MVOdbError *error)
Definition: nullodb.cxx:89
void RSAI(const char *varname, int index, std::string *value, MVOdbError *error)
Definition: nullodb.cxx:92
void RF(const char *varname, float *value, bool create, MVOdbError *error)
Definition: nullodb.cxx:75
void SetPrintError(bool v)
Definition: nullodb.cxx:29
void WDAI(const char *varname, int index, double v, MVOdbError *error)
Definition: nullodb.cxx:114
void RDAI(const char *varname, int index, double *value, MVOdbError *error)
Definition: nullodb.cxx:90
void RS(const char *varname, std::string *value, bool create, int create_string_length, MVOdbError *error)
Definition: nullodb.cxx:76
void WU16A(const char *varname, const std::vector< uint16_t > &v, MVOdbError *error)
Definition: nullodb.cxx:109
void WBAI(const char *varname, int index, bool v, MVOdbError *error)
Definition: nullodb.cxx:112
void WU32(const char *varname, uint32_t v, MVOdbError *error)
Definition: nullodb.cxx:102
void WU16AI(const char *varname, int index, uint16_t v, MVOdbError *error)
Definition: nullodb.cxx:117
void ReadKey(const char *varname, int *tid, int *num_values, int *total_size, int *item_size, MVOdbError *error)
Definition: nullodb.cxx:58
void WU32AI(const char *varname, int index, uint32_t v, MVOdbError *error)
Definition: nullodb.cxx:118
void RU32(const char *varname, uint32_t *value, bool create, MVOdbError *error)
Definition: nullodb.cxx:78
void RBAI(const char *varname, int index, bool *value, MVOdbError *error)
Definition: nullodb.cxx:88
void WS(const char *varname, const char *v, int string_length, MVOdbError *error)
Definition: nullodb.cxx:100
void RI(const char *varname, int *value, bool create, MVOdbError *error)
Definition: nullodb.cxx:73
void WU16(const char *varname, uint16_t v, MVOdbError *error)
Definition: nullodb.cxx:101
bool IsReadOnly() const
Definition: nullodb.cxx:39
void WIAI(const char *varname, int index, int v, MVOdbError *error)
Definition: nullodb.cxx:113
void WDA(const char *varname, const std::vector< double > &v, MVOdbError *error)
Definition: nullodb.cxx:106
void RU32AI(const char *varname, int index, uint32_t *value, MVOdbError *error)
Definition: nullodb.cxx:94
void RU16(const char *varname, uint16_t *value, bool create, MVOdbError *error)
Definition: nullodb.cxx:77
void RB(const char *varname, bool *value, bool create, MVOdbError *error)
Definition: nullodb.cxx:72
void WI(const char *varname, int v, MVOdbError *error)
Definition: nullodb.cxx:97
void Delete(const char *odbname, MVOdbError *error)
Definition: nullodb.cxx:120
void RSA(const char *varname, std::vector< std::string > *value, bool create, int create_size, int create_string_length, MVOdbError *error)
Definition: nullodb.cxx:84
void RFA(const char *varname, std::vector< float > *value, bool create, int create_size, MVOdbError *error)
Definition: nullodb.cxx:83
NullOdb()
Definition: nullodb.cxx:24
void RU16AI(const char *varname, int index, uint16_t *value, MVOdbError *error)
Definition: nullodb.cxx:93
void WBA(const char *varname, const std::vector< bool > &v, MVOdbError *error)
Definition: nullodb.cxx:104
void RU16A(const char *varname, std::vector< uint16_t > *value, bool create, int create_size, MVOdbError *error)
Definition: nullodb.cxx:85
void WU32A(const char *varname, const std::vector< uint32_t > &v, MVOdbError *error)
Definition: nullodb.cxx:110
void WFA(const char *varname, const std::vector< float > &v, MVOdbError *error)
Definition: nullodb.cxx:107
void SetOk(MVOdbError *error)
Definition: mvodb.cxx:31
MVOdb * MakeNullOdb()
Definition: nullodb.cxx:123