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 ReadKeyLastWritten( const char* varname, int *last_written, MVOdbError* error)
68  {
69  if (last_written) *last_written = 0;
70  SetOk(error);
71  }
72 
73  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)
74  {
75  SetOk(error);
76  }
77 
78  void RB(const char* varname, bool *value, bool create, MVOdbError* error) { SetOk(error); };
79  void RI(const char* varname, int *value, bool create, MVOdbError* error) { SetOk(error); };
80  void RD(const char* varname, double *value, bool create, MVOdbError* error) { SetOk(error); };
81  void RF(const char* varname, float *value, bool create, MVOdbError* error) { SetOk(error); };
82  void RS(const char* varname, std::string *value, bool create, int create_string_length, MVOdbError* error) { SetOk(error); };
83  void RU16(const char* varname, uint16_t *value, bool create, MVOdbError* error) { SetOk(error); };
84  void RU32(const char* varname, uint32_t *value, bool create, MVOdbError* error) { SetOk(error); };
85 
86  void RBA(const char* varname, std::vector<bool> *value, bool create, int create_size, MVOdbError* error) { SetOk(error); };
87  void RIA(const char* varname, std::vector<int> *value, bool create, int create_size, MVOdbError* error) { SetOk(error); };
88  void RDA(const char* varname, std::vector<double> *value, bool create, int create_size, MVOdbError* error) { SetOk(error); };
89  void RFA(const char* varname, std::vector<float> *value, bool create, int create_size, MVOdbError* error) { SetOk(error); };
90  void RSA(const char* varname, std::vector<std::string> *value, bool create, int create_size, int create_string_length, MVOdbError* error) { SetOk(error); };
91  void RU16A(const char* varname, std::vector<uint16_t> *value, bool create, int create_size, MVOdbError* error) { SetOk(error); };
92  void RU32A(const char* varname, std::vector<uint32_t> *value, bool create, int create_size, MVOdbError* error) { SetOk(error); };
93 
94  void RBAI(const char* varname, int index, bool *value, MVOdbError* error) { SetOk(error); };
95  void RIAI(const char* varname, int index, int *value, MVOdbError* error) { SetOk(error); };
96  void RDAI(const char* varname, int index, double *value, MVOdbError* error) { SetOk(error); };
97  void RFAI(const char* varname, int index, float *value, MVOdbError* error) { SetOk(error); };
98  void RSAI(const char* varname, int index, std::string *value, MVOdbError* error) { SetOk(error); };
99  void RU16AI(const char* varname, int index, uint16_t *value, MVOdbError* error) { SetOk(error); };
100  void RU32AI(const char* varname, int index, uint32_t *value, MVOdbError* error) { SetOk(error); };
101 
102  void WB(const char* varname, bool v, MVOdbError* error) { SetOk(error); };
103  void WI(const char* varname, int v, MVOdbError* error) { SetOk(error); };
104  void WD(const char* varname, double v, MVOdbError* error) { SetOk(error); };
105  void WF(const char* varname, float v, MVOdbError* error) { SetOk(error); };
106  void WS(const char* varname, const char* v, int string_length, MVOdbError* error) { SetOk(error); };
107  void WU16(const char* varname, uint16_t v, MVOdbError* error) { SetOk(error); };
108  void WU32(const char* varname, uint32_t v, MVOdbError* error) { SetOk(error); };
109 
110  void WBA(const char* varname, const std::vector<bool>& v, MVOdbError* error) { SetOk(error); };
111  void WIA(const char* varname, const std::vector<int>& v, MVOdbError* error) { SetOk(error); };
112  void WDA(const char* varname, const std::vector<double>& v, MVOdbError* error) { SetOk(error); };
113  void WFA(const char* varname, const std::vector<float>& v, MVOdbError* error) { SetOk(error); };
114  void WSA(const char* varname, const std::vector<std::string>& data, int odb_string_length, MVOdbError* error) { SetOk(error); };
115  void WU16A(const char* varname, const std::vector<uint16_t>& v, MVOdbError* error) { SetOk(error); };
116  void WU32A(const char* varname, const std::vector<uint32_t>& v, MVOdbError* error) { SetOk(error); };
117 
118  void WBAI(const char* varname, int index, bool v, MVOdbError* error) { SetOk(error); };
119  void WIAI(const char* varname, int index, int v, MVOdbError* error) { SetOk(error); };
120  void WDAI(const char* varname, int index, double v, MVOdbError* error) { SetOk(error); };
121  void WFAI(const char* varname, int index, float v, MVOdbError* error) { SetOk(error); };
122  void WSAI(const char* varname, int index, const char* v, MVOdbError* error) { SetOk(error); };
123  void WU16AI(const char* varname, int index, uint16_t v, MVOdbError* error) { SetOk(error); };
124  void WU32AI(const char* varname, int index, uint32_t v, MVOdbError* error) { SetOk(error); };
125 
126  void Delete(const char* odbname, MVOdbError* error) { SetOk(error); };
127 };
128 
130 {
131  return new NullOdb();
132 }
133 
134 /* emacs
135  * Local Variables:
136  * tab-width: 8
137  * c-basic-offset: 3
138  * indent-tabs-mode: nil
139  * End:
140  */
Definition: mvodb.h:21
void RFAI(const char *varname, int index, float *value, MVOdbError *error)
Definition: nullodb.cxx:97
void RBA(const char *varname, std::vector< bool > *value, bool create, int create_size, MVOdbError *error)
Definition: nullodb.cxx:86
void RDA(const char *varname, std::vector< double > *value, bool create, int create_size, MVOdbError *error)
Definition: nullodb.cxx:88
void WSA(const char *varname, const std::vector< std::string > &data, int odb_string_length, MVOdbError *error)
Definition: nullodb.cxx:114
void WB(const char *varname, bool v, MVOdbError *error)
Definition: nullodb.cxx:102
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:87
void WD(const char *varname, double v, MVOdbError *error)
Definition: nullodb.cxx:104
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:73
void RU32A(const char *varname, std::vector< uint32_t > *value, bool create, int create_size, MVOdbError *error)
Definition: nullodb.cxx:92
void WF(const char *varname, float v, MVOdbError *error)
Definition: nullodb.cxx:105
void WFAI(const char *varname, int index, float v, MVOdbError *error)
Definition: nullodb.cxx:121
void RD(const char *varname, double *value, bool create, MVOdbError *error)
Definition: nullodb.cxx:80
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:122
void ReadKeyLastWritten(const char *varname, int *last_written, MVOdbError *error)
Definition: nullodb.cxx:67
bool GetPrintError() const
Definition: nullodb.cxx:34
void WIA(const char *varname, const std::vector< int > &v, MVOdbError *error)
Definition: nullodb.cxx:111
void RIAI(const char *varname, int index, int *value, MVOdbError *error)
Definition: nullodb.cxx:95
void RSAI(const char *varname, int index, std::string *value, MVOdbError *error)
Definition: nullodb.cxx:98
void RF(const char *varname, float *value, bool create, MVOdbError *error)
Definition: nullodb.cxx:81
void SetPrintError(bool v)
Definition: nullodb.cxx:29
void WDAI(const char *varname, int index, double v, MVOdbError *error)
Definition: nullodb.cxx:120
void RDAI(const char *varname, int index, double *value, MVOdbError *error)
Definition: nullodb.cxx:96
void RS(const char *varname, std::string *value, bool create, int create_string_length, MVOdbError *error)
Definition: nullodb.cxx:82
void WU16A(const char *varname, const std::vector< uint16_t > &v, MVOdbError *error)
Definition: nullodb.cxx:115
void WBAI(const char *varname, int index, bool v, MVOdbError *error)
Definition: nullodb.cxx:118
void WU32(const char *varname, uint32_t v, MVOdbError *error)
Definition: nullodb.cxx:108
void WU16AI(const char *varname, int index, uint16_t v, MVOdbError *error)
Definition: nullodb.cxx:123
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:124
void RU32(const char *varname, uint32_t *value, bool create, MVOdbError *error)
Definition: nullodb.cxx:84
void RBAI(const char *varname, int index, bool *value, MVOdbError *error)
Definition: nullodb.cxx:94
void WS(const char *varname, const char *v, int string_length, MVOdbError *error)
Definition: nullodb.cxx:106
void RI(const char *varname, int *value, bool create, MVOdbError *error)
Definition: nullodb.cxx:79
void WU16(const char *varname, uint16_t v, MVOdbError *error)
Definition: nullodb.cxx:107
bool IsReadOnly() const
Definition: nullodb.cxx:39
void WIAI(const char *varname, int index, int v, MVOdbError *error)
Definition: nullodb.cxx:119
void WDA(const char *varname, const std::vector< double > &v, MVOdbError *error)
Definition: nullodb.cxx:112
void RU32AI(const char *varname, int index, uint32_t *value, MVOdbError *error)
Definition: nullodb.cxx:100
void RU16(const char *varname, uint16_t *value, bool create, MVOdbError *error)
Definition: nullodb.cxx:83
void RB(const char *varname, bool *value, bool create, MVOdbError *error)
Definition: nullodb.cxx:78
void WI(const char *varname, int v, MVOdbError *error)
Definition: nullodb.cxx:103
void Delete(const char *odbname, MVOdbError *error)
Definition: nullodb.cxx:126
void RSA(const char *varname, std::vector< std::string > *value, bool create, int create_size, int create_string_length, MVOdbError *error)
Definition: nullodb.cxx:90
void RFA(const char *varname, std::vector< float > *value, bool create, int create_size, MVOdbError *error)
Definition: nullodb.cxx:89
NullOdb()
Definition: nullodb.cxx:24
void RU16AI(const char *varname, int index, uint16_t *value, MVOdbError *error)
Definition: nullodb.cxx:99
void WBA(const char *varname, const std::vector< bool > &v, MVOdbError *error)
Definition: nullodb.cxx:110
void RU16A(const char *varname, std::vector< uint16_t > *value, bool create, int create_size, MVOdbError *error)
Definition: nullodb.cxx:91
void WU32A(const char *varname, const std::vector< uint32_t > &v, MVOdbError *error)
Definition: nullodb.cxx:116
void WFA(const char *varname, const std::vector< float > &v, MVOdbError *error)
Definition: nullodb.cxx:113
void SetOk(MVOdbError *error)
Definition: mvodb.cxx:31
MVOdb * MakeNullOdb()
Definition: nullodb.cxx:129