All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
DB.h
Go to the documentation of this file.
1 /*
2  * DB.h
3  *
4  * This file is part of the HausmiSEP project
5  *
6  * Copyright (C) 2012, 2013 Marco Alvarado (malvcr@gmail.com)
7  *
8  * This program is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #ifndef DB_H_
23 #define DB_H_
24 
25 #include <HSEPData/DBBase.h>
26 #include <HSEPData/DBDrvLib.h>
28 #include <HSEP/HSEPObject.h>
29 
30 #include <vector>
31 #include <map>
32 
33 using namespace HSEP;
34 
35 namespace HSEPData {
36 
46  class DB : public HSEPObject {
47 
49 
50  DBDrvLibDictionary* aDBDrvLibraries;
51  DBEnvironmentQueueMap* aEnvironments;
52 
53  protected:
60  void loadDrivers (string& pDriverPathRef);
61 
70  ErrorCode loadInstances(string& pConfigPathRef);
71 
77  void unloadDrivers();
78 
84  void unloadInstances();
85 
86  public:
87 
102  DB(string& pConfigPathRef, string& pQueryPathRef,string& pDriverPathRef);
103 
107  ~DB();
108 
109  static DB* aInstance;
117  DBEnvironment* getEnvironmentPtr(string& pEnvironmentTypeRef);
118 
124  void releaseEnvironment(string& pEnvironmentTypeRef, DBEnvironment* pEnvironmentPtr);
125 
126  }; // DB class
127 
128 } // HSEPData namespace
129 
130 #endif /* DB_H_ */