00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
#ifndef STDBNODE_HH
00062
#define STDBNODE_HH
00063
00064
#include "StDbDefs.hh"
00065
#include <string.h>
00066
#ifdef __ROOT__
00067
#include "TROOT.h"
00068
#endif
00069
00070 class StDbNode {
00071
00072
protected:
00073
00074
00075 char *
mname;
00076 char *
mversion;
00077 char *
mdbName;
00078 StDbType mdbType;
00079 StDbDomain mdbDomain;
00080
00081
00082 int mnodeID;
00083 char*
mnodeType;
00084
00085 bool misConfigured;
00086 bool mcanRollBack;
00087
00088
public:
00089
00090 StDbNode() :
mname(0),
mversion(0),
mdbName(0),
mnodeID(0),
mnodeType(0),
misConfigured(false),
mcanRollBack(false) {};
00091
StDbNode(
const char* name,
const char* versionKey);
00092
StDbNode(
const char* name);
00093
StDbNode(
StDbNode& node);
00094
00095
virtual ~StDbNode();
00096
00097
char*
getName() ;
00098
char*
printName() ;
00099
char*
getMyName() ;
00100
char*
getVersion() ;
00101
char*
printVersion() ;
00102
char*
getDbName() ;
00103
char*
printDbName();
00104
StDbType getDbType() const;
00105 StDbDomain getDbDomain() const;
00106
int getNodeID() const;
00107
char* getNodeType() ;
00108
char* printNodeType();
00109
00110
void setName(const
char* nodeName);
00111
void setVersion(const
char* nodeVersion);
00112
void setDbName(const
char* nodeDbName);
00113
void setDbType(StDbType type);
00114
void setDbDomain(StDbDomain domain);
00115
void setNodeID(
int id);
00116
void setNodeType(const
char* nodeType);
00117
00118
00119
bool canRollBack() const;
00120
void addWrittenNode(
int dataID);
00121
void commit();
00122
00123
00124
bool checkName(const
char* nodeName) const;
00125
bool checkVersion(const
char* nodeVersion) const;
00126
bool checkNode(const
char* nodeName, const
char* nodeVersion) const;
00127
bool IsConfigured() const;
00128
void setConfigured(
bool isConfigured);
00129
bool isNode(StDbType type, StDbDomain domain);
00130 virtual
bool IsTable() const;
00131
00132
00133
char* mstrDup(const
char* s2) ;
00134
int* decodeElementID(const
char* elementID,
int& numRows) ;
00135
char* getNextID(
char*& currentElement) const;
00136 #ifdef __ROOT__
00137 ClassDef(
StDbNode,0)
00138 #endif
00139
00140 };
00141 inline
char* StDbNode::printName() {
return mname; };
00142 inline char*
StDbNode::printDbName() {
return mdbName; };
00143 inline char*
StDbNode::printNodeType() {
return mnodeType; };
00144 inline char*
StDbNode::printVersion() {
return mversion; };
00145 inline char*
StDbNode::getMyName() {
return printName(); }
00146 inline StDbType StDbNode::getDbType()
const {
return mdbType;}
00147 inline StDbDomain StDbNode::getDbDomain()
const {
return mdbDomain; }
00148 inline void StDbNode::setDbType(StDbType type) {
mdbType=type;}
00149 inline void StDbNode::setDbDomain(StDbDomain domain) {
mdbDomain=domain; }
00150 inline int StDbNode::getNodeID()
const {
return mnodeID; }
00151 inline void StDbNode::setNodeID(
int id ) {
mnodeID =
id; }
00152 inline void StDbNode::setConfigured(
bool isC){
misConfigured=isC; }
00153 inline bool StDbNode::IsConfigured()
const {
return misConfigured; }
00154 inline bool StDbNode::isNode(StDbType type, StDbDomain domain){
00155
return ( (type==
mdbType) && (domain==
mdbDomain) ) ?
true :
false;
00156 }
00157 inline bool StDbNode::canRollBack()
const {
return mcanRollBack; }
00158 inline void StDbNode::addWrittenNode(
int dataID){
00159
mcanRollBack=
true;
00160
mnodeID=dataID;
00161 }
00162 inline void StDbNode::commit() {
mcanRollBack =
false; }
00163 inline bool StDbNode::checkName(
const char* nodeName)
const {
00164
return (
mname && (strcmp(
mname,nodeName)==0)) ?
true :
false;
00165 }
00166 inline bool StDbNode::checkVersion(
const char* nodeVersion)
const {
00167
return (
mversion && (strcmp(
mversion,nodeVersion)==0)) ?
true :
false;
00168 }
00169 inline bool StDbNode::checkNode(
const char* name,
const char* version)
const {
00170
return (
checkName(name) &&
checkVersion(version)) ?
true :
false;
00171 }
00172 inline bool StDbNode::IsTable()
const {
return false; }
00173
#endif