WSL/SLF GitLab Repository

Commit 3dcebb87 authored by Mathias Bavay's avatar Mathias Bavay
Browse files

Another round of fixes for Weffc++... Only things in the plugins should now remain

parent e1164d41
......@@ -44,7 +44,7 @@ ELSE(MSVC)
IF(POPC)
SET(EXTRA_WARNINGS "-Wextra -Wno-ignored-qualifiers")
ELSE(POPC)
SET(EXTRA_WARNINGS "-Wextra -pedantic")
SET(EXTRA_WARNINGS "-Wextra -pedantic") #-Weffc++
ENDIF(POPC)
IF(CMAKE_COMPILER_IS_GNUCXX)
SET(EXTRA_WARNINGS "${EXTRA_WARNINGS} -ansi")
......
......@@ -23,10 +23,13 @@ namespace mio {
#ifdef _POPC_
BufferedIOHandler::BufferedIOHandler(IOHandler& in_iohandler, const Config& in_cfg)
: iohandler(in_iohandler), cfg(in_cfg), mapBufferedGrids()
: 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), mapBufferedGrids()
: 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();
......
......@@ -292,7 +292,7 @@ class ConfigProxy {
return tmp;
}
ConfigProxy operator =(const ConfigProxy& /*i_cfg*/) {return *this;} //making VC++ happy...
ConfigProxy& operator =(const ConfigProxy& /*i_cfg*/) {return *this;} //making VC++ happy...
};
} //end namespace mio
......
......@@ -313,6 +313,17 @@ Coords::Coords(const double& in_lat_ref, const double& in_long_ref) :
setProj("LOCAL", "");
}
Coords::Coords(const Coords& c) : ref_latitude(c.ref_latitude), ref_longitude(c.ref_longitude),
altitude(c.altitude), latitude(c.latitude), longitude(c.longitude),
easting(c.easting), northing(c.northing),
grid_i(c.grid_i), grid_j(c.grid_j), grid_k(c.grid_k),
coordsystem(c.coordsystem), coordparam(c.coordparam),
convToWGS84(NULL), convFromWGS84(NULL), distance_algo(c.distance_algo)
{
setFunctionPointers();
}
/**
* @brief Returns the East coordinate in the configured projection system
* @return easting
......
......@@ -62,6 +62,7 @@ class Coords {
Coords();
Coords(const std::string& in_coordinatesystem, const std::string& in_parameters="");
Coords(const double& in_lat_ref, const double& in_long_ref);
Coords(const Coords& c);
//Operators
Coords& operator=(const Coords&); ///<Assignement operator
......
......@@ -30,18 +30,22 @@
using namespace std;
namespace mio {
const double dbl_max = std::numeric_limits<double>::max();
const double dbl_min = -std::numeric_limits<double>::max();
/**
* @brief Default constructor.
* Initializes all variables to 0, except lat/long which are initialized to IOUtils::nodata
* @param i_algorithm specify the default algorithm to use for slope computation (default=DFLT)
*/
DEMObject::DEMObject(const slope_type& i_algorithm) : Grid2DObject(), slope(), azi(), curvature(), Nx(), Ny(), Nz()
DEMObject::DEMObject(const slope_type& i_algorithm)
: Grid2DObject(), slope(), azi(), curvature(), Nx(), Ny(), Nz(),
min_altitude(dbl_max), min_slope(dbl_max), min_curvature(dbl_max),
max_altitude(dbl_min), max_slope(dbl_min), max_curvature(dbl_min),
CalculateSlope(&DEMObject::CalculateCorripio),
update_flag(INT_MAX), dflt_algorithm(i_algorithm),
slope_failures(0), curvature_failures(0)
{
min_altitude = min_slope = min_curvature = std::numeric_limits<double>::max();
max_altitude = max_slope = max_curvature = -std::numeric_limits<double>::max();
slope_failures = curvature_failures = 0;
update_flag = INT_MAX;
setDefaultAlgorithm(i_algorithm);
}
......@@ -55,13 +59,14 @@ DEMObject::DEMObject(const slope_type& i_algorithm) : Grid2DObject(), slope(), a
*/
DEMObject::DEMObject(const unsigned int& i_ncols, const unsigned int& i_nrows,
const double& i_cellsize, const Coords& i_llcorner, const slope_type& i_algorithm)
: Grid2DObject(i_ncols, i_nrows, i_cellsize, i_llcorner),
slope(), azi(), curvature(), Nx(), Ny(), Nz()
: Grid2DObject(i_ncols, i_nrows, i_cellsize, i_llcorner),
slope(), azi(), curvature(), Nx(), Ny(), Nz(),
min_altitude(dbl_max), min_slope(dbl_max), min_curvature(dbl_max),
max_altitude(dbl_min), max_slope(dbl_min), max_curvature(dbl_min),
CalculateSlope(&DEMObject::CalculateCorripio),
update_flag(INT_MAX), dflt_algorithm(i_algorithm),
slope_failures(0), curvature_failures(0)
{
min_altitude = min_slope = min_curvature = std::numeric_limits<double>::max();
max_altitude = max_slope = max_curvature = -std::numeric_limits<double>::max();
slope_failures = curvature_failures = 0;
update_flag = INT_MAX;
setDefaultAlgorithm(i_algorithm);
}
......@@ -78,11 +83,14 @@ DEMObject::DEMObject(const unsigned int& i_ncols, const unsigned int& i_nrows,
DEMObject::DEMObject(const unsigned int& i_ncols, const unsigned int& i_nrows,
const double& i_cellsize, const Coords& i_llcorner, const Array2D<double>& i_altitude,
const bool& i_update, const slope_type& i_algorithm)
: Grid2DObject(i_ncols, i_nrows, i_cellsize, i_llcorner, i_altitude),
slope(), azi(), curvature(), Nx(), Ny(), Nz()
: Grid2DObject(i_ncols, i_nrows, i_cellsize, i_llcorner, i_altitude),
slope(), azi(), curvature(), Nx(), Ny(), Nz(),
min_altitude(dbl_max), min_slope(dbl_max), min_curvature(dbl_max),
max_altitude(dbl_min), max_slope(dbl_min), max_curvature(dbl_min),
CalculateSlope(&DEMObject::CalculateCorripio),
update_flag(INT_MAX), dflt_algorithm(i_algorithm),
slope_failures(0), curvature_failures(0)
{
slope_failures = curvature_failures = 0;
update_flag = INT_MAX;
setDefaultAlgorithm(i_algorithm);
if(i_update==false) {
updateAllMinMax();
......@@ -98,11 +106,14 @@ DEMObject::DEMObject(const unsigned int& i_ncols, const unsigned int& i_nrows,
* @param i_algorithm specify the default algorithm to use for slope computation (default=DFLT)
*/
DEMObject::DEMObject(const Grid2DObject& i_dem, const bool& i_update, const slope_type& i_algorithm)
: Grid2DObject(i_dem.ncols, i_dem.nrows, i_dem.cellsize, i_dem.llcorner, i_dem.grid2D),
slope(), azi(), curvature(), Nx(), Ny(), Nz()
: Grid2DObject(i_dem.ncols, i_dem.nrows, i_dem.cellsize, i_dem.llcorner, i_dem.grid2D),
slope(), azi(), curvature(), Nx(), Ny(), Nz(),
min_altitude(dbl_max), min_slope(dbl_max), min_curvature(dbl_max),
max_altitude(dbl_min), max_slope(dbl_min), max_curvature(dbl_min),
CalculateSlope(&DEMObject::CalculateCorripio),
update_flag(INT_MAX), dflt_algorithm(i_algorithm),
slope_failures(0), curvature_failures(0)
{
slope_failures = curvature_failures = 0;
update_flag = INT_MAX;
setDefaultAlgorithm(i_algorithm);
if(i_update==false) {
updateAllMinMax();
......@@ -125,16 +136,19 @@ DEMObject::DEMObject(const Grid2DObject& i_dem, const bool& i_update, const slop
DEMObject::DEMObject(const DEMObject& i_dem, const unsigned int& i_nx, const unsigned int& i_ny,
const unsigned int& i_ncols, const unsigned int& i_nrows,
const bool& i_update, const slope_type& i_algorithm)
: Grid2DObject(i_dem, i_nx,i_ny, i_ncols,i_nrows),
slope(), azi(), curvature(), Nx(), Ny(), Nz()
: Grid2DObject(i_dem, i_nx,i_ny, i_ncols,i_nrows),
slope(), azi(), curvature(), Nx(), Ny(), Nz(),
min_altitude(dbl_max), min_slope(dbl_max), min_curvature(dbl_max),
max_altitude(dbl_min), max_slope(dbl_min), max_curvature(dbl_min),
CalculateSlope(&DEMObject::CalculateCorripio),
update_flag(i_dem.update_flag), dflt_algorithm(i_algorithm),
slope_failures(0), curvature_failures(0)
{
if ((i_ncols==0) || (i_nrows==0)) {
throw InvalidArgumentException("requesting a subset of 0 columns or rows for DEMObject", AT);
}
//handling of the update properties
slope_failures = curvature_failures = 0;
update_flag = i_dem.getUpdatePpt();
setDefaultAlgorithm(i_algorithm);
if(i_update==true) {
//if the object is in automatic update, then we only process the arrays according to
......
......@@ -47,9 +47,8 @@ class DEMObject : public Grid2DObject {
Array2D<double> azi;
Array2D<double> curvature;
Array2D<double> Nx, Ny, Nz;
double min_altitude, max_altitude;
double min_slope, max_slope;
double min_curvature, max_curvature;
double min_altitude, min_slope, min_curvature;
double max_altitude, max_slope, max_curvature;
///Keywords for slope computation algorithm
typedef enum SLOPE_TYPE {
......
......@@ -19,12 +19,6 @@
namespace mio {
#ifdef _WIN32
DynamicLibrary::DynamicLibrary(HINSTANCE i_objFile) : objFile(i_objFile){}
#else
DynamicLibrary::DynamicLibrary(void* i_objFile) : objFile(i_objFile){}
#endif
DynamicLibrary::~DynamicLibrary(void)
{
#ifdef _WIN32
......
......@@ -77,27 +77,27 @@ class DynamicLibrary {
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
// 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&) {}
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
// 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);
DynamicLibrary(HINSTANCE i_objFile) : objFile(i_objFile) {}
#else
DynamicLibrary(void* i_objFile);
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.
// 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)
......
......@@ -63,7 +63,7 @@ const unsigned int legend::font_E[char_height][char_width] = {{0,0,0,0,0,0}, {0,
//create a legend of given height
//if height is insufficient, we don't generate any content, only transparent pixels
legend::legend(const unsigned int &height, const double &minimum, const double &maximum)
legend::legend(const unsigned int &height, const double &minimum, const double &maximum) : grid(total_width, height, IOUtils::nodata)
{
drawLegend(height, minimum, maximum);
}
......@@ -290,31 +290,57 @@ const unsigned char Gradient::channel_max_color = 255;
const unsigned char Gradient::reserved_idx = 5;
const unsigned char Gradient::reserved_cols = 2;
Gradient::Gradient(const Type& type, const double& i_min, const double& i_max, const bool& i_autoscale)
Gradient::Gradient(const Type& i_type, const double& i_min, const double& i_max, const bool& i_autoscale)
: min(i_min), max(i_max), delta(i_max - i_min), type(none), model(NULL), nr_unique_cols(0), autoscale(i_autoscale)
{
set(type, i_min, i_max, i_autoscale);
nr_unique_cols = 0;
setModel(i_type);
}
void Gradient::set(const Type& type, const double& i_min, const double& i_max, const bool& i_autoscale)
Gradient::Gradient(const Gradient& c)
: min(c.min), max(c.max), delta(c.delta), type(c.type), model(NULL), nr_unique_cols(c.nr_unique_cols), autoscale(c.autoscale)
{
setModel(type);
}
Gradient& Gradient::operator=(const Gradient& source)
{
if(this != &source) {
min = source.min;
max = source.max;
delta = source.delta;
type = source.type;
nr_unique_cols = source.nr_unique_cols;
autoscale = source.autoscale;
setModel(type);
}
return *this;
}
void Gradient::set(const Type& i_type, const double& i_min, const double& i_max, const bool& i_autoscale)
{
min = i_min;
max = i_max;
delta = i_max - i_min;
autoscale = i_autoscale;
type = i_type;
if(type==terrain) model = new gr_terrain(i_min, i_max, i_autoscale);
else if(type==slope) model = new gr_slope(i_min, i_max, i_autoscale);
else if(type==azi) model = new gr_azi(i_min, i_max, i_autoscale);
else if(type==heat) model = new gr_heat(i_min, i_max, i_autoscale);
else if(type==freeze) model = new gr_freeze(i_min, i_max, i_autoscale);
else if(type==blue) model = new gr_blue(i_min, i_max, i_autoscale);
else if(type==bluewhitered) model = new gr_bluewhitered(i_min, i_max, i_autoscale);
else if(type==whitetoblk) model = new gr_whitetoblk(i_min, i_max, i_autoscale);
else if(type==blktowhite) model = new gr_blktowhite(i_min, i_max, i_autoscale);
else if(type==blue_pink) model = new gr_blue_pink(i_min, i_max, i_autoscale);
else if(type==pastel) model = new gr_pastel(i_min, i_max, i_autoscale);
else if(type==bg_isomorphic) model = new gr_bg_isomorphic(i_min, i_max, i_autoscale);
setModel(i_type);
}
void Gradient::setModel(const Type& i_type)
{
if(i_type==terrain) model = new gr_terrain(min, max, autoscale);
else if(i_type==slope) model = new gr_slope(min, max, autoscale);
else if(i_type==azi) model = new gr_azi(min, max, autoscale);
else if(i_type==heat) model = new gr_heat(min, max, autoscale);
else if(i_type==freeze) model = new gr_freeze(min, max, autoscale);
else if(i_type==blue) model = new gr_blue(min, max, autoscale);
else if(i_type==bluewhitered) model = new gr_bluewhitered(min, max, autoscale);
else if(i_type==whitetoblk) model = new gr_whitetoblk(min, max, autoscale);
else if(i_type==blktowhite) model = new gr_blktowhite(min, max, autoscale);
else if(i_type==blue_pink) model = new gr_blue_pink(min, max, autoscale);
else if(i_type==pastel) model = new gr_pastel(min, max, autoscale);
else if(i_type==bg_isomorphic) model = new gr_bg_isomorphic(min, max, autoscale);
}
void Gradient::setNrOfLevels(const unsigned char& i_nr_unique_levels) {
......
......@@ -132,9 +132,9 @@ namespace Color {
//Gradients scale between 0 and 1, but might receive some out of range values for special effects (below sea level, above snow line, etc)
class Gradient_model {
public:
Gradient_model() {}; //do not use this constructor!
Gradient_model() : X(), v_h(), v_s(), v_v() {}; //do not use this constructor!
virtual ~Gradient_model() {};
Gradient_model(const double& i_min, const double& i_max, const bool& i_autoscale) { (void)i_min; (void)i_max; (void)i_autoscale;};
Gradient_model(const double& i_min, const double& i_max, const bool& i_autoscale) : X(), v_h(), v_s(), v_v() { (void)i_min; (void)i_max; (void)i_autoscale;};
//setBgColor()
//setFgColor()
......@@ -181,6 +181,7 @@ class Gradient {
public:
/// This enum provides names for possible color gradients
typedef enum TYPE {
none, ///< no type selected
terrain, ///< suitable for DEM. if autoscale, then sea and snow line are turned off
slope, ///< suitable to represent slope
azi, ///< suitable to represent slope azimuth. In autoscale, it becomes a two color gradient
......@@ -199,7 +200,7 @@ class Gradient {
* @brief Default Constructor.
* This should be followed by a call to set() before calling getColor
*/
Gradient() {model=NULL; min=max=delta=0.; nr_unique_cols=0;};
Gradient() : min(0.), max(0.), delta(0.), type(none), model(NULL), nr_unique_cols(0), autoscale(true) { };
/**
* @brief Constructor.
......@@ -209,7 +210,9 @@ class Gradient {
* @param max_val end value of the gradient
* @param i_autoscale do autoscale for setting the colors?
*/
Gradient(const Type& type, const double& min_val, const double &max_val, const bool& i_autoscale);
Gradient(const Type& i_type, const double& min_val, const double &max_val, const bool& i_autoscale);
Gradient(const Gradient& c);
~Gradient() {delete model;};
......@@ -221,7 +224,7 @@ class Gradient {
* @param max_val end value of the gradient
* @param i_autoscale do autoscale for setting the colors?
*/
void set(const Type& type, const double& min_val, const double &max_val, const bool& i_autoscale);
void set(const Type& i_type, const double& min_val, const double &max_val, const bool& i_autoscale);
//setBgColor()
//setFgColor()
......@@ -264,9 +267,14 @@ class Gradient {
*/
void getPalette(std::vector<unsigned char> &palette, size_t &nr_colors) const;
Gradient& operator=(const Gradient& source);
static const unsigned char channel_max_color; ///< nr of colors per channel of the generated gradients
private:
void setModel(const Type& i_type);
double min, max, delta;
Type type;
Gradient_model *model;
unsigned char nr_unique_cols; ///< number of unique colors to generate for indexed images
static const unsigned char reserved_idx; ///< for indexed gradients, number of reserved indexes
......@@ -291,7 +299,7 @@ class gr_freeze : public Gradient_model {
void getColor(const double &val, double &r, double &g, double &b) const;
private:
//This gradient is interpolated in RGB color space
std::vector<double> X, v_r,v_g,v_b; ///<control points: vector of X and associated r,g,b. They must be in X ascending order
std::vector<double> X, v_r, v_g, v_b; ///<control points: vector of X and associated r,g,b. They must be in X ascending order
};
class gr_bluewhitered : public Gradient_model {
......
......@@ -81,6 +81,8 @@ class Grid2DObject {
Grid2DObject(const unsigned int& ncols, const unsigned int& nrows,
const double& cellsize, const Coords& i_llcorner, const Array2D<double>& grid2D_in);
virtual ~Grid2DObject() {};
/**
* @brief constructs an object as a subset of another grid object
* @param i_grid2Dobj (const Grid2DObject&) initial grid object
......
......@@ -36,24 +36,21 @@ Grid3DObject& Grid3DObject::operator=(const Grid3DObject& source) {
return *this;
}
Grid3DObject::Grid3DObject() : grid3D() //using Array3D default constructor
Grid3DObject::Grid3DObject()
: grid3D(), llcorner(), cellsize(0.), z(), ncols(0), nrows(0), ndepths(0), z_is_absolute(true)
{
ncols = nrows = ndepths = 0;
cellsize = 0.0;
z_is_absolute = true;
}
Grid3DObject::Grid3DObject(const Grid3DObject& i_grid3Dobj,
const unsigned int& i_nx, const unsigned int& i_ny, const unsigned int& i_nz,
const unsigned int& i_nwidths, const unsigned int& i_nheights, const unsigned int& i_ndepths)
: grid3D(i_grid3Dobj.grid3D, i_nx,i_ny,i_nz, i_nwidths,i_nheights,i_ndepths)
: grid3D(i_grid3Dobj.grid3D, i_nx,i_ny,i_nz, i_nwidths,i_nheights,i_ndepths), llcorner(i_grid3Dobj.llcorner),
cellsize(i_grid3Dobj.cellsize), z(), ncols(i_nwidths), nrows(i_nheights), ndepths(i_ndepths), z_is_absolute(true)
{
setValues(i_nwidths, i_nheights, i_ndepths, i_grid3Dobj.cellsize);
z_is_absolute = true;
//setValues(i_nwidths, i_nheights, i_ndepths, i_grid3Dobj.cellsize);
//we take the previous corner (so we use the same projection parameters)
//and we shift it by the correct X and Y distance
llcorner = i_grid3Dobj.llcorner;
if( (llcorner.getEasting()!=IOUtils::nodata) && (llcorner.getNorthing()!=IOUtils::nodata) ) {
llcorner.setXY( llcorner.getEasting()+i_nx*i_grid3Dobj.cellsize,
llcorner.getNorthing()+i_ny*i_grid3Dobj.cellsize,
......@@ -62,24 +59,28 @@ Grid3DObject::Grid3DObject(const Grid3DObject& i_grid3Dobj,
}
Grid3DObject::Grid3DObject(const unsigned int& i_ncols, const unsigned int& i_nrows, const unsigned int& i_ndepths,
const double& i_cellsize, const Coords& i_llcorner) : grid3D(i_ncols, i_nrows, i_ndepths, IOUtils::nodata)
const double& i_cellsize, const Coords& i_llcorner)
: grid3D(i_ncols, i_nrows, i_ndepths, IOUtils::nodata), llcorner(i_llcorner),
cellsize(i_cellsize), z(), ncols(i_ncols), nrows(i_nrows), ndepths(i_ndepths), z_is_absolute(true)
{
setValues(i_ncols, i_nrows, i_ndepths, i_cellsize, i_llcorner);
z_is_absolute = true;
//setValues(i_ncols, i_nrows, i_ndepths, i_cellsize, i_llcorner);
}
Grid3DObject::Grid3DObject(const unsigned int& i_ncols, const unsigned int& i_nrows, const unsigned int& i_ndepths,
const double& i_cellsize, const Coords& i_llcorner, const double& init) : grid3D(i_ncols, i_nrows, i_ndepths, init)
const double& i_cellsize, const Coords& i_llcorner, const double& init)
: grid3D(i_ncols, i_nrows, i_ndepths, init), llcorner(i_llcorner),
cellsize(i_cellsize), z(), ncols(i_ncols), nrows(i_nrows), ndepths(i_ndepths), z_is_absolute(true)
{
setValues(i_ncols, i_nrows, i_ndepths, i_cellsize, i_llcorner);
z_is_absolute = true;
//setValues(i_ncols, i_nrows, i_ndepths, i_cellsize, i_llcorner);
}
Grid3DObject::Grid3DObject(const unsigned int& i_ncols, const unsigned int& i_nrows, const unsigned int& i_ndepths,
const double& i_cellsize, const Coords& i_llcorner, const Array3D<double>& i_grid3D) : grid3D()
const double& i_cellsize, const Coords& i_llcorner, const Array3D<double>& i_grid3D)
: grid3D(i_grid3D), llcorner(i_llcorner),
cellsize(i_cellsize), z(), ncols(i_ncols), nrows(i_nrows), ndepths(i_ndepths), z_is_absolute(true)
{
set(i_ncols, i_nrows, i_ndepths, i_cellsize, i_llcorner, i_grid3D);
z_is_absolute = true;
//set(i_ncols, i_nrows, i_ndepths, i_cellsize, i_llcorner, i_grid3D);
}
bool Grid3DObject::gridify(std::vector<Coords>& vec_points) const
......
......@@ -107,11 +107,14 @@ void IOHandler::registerPlugins()
//Copy constructor
#ifdef _POPC_
//IOHandler::IOHandler(const IOHandler& aio) : cfg(aio.cfg), bormaio(aio.cfg), imisio(aio.cfg){
//IOHandler::IOHandler(const IOHandler& aio)
// : cfg(aio.cfg), mapPlugins(), copy_parameter(), copy_name(), enable_copying(false)
//{
//Nothing else so far //HACK for POPC
//}
#else
IOHandler::IOHandler(const IOHandler& aio) : IOInterface(NULL), cfg(aio.cfg), enable_copying(false)
IOHandler::IOHandler(const IOHandler& aio)
: IOInterface(NULL), cfg(aio.cfg), mapPlugins(), copy_parameter(), copy_name(), enable_copying(false)
{
//Nothing else so far
//TODO: Deal with the IOInterface* pointers, e.g. bormaio
......@@ -119,9 +122,9 @@ IOHandler::IOHandler(const IOHandler& aio) : IOInterface(NULL), cfg(aio.cfg), en
#endif
#ifdef _POPC_
IOHandler::IOHandler(const Config& cfgreader) : cfg(cfgreader), enable_copying(false)
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), enable_copying(false)
IOHandler::IOHandler(const Config& cfgreader) : IOInterface(NULL), cfg(cfgreader), mapPlugins(), copy_parameter(), copy_name(), enable_copying(false)
#endif
{
registerPlugins();
......
......@@ -21,6 +21,19 @@ namespace mio {
const std::string IOPlugin::header="<IOPlugin> libname, classname, &class, &lib</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;
}
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;
......
......@@ -25,11 +25,11 @@ namespace mio {
/**
* @class IOPlugin
* @brief A helper class representing a MeteoIO plugin in the context of the dynamic loading as implemented in class
* @brief A helper class representing a MeteoIO plugin in the context of the dynamic loading as implemented in class
* IOHandler. Each IOPlugin object represents an implementation of IOInterface or in more tangible terms it represents
* an instance of IOInterface in use. The two pointer member variables *io and *dynLibrary represent the opened
* dynamic library and the loaded object (from within that library). These pointers are essential for knowing
* how to deallocate the loaded object and library.
* how to deallocate the loaded object and library.
*
* @author Thomas Egger
* @date 2009-08-11
......@@ -40,7 +40,7 @@ class IOPlugin {
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
/**
* @brief The main constructor for the IOPlugin class
*
......@@ -51,6 +51,9 @@ class IOPlugin {
*/
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& operator=(const IOPlugin& source);
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 <<
......
......@@ -25,47 +25,39 @@ namespace mio {
const double Matrix::epsilon = 1e-9; //for considering a determinant to be zero, etc
const double Matrix::epsilon_mtr = 1e-6; //for comparing two matrix
Matrix::Matrix() {
nrows = ncols = 0;
Matrix::Matrix() : vecData(), ncols(0), nrows(0)
{
}
Matrix::Matrix(const int& rows, const int& cols) {
Matrix::Matrix(const int& rows, const int& cols) : vecData(), ncols(0), nrows(0)
{
if(rows<0 || cols<0) {
std::stringstream tmp;
tmp << "Trying construct a matrix with negative dimensions: ";
tmp << "(" << rows << "," << cols << ")";
throw IOException(tmp.str(), AT);
}
nrows = ncols = 0;
resize((unsigned)rows,(unsigned)cols);
}
Matrix::Matrix(const unsigned int& rows, const unsigned int& cols) {
nrows = ncols = 0;
resize(rows,cols);
Matrix::Matrix(const unsigned int& rows, const unsigned int& cols) : vecData(rows*cols), ncols(cols), nrows(rows)
{
//resize(rows,cols);
}
Matrix::Matrix(const unsigned int& rows, const unsigned int& cols, const double& init) {