74 lines
1.2 KiB
C++
74 lines
1.2 KiB
C++
/*
|
|
* This file is part of the Owl Positioning System (OwlPS).
|
|
* OwlPS is a project of the University of Franche-Comté
|
|
* (Université de Franche-Comté), France.
|
|
*/
|
|
|
|
|
|
#ifndef _OWLPS_POSITIONING_INPUTCSV_HH_
|
|
#define _OWLPS_POSITIONING_INPUTCSV_HH_
|
|
|
|
#include "inputmedium.hh"
|
|
#include "csvfilereader.hh"
|
|
|
|
#include <string>
|
|
|
|
/// Reads \link Request requests \endlink from a CSV file
|
|
/**
|
|
* CSV format is:
|
|
* Mobile_MAC;Request_type;Number_of_packets;Timestamp;X;Y;Z;Direction;
|
|
* AP_MAC_1;Packet_ID_1;SS_1;…;AP_MAC_n;Packet_ID_n;SS_n
|
|
*/
|
|
class InputCSV: public InputMedium
|
|
{
|
|
protected:
|
|
CSVFileReader file ;
|
|
|
|
/** @name Operations */
|
|
//@{
|
|
/// Reads data & fills the current request
|
|
bool fill_current_request(void) ;
|
|
//@}
|
|
|
|
public:
|
|
InputCSV(const std::string &filename):
|
|
file(filename) {}
|
|
|
|
~InputCSV(void) {}
|
|
|
|
/** @name Read accessors */
|
|
//@{
|
|
/// Checks if the end of the CSV file has been reached
|
|
bool eof(void) const ;
|
|
//@}
|
|
|
|
/** @name Operators */
|
|
//@{
|
|
operator bool(void) const ;
|
|
//@}
|
|
} ;
|
|
|
|
|
|
|
|
/* *** Read accessors *** */
|
|
|
|
|
|
inline bool InputCSV::eof() const
|
|
{
|
|
return file.eof() ;
|
|
}
|
|
|
|
|
|
|
|
/* *** Operators *** */
|
|
|
|
|
|
inline InputCSV::operator bool() const
|
|
{
|
|
return ! eof() ;
|
|
}
|
|
|
|
|
|
|
|
#endif // _OWLPS_POSITIONING_INPUTCSV_HH_
|