4 #include "RelationalAccess/ISessionProxy.h"
11 m_proxy(coralSession){
15 m_proxy( rhs.m_proxy ){
30 "SharedSession::proxy");
35 boost::shared_ptr<coral::ISessionProxy>
55 return m_connectionService;
58 return m_connectionService.configuration();
62 coral::AccessMode accessMode ){
64 boost::shared_ptr<coral::ISessionProxy>
session;
65 std::map<std::string,boost::weak_ptr<coral::ISessionProxy> >::iterator iS = m_sessions.find( lookupString( connectionString, accessMode ) );
66 if( iS != m_sessions.end() ){
67 if( !iS->second.expired() ){
68 session = iS->second.lock();
72 iS = m_sessions.insert(std::make_pair( lookupString( connectionString, accessMode ),boost::weak_ptr<coral::ISessionProxy>())).first;
75 session.reset(m_connectionService.connect( connectionString, accessMode ));
76 boost::weak_ptr<coral::ISessionProxy>
tmp(session);
77 iS->second.swap( tmp );
84 coral::AccessMode accessMode ){
86 boost::shared_ptr<coral::ISessionProxy>
session;
87 std::map<std::string,boost::weak_ptr<coral::ISessionProxy> >::iterator iS = m_sessions.find( lookupString( connectionString, asRole, accessMode ) );
88 if( iS != m_sessions.end() ){
89 if( !iS->second.expired() ){
90 session = iS->second.lock();
94 iS = m_sessions.insert(std::make_pair( lookupString( connectionString, asRole, accessMode ),boost::weak_ptr<coral::ISessionProxy>())).first;
97 session.reset(m_connectionService.connect( connectionString, asRole, accessMode ));
98 boost::weak_ptr<coral::ISessionProxy>
tmp(session);
99 iS->second.swap( tmp );
106 coral::AccessMode accessMode ){
107 std::stringstream lookupString;
108 lookupString <<
"["<<connectionString <<
"]_";
109 if(accessMode == coral::ReadOnly){
114 return lookupString.str();
119 coral::AccessMode accessMode ){
121 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 > share()
boost::shared_ptr< coral::ISessionProxy > m_proxy
SharedSession connect(const std::string &connectionString, coral::AccessMode accessMode)
void throwException(const std::string &message, const std::string &methodName) __attribute__((noreturn))
std::vector< std::vector< double > > tmp