WSL/SLF GitLab Repository

Commit 9987af2f authored by Thomas Egger's avatar Thomas Egger
Browse files

Added the namespace mio to all classes within MeteoIO (plugins included)

Changed the name of the Date_IO class to Date. In case of namespace conflicts, just use mio::Date to reference the MeteoIO Date class.
parent 070d0974
......@@ -54,6 +54,7 @@
*/
using namespace std;
using namespace mio;
const double A3DIO::plugin_nodata = -9999.0; //plugin specific nodata value
......@@ -114,7 +115,7 @@ void A3DIO::readLanduse(Grid2DObject& landuse_out)
throw IOException("Nothing implemented here", AT);
}
void A3DIO::readAssimilationData(const Date_IO& date_in, Grid2DObject& da_out)
void A3DIO::readAssimilationData(const Date& date_in, Grid2DObject& da_out)
{
//Nothing so far
(void)date_in;
......@@ -130,19 +131,19 @@ void A3DIO::writeMeteoData(const std::vector< std::vector<MeteoData> >&,
throw IOException("Nothing implemented here", AT);
}
void A3DIO::readStationData(const Date_IO&, std::vector<StationData>&)
void A3DIO::readStationData(const Date&, std::vector<StationData>&)
{
//Nothing so far
throw IOException("Nothing implemented here", AT);
}
void A3DIO::readMeteoData(const Date_IO& dateStart, const Date_IO& dateEnd, std::vector< std::vector<MeteoData> >& vecMeteo)
void A3DIO::readMeteoData(const Date& dateStart, const Date& dateEnd, std::vector< std::vector<MeteoData> >& vecMeteo)
{
std::vector< std::vector<StationData> > vecStation;
readMeteoData(dateStart, dateEnd, vecMeteo, vecStation);
}
void A3DIO::readMeteoData(const Date_IO& dateStart, const Date_IO& dateEnd,
void A3DIO::readMeteoData(const Date& dateStart, const Date& dateEnd,
std::vector< std::vector<MeteoData> >& vecMeteo,
std::vector< std::vector<StationData> >& vecStation,
const unsigned int& stationindex)
......@@ -184,14 +185,14 @@ void A3DIO::convertUnits(MeteoData& meteo)
}
}
void A3DIO::read1DMeteo(const Date_IO& dateStart, const Date_IO& dateEnd,
void A3DIO::read1DMeteo(const Date& dateStart, const Date& dateEnd,
std::vector< std::vector<MeteoData> >& vecMeteo,
std::vector< std::vector<StationData> >& vecStation)
{
double latitude=IOUtils::nodata, longitude=IOUtils::nodata,
xcoord=IOUtils::nodata, ycoord=IOUtils::nodata, altitude=IOUtils::nodata;
std::string tmp="", line="";
Date_IO tmp_date;
Date tmp_date;
std::vector<std::string> tmpvec;
std::map<std::string, std::string> header; // A map to save key value pairs of the file header
MeteoData tmpdata;
......@@ -243,7 +244,7 @@ void A3DIO::read1DMeteo(const Date_IO& dateStart, const Date_IO& dateEnd,
sd.setStationData(location, "");
//Read one line, construct Date_IO object and see whether date is greater or equal than the date_in object
//Read one line, construct Date object and see whether date is greater or equal than the date_in object
IOUtils::skipLines(fin, 1, eoln); //skip rest of line
//Loop going through the data sequentially until dateStart is found
......@@ -287,7 +288,7 @@ void A3DIO::read1DMeteo(const Date_IO& dateStart, const Date_IO& dateEnd,
bool A3DIO::readMeteoDataLine(std::string& line, MeteoData& tmpdata, std::string filename)
{
Date_IO tmp_date;
Date tmp_date;
int tmp_ymdh[4];
std::vector<std::string> tmpvec;
double tmp_values[6];
......@@ -342,8 +343,8 @@ bool A3DIO::readMeteoDataLine(std::string& line, MeteoData& tmpdata, std::string
//1D and 2D data must correspond, that means that if there is 1D data
//for a certain date (e.g. 1.1.2006) then 2D data must exist (prec2006.txt etc),
//otherwise throw FileNotFoundException
Date_IO startDate(vecMeteo[0][0].date);
Date_IO endDate(vecMeteo[0][vecMeteo[0].size()-1].date);
Date startDate(vecMeteo[0][0].date);
Date endDate(vecMeteo[0][vecMeteo[0].size()-1].date);
constructMeteo2DFilenames(startDate, endDate, filenames);//get all files for all years
stations = getNrOfStations(filenames, hashStations);
......@@ -415,7 +416,7 @@ bool A3DIO::readMeteoDataLine(std::string& line, MeteoData& tmpdata, std::string
}
}
void A3DIO::constructMeteo2DFilenames(const Date_IO& startDate, const Date_IO& endDate, std::vector<std::string>& filenames)
void A3DIO::constructMeteo2DFilenames(const Date& startDate, const Date& endDate, std::vector<std::string>& filenames)
{
int startyear=0, endyear=0, dummy=0;
std::string tmp;
......@@ -495,7 +496,7 @@ void A3DIO::read2DMeteoData(const std::string& filename, const std::string& para
std::string line_in = "";
unsigned int columns;
std::vector<std::string> tmpvec, vec_names;
Date_IO tmp_date;
Date tmp_date;
int tmp_ymdh[4];
fin.clear();
......@@ -526,7 +527,7 @@ void A3DIO::read2DMeteoData(const std::string& filename, const std::string& para
if (IOUtils::readLineToVec(line_in, tmpvec)!=columns) { //Every station has to have its own column
throw InvalidFormatException("Premature End of Line or no data for date "
+ vecM[0][bufferindex].date.toString(Date_IO::FULL) + " found in File "
+ vecM[0][bufferindex].date.toString(Date::FULL) + " found in File "
+ filename, AT);
}
......@@ -547,25 +548,25 @@ void A3DIO::read2DMeteoData(const std::string& filename, const std::string& para
if (parameter == "nswc") {
if (!IOUtils::convertString(tmpmd.hnw, tmpvec[ii], std::dec)) {
throw ConversionFailedException("For hnw value in " + filename + " for date " + tmpmd.date.toString(Date_IO::FULL), AT);
throw ConversionFailedException("For hnw value in " + filename + " for date " + tmpmd.date.toString(Date::FULL), AT);
}
} else if (parameter == "rh") {
if (!IOUtils::convertString(tmpmd.rh, tmpvec[ii], std::dec)) {
throw ConversionFailedException("For rh value in " + filename + " for date " + tmpmd.date.toString(Date_IO::FULL), AT);
throw ConversionFailedException("For rh value in " + filename + " for date " + tmpmd.date.toString(Date::FULL), AT);
}
} else if (parameter == "ta") {
if (!IOUtils::convertString(tmpmd.ta, tmpvec[ii], std::dec))
throw ConversionFailedException("For ta value in " + filename + " for date " + tmpmd.date.toString(Date_IO::FULL), AT);
throw ConversionFailedException("For ta value in " + filename + " for date " + tmpmd.date.toString(Date::FULL), AT);
} else if (parameter == "vw") {
if (!IOUtils::convertString(tmpmd.vw, tmpvec[ii], std::dec)) {
throw ConversionFailedException("For vw value in " + filename + " for date " + tmpmd.date.toString(Date_IO::FULL), AT);
throw ConversionFailedException("For vw value in " + filename + " for date " + tmpmd.date.toString(Date::FULL), AT);
}
} else if (parameter == "dw") {
if (!IOUtils::convertString(tmpmd.dw, tmpvec[ii], std::dec)) {
throw ConversionFailedException("For dw value in " + filename + " for date " + tmpmd.date.toString(Date_IO::FULL), AT);
throw ConversionFailedException("For dw value in " + filename + " for date " + tmpmd.date.toString(Date::FULL), AT);
}
}
}
......
......@@ -29,6 +29,8 @@
#include <vector>
#include <map>
namespace mio {
class A3DIO : public IOInterface {
public:
//virtual A3DIO* clone() const;
......@@ -44,14 +46,14 @@ class A3DIO : public IOInterface {
virtual void readDEM(DEMObject& dem_out);
virtual void readLanduse(Grid2DObject& landuse_out);
virtual void readAssimilationData(const Date_IO&, Grid2DObject& da_out);
virtual void readAssimilationData(const Date&, Grid2DObject& da_out);
virtual void readStationData(const Date_IO& date, std::vector<StationData>& vecStation);
virtual void readStationData(const Date& date, std::vector<StationData>& vecStation);
virtual void readMeteoData(const Date_IO& dateStart, const Date_IO& dateEnd,
virtual void readMeteoData(const Date& dateStart, const Date& dateEnd,
std::vector< std::vector<MeteoData> >& vecMeteo);
virtual void readMeteoData(const Date_IO& dateStart, const Date_IO& dateEnd,
virtual void readMeteoData(const Date& dateStart, const Date& dateEnd,
std::vector< std::vector<MeteoData> >& vecMeteo,
std::vector< std::vector<StationData> >& vecStation,
const unsigned int& stationindex=IOUtils::npos);
......@@ -66,11 +68,11 @@ class A3DIO : public IOInterface {
private:
static const double plugin_nodata; //plugin specific nodata value, e.g. -9999
void read1DMeteo(const Date_IO& dateStart, const Date_IO& dateEnd,
void read1DMeteo(const Date& dateStart, const Date& dateEnd,
std::vector< std::vector<MeteoData> >&, std::vector< std::vector<StationData> >&); ///< No buffering
void read2DMeteo(std::vector< std::vector<MeteoData> >&, std::vector< std::vector<StationData> >&); ///< No buffering
void constructMeteo2DFilenames(const Date_IO& _startDate, const Date_IO& _endDate, std::vector<std::string>& _filenames);
void constructMeteo2DFilenames(const Date& _startDate, const Date& _endDate, std::vector<std::string>& _filenames);
bool readMeteoDataLine(std::string& line, MeteoData& tmpdata, std::string filename);
void convertUnits(MeteoData& meteo);
void cleanup() throw();
......@@ -85,5 +87,6 @@ class A3DIO : public IOInterface {
std::ifstream fin; //Input file streams
std::string coordin, coordinparam, coordout, coordoutparam; //projection parameters
};
} //end namespace
#endif
......@@ -33,6 +33,8 @@
* @author Thomas Egger
* @date 2009-05-02
*/
namespace mio {
template<class T> class Array {
public:
Array(const unsigned int& asize=0);
......@@ -423,5 +425,6 @@ template<class T> const Array<T> Array<T>::operator/(const T& rhs)
return result;
}
} //end namespace mio
#endif
......@@ -26,6 +26,8 @@
#define NOSAFECHECKS
namespace mio {
template <class T> class Array2D;
/**
......@@ -126,7 +128,6 @@ template<class T> class Array2D {
unsigned int ny;
};
template<class T> T& Array2D<T>::operator()(const unsigned int& x, const unsigned int& y) {
#ifndef NOSAFECHECKS
if ((x >= nx) || (y >= ny)) {
......@@ -501,4 +502,6 @@ template<class T> const Array2D<T> Array2D<T>::operator/(const T& rhs)
return result;
}
} //end namespace mio
#endif
......@@ -26,6 +26,8 @@
#define NOSAFECHECKS
namespace mio {
template <class T> class Array3D;
template <class T> class Array3DProxy2;
......@@ -153,7 +155,6 @@ template<class T> class Array3D {
unsigned int nxny; //nx times ny
};
template<class T> T& Array3D<T>::operator()(const unsigned int& x, const unsigned int& y, const unsigned int& z) {
#ifndef NOSAFECHECKS
if ((x >= nx) || (y >= ny) || (z >= nz)) {
......@@ -567,5 +568,6 @@ template<class T> const Array3D<T> Array3D<T>::operator/(const T& rhs)
return result;
}
} //end namespace mio
#endif
......@@ -18,6 +18,7 @@
#include "BufferedIOHandler.h"
using namespace std;
using namespace mio;
#ifdef _POPC_
BufferedIOHandler::BufferedIOHandler(IOHandler& _iohandler, const ConfigReader& _cfg)
......@@ -81,9 +82,9 @@ void BufferedIOHandler::readLanduse(Grid2DObject& _grid2Dobj)
_grid2Dobj = tmpgrid2D;
}
void BufferedIOHandler::readAssimilationData(const Date_IO& _date, Grid2DObject& _grid2Dobj)
void BufferedIOHandler::readAssimilationData(const Date& _date, Grid2DObject& _grid2Dobj)
{
std::map<std::string, Grid2DObject>::iterator it = mapBufferedGrids.find("/:ASSIMILATIONDATA" + _date.toString(Date_IO::FULL));
std::map<std::string, Grid2DObject>::iterator it = mapBufferedGrids.find("/:ASSIMILATIONDATA" + _date.toString(Date::FULL));
if (it != mapBufferedGrids.end()) { //already in map
_grid2Dobj = (*it).second;
return;
......@@ -91,11 +92,11 @@ void BufferedIOHandler::readAssimilationData(const Date_IO& _date, Grid2DObject&
Grid2DObject tmpgrid2D;
iohandler.readAssimilationData(_date, tmpgrid2D);
mapBufferedGrids["/:ASSIMILATIONDATA" + _date.toString(Date_IO::FULL)] = tmpgrid2D;
mapBufferedGrids["/:ASSIMILATIONDATA" + _date.toString(Date::FULL)] = tmpgrid2D;
_grid2Dobj = tmpgrid2D;
}
void BufferedIOHandler::readStationData(const Date_IO& date, std::vector<StationData>& vecStation)
void BufferedIOHandler::readStationData(const Date& date, std::vector<StationData>& vecStation)
{
iohandler.readStationData(date, vecStation);
}
......@@ -113,7 +114,7 @@ void BufferedIOHandler::writeMeteoData(const std::vector< std::vector<MeteoData>
iohandler.writeMeteoData(vecMeteo, vecStation, name);
}
void BufferedIOHandler::readMeteoData(const Date_IO& dateStart, const Date_IO& dateEnd, std::vector< std::vector<MeteoData> >& vecMeteo)
void BufferedIOHandler::readMeteoData(const Date& dateStart, const Date& dateEnd, std::vector< std::vector<MeteoData> >& vecMeteo)
{
std::vector< std::vector<StationData> > vecStation;
readMeteoData(dateStart, dateEnd, vecMeteo, vecStation);
......@@ -122,11 +123,11 @@ void BufferedIOHandler::readMeteoData(const Date_IO& dateStart, const Date_IO& d
void BufferedIOHandler::setBufferProperties()
{
always_rebuffer = true;
bufferbefore = Date_IO(2.0); //minus 2 days
bufferafter = Date_IO(20.0); //plus 20 days
bufferbefore = Date(2.0); //minus 2 days
bufferafter = Date(20.0); //plus 20 days
}
void BufferedIOHandler::readMeteoData(const Date_IO& date_in, std::vector<MeteoData>& vecMeteo, std::vector<StationData>& vecStation){
void BufferedIOHandler::readMeteoData(const Date& date_in, std::vector<MeteoData>& vecMeteo, std::vector<StationData>& vecStation){
/* For every station:
* 1) See whether data is already buffered
* 2) Filter - includes resampling
......@@ -166,7 +167,7 @@ void BufferedIOHandler::readMeteoData(const Date_IO& date_in, std::vector<MeteoD
if (rebuffer){
//cout << "[I] Station " << ii << "(" << stationName
// << ") data for date " << date_in.toString(Date_IO::FULL) << " not in buffer ..." << endl;
// << ") data for date " << date_in.toString(Date::FULL) << " not in buffer ..." << endl;
bool dataexists = bufferData(date_in, ii);
if (dataexists) {//date_in is contained in buffer
......@@ -189,7 +190,7 @@ void BufferedIOHandler::readMeteoData(const Date_IO& date_in, std::vector<MeteoD
vecMeteo.push_back(md);
vecStation.push_back(sd);
} else {
cout << "[I] No data found for station " << stationName << " at date " << date_in.toString(Date_IO::FULL)
cout << "[I] No data found for station " << stationName << " at date " << date_in.toString(Date::FULL)
<< endl;
vecMeteo.push_back(MeteoData());
vecMeteo[ii].date = date_in; //set correct date
......@@ -203,11 +204,11 @@ void BufferedIOHandler::readMeteoData(const Date_IO& date_in, std::vector<MeteoD
vecMeteo[0].date = date_in; //set correct date
vecStation.push_back(StationData());
//throw IOException("[E] No data for any station for date " + date_in.toString(Date_IO::FULL) + " found", AT);
//throw IOException("[E] No data for any station for date " + date_in.toString(Date::FULL) + " found", AT);
}
}
void BufferedIOHandler::getNextMeteoData(const Date_IO& _date, std::vector<MeteoData>& vecMeteo, std::vector<StationData>& vecStation)
void BufferedIOHandler::getNextMeteoData(const Date& _date, std::vector<MeteoData>& vecMeteo, std::vector<StationData>& vecStation)
{
//TODO: check whether there is something in the buffer!
//Try to rebuffer!
......@@ -217,7 +218,7 @@ void BufferedIOHandler::getNextMeteoData(const Date_IO& _date, std::vector<Meteo
std::vector< std::vector<MeteoData> > meteoTmpBuffer;
std::vector< std::vector<StationData> > stationTmpBuffer;
readMeteoData(_date, (_date-Date_IO(1900,1,2,0,0)), meteoTmpBuffer, stationTmpBuffer);
readMeteoData(_date, (_date-Date(1900,1,2,0,0)), meteoTmpBuffer, stationTmpBuffer);
unsigned int emptycounter = 0;
for (unsigned int ii=0; ii<meteoTmpBuffer.size(); ii++){//stations
......@@ -235,9 +236,9 @@ void BufferedIOHandler::getNextMeteoData(const Date_IO& _date, std::vector<Meteo
}
}
void BufferedIOHandler::bufferAllData(const Date_IO& _date){
Date_IO fromDate = _date - bufferbefore;
Date_IO toDate = _date + bufferafter;
void BufferedIOHandler::bufferAllData(const Date& _date){
Date fromDate = _date - bufferbefore;
Date toDate = _date + bufferafter;
readMeteoData(fromDate, toDate, meteoBuffer, stationBuffer);
......@@ -248,10 +249,10 @@ void BufferedIOHandler::bufferAllData(const Date_IO& _date){
}
}
bool BufferedIOHandler::bufferData(const Date_IO& _date, const unsigned int& stationindex)
bool BufferedIOHandler::bufferData(const Date& _date, const unsigned int& stationindex)
{
Date_IO fromDate = _date - bufferbefore;
Date_IO toDate = _date + bufferafter;
Date fromDate = _date - bufferbefore;
Date toDate = _date + bufferafter;
readMeteoData(fromDate, toDate, meteoBuffer, stationBuffer, stationindex);
startDateBuffer.at(stationindex) = fromDate;
......@@ -271,7 +272,7 @@ bool BufferedIOHandler::bufferData(const Date_IO& _date, const unsigned int& sta
return false;
}
//If we reach this point: Date_IO is definitely covered
//If we reach this point: Date is definitely covered
return true;
}
......@@ -280,13 +281,13 @@ void BufferedIOHandler::bufferAlways(const bool& bufferalways)
always_rebuffer = bufferalways;
}
void BufferedIOHandler::setBufferDuration(const Date_IO& _beforeDate, const Date_IO& _afterDate)
void BufferedIOHandler::setBufferDuration(const Date& _beforeDate, const Date& _afterDate)
{
bufferbefore = _beforeDate;
bufferafter = _afterDate;
}
void BufferedIOHandler::readMeteoData(const Date_IO& dateStart, const Date_IO& dateEnd,
void BufferedIOHandler::readMeteoData(const Date& dateStart, const Date& dateEnd,
std::vector< std::vector<MeteoData> >& vecMeteo,
std::vector< std::vector<StationData> >& vecStation,
const unsigned int& stationindex)
......@@ -317,7 +318,7 @@ void BufferedIOHandler::clearBuffer(){
mapBufferedGrids.clear();
}
unsigned int BufferedIOHandler::seek(const Date_IO& date_in, std::vector<MeteoData>& vecM){ //TODO: binary search
unsigned int BufferedIOHandler::seek(const Date& date_in, std::vector<MeteoData>& vecM){ //TODO: binary search
//returns index of element, if element does not exist it returns closest index
//the element needs to be an exact hit or embedded between two measurments
......
......@@ -39,6 +39,8 @@
* @author Thomas Egger
* @date 2009-07-25
*/
namespace mio {
class MeteoFilter;
#ifdef _POPC_
......@@ -77,16 +79,16 @@ class BufferedIOHandler : public IOInterface {
* @param vecMeteo A vector of MeteoData objects to be filled with data
* @param vecStation A vector of StationData objects to be filled with meta data
*/
void getNextMeteoData(const Date_IO& _date, std::vector<MeteoData>& vecMeteo, std::vector<StationData>& vecStation);
void getNextMeteoData(const Date& _date, std::vector<MeteoData>& vecMeteo, std::vector<StationData>& vecStation);
virtual void readStationData(const Date_IO& date, std::vector<StationData>& vecStation);
virtual void readStationData(const Date& date, std::vector<StationData>& vecStation);
/**
* @brief See BufferedIOHandler::readMeteoData(const Date& date_in,
* vector<MeteoData>& vecMeteo,
* vector<StationData>& vecStation).
*/
void readMeteoData(const Date_IO& dateStart, const Date_IO& dateEnd, std::vector< std::vector<MeteoData> >& vecMeteo);
void readMeteoData(const Date& dateStart, const Date& dateEnd, std::vector< std::vector<MeteoData> >& vecMeteo);
/**
* @brief Fill vector<MeteoData> and vector<StationData> objects with multiple datasets
......@@ -114,7 +116,7 @@ class BufferedIOHandler : public IOInterface {
* @param vecMeteo A vector of MeteoData objects to be filled with data
* @param vecStation A vector of StationData objects to be filled with data
*/
void readMeteoData(const Date_IO& _date, std::vector<MeteoData>& vecMeteo, std::vector<StationData>& vecStation);
void readMeteoData(const Date& _date, std::vector<MeteoData>& vecMeteo, std::vector<StationData>& vecStation);
/**
* @brief Clear all buffers in BufferedIOHandler and hence force rebuffering
......@@ -123,10 +125,10 @@ class BufferedIOHandler : public IOInterface {
virtual void read2DGrid(Grid2DObject& grid_out, const std::string& parameter="");
virtual void readDEM(DEMObject& dem_out);
virtual void readAssimilationData(const Date_IO& date_in, Grid2DObject& da_out);
virtual void readAssimilationData(const Date& date_in, Grid2DObject& da_out);
virtual void readLanduse(Grid2DObject& landuse_out);
virtual void readSpecialPoints(std::vector<Coords>& pts);
virtual void readMeteoData(const Date_IO& dateStart, const Date_IO& dateEnd,
virtual void readMeteoData(const Date& dateStart, const Date& dateEnd,
std::vector< std::vector<MeteoData> >& vecMeteo,
std::vector< std::vector<StationData> >& vecStation,
const unsigned int& stationindex=IOUtils::npos);
......@@ -144,14 +146,14 @@ class BufferedIOHandler : public IOInterface {
//HACK: please do NOT use these methods, they will be replaced/changed/tweaked asap
//These methods should be considered experimental and NOT stable (from an API point of view)
void bufferAlways(const bool& bufferalways);
void setBufferDuration(const Date_IO& _bufferbefore, const Date_IO& _bufferafter);
void setBufferDuration(const Date& _bufferbefore, const Date& _bufferafter);
static const unsigned int npos = (unsigned int)-1; ///<npos is the out-of-range value
private:
unsigned int seek(const Date_IO& date_in, std::vector<MeteoData>& vecM);
bool bufferData(const Date_IO& _date, const unsigned int& stationindex);
void bufferAllData(const Date_IO& _date);
unsigned int seek(const Date& date_in, std::vector<MeteoData>& vecM);
bool bufferData(const Date& _date, const unsigned int& stationindex);
void bufferAllData(const Date& _date);
void setBufferProperties();
IOHandler& iohandler;
......@@ -159,12 +161,13 @@ class BufferedIOHandler : public IOInterface {
MeteoFilter meteoFilter;
bool always_rebuffer;
Date_IO bufferbefore, bufferafter; //NrOfDays to buffer before and after a given date
Date bufferbefore, bufferafter; //NrOfDays to buffer before and after a given date
std::vector< std::vector<MeteoData> > meteoBuffer;
std::vector< std::vector<StationData> > stationBuffer;
std::vector< Date_IO > startDateBuffer;
std::vector< Date_IO > endDateBuffer;
std::vector< Date > startDateBuffer;
std::vector< Date > endDateBuffer;
std::map<std::string, Grid2DObject> mapBufferedGrids;
};
} //end namespace
#endif
......@@ -13,7 +13,7 @@ SET(meteoio_sources
MeteoFilter.cc
FilterAlgorithms.cc
A3DIO.cc
Date_IO.cc
Date.cc
Grid2DObject.cc
IOHandler.cc
LegacyIO.cc
......
......@@ -18,6 +18,7 @@
#include "ConfigReader.h"
using namespace std;
using namespace mio;
const unsigned int ConfigReader::nothrow = 666;
......
......@@ -26,14 +26,6 @@
#include <string>
#include <map>
namespace IOUtils {
void toUpper(std::string& str);
template <class T> void getValueForKey(const std::map<std::string,std::string>& properties,
const std::string& key, T& t);
template <class T> void getValueForKey(const std::map<std::string,std::string>& properties,
const std::string& key, std::vector<T>& vecT);
}
/**
* @class ConfigReader
* @brief A class that reads a key/value file. These files (typically named *.ini) have the following structure:
......@@ -49,6 +41,16 @@ namespace IOUtils {
* @author Thomas Egger
* @date 2008-11-30
*/
namespace mio {
namespace IOUtils {
void toUpper(std::string& str);
template <class T> void getValueForKey(const std::map<std::string,std::string>& properties,
const std::string& key, T& t);
template <class T> void getValueForKey(const std::map<std::string,std::string>& properties,
const std::string& key, std::vector<T>& vecT);
}
#ifdef _POPC_
class ConfigReader : POPBase {
public:
......@@ -193,20 +195,6 @@ class ConfigReader {
unsigned int findKeys(std::vector<std::string>& vecResult,
const std::string keystart, const std::string section="GENERAL") const;
//LEGACY
static bool readConfigLine(std::istream& fin, int lineNb, int& lineType, std::string& str1, std::string& str2);
/** [Constant for lineType] The config line is the end of the file */
static const int CfgLineEOF = 0;
/** [Constant for lineType] The config line is a comment (or a blank line) */
static const int CfgLineComment = 1;
/** [Constant for lineType] The config line is the start of a section */
static const int CfgLineSection = 2;
/** [Constant for lineType] The config line is a key-value pair */
static const int CfgLineKeyValue = 3;
/** [Constant for lineType] The config line is of an unknown type (in fact, an invalid format) */
static const int CfgLineUnknown = 9;
static const unsigned int nothrow;
private:
......@@ -219,4 +207,6 @@ class ConfigReader {
}; //end class definition ConfigReader
} //end namespace mio
#endif
......@@ -24,7 +24,9 @@
#define PI 3.141592653589
#endif
using namespace IOUtils;
using namespace std;
using namespace mio;
using namespace mio::IOUtils;
/**
* @page coords Available coordinate systems
......@@ -123,15 +125,17 @@ Coords& Coords::operator=(const Coords& source) {
* @brief Print the content of the Coords object (usefull for debugging)
* The Coords is bound by "<Coords>" and "</Coords>" on separate lines
*/
std::ostream& operator<<(std::ostream &os, const Coords& coord)
{
os << "<Coords>\n";
os << "Lat/Long\t" << coord.printLatLon() << "\n";
os << "X/Y_coords\t" << "(" << coord.getEasting() << " , " << coord.getNorthing() << ")" << "\n";
os << "I/J_indices\t" << "(" << coord.getGridI() << " , " << coord.getGridJ() << ")" << "\n";
os << "Projection\t" << coord.coordsystem << " " << coord.coordparam << "\n";
os << "</Coords>\n";
return os;
namespace mio {
std::ostream& operator<<(std::ostream &os, const Coords& coord)
{
os << "<Coords>\n";
os << "Lat/Long\t" << coord.printLatLon() << "\n";
os << "X/Y_coords\t" << "(" << coord.getEasting() << " , " << coord.getNorthing() << ")" << "\n";
os << "I/J_indices\t" << "(" << coord.getGridI() << " , " << coord.getGridJ() << ")" << "\n";
os << "Projection\t" << coord.coordsystem << " " << coord.coordparam << "\n";
os << "</Coords>\n";
return os;
}
}
/**
......
......@@ -24,6 +24,8 @@