51 lines
1003 B
C++
51 lines
1003 B
C++
|
#include "inputdatareader.hh"
|
||
|
#include "configuration.hh"
|
||
|
#include "posexcept.hh"
|
||
|
#include "topologyreadercsv.hh"
|
||
|
|
||
|
using namespace std ;
|
||
|
|
||
|
|
||
|
|
||
|
/* *** Constructors *** */
|
||
|
|
||
|
|
||
|
InputDataReader::InputDataReader()
|
||
|
{
|
||
|
initialise_topology_media() ;
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
/* *** Operations *** */
|
||
|
|
||
|
|
||
|
void InputDataReader::initialise_topology_media()
|
||
|
{
|
||
|
if (! Configuration::is_configured("data-input.topology-medium"))
|
||
|
return ;
|
||
|
|
||
|
const vector<string> &media_names =
|
||
|
Configuration::string_vector_value("data-input.topology-medium") ;
|
||
|
|
||
|
for (vector<string>::const_iterator i = media_names.begin() ;
|
||
|
i != media_names.end() ; ++i)
|
||
|
{
|
||
|
if (*i == "CSV")
|
||
|
initialise_topology_csv() ;
|
||
|
|
||
|
else
|
||
|
throw topology_input_medium_type_unknown(*i) ;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
void InputDataReader::initialise_topology_csv()
|
||
|
{
|
||
|
if (! Configuration::is_configured("data-input.areas-csv-file"))
|
||
|
throw no_topology_input_csv_file() ;
|
||
|
|
||
|
TopologyReaderCSV(
|
||
|
Configuration::string_value("data-input.areas-csv-file")) ;
|
||
|
}
|