[Positioning] InputCSV: read direction as int
Prepare handling of calibration requests.
This commit is contained in:
parent
ce92f0979e
commit
0b461bf4d0
|
@ -2,7 +2,6 @@
|
|||
- InputCSV
|
||||
° Différencier une requête normale d'une requête de calibration, en
|
||||
utilisant les champs de direction.
|
||||
° Lire la direction en tant qu'entier plutôt que float ?
|
||||
|
||||
- Input
|
||||
° Finir le test unitaire.
|
||||
|
|
|
@ -172,8 +172,9 @@ const Request& InputCSV::get_next_request()
|
|||
}
|
||||
|
||||
// Read position fields
|
||||
float pos[4] ;
|
||||
for (int i = 0 ; i < 4 ; ++i)
|
||||
bool is_calibration_request = false ;
|
||||
float pos[3] ;
|
||||
for (int i = 0 ; i < 3 ; ++i)
|
||||
{
|
||||
if (++ti == tok.end())
|
||||
{
|
||||
|
@ -184,6 +185,8 @@ const Request& InputCSV::get_next_request()
|
|||
try
|
||||
{
|
||||
pos[i] = lexical_cast<float>(*ti) ;
|
||||
if (pos[i] != 0)
|
||||
is_calibration_request = true ;
|
||||
}
|
||||
catch (bad_lexical_cast &e)
|
||||
{
|
||||
|
@ -198,9 +201,34 @@ const Request& InputCSV::get_next_request()
|
|||
}
|
||||
}
|
||||
|
||||
unordered_map<string, Measurement> measurements ;
|
||||
// Read direction field
|
||||
int direction ;
|
||||
if (++ti == tok.end())
|
||||
{
|
||||
// Wrong number of fields: blank current request
|
||||
current_request.clear() ;
|
||||
return current_request ;
|
||||
}
|
||||
try
|
||||
{
|
||||
direction = lexical_cast<int>(*ti) ;
|
||||
if (direction != 0)
|
||||
is_calibration_request = true ;
|
||||
}
|
||||
catch (bad_lexical_cast &e)
|
||||
{
|
||||
cerr
|
||||
<< "InputCSV::get_next_request(): Bad value « "
|
||||
<< *ti << " » at line "
|
||||
<< current_line_nb << ", field « Direction », of input file « "
|
||||
<< input_file_name << " »!" << endl ;
|
||||
current_request.clear() ; // Blank current request
|
||||
return current_request ;
|
||||
}
|
||||
|
||||
// Reading {MAC_AP;SS} couples
|
||||
unordered_map<string, Measurement> measurements ;
|
||||
|
||||
for (++ti ; ti != tok.end() ; ++ti)
|
||||
{
|
||||
string mac_ap(*ti) ;
|
||||
|
@ -248,5 +276,8 @@ const Request& InputCSV::get_next_request()
|
|||
|
||||
read_next_line() ;
|
||||
|
||||
if (is_calibration_request)
|
||||
{} // TODO
|
||||
|
||||
return current_request ;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue