Loading...
Searching...
No Matches
DataSourceInfoManager.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/dataaccess/datasource/DataSourceInfoManager.h
22
23 \brief A singleton to keep all the registered data sources.
24*/
25
26#ifndef __TERRALIB_DATAACCESS_INTERNAL_DATASOURCEINFOMANAGER_H
27#define __TERRALIB_DATAACCESS_INTERNAL_DATASOURCEINFOMANAGER_H
28
29// TerraLib
30#include "../../common/Singleton.h"
31#include "DataSourceInfo.h"
32
33// STL
34#include <map>
35#include <string>
36#include <vector>
37
38namespace te
39{
40 namespace da
41 {
42 /*!
43 \class DataSourceInfoManager
44
45 \brief A singleton to keep all the registered data sources.
46
47 \ingroup dataaccess
48 */
50 {
52
53 public:
54
55 typedef std::map<std::string, DataSourceInfoPtr>::const_iterator const_iterator;
56 typedef std::map<std::string, DataSourceInfoPtr>::iterator iterator;
57
58 DataSourceInfoPtr get(const std::string& id) const;
59
60 bool add(const DataSourceInfoPtr& ds);
61
62 void remove(const std::string& id);
63
64 void removeByType(const std::string& dsTypeName);
65
66 void getByType(const std::string& dsTypeName, std::vector<DataSourceInfoPtr>& datasources) const;
67
68 DataSourceInfoPtr getByConnInfo(const std::string& connInfo);
69
70 std::size_t size() const;
71
73
75
77
79
80 protected:
81
83
85
86 private:
87
88 std::map<std::string, DataSourceInfoPtr> m_datasources;
89 };
90
91 } // end namespace da
92} // end namespace te
93
94#endif // __TERRALIB_DATAACCESS_INTERNAL_DATASOURCEINFOMANAGER_H
A conteiner class for keeping information about a data source.
Template support for singleton pattern.
Definition: Singleton.h:101
A singleton to keep all the registered data sources.
void removeByType(const std::string &dsTypeName)
bool add(const DataSourceInfoPtr &ds)
std::size_t size() const
std::map< std::string, DataSourceInfoPtr >::iterator iterator
std::map< std::string, DataSourceInfoPtr > m_datasources
DataSourceInfoPtr get(const std::string &id) const
void getByType(const std::string &dsTypeName, std::vector< DataSourceInfoPtr > &datasources) const
const_iterator end() const
std::map< std::string, DataSourceInfoPtr >::const_iterator const_iterator
void remove(const std::string &id)
DataSourceInfoPtr getByConnInfo(const std::string &connInfo)
const_iterator begin() const
boost::shared_ptr< DataSourceInfo > DataSourceInfoPtr
TerraLib.
#define TEDATAACCESSEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:97