27 #include "../../common/STLUtils.h"
28 #include "../../common/Translator.h"
29 #include "../Exception.h"
37 #include <boost/foreach.hpp>
38 #include <boost/format.hpp>
42 std::map<std::string, DataSourceInfoPtr>::const_iterator it =
m_datasources.find(
id);
50 throw Exception(
TE_TR(
"Can not insert a NULL data source into the manager!"));
52 if(m_datasources.find(ds->getId()) == m_datasources.end())
53 m_datasources[ds->getId()] = ds;
58 std::map<std::string, DataSourceInfoPtr>::iterator it = m_datasources.find(
id);
60 if(it == m_datasources.end())
61 throw Exception((boost::format(
TE_TR(
"There isn't a data source with the given id (%1%) in data source manager!")) %
id).str());
63 m_datasources.erase(it);
68 std::map<std::string, DataSourceInfoPtr>::iterator it = m_datasources.begin();
70 while(it!=m_datasources.end())
71 if(it->second->getType() == dsTypeName)
72 m_datasources.erase(it++);
80 std::map<std::string, DataSourceInfoPtr>::const_iterator it = m_datasources.begin();
81 std::map<std::string, DataSourceInfoPtr>::const_iterator itend = m_datasources.end();
85 if(it->second->getType() == dsTypeName)
86 datasources.push_back(it->second);
94 return m_datasources.size();
99 return m_datasources.begin();
104 return m_datasources.begin();
109 return m_datasources.end();
114 return m_datasources.end();
std::map< std::string, DataSourceInfoPtr >::iterator iterator
std::map< std::string, DataSourceInfoPtr >::const_iterator const_iterator
void getByType(const std::string &dsTypeName, std::vector< DataSourceInfoPtr > &datasources) const
#define TE_TR(message)
It marks a string in order to get translated.
DataSourceInfoPtr get(const std::string &id) const
A singleton to keep all the registered data sources.
const_iterator end() const
void add(const DataSourceInfoPtr &ds)
A conteiner class for keeping information about a data source.
void remove(const std::string &id)
void removeByType(const std::string &dsTypeName)
std::map< std::string, DataSourceInfoPtr > m_datasources
const_iterator begin() const
boost::shared_ptr< DataSourceInfo > DataSourceInfoPtr