4 #include "RelationalAccess/ISessionProxy.h"
11 m_proxy(coralSession){
15 m_proxy( rhs.m_proxy ){
30 "SharedSession::proxy");
50 return m_connectionService;
53 return m_connectionService.configuration();
57 coral::AccessMode accessMode ){
59 boost::shared_ptr<coral::ISessionProxy>
session;
60 std::map<std::string,boost::weak_ptr<coral::ISessionProxy> >::iterator iS = m_sessions.find( lookupString( connectionString, accessMode ) );
61 if( iS != m_sessions.end() ){
62 if( !iS->second.expired() ){
63 session = iS->second.lock();
67 iS = m_sessions.insert(std::make_pair( lookupString( connectionString, accessMode ),boost::weak_ptr<coral::ISessionProxy>())).first;
70 session.reset(m_connectionService.connect( connectionString, accessMode ));
71 boost::weak_ptr<coral::ISessionProxy>
tmp(session);
72 iS->second.swap( tmp );
79 coral::AccessMode accessMode ){
81 boost::shared_ptr<coral::ISessionProxy>
session;
82 std::map<std::string,boost::weak_ptr<coral::ISessionProxy> >::iterator iS = m_sessions.find( lookupString( connectionString, asRole, accessMode ) );
83 if( iS != m_sessions.end() ){
84 if( !iS->second.expired() ){
85 session = iS->second.lock();
89 iS = m_sessions.insert(std::make_pair( lookupString( connectionString, asRole, accessMode ),boost::weak_ptr<coral::ISessionProxy>())).first;
92 session.reset(m_connectionService.connect( connectionString, asRole, accessMode ));
93 boost::weak_ptr<coral::ISessionProxy>
tmp(session);
94 iS->second.swap( tmp );
101 coral::AccessMode accessMode ){
102 std::stringstream lookupString;
103 lookupString <<
"["<<connectionString <<
"]_";
104 if(accessMode == coral::ReadOnly){
109 return lookupString.str();
114 coral::AccessMode accessMode ){
116 return rolePrefix+lookupString( connectionString, accessMode );
coral::ISessionProxy & get()
static std::string lookupString(const std::string &connectionString, coral::AccessMode accessMode)
coral::IConnectionServiceConfiguration & configuration()
virtual ~ConnectionPool()
coral::IConnectionService & connectionService()
SharedSession & operator=(const SharedSession &rhs)
boost::shared_ptr< coral::ISessionProxy > m_proxy
SharedSession connect(const std::string &connectionString, coral::AccessMode accessMode)
std::vector< std::vector< double > > tmp
void throwException(const std::string &message, const std::string &methodName)