QGIS API Documentation  3.0.2-Girona (307d082)
Classes | Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
QgsConnectionPoolGroup< T > Class Template Reference

Template that stores data related to one server. More...

#include <qgsconnectionpool.h>

Classes

struct  Item
 

Public Member Functions

 QgsConnectionPoolGroup (const QString &ci)
 
 QgsConnectionPoolGroup (const QgsConnectionPoolGroup &other)=delete
 QgsConnectionPoolGroup cannot be copied. More...
 
 ~QgsConnectionPoolGroup ()
 
acquire (int timeout)
 Try to acquire a connection for a maximum of timeout milliseconds. More...
 
void invalidateConnections ()
 
QgsConnectionPoolGroupoperator= (const QgsConnectionPoolGroup &other)=delete
 QgsConnectionPoolGroup cannot be copied. More...
 
void release (T conn)
 

Static Public Attributes

static const int MAX_CONCURRENT_CONNECTIONS
 

Protected Member Functions

void initTimer (QObject *parent)
 
void onConnectionExpired ()
 

Protected Attributes

QList< T > acquiredConns
 
QString connInfo
 
QMutex connMutex
 
QStack< Itemconns
 
QTimer * expirationTimer = nullptr
 
QSemaphore sem
 

Detailed Description

template<typename T>
class QgsConnectionPoolGroup< T >

Template that stores data related to one server.

It is assumed that following functions exist:

Because of issues with templates and QObject's signals and slots, this class only provides helper functions for QObject-related functionality - the place which uses the template is resonsible for:

For an example on how to use the template class, have a look at the implementation in Postgres/SpatiaLite providers.

Note
not available in Python bindings

Definition at line 57 of file qgsconnectionpool.h.

Constructor & Destructor Documentation

◆ QgsConnectionPoolGroup() [1/2]

template<typename T >
QgsConnectionPoolGroup< T >::QgsConnectionPoolGroup ( const QString &  ci)
inline

Definition at line 69 of file qgsconnectionpool.h.

◆ ~QgsConnectionPoolGroup()

template<typename T >
QgsConnectionPoolGroup< T >::~QgsConnectionPoolGroup ( )
inline

Definition at line 75 of file qgsconnectionpool.h.

◆ QgsConnectionPoolGroup() [2/2]

template<typename T >
QgsConnectionPoolGroup< T >::QgsConnectionPoolGroup ( const QgsConnectionPoolGroup< T > &  other)
delete

QgsConnectionPoolGroup cannot be copied.

Member Function Documentation

◆ acquire()

template<typename T >
T QgsConnectionPoolGroup< T >::acquire ( int  timeout)
inline

Try to acquire a connection for a maximum of timeout milliseconds.

If timeout is a negative value the calling thread will be blocked until a connection becomes available. This is the default behavior.

Returns
initialized connection or nullptr if unsuccessful

Definition at line 95 of file qgsconnectionpool.h.

◆ initTimer()

template<typename T >
void QgsConnectionPoolGroup< T >::initTimer ( QObject *  parent)
inlineprotected

Definition at line 195 of file qgsconnectionpool.h.

◆ invalidateConnections()

template<typename T >
void QgsConnectionPoolGroup< T >::invalidateConnections ( )
inline

Definition at line 180 of file qgsconnectionpool.h.

◆ onConnectionExpired()

template<typename T >
void QgsConnectionPoolGroup< T >::onConnectionExpired ( )
inlineprotected

Definition at line 206 of file qgsconnectionpool.h.

◆ operator=()

template<typename T >
QgsConnectionPoolGroup& QgsConnectionPoolGroup< T >::operator= ( const QgsConnectionPoolGroup< T > &  other)
delete

QgsConnectionPoolGroup cannot be copied.

◆ release()

template<typename T >
void QgsConnectionPoolGroup< T >::release ( conn)
inline

Definition at line 153 of file qgsconnectionpool.h.

Member Data Documentation

◆ acquiredConns

template<typename T >
QList<T> QgsConnectionPoolGroup< T >::acquiredConns
protected

Definition at line 238 of file qgsconnectionpool.h.

◆ connInfo

template<typename T >
QString QgsConnectionPoolGroup< T >::connInfo
protected

Definition at line 236 of file qgsconnectionpool.h.

◆ connMutex

template<typename T >
QMutex QgsConnectionPoolGroup< T >::connMutex
protected

Definition at line 239 of file qgsconnectionpool.h.

◆ conns

template<typename T >
QStack<Item> QgsConnectionPoolGroup< T >::conns
protected

Definition at line 237 of file qgsconnectionpool.h.

◆ expirationTimer

template<typename T >
QTimer* QgsConnectionPoolGroup< T >::expirationTimer = nullptr
protected

Definition at line 241 of file qgsconnectionpool.h.

◆ MAX_CONCURRENT_CONNECTIONS

template<typename T >
const int QgsConnectionPoolGroup< T >::MAX_CONCURRENT_CONNECTIONS
static

Definition at line 61 of file qgsconnectionpool.h.

◆ sem

template<typename T >
QSemaphore QgsConnectionPoolGroup< T >::sem
protected

Definition at line 240 of file qgsconnectionpool.h.


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