st/LoadModules.cpp
Go to the documentation of this file.
1 // Examples
2 #include "STExamples.h"
3 
4 // TerraLib
6 #include <terralib/core/plugin.h>
7 #include <terralib/common.h>
8 
9 
10 // STL
11 #include <iostream>
12 
14 {
15  try
16  {
17  std::string plugins_path = te::core::FindInTerraLibPath("share/terralib/plugins");
18 
20 
21 #ifdef TERRALIB_MOD_OGR_ENABLED
22  info = te::core::JSONPluginInfoSerializer(plugins_path + "/te.da.ogr.teplg.json");
25 #endif
26 
27 #ifdef TERRALIB_MOD_GDAL_ENABLED
28  info = te::core::JSONPluginInfoSerializer(plugins_path + "/te.da.gdal.teplg.json");
31 #endif
32 
33 #ifdef TERRALIB_MOD_POSTGIS_ENABLED
34  info = te::core::JSONPluginInfoSerializer(plugins_path + "/te.da.pgis.teplg.json");
37 #endif
38  }
39  catch(const boost::exception& e)
40  {
41  const std::string* err = boost::get_error_info<te::ErrorDescription>(e);
42  std::cerr << std::endl << "Failed to load data source drivers: " << *err << std::endl;
43  }
44  catch(...)
45  {
46  std::cerr << std::endl << "Failed to load data source drivers: unknow exception!" << std::endl;
47  }
48 }
49 
50 
51 
52 
Include files for Core Plugin Library.
void insert(const PluginInfo &pinfo)
Adds plugin with its plugin information to the list of unloaded plugins.
This file is a wrapper around platform specific include files.
Basic information about a plugin.
Examples on how to load/manipulate st types.
void load(const std::string &plugin_name, const bool start=true)
It tries to load the informed plugin.
std::string name
The plugin name: an internal value used to identify the plugin in the system. Must be a unique value...
static PluginManager & instance()
Access the singleton.
void LoadModules()
It loads the data source drivers.
TECOREEXPORT PluginInfo JSONPluginInfoSerializer(const std::string &file_name)
A plugin finder that search for plugins in some special directories defined by compile time macros...
Definition: Serializers.cpp:44
TECOREEXPORT std::string FindInTerraLibPath(const std::string &path)
Returns the path relative to a directory or file in the context of TerraLib.
This file contains include headers for the TerraLib Common Runtime module.