2010-04-02 15:49:22 +02:00
|
|
|
#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
|
2010-04-20 15:59:27 +02:00
|
|
|
throw bad_configuration(
|
|
|
|
"The specified topology input medium « "+ *i +
|
|
|
|
" » is unknown!") ;
|
2010-04-02 15:49:22 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void InputDataReader::initialise_topology_csv()
|
|
|
|
{
|
|
|
|
if (! Configuration::is_configured("data-input.areas-csv-file"))
|
2010-04-20 15:59:27 +02:00
|
|
|
throw missing_configuration(
|
|
|
|
"No topology input CSV file specified for areas") ;
|
2010-04-13 10:47:10 +02:00
|
|
|
|
|
|
|
if (! Configuration::is_configured("data-input.waypoints-csv-file"))
|
2010-04-20 15:59:27 +02:00
|
|
|
throw missing_configuration(
|
|
|
|
"No topology input CSV file specified for waypoints") ;
|
2010-04-02 15:49:22 +02:00
|
|
|
|
|
|
|
TopologyReaderCSV(
|
2010-04-13 10:47:10 +02:00
|
|
|
Configuration::string_value("data-input.areas-csv-file"),
|
|
|
|
Configuration::string_value("data-input.waypoints-csv-file")) ;
|
2010-04-02 15:49:22 +02:00
|
|
|
}
|