owlps/owlps-positioning/src/inputmedium.hh

99 lines
2.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_INPUTMEDIUM_HH_
#define _OWLPS_POSITIONING_INPUTMEDIUM_HH_
class ReferencePoint ;
class Direction ;
#include "request.hh"
#include <string>
/// Super class of all input media
/**
* This class Provides an interface for input media, i.e. to read
* Request sent by a Mobile.
*/
class InputMedium
{
protected:
Request *current_request ;
/// Number of the current line proceeded
unsigned long current_line_nb ;
/** @name Operations */
//@{
/// Reads data & fills the current request
virtual bool fill_current_request(void) = 0 ;
/// \brief Checks if the current request is a calibration request and
/// if so fills it with additionnal data
void fill_calibration_request_data(const std::string &mac_mobile,
Point3D &position,
const Direction &direction,
uint8_t type) ;
//@}
public:
InputMedium(void) ;
virtual ~InputMedium(void) ;
/** @name Read accessors */
//@{
const Request& get_current_request(void) const ;
unsigned int get_current_line_nb(void) const ;
/// Checks if the last request has been reached
/**
* @return \em true if the last request has been reached.
* @return \em false if there is something more to read.
*/
virtual bool eof(void) const = 0 ;
//@} // End Read accessors
/** @name Operations */
//@{
/// Reads the next request
const Request& get_next_request(void) ;
/// Converts #current_request into a CalibrationRequest
void current_request_to_calibration_request(
const ReferencePoint *const reference_point,
const Direction &direction,
uint_fast8_t request_type) ;
/// Clears (reallocates to Request if needed) #current_request
void clear_current_request(void) ;
//@} // End Operations
} ;
/* *** Read accessors *** */
inline const Request& InputMedium::get_current_request() const
{
return *current_request ;
}
inline unsigned int InputMedium::get_current_line_nb() const
{
return current_line_nb ;
}
#endif // _OWLPS_POSITIONING_INPUTMEDIUM_HH_