35 #include "StDataBaseI.hh"
36 #include "StDbManager.hh"
44 StDataBaseI::StDataBaseI() : mdbType(dbStDb), mdbDomain(dbDomainUnknown), mdbName(0), mtypeName(0), mdomainName(0), mdbStore(dbV00) { };
46 StDataBaseI::StDataBaseI(StDbType type, StDbDomain domain) : mdbName(0), mtypeName(0), mdomainName(0), mdbStore(dbV00) { setDataBase(type,domain); }
48 StDataBaseI::StDataBaseI(
const char* typeName,
const char* domainName) : mdbName(0), mtypeName(0), mdomainName(0), mdbStore(dbV00) { setDataBase(typeName,domainName); }
51 StDataBaseI::~StDataBaseI(){
52 if(mdbName)
delete [] mdbName;
53 if(mtypeName)
delete [] mtypeName;
54 if(mdomainName)
delete [] mdomainName;
59 StDataBaseI::setDataBase(StDbType type, StDbDomain domain){
63 setTypeName(name);
if(name)
delete [] name;
65 setDomainName(name);
if(name)
delete [] name;
67 setDbName(name);
if(name)
delete [] name;
72 StDataBaseI::setDataBase(
const char* typeName,
const char* domainName){
73 setTypeName(typeName);
74 setDomainName(domainName);
76 setDbName(name);
if(name)
delete [] name;
83 StDataBaseI::setDataBase(
const char* dbName){
92 StDataBaseI::setDbName(
const char* dbName) {
95 if(mdbName)
delete [] mdbName;
96 mdbName =
new char[strlen(dbName)+1];
97 strcpy(mdbName,dbName);
103 StDataBaseI::setTypeName(
const char* typeName) {
106 if(mtypeName)
delete [] mtypeName;
107 mtypeName =
new char[strlen(typeName)+1];
108 strcpy(mtypeName,typeName);
114 StDataBaseI::setDomainName(
const char* domainName) {
117 if(mdomainName)
delete [] mdomainName;
118 mdomainName =
new char[strlen(domainName)+1];
119 strcpy(mdomainName,domainName);
125 StDataBaseI::getDbName()
const {
129 retVal =
new char[strlen(mdbName)+1];
130 strcpy(retVal,mdbName);
137 StDataBaseI::getTypeName()
const {
141 retVal =
new char[strlen(mtypeName)+1];
142 strcpy(retVal,mtypeName);
149 StDataBaseI::getDomainName()
const {
153 retVal =
new char[strlen(mdomainName)+1];
154 strcpy(retVal,mdomainName);
161 char* StDataBaseI::printDbName() {
return mdbName; }
162 char* StDataBaseI::printTypeName() {
return mtypeName; }
163 char* StDataBaseI::printDomainName() {
return mdomainName; }
164 bool StDataBaseI::checkDbName(
const char* name) {
165 return (strcmp(name,mdbName)==0) ?
true :
false;
167 bool StDataBaseI::checkDbType(
const char* name) {
168 return (strcmp(name,mtypeName)==0) ?
true :
false;
170 bool StDataBaseI::checkDbDomain(
const char* name) {
171 return (strcmp(name,mdomainName)==0) ?
true :
false;
static StDbManager * Instance()
strdup(..) is not ANSI