WSL/SLF GitLab Repository

Commit 5fadda07 authored by Thomas Egger's avatar Thomas Egger
Browse files

The plugins are no longer separately loadable libraries, but are fully...

The plugins are no longer separately loadable libraries, but are fully incorporated into libmeteoio. All classes and facilities that provided capabilites for the dynamic loading were deleted (DynamicLibrary). IOPlugin now holds a function pointer to an instantiation function for children of IOInterface. In IOHandler::registerPlugins() all plugins need to be registered with the key name, the class name, a pointer to an instance of the class and a function pointer to the instantiation function for the class (child of IOInterface). IOInterface lost some complexity and thus the constructor of the base class does not have to be called in derived classes anymore.

The CMakeLists.txt files had to be updated to no longer make separate dynamically loadable libraries for each plugin, but to simply add the classes the user selectes to the meteoio library. 

As a side effect the io.ini key GENERAL::PLUGINPATH is no longer necessary.
parent a97ddf12
......@@ -21,16 +21,10 @@ using namespace std;
namespace mio {
#ifdef _POPC_
BufferedIOHandler::BufferedIOHandler(IOHandler& in_iohandler, const Config& in_cfg)
: iohandler(in_iohandler), cfg(in_cfg), vec_buffer_meteo(), mapBufferedGrids(), IndexBufferedGrids(),
buffer_start(), buffer_end(), chunk_size(), buff_before(), chunks(1), max_grids(10)
#else
BufferedIOHandler::BufferedIOHandler(IOHandler& in_iohandler, const Config& in_cfg)
: IOInterface(NULL), iohandler(in_iohandler), cfg(in_cfg), vec_buffer_meteo(), mapBufferedGrids(), IndexBufferedGrids(),
buffer_start(), buffer_end(), chunk_size(), buff_before(), chunks(1), max_grids(10)
#endif
{
setDfltBufferProperties();
}
......
......@@ -21,6 +21,7 @@ IF(PROJ4)
ENDIF(MSVC)
ENDIF(PROJ4)
INCLUDE("${PROJECT_SOURCE_DIR}/meteoio/plugins/CMakeLists.txt")
INCLUDE("${PROJECT_SOURCE_DIR}/meteoio/meteolaws/CMakeLists.txt")
INCLUDE("${PROJECT_SOURCE_DIR}/meteoio/meteostats/CMakeLists.txt")
INCLUDE("${PROJECT_SOURCE_DIR}/meteoio/meteofilters/CMakeLists.txt")
......@@ -63,10 +64,10 @@ SET(meteoio_sources
IOInterface.cc
StationData.cc
Config.cc
DynamicLibrary.cc
IOExceptions.cc
IOUtils.cc
MeteoData.cc
${plugins_sources}
${meteolaws_sources}
${meteostats_sources}
${meteofilters_sources}
......@@ -77,12 +78,12 @@ IF(BUILD_STATIC_LIBS)
SET(STATICNAME ${PROJECT_NAME}_STATIC)
SET(STATICLIBNAME ${PROJECT_NAME}${POPC_EXT})
ADD_LIBRARY(${STATICNAME} STATIC ${meteoio_sources})
TARGET_LINK_LIBRARIES(${STATICNAME} ${LIBPROJ} ${Popc_LIBRARIES})
TARGET_LINK_LIBRARIES(${STATICNAME} ${plugin_libs} ${LIBPROJ} ${Popc_LIBRARIES})
ENDIF(BUILD_STATIC_LIBS)
SET(SHAREDNAME ${PROJECT_NAME}${POPC_EXT})
ADD_LIBRARY(${SHAREDNAME} ${meteoio_sources})
TARGET_LINK_LIBRARIES(${SHAREDNAME} ${LIBPROJ} ${Popc_LIBRARIES})
TARGET_LINK_LIBRARIES(${SHAREDNAME} ${plugin_libs} ${LIBPROJ} ${Popc_LIBRARIES})
SET_TARGET_PROPERTIES(${SHAREDNAME} PROPERTIES
PREFIX "${LIBPREFIX}"
LIBRARY_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/lib"
......
/***********************************************************************************/
/* Copyright 2009 WSL Institute for Snow and Avalanche Research SLF-DAVOS */
/***********************************************************************************/
/* This file is part of MeteoIO.
MeteoIO is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
MeteoIO is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with MeteoIO. If not, see <http://www.gnu.org/licenses/>.
*/
#include <meteoio/DynamicLibrary.h>
namespace mio {
DynamicLibrary::~DynamicLibrary(void)
{
#ifdef _WIN32
FreeLibrary(objFile);
#else
dlclose(objFile);
#endif
}
PluginObject* DynamicLibrary::newObject(const std::string& name, const Config& cfg)
{
// If there is no valid library, return null
if(objFile == NULL) {
return NULL;
}
// Get the loadObject() function. If it doesn't exist, return NULL.
#ifdef _WIN32
#pragma warning(disable:4191) //GetProcAddress does NOT return a FARPROC, the warning misses it...
const void (*loadSym)(const std::string&, const Config&) = (const void (*)(const std::string&, const Config&))GetProcAddress(objFile, "loadObject");
#else
const void* loadSym = dlsym(objFile, "loadObject");
#endif
if(loadSym == NULL) {
return NULL;
}
//HACK: this has to stay until c++ standard handles this case...
#ifdef __GNUC__
__extension__
#endif
// Load a new instance of the requested class, and return it
void* obj = ((void* (*)(const std::string&, const Config&))(loadSym))(name, cfg);
return reinterpret_cast<PluginObject*>(obj);
}
DynamicLibrary* DynamicLoader::loadObjectFile(const std::string& file)
{
#ifdef _WIN32
HINSTANCE objFile = LoadLibrary(TEXT(file.c_str()));
#else
void* objFile = dlopen(file.c_str(), RTLD_NOW);
#endif
if(objFile == NULL) {
return NULL;
}
return new DynamicLibrary(objFile);
}
std::string DynamicLoader::getErrorMessage(){
#ifdef _WIN32
std::stringstream ss;
ss << GetLastError();
return ss.str();
#else
return std::string(dlerror());
#endif
}
PluginObject::PluginObject(void (*i_delObj)(void*)) : deleteObject(i_delObj){}
PluginObject::~PluginObject(void){}
void PluginObject::deleteSelf(void)
{
(*deleteObject)(reinterpret_cast<void*>(this));
}
} //namespace
/***********************************************************************************/
/* Copyright 2009 WSL Institute for Snow and Avalanche Research SLF-DAVOS */
/***********************************************************************************/
/* This file is part of MeteoIO.
MeteoIO is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
MeteoIO is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with MeteoIO. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __DYNAMICLIB_H__
#define __DYNAMICLIB_H__
#include <meteoio/Config.h>
#ifndef USE_PRECOMPILED_HEADERS
#ifdef _WIN32
#include <direct.h>
#include <windows.h>
#undef max
#undef min
#else
#include <dlfcn.h>
#endif
#include <iostream>
#include <sstream>
#include <string>
#include <cstdlib>
#endif
namespace mio {
/**
* @class PluginObject
* @brief The PluginObject is an interface for all dynamically loadable Objects, its main task is to register a callback destructor function
* for the object dynamically allocated
*
* @author Thomas Egger
* @date 2009-03-10
*/
class PluginObject {
private:
// Callback function that should be called to delete dynamic object
void (*deleteObject)(void*);
public:
// The constructor sets the callback function to use
PluginObject(void (*i_delObj)(void*));
// The destructor
virtual ~PluginObject(void);
// Sends "this" to the callback destructor function.
void deleteSelf(void);
};
/**
* @class DynamicLibrary
* @brief Manages lifetime of an open dynamic library
*
* @author Thomas Egger
* @date 2009-03-10
*/
class DynamicLibrary {
protected:
// The handle to the shared library that was opened
#ifdef _WIN32
HINSTANCE objFile;
#else
void *objFile;
#endif
// Since an instance of DynamicLibrary manages lifetime of an open
// library, it is important to make sure that the object isn't
// copied.
DynamicLibrary(const DynamicLibrary&) : objFile() {}
DynamicLibrary& operator=(const DynamicLibrary&) {return *this;}
// Creates a new library, with the object file handle that is passed
// in. Protected so that only the DynamicLoader can create an
// instance (since it is declared friend.
#ifdef _WIN32
DynamicLibrary(HINSTANCE i_objFile) : objFile(i_objFile) {}
#else
DynamicLibrary(void* i_objFile) : objFile(i_objFile) {}
#endif
public:
// Destructor, closes the open shared library
~DynamicLibrary(void);
// Creates a new instance of the named class, or returns NULL is the
// class isn't found.
PluginObject* newObject(const std::string& name, const Config& cfg);
friend class DynamicLoader; ///< The friend class DynamicLoader can solely instantiate the DynamicLibrary class (protected constructor)
};
/**
* @class DynamicLoader
* @brief The dynamic loader class, used for loading DynamicLibraries.
*
* @author Thomas Egger
* @date 2009-03-10
*/
class DynamicLoader {
public:
static DynamicLibrary* loadObjectFile(const std::string& file);
// Loads a DynamicLibrary, given the shared library file
// "file", with the dlopen flags supplied.
//Return last error message of dynamic link libraries
static std::string getErrorMessage();
};
} //end namespace
#endif
......@@ -76,33 +76,33 @@ namespace mio {
void IOHandler::registerPlugins()
{
#if defined(_WIN32)
const std::string libsuffix = ".dll";
#elif defined(APPLE)
const std::string libsuffix = ".dylib";
#else
const std::string libsuffix = ".so";
//mapPlugins[io.ini KEY]= IOPlugin(library file name, class name, NULL, NULL);
mapPlugins["SMET"] = IOPlugin("SMETIO", NULL, &IOPlugin::createInstance<SMETIO>);
mapPlugins["ARC"] = IOPlugin("ARCIO", NULL, &IOPlugin::createInstance<ARCIO>);
mapPlugins["A3D"] = IOPlugin("A3DIO", NULL, &IOPlugin::createInstance<A3DIO>);
mapPlugins["ARPS"] = IOPlugin("ARPSIO", NULL, &IOPlugin::createInstance<ARPSIO>);
mapPlugins["GRASS"] = IOPlugin("GrassIO", NULL, &IOPlugin::createInstance<GrassIO>);
mapPlugins["GEOTOP"] = IOPlugin("GeotopIO", NULL, &IOPlugin::createInstance<GeotopIO>);
mapPlugins["SNOWPACK"] = IOPlugin("SNIO", NULL, &IOPlugin::createInstance<SNIO>);
mapPlugins["PGM"] = IOPlugin("PGMIO", NULL, &IOPlugin::createInstance<PGMIO>);
#ifdef PLUGIN_IMISIO
mapPlugins["IMIS"] = IOPlugin("ImisIO", NULL, &IOPlugin::createInstance<ImisIO>);
#endif
#ifdef _POPC_
const std::string popc_extra = "popc";
#else
const std::string popc_extra = "";
#ifdef PLUGIN_GRIBIO
mapPlugins["GRIB"] = IOPlugin("GRIBIO", NULL, &IOPlugin::createInstance<GRIBIO>);
#endif
#ifdef PLUGIN_PNGIO
mapPlugins["PNG"] = IOPlugin("PNGIO", NULL, &IOPlugin::createInstance<PNGIO>);
#endif
#ifdef PLUGIN_BORMAIO
mapPlugins["BORMA"] = IOPlugin("BormaIO", NULL, &IOPlugin::createInstance<BormaIO>);
#endif
#ifdef PLUGIN_COSMOXMLIO
mapPlugins["COSMOXML"] = IOPlugin("CosmoXMLIO", NULL, &IOPlugin::createInstance<CosmoXMLIO>);
#endif
#ifdef PLUGIN_GSNIO
mapPlugins["GSN"] = IOPlugin("GSNIO", NULL, &IOPlugin::createInstance<GSNIO>);
#endif
//mapPlugins[io.ini KEY]= IOPlugin(library file name, class name, NULL, NULL);
mapPlugins["A3D"] = IOPlugin("liba3dio"+popc_extra+libsuffix, "A3DIO", NULL, NULL);
mapPlugins["BORMA"] = IOPlugin("libbormaio"+popc_extra+libsuffix, "BormaIO", NULL, NULL);
mapPlugins["IMIS"] = IOPlugin("libimisio"+popc_extra+libsuffix, "ImisIO", NULL, NULL);
mapPlugins["GEOTOP"] = IOPlugin("libgeotopio"+popc_extra+libsuffix, "GeotopIO", NULL, NULL);
mapPlugins["SNOWPACK"] = IOPlugin("libsnio"+popc_extra+libsuffix, "SNIO", NULL, NULL);
mapPlugins["GSN"] = IOPlugin("libgsnio"+popc_extra+libsuffix, "GSNIO", NULL, NULL);
mapPlugins["ARC"] = IOPlugin("libarcio"+popc_extra+libsuffix, "ARCIO", NULL, NULL);
mapPlugins["GRASS"] = IOPlugin("libgrassio"+popc_extra+libsuffix, "GrassIO", NULL, NULL);
mapPlugins["ARPS"] = IOPlugin("libarpsio"+popc_extra+libsuffix, "ARPSIO", NULL, NULL);
mapPlugins["PGM"] = IOPlugin("libpgmio"+popc_extra+libsuffix, "PGMIO", NULL, NULL);
mapPlugins["PNG"] = IOPlugin("libpngio"+popc_extra+libsuffix, "PNGIO", NULL, NULL);
mapPlugins["SMET"] = IOPlugin("libsmetio"+popc_extra+libsuffix, "SMETIO", NULL, NULL);
mapPlugins["COSMOXML"] = IOPlugin("libcosmoxmlio"+popc_extra+libsuffix, "CosmoXMLIO", NULL, NULL);
mapPlugins["GRIB"] = IOPlugin("libgribio"+popc_extra+libsuffix, "GRIBIO", NULL, NULL);
}
//Copy constructor
......@@ -114,18 +114,14 @@ void IOHandler::registerPlugins()
//}
#else
IOHandler::IOHandler(const IOHandler& aio)
: IOInterface(NULL), cfg(aio.cfg), mapPlugins(), copy_parameter(), copy_name(), enable_copying(false)
: cfg(aio.cfg), mapPlugins(), copy_parameter(), copy_name(), enable_copying(false)
{
//Nothing else so far
//TODO: Deal with the IOInterface* pointers, e.g. bormaio
}
#endif
#ifdef _POPC_
IOHandler::IOHandler(const Config& cfgreader) : cfg(cfgreader), mapPlugins(), copy_parameter(), copy_name(), enable_copying(false)
#else
IOHandler::IOHandler(const Config& cfgreader) : IOInterface(NULL), cfg(cfgreader), mapPlugins(), copy_parameter(), copy_name(), enable_copying(false)
#endif
{
registerPlugins();
parse_copy_config();
......@@ -139,60 +135,11 @@ IOHandler::~IOHandler() throw(){
// Get rid of the objects
std::map<std::string, IOPlugin>::iterator mapit;
for (mapit = mapPlugins.begin(); mapit!=mapPlugins.end(); mapit++){
deletePlugin((mapit->second).dynLibrary, (mapit->second).io);
}
}
#ifdef _POPC_
void IOHandler::deletePlugin(DynamicLibrary*& dynLibrary, IOInterface*& io)
#else
void IOHandler::deletePlugin(DynamicLibrary*& dynLibrary, IOInterface*& io) throw()
#endif
{
if (dynLibrary != NULL) {
IOInterface*& io = (mapit->second).io;
if (io != NULL) {
io->deleteSelf();
delete io;
io = NULL;
}
// Close the dynamic library
#ifndef _POPC_ //HACK: this line causes a segfault in the parallel version for unknown reasons, lwk
delete dynLibrary;
#endif
}
}
void IOHandler::loadPlugin(const std::string& libname, const std::string& classname, DynamicLibrary*& dynLibrary, IOInterface*& io)
{
std::string pluginpath = "";
try {
cfg.getValue("PLUGINPATH", pluginpath, Config::nothrow);
if (pluginpath.length() > 0 && pluginpath.at( pluginpath.length() - 1 )!='/')
pluginpath += "/";
//Which dynamic library needs to be loaded
const std::string filename = pluginpath + libname;
dynLibrary = DynamicLoader::loadObjectFile(filename);
if(dynLibrary == NULL) {
cerr << AT << ": [E] Failed loading dynamic plugin " << classname << " from " << filename << std::endl;
cerr << "\t" << DynamicLoader::getErrorMessage() << std::endl;
cerr << "Please check your PLUGINPATH in your configuration file!" << std::endl;
} else {
io = dynamic_cast<IOInterface*>((dynLibrary)->newObject(classname, cfg));
if(io == NULL) {
cerr << AT << ": [E] Failed loading dynamic plugin " << classname << " from " << filename << "(NULL pointer to plugin's class)" << std::endl;
//delete dynLibrary; This causes a segfault !!
} else {
cerr << "[i] Success loading dynamic plugin " << classname << " from " << filename << std::endl;
}
}
} catch (const std::exception& e) {
#ifndef _POPC_ //HACK: this line causes a segfault in the parallel version for unknown reasons, lwk
if (dynLibrary != NULL)
delete dynLibrary;
#endif
cerr << AT << ": [E] failed while loading plugin with error: \n" << e.what() << std::endl;
}
}
......@@ -203,10 +150,12 @@ IOInterface* IOHandler::getPlugin(const std::string& cfgkey, const std::string&
std::map<std::string, IOPlugin>::iterator mapit = mapPlugins.find(op_src);
if (mapit == mapPlugins.end())
throw IOException("Can not find plugin " + op_src + " as requested in file " + cfg.getSourceName() + ". Has its developer declared it in IOHandler::registerPlugins?", AT);
throw IOException("Cannot find plugin " + op_src + " as requested in file " + cfg.getSourceName() + ". Has its developer declared it in IOHandler::registerPlugins?", AT);
if ((mapit->second).io == NULL){
loadPlugin((mapit->second).libname, (mapit->second).classname, (mapit->second).dynLibrary, (mapit->second).io);
(mapit->second).io = (mapit->second).creator_func(cfg);
}
//Now check if it is correctly loaded
if ((mapit->second).io == NULL) {
throw IOException("Requesting to read/write data with plugin '" + op_src + "', but plugin is not loaded", AT);
}
......
......@@ -26,6 +26,31 @@
#include <meteoio/IOExceptions.h>
#include <meteoio/IOPlugin.h>
#include <meteoio/plugins/SMETIO.h>
#include <meteoio/plugins/ARCIO.h>
#include <meteoio/plugins/A3DIO.h>
#include <meteoio/plugins/ARPSIO.h>
#include <meteoio/plugins/GrassIO.h>
#include <meteoio/plugins/GeotopIO.h>
#include <meteoio/plugins/PGMIO.h>
#include <meteoio/plugins/SNIO.h>
#ifdef PLUGIN_IMISIO
#include <meteoio/plugins/ImisIO.h>
#endif
#ifdef PLUGIN_GRIBIO
#include <meteoio/plugins/GRIBIO.h>
#endif
#ifdef PLUGIN_PNGIO
#include <meteoio/plugins/PNGIO.h>
#endif
#ifdef PLUGIN_GSNIO
#include <meteoio/plugins/GSNIO.h>
#endif
#include <map>
#include <string>
......@@ -88,14 +113,6 @@ class IOHandler : public IOInterface {
#endif
private:
void loadDynamicPlugins();
void loadPlugin(const std::string& libname, const std::string& classname,
DynamicLibrary*& dynLibrary, IOInterface*& io);
#ifdef _POPC_
void deletePlugin(DynamicLibrary*& dynLibrary, IOInterface*& io);
#else
void deletePlugin(DynamicLibrary*& dynLibrary, IOInterface*& io) throw();
#endif
void registerPlugins();
IOInterface *getPlugin(const std::string& cfgkey, const std::string& cfgsection="GENERAL");
......
......@@ -19,8 +19,6 @@
namespace mio {
IOInterface::IOInterface(void (*delObj)(void*)) : PluginObject(delObj){}
IOInterface::~IOInterface(){}
} //namespace
......@@ -22,7 +22,6 @@
#include <meteoio/Array2D.h>
#include <meteoio/Date.h>
#include <meteoio/DEMObject.h>
#include <meteoio/DynamicLibrary.h>
#include <meteoio/Grid2DObject.h>
#include <meteoio/MeteoData.h>
#include <meteoio/StationData.h>
......@@ -88,10 +87,8 @@ namespace mio {
* @author Thomas Egger
* @date 2009-01-08
*/
class IOInterface : public PluginObject {
class IOInterface {
public:
IOInterface(void (*delObj)(void*));
virtual ~IOInterface();
/**
......
......@@ -19,26 +19,25 @@
namespace mio {
const std::string IOPlugin::header="<IOPlugin> libname, classname, &class, &lib</IOPlugin>";
const std::string IOPlugin::header="<IOPlugin> classname, &class, &creator_func</IOPlugin>";
IOPlugin& IOPlugin::operator=(const IOPlugin& source)
{
//since this represents a plugin on a given machine/node, since the pointers point to entry points
//in the compiled code, they should remain valid and therefore can be copied
if(this != &source) {
libname = source.libname;
classname = source.classname;
io = source.io;
dynLibrary = source.dynLibrary;
creator_func = source.creator_func;
}
return *this;
}
std::ostream& operator<<(std::ostream& os, const IOPlugin& data) {
const unsigned int pt_w=8;
os << "<IOPlugin>" << std::setw(21) << data.libname << "," << std::setw(10) << data.classname;
os << "<IOPlugin>" << std::setw(10) << data.classname;
os << "," << std::showbase << std::setw(pt_w+2) << data.io;
os << "," << std::showbase << std::setw(pt_w+2) << data.dynLibrary << "</IOPlugin>\n";
os << "," << std::showbase << std::setw(pt_w+2) << data.creator_func << "</IOPlugin>\n";
return os;
}
......
......@@ -36,10 +36,9 @@ namespace mio {
*/
class IOPlugin {
public:
std::string libname; ///< A string representing the file to be loaded, e.g. "libgeotopio.so", can be empty
std::string classname; ///< Classname of the object to be loaded from that dynamic library (e.g. "A3DIO")
IOInterface *io; ///< The pointer to the actual dynamically loaded instance of IOInterface
DynamicLibrary *dynLibrary; ///< The pointer to the opened dynamic library
IOInterface* (*creator_func)(const Config&); ///< The function pointer to the instantiation function
/**
* @brief The main constructor for the IOPlugin class
......@@ -49,12 +48,14 @@ class IOPlugin {
* @param p1 A pointer to the loaded object of type IOInterface (or NULL)
* @param p2 A pointer to the loaded dynamic library (or NULL)
*/
IOPlugin(std::string i_s1, std::string i_s2, IOInterface *p1, DynamicLibrary *p2) : libname(i_s1), classname(i_s2), io(p1), dynLibrary(p2){}
IOPlugin() : libname(""), classname(""), io(NULL), dynLibrary(NULL){}
IOPlugin(const IOPlugin& c) : libname(c.libname), classname(c.classname), io(c.io), dynLibrary(c.dynLibrary){}
IOPlugin(std::string i_s2, IOInterface *p1, IOInterface*(*p2)(const Config&)) : classname(i_s2), io(p1), creator_func(p2){}
IOPlugin() : classname(""), io(NULL), creator_func(NULL){}
IOPlugin(const IOPlugin& c) : classname(c.classname), io(c.io), creator_func(c.creator_func){}
IOPlugin& operator=(const IOPlugin& source);
template<typename T> static IOInterface* createInstance(const Config& cfg) { return new T(cfg); }
friend std::ostream& operator<<(std::ostream& os, const IOPlugin& data);
static const std::string header; //to contain a helpful header for understanding the output of <<
......
......@@ -117,7 +117,6 @@ namespace mio {
* The keys and their location in the configuration file (ie: to which section they belong) depends on the module that is actually using them. The optional keys depend on the specific options handled by each specific module (or plugin, or algorithm). Therefore, we can draw the following skeleton:
* @code
* [General]
* PLUGINPATH = ../../lib #optional, if not provided the plugins will be search in the normal library path
*
* [Input]
* COORDSYS = CH1903 #mandatory: which coordinate system is used for the geographic coordinates
......
......@@ -59,17 +59,8 @@ namespace mio {
const double A3DIO::plugin_nodata = -9999.0; //plugin specific nodata value
const unsigned int A3DIO::buffer_reserve = 23*24*2; //kind of average size of a buffer for optimizing vectors
A3DIO::A3DIO(void (*delObj)(void*), const Config& i_cfg)
: IOInterface(delObj), cfg(i_cfg),
in_tz(0.), out_tz(0.), fin(), coordin(), coordinparam(), coordout(), coordoutparam()
{
IOUtils::getProjectionParameters(cfg, coordin, coordinparam, coordout, coordoutparam);
in_tz = out_tz = 0.;
IOUtils::getTimeZoneParameters(cfg, in_tz, out_tz);
}
A3DIO::A3DIO(const std::string& configfile)
: IOInterface(NULL), cfg(configfile),
: cfg(configfile),
in_tz(0.), out_tz(0.), fin(), coordin(), coordinparam(), coordout(), coordoutparam()
{
IOUtils::getProjectionParameters(cfg, coordin, coordinparam, coordout, coordoutparam);
......@@ -78,7 +69,7 @@ A3DIO::A3DIO(const std::string& configfile)
}
A3DIO::A3DIO(const Config& in_cfg)
: IOInterface(NULL), cfg(in_cfg),
: cfg(in_cfg),
in_tz(0.), out_tz(0.), fin(), coordin(), coordinparam(), coordout(), coordoutparam()
{
IOUtils::getProjectionParameters(cfg, coordin, coordinparam, coordout, coordoutparam);
......@@ -956,25 +947,4 @@ void A3DIO::write2DMeteo(const std::vector< std::vector<MeteoData> >& data)