LibreOffice Module dbaccess (master) 1
Classes | Public Member Functions | Protected Member Functions | Private Attributes | Friends | List of all members
sdbtools::ConnectionDependentComponent Class Reference

#include <connectiondependent.hxx>

Inheritance diagram for sdbtools::ConnectionDependentComponent:
[legend]

Classes

class  EntryGuard
 a class for guarding methods of a connection-dependent component More...
 
struct  GuardAccess
 helper for granting exclusive access to various other methods More...
 

Public Member Functions

::osl::Mutex & getMutex (GuardAccess) const
 
bool acquireConnection (GuardAccess)
 
void releaseConnection (GuardAccess)
 

Protected Member Functions

::osl::Mutex & getMutex () const
 
const css::uno::Reference< css::uno::XComponentContext > & getContext () const
 
 ConnectionDependentComponent (css::uno::Reference< css::uno::XComponentContext > _xContext)
 
void setWeakConnection (const css::uno::Reference< css::sdbc::XConnection > &_rxConnection)
 sets the connection we depend on. More...
 
const css::uno::Reference< css::sdbc::XConnection > & getConnection () const
 

Private Attributes

mutable::osl::Mutex m_aMutex
 
css::uno::WeakReference< css::sdbc::XConnection > m_aConnection
 
css::uno::Reference< css::uno::XComponentContext > m_aContext
 
css::uno::Reference< css::sdbc::XConnection > m_xConnection
 a hard reference to the connection we're working for More...
 

Friends

struct GuardAccess
 

Detailed Description

Definition at line 34 of file connectiondependent.hxx.

Constructor & Destructor Documentation

◆ ConnectionDependentComponent()

sdbtools::ConnectionDependentComponent::ConnectionDependentComponent ( css::uno::Reference< css::uno::XComponentContext >  _xContext)
inlineexplicitprotected

Definition at line 62 of file connectiondependent.hxx.

References _xContext.

Member Function Documentation

◆ acquireConnection()

bool sdbtools::ConnectionDependentComponent::acquireConnection ( GuardAccess  )
inline

◆ getConnection()

const css::uno::Reference< css::sdbc::XConnection > & sdbtools::ConnectionDependentComponent::getConnection ( ) const
inlineprotected

◆ getContext()

const css::uno::Reference< css::uno::XComponentContext > & sdbtools::ConnectionDependentComponent::getContext ( ) const
inlineprotected

◆ getMutex() [1/2]

::osl::Mutex & sdbtools::ConnectionDependentComponent::getMutex ( ) const
inlineprotected

Definition at line 53 of file connectiondependent.hxx.

References m_aMutex.

Referenced by sdbtools::ConnectionTools::initialize().

◆ getMutex() [2/2]

::osl::Mutex & sdbtools::ConnectionDependentComponent::getMutex ( GuardAccess  ) const
inline

Definition at line 89 of file connectiondependent.hxx.

References m_aMutex.

◆ releaseConnection()

void sdbtools::ConnectionDependentComponent::releaseConnection ( GuardAccess  )
inline

◆ setWeakConnection()

void sdbtools::ConnectionDependentComponent::setWeakConnection ( const css::uno::Reference< css::sdbc::XConnection > &  _rxConnection)
inlineprotected

sets the connection we depend on.

To be called exactly once.

Parameters
_rxConnectionthe connection to set

Definition at line 74 of file connectiondependent.hxx.

References m_aConnection.

Referenced by sdbtools::ConnectionTools::initialize().

Friends And Related Function Documentation

◆ GuardAccess

friend struct GuardAccess
friend

Definition at line 84 of file connectiondependent.hxx.

Member Data Documentation

◆ m_aConnection

css::uno::WeakReference< css::sdbc::XConnection > sdbtools::ConnectionDependentComponent::m_aConnection
private

Definition at line 39 of file connectiondependent.hxx.

Referenced by acquireConnection(), and setWeakConnection().

◆ m_aContext

css::uno::Reference< css::uno::XComponentContext > sdbtools::ConnectionDependentComponent::m_aContext
private

Definition at line 41 of file connectiondependent.hxx.

Referenced by getContext().

◆ m_aMutex

mutable::osl::Mutex sdbtools::ConnectionDependentComponent::m_aMutex
private

Definition at line 37 of file connectiondependent.hxx.

Referenced by getMutex().

◆ m_xConnection

css::uno::Reference< css::sdbc::XConnection > sdbtools::ConnectionDependentComponent::m_xConnection
private

a hard reference to the connection we're working for

This member is only valid as long as a EntryGuard is on the stack. The guard will, in its constructor, set the member, and reset it in its destructor. This ensures that the connection is only held hard when it's needed, and weak otherwise.

Definition at line 50 of file connectiondependent.hxx.

Referenced by acquireConnection(), getConnection(), and releaseConnection().


The documentation for this class was generated from the following file: