Loading...
Searching...
No Matches
ScopedConnection.h
Go to the documentation of this file.
1/* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2
3 This file is part of the TerraLib - a Framework for building GIS enabled applications.
4
5 TerraLib is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 TerraLib is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with TerraLib. See COPYING. If not, write to
17 TerraLib Team at <terralib-team@terralib.org>.
18 */
19
20/*!
21 \file terralib/postgis/ScopedConnection.h
22
23 \brief A class that control the use of connection to a PostgreSQL database.
24*/
25
26#ifndef __TERRALIB_POSTGIS_INTERNAL_SCOPEDCONNECTION_H
27#define __TERRALIB_POSTGIS_INTERNAL_SCOPEDCONNECTION_H
28
29// TerraLib
30#include "Config.h"
31
32namespace te
33{
34 namespace pgis
35 {
36 class Connection;
37 class ConnectionPool;
38
39 /*!
40 \class ScopedConnection
41
42 \brief A class that control the use of the connection to a PostgreSQL database.
43
44 This class control the use of the connection and release the connection to the connectionPool.
45
46 \sa Connection
47 */
49 {
50 public:
51
52 /*! \brief Constructor. */
53 ScopedConnection(ConnectionPool* pool, int id = -1);
54
55 /*! \brief Destructor. */
57
58 /*! \brief Release connection. */
59 void release();
60
61 /*! Member access operator. */
63
64 protected:
65
67
69
70 private:
71
72 Connection* m_connection; //!< An available connection that will be released when the scopedConnection is deleted.
73 ConnectionPool* m_connectionPool; //!< The connection pool associated to the connection.
74
75 };
76
77 } // end namespace pgis
78} // end namespace te
79
80#endif // __TERRALIB_POSTGIS_INTERNAL_SCOPEDCONNECTION_H
This class implements a connection pool for the PostGIS driver.
A class that implements a connection to a PostgreSQL database.
Definition Connection.h:69
A class that control the use of the connection to a PostgreSQL database.
ScopedConnection & operator=(const ScopedConnection &)
ConnectionPool * m_connectionPool
The connection pool associated to the connection.
Connection * m_connection
An available connection that will be released when the scopedConnection is deleted.
void release()
Release connection.
Connection * operator->() const
ScopedConnection(const ScopedConnection &)
ScopedConnection(ConnectionPool *pool, int id=-1)
Constructor.
~ScopedConnection()
Destructor.
TerraLib.
#define TEPGISEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition Config.h:195
Proxy configuration file for TerraView (see terraview_config.h).