Menu

[r1560]: / cppdb / trunk / cppdb / conn_manager.h  Maximize  Restore  History

Download this file

40 lines (33 with data), 854 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#ifndef CPPDB_CONN_MANAGER_H
#define CPPDB_CONN_MANAGER_H
#include <cppdb/defs.h>
#include <cppdb/ref_ptr.h>
#include <cppdb/mutex.h>
#include <map>
#include <string>
#include <memory>
namespace cppdb {
class pool;
class connection_info;
namespace backend {
class connection;
}
class CPPDB_API connections_manager {
connections_manager();
~connections_manager();
connections_manager(connections_manager const &);
void operator = (connections_manager const &);
public:
static connections_manager &instance();
ref_ptr<backend::connection> open(std::string const &cs);
ref_ptr<backend::connection> open(connection_info const &ci);
void gc();
private:
struct data;
std::auto_ptr<data> d;
mutex lock_;
typedef std::map<std::string,ref_ptr<pool> > connections_type;
connections_type connections_;
};
} // cppdb
#endif
MongoDB Logo MongoDB