27 #include "../../core/translator/Translator.h" 28 #include "../../core/uri/URI.h" 33 #include <boost/format.hpp> 35 std::map<std::string, te::da::DataSourceFactory::FactoryFnctType>
40 std::unique_ptr<DataSource>
ds;
43 std::map<std::string, FactoryFnctType>::const_iterator it =
sm_factories.find(driver);
46 throw Exception((boost::format(
TE_TR(
"Could not find a data source factory named: %1!")) % connInfo.
path()).str());
57 std::unique_ptr<DataSource>
ds;
61 ds =
make(driver, dsURI);
69 std::map<std::string, FactoryFnctType>::const_iterator it =
sm_factories.find(dsType);
76 std::map<std::string, FactoryFnctType>::const_iterator it =
sm_factories.find(dsType);
79 throw Exception((boost::format(
TE_TR(
"A data source factory with name '%1' is already registered.")) % dsType).str());
86 std::map<std::string, FactoryFnctType>::iterator it =
sm_factories.find(dsType);
89 throw Exception((boost::format(
TE_TR(
"There is no registered data source factory named '%1'.")) % dsType).str());
std::string path() const
Retrieving the path.
static std::unique_ptr< DataSource > make(const std::string &driver, const te::core::URI &connInfo)
static bool find(const std::string &dsType)
static std::map< std::string, FactoryFnctType > sm_factories
An abstract class for data providers like a DBMS, Web Services or a regular file. ...
Base exception class for plugin module.
bool isValid() const
Return if the given URI is valid or not.
static te::dt::Date ds(2010, 01, 01)
#define TE_TR(message)
It marks a string in order to get translated.
static void remove(const std::string &dsType)
it finalizes the GDAL factory support.
A factory for data sources.
boost::function< DataSource *(const te::core::URI &uri)> FactoryFnctType
A class for representing an Uniform Resource Identifier (URI).
static void add(const std::string &dsType, FactoryFnctType f)