owlps/owlps-positioning/src/inputlogcsv.hh

48 lines
941 B
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_INPUTLOGCSV_HH_
#define _OWLPS_POSITIONING_INPUTLOGCSV_HH_
#include "inputlogmedium.hh"
#include "textfilewriter.hh"
/// Logs \link Request requests \endlink to a CSV file
/**
* CSV format is the same as the one read by InputCSV.
*/
class InputLogCSV: public InputLogMedium
{
protected:
TextFileWriter file ;
const std::string request_to_csv(const Request &request) const ;
public:
InputLogCSV(const std::string &filename):
file(filename) {}
/** @name Operations */
//@{
bool log_request(const Request &request) ;
//@}
} ;
/* *** Operations *** */
inline bool InputLogCSV::log_request(const Request &request)
{
return file.write_text(request_to_csv(request)) ;
}
#endif // _OWLPS_POSITIONING_INPUTLOGCSV_HH_