ROOTANA
Loading...
Searching...
No Matches
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#undef NDEBUG // midas required assert() to be always enabled
13
14//#include <stdio.h>
15//#include <string.h> // strlen()
16//#include <assert.h>
17//#include <stdlib.h> // malloc()
18
19#include "mvodb.h"
20
21class NullOdb: public MVOdb
22{
23public:
25
26 NullOdb() // ctor
27 {
28 fPrintError = true;
29 }
30
31 void SetPrintError(bool v)
32 {
33 fPrintError = true;
34 }
35
36 bool GetPrintError() const
37 {
38 return fPrintError;
39 }
40
41 bool IsReadOnly() const
42 {
43 return true;
44 }
45
46 MVOdb* Chdir(const char* subdir, bool create, MVOdbError* error)
47 {
48 SetOk(error);
49 if (create)
50 return new NullOdb;
51 else
52 return NULL;
53 }
54
55 //void RAInfo(const char* varname, int* num_elements, int* element_size, MVOdbError* error)
56 //{
57 // SetOk(error);
58 //};
59
60 void ReadKey(const char* varname, int *tid, int *num_values, int *total_size, int *item_size, MVOdbError* error)
61 {
62 if (tid) *tid = 0;
63 if (num_values) *num_values = 0;
64 if (total_size) *total_size = 0;
65 if (item_size) *item_size = 0;
66 SetOk(error);
67 }
68
69 void ReadKeyLastWritten( const char* varname, int *last_written, MVOdbError* error)
70 {
71 if (last_written) *last_written = 0;
72 SetOk(error);
73 }
74
75 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)
76 {
77 SetOk(error);
78 }
79
80 void RB(const char* varname, bool *value, bool create, MVOdbError* error) { SetOk(error); };
81 void RI(const char* varname, int *value, bool create, MVOdbError* error) { SetOk(error); };
82 void RD(const char* varname, double *value, bool create, MVOdbError* error) { SetOk(error); };
83 void RF(const char* varname, float *value, bool create, MVOdbError* error) { SetOk(error); };
84 void RS(const char* varname, std::string *value, bool create, int create_string_length, MVOdbError* error) { SetOk(error); };
85 void RU16(const char* varname, uint16_t *value, bool create, MVOdbError* error) { SetOk(error); };
86 void RU32(const char* varname, uint32_t *value, bool create, MVOdbError* error) { SetOk(error); };
87 void RU64(const char* varname, uint64_t *value, bool create, MVOdbError* error) { SetOk(error); };
88
89 void RBA(const char* varname, std::vector<bool> *value, bool create, int create_size, MVOdbError* error) { SetOk(error); };
90 void RIA(const char* varname, std::vector<int> *value, bool create, int create_size, MVOdbError* error) { SetOk(error); };
91 void RDA(const char* varname, std::vector<double> *value, bool create, int create_size, MVOdbError* error) { SetOk(error); };
92 void RFA(const char* varname, std::vector<float> *value, bool create, int create_size, MVOdbError* error) { SetOk(error); };
93 void RSA(const char* varname, std::vector<std::string> *value, bool create, int create_size, int create_string_length, MVOdbError* error) { SetOk(error); };
94 void RU16A(const char* varname, std::vector<uint16_t> *value, bool create, int create_size, MVOdbError* error) { SetOk(error); };
95 void RU32A(const char* varname, std::vector<uint32_t> *value, bool create, int create_size, MVOdbError* error) { SetOk(error); };
96 void RU64A(const char* varname, std::vector<uint64_t> *value, bool create, int create_size, MVOdbError* error) { SetOk(error); };
97
98 void RBAI(const char* varname, int index, bool *value, MVOdbError* error) { SetOk(error); };
99 void RIAI(const char* varname, int index, int *value, MVOdbError* error) { SetOk(error); };
100 void RDAI(const char* varname, int index, double *value, MVOdbError* error) { SetOk(error); };
101 void RFAI(const char* varname, int index, float *value, MVOdbError* error) { SetOk(error); };
102 void RSAI(const char* varname, int index, std::string *value, MVOdbError* error) { SetOk(error); };
103 void RU16AI(const char* varname, int index, uint16_t *value, MVOdbError* error) { SetOk(error); };
104 void RU32AI(const char* varname, int index, uint32_t *value, MVOdbError* error) { SetOk(error); };
105 void RU64AI(const char* varname, int index, uint64_t *value, MVOdbError* error) { SetOk(error); };
106
107 void WB(const char* varname, bool v, MVOdbError* error) { SetOk(error); };
108 void WI(const char* varname, int v, MVOdbError* error) { SetOk(error); };
109 void WD(const char* varname, double v, MVOdbError* error) { SetOk(error); };
110 void WF(const char* varname, float v, MVOdbError* error) { SetOk(error); };
111 void WS(const char* varname, const char* v, int string_length, MVOdbError* error) { SetOk(error); };
112 void WU16(const char* varname, uint16_t v, MVOdbError* error) { SetOk(error); };
113 void WU32(const char* varname, uint32_t v, MVOdbError* error) { SetOk(error); };
114 void WU64(const char* varname, uint64_t v, MVOdbError* error) { SetOk(error); };
115
116 void WBA(const char* varname, const std::vector<bool>& v, MVOdbError* error) { SetOk(error); };
117 void WIA(const char* varname, const std::vector<int>& v, MVOdbError* error) { SetOk(error); };
118 void WDA(const char* varname, const std::vector<double>& v, MVOdbError* error) { SetOk(error); };
119 void WFA(const char* varname, const std::vector<float>& v, MVOdbError* error) { SetOk(error); };
120 void WSA(const char* varname, const std::vector<std::string>& data, int odb_string_length, MVOdbError* error) { SetOk(error); };
121 void WU16A(const char* varname, const std::vector<uint16_t>& v, MVOdbError* error) { SetOk(error); };
122 void WU32A(const char* varname, const std::vector<uint32_t>& v, MVOdbError* error) { SetOk(error); };
123 void WU64A(const char* varname, const std::vector<uint64_t>& v, MVOdbError* error) { SetOk(error); };
124
125 void WBAI(const char* varname, int index, bool v, MVOdbError* error) { SetOk(error); };
126 void WIAI(const char* varname, int index, int v, MVOdbError* error) { SetOk(error); };
127 void WDAI(const char* varname, int index, double v, MVOdbError* error) { SetOk(error); };
128 void WFAI(const char* varname, int index, float v, MVOdbError* error) { SetOk(error); };
129 void WSAI(const char* varname, int index, const char* v, MVOdbError* error) { SetOk(error); };
130 void WU16AI(const char* varname, int index, uint16_t v, MVOdbError* error) { SetOk(error); };
131 void WU32AI(const char* varname, int index, uint32_t v, MVOdbError* error) { SetOk(error); };
132 void WU64AI(const char* varname, int index, uint64_t v, MVOdbError* error) { SetOk(error); };
133
134 void Delete(const char* odbname, MVOdbError* error) { SetOk(error); };
135};
136
138{
139 return new NullOdb();
140}
141
142/* emacs
143 * Local Variables:
144 * tab-width: 8
145 * c-basic-offset: 3
146 * indent-tabs-mode: nil
147 * End:
148 */
Definition mvodb.h:21
void RFAI(const char *varname, int index, float *value, MVOdbError *error)
Definition nullodb.cxx:101
void RBA(const char *varname, std::vector< bool > *value, bool create, int create_size, MVOdbError *error)
Definition nullodb.cxx:89
void RDA(const char *varname, std::vector< double > *value, bool create, int create_size, MVOdbError *error)
Definition nullodb.cxx:91
void WSA(const char *varname, const std::vector< std::string > &data, int odb_string_length, MVOdbError *error)
Definition nullodb.cxx:120
void WB(const char *varname, bool v, MVOdbError *error)
Definition nullodb.cxx:107
bool fPrintError
Definition nullodb.cxx:24
void RIA(const char *varname, std::vector< int > *value, bool create, int create_size, MVOdbError *error)
Definition nullodb.cxx:90
void WD(const char *varname, double v, MVOdbError *error)
Definition nullodb.cxx:109
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:75
void RU64AI(const char *varname, int index, uint64_t *value, MVOdbError *error)
Definition nullodb.cxx:105
void RU32A(const char *varname, std::vector< uint32_t > *value, bool create, int create_size, MVOdbError *error)
Definition nullodb.cxx:95
void WF(const char *varname, float v, MVOdbError *error)
Definition nullodb.cxx:110
void WFAI(const char *varname, int index, float v, MVOdbError *error)
Definition nullodb.cxx:128
void RD(const char *varname, double *value, bool create, MVOdbError *error)
Definition nullodb.cxx:82
void WSAI(const char *varname, int index, const char *v, MVOdbError *error)
Definition nullodb.cxx:129
void RU64A(const char *varname, std::vector< uint64_t > *value, bool create, int create_size, MVOdbError *error)
Definition nullodb.cxx:96
void ReadKeyLastWritten(const char *varname, int *last_written, MVOdbError *error)
Definition nullodb.cxx:69
bool GetPrintError() const
Definition nullodb.cxx:36
void WIA(const char *varname, const std::vector< int > &v, MVOdbError *error)
Definition nullodb.cxx:117
void RIAI(const char *varname, int index, int *value, MVOdbError *error)
Definition nullodb.cxx:99
void RSAI(const char *varname, int index, std::string *value, MVOdbError *error)
Definition nullodb.cxx:102
void RF(const char *varname, float *value, bool create, MVOdbError *error)
Definition nullodb.cxx:83
void SetPrintError(bool v)
Definition nullodb.cxx:31
void WDAI(const char *varname, int index, double v, MVOdbError *error)
Definition nullodb.cxx:127
void RDAI(const char *varname, int index, double *value, MVOdbError *error)
Definition nullodb.cxx:100
void RS(const char *varname, std::string *value, bool create, int create_string_length, MVOdbError *error)
Definition nullodb.cxx:84
void WU16A(const char *varname, const std::vector< uint16_t > &v, MVOdbError *error)
Definition nullodb.cxx:121
void WBAI(const char *varname, int index, bool v, MVOdbError *error)
Definition nullodb.cxx:125
void WU32(const char *varname, uint32_t v, MVOdbError *error)
Definition nullodb.cxx:113
void WU16AI(const char *varname, int index, uint16_t v, MVOdbError *error)
Definition nullodb.cxx:130
void ReadKey(const char *varname, int *tid, int *num_values, int *total_size, int *item_size, MVOdbError *error)
Definition nullodb.cxx:60
void WU32AI(const char *varname, int index, uint32_t v, MVOdbError *error)
Definition nullodb.cxx:131
void RU32(const char *varname, uint32_t *value, bool create, MVOdbError *error)
Definition nullodb.cxx:86
void RBAI(const char *varname, int index, bool *value, MVOdbError *error)
Definition nullodb.cxx:98
void WS(const char *varname, const char *v, int string_length, MVOdbError *error)
Definition nullodb.cxx:111
void RI(const char *varname, int *value, bool create, MVOdbError *error)
Definition nullodb.cxx:81
void WU16(const char *varname, uint16_t v, MVOdbError *error)
Definition nullodb.cxx:112
bool IsReadOnly() const
Definition nullodb.cxx:41
void WU64AI(const char *varname, int index, uint64_t v, MVOdbError *error)
Definition nullodb.cxx:132
void WIAI(const char *varname, int index, int v, MVOdbError *error)
Definition nullodb.cxx:126
void WDA(const char *varname, const std::vector< double > &v, MVOdbError *error)
Definition nullodb.cxx:118
void RU32AI(const char *varname, int index, uint32_t *value, MVOdbError *error)
Definition nullodb.cxx:104
void RU16(const char *varname, uint16_t *value, bool create, MVOdbError *error)
Definition nullodb.cxx:85
void RB(const char *varname, bool *value, bool create, MVOdbError *error)
Definition nullodb.cxx:80
void WI(const char *varname, int v, MVOdbError *error)
Definition nullodb.cxx:108
void Delete(const char *odbname, MVOdbError *error)
Definition nullodb.cxx:134
void RU64(const char *varname, uint64_t *value, bool create, MVOdbError *error)
Definition nullodb.cxx:87
void RSA(const char *varname, std::vector< std::string > *value, bool create, int create_size, int create_string_length, MVOdbError *error)
Definition nullodb.cxx:93
void WU64(const char *varname, uint64_t v, MVOdbError *error)
Definition nullodb.cxx:114
void RFA(const char *varname, std::vector< float > *value, bool create, int create_size, MVOdbError *error)
Definition nullodb.cxx:92
NullOdb()
Definition nullodb.cxx:26
void RU16AI(const char *varname, int index, uint16_t *value, MVOdbError *error)
Definition nullodb.cxx:103
void WU64A(const char *varname, const std::vector< uint64_t > &v, MVOdbError *error)
Definition nullodb.cxx:123
void WBA(const char *varname, const std::vector< bool > &v, MVOdbError *error)
Definition nullodb.cxx:116
void RU16A(const char *varname, std::vector< uint16_t > *value, bool create, int create_size, MVOdbError *error)
Definition nullodb.cxx:94
void WU32A(const char *varname, const std::vector< uint32_t > &v, MVOdbError *error)
Definition nullodb.cxx:122
void WFA(const char *varname, const std::vector< float > &v, MVOdbError *error)
Definition nullodb.cxx:119
MVOdb * Chdir(const char *subdir, bool create, MVOdbError *error)
Definition nullodb.cxx:46
void SetOk(MVOdbError *error)
Definition mvodb.cxx:33
MVOdb * MakeNullOdb()
Definition nullodb.cxx:137