ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/DecentralizedMedia/Connector.hpp
Revision: 558
Committed: 2005-07-17T00:50:52-07:00 (19 years, 11 months ago) by douglas
File size: 795 byte(s)
Log Message:
Moo!

File Contents

# User Rev Content
1 douglas 555 // Connector
2     //
3     // Douglas Thrift
4     //
5     // $Id$
6    
7     #ifndef _Connector_hpp_
8     #define _Connector_hpp_
9    
10 douglas 558 #include <menes/cxx/platform.hpp>
11 douglas 555
12     #ifdef MENES_PRAGMA_ONCE
13     #pragma once
14     #endif
15    
16     #include <menes/api/threads.hpp>
17     #include <menes/dbi/driver.hpp>
18     #include <menes/dbi/connection.hpp>
19     #include <menes/ext/stack.hpp>
20    
21     class Connector : public ext::ReferenceCounted
22     {
23     private:
24     _R<dbi::Driver> driver;
25     cse::String host, user, password, database;
26     api::ThreadMutex connectionsLock;
27     ext::Stack<_R<dbi::Connection> > connections;
28     bool running;
29     _S<api::Thread> cleanup;
30     int Cleanup();
31     public:
32     Connector(const cse::String& configuration);
33     ~Connector() { running = false; cleanup.Join(); }
34     _R<dbi::Connection> Connect();
35     void Release(const _R<dbi::Connection>& connection);
36     };
37    
38     #endif//_Connector_hpp_

Properties

Name Value
svn:eol-style native
svn:keywords Id