2010-03-03 16:06:41 +01:00
|
|
|
#ifndef _OWLPS_POSITIONING_RESULT_HH_
|
|
|
|
#define _OWLPS_POSITIONING_RESULT_HH_
|
|
|
|
|
2011-07-24 12:32:07 +02:00
|
|
|
class Request ;
|
|
|
|
|
2010-03-03 16:06:41 +01:00
|
|
|
#include "point3d.hh"
|
|
|
|
|
2011-03-31 19:42:35 +02:00
|
|
|
#include <string>
|
|
|
|
|
2010-03-03 16:06:41 +01:00
|
|
|
/// Represents a result computed by a positioning algorithm
|
|
|
|
class Result
|
|
|
|
{
|
|
|
|
protected:
|
2011-07-24 12:32:07 +02:00
|
|
|
/// Request sent by the mobile
|
|
|
|
const Request *request ;
|
2011-05-03 15:16:03 +02:00
|
|
|
/// Algorithm used to compute the position
|
2011-03-31 19:42:35 +02:00
|
|
|
std::string algorithm ;
|
2011-07-24 12:32:07 +02:00
|
|
|
/// Computed coordinates of the mobile
|
|
|
|
Point3D position ;
|
2011-05-03 15:16:03 +02:00
|
|
|
/// Distance error between the real coordinates and the computed point
|
|
|
|
/** The error is set to -1 if the real coordinates are unknown. */
|
|
|
|
float error ;
|
2010-03-03 16:06:41 +01:00
|
|
|
|
|
|
|
public:
|
2011-07-24 12:32:07 +02:00
|
|
|
Result(const Request *_request = NULL,
|
|
|
|
const std::string &_algorithm = "UnknownAlgorithm"):
|
|
|
|
request(_request), algorithm(_algorithm), error(-1) {}
|
|
|
|
Result(const Request *_request, const std::string &_algorithm,
|
|
|
|
const Point3D &_position):
|
|
|
|
request(_request), algorithm(_algorithm), position(_position),
|
|
|
|
error(-1) {}
|
|
|
|
Result(const Request *_request, const std::string &_algorithm,
|
|
|
|
const Point3D &_position, const Point3D &real_position) ;
|
2010-03-03 16:06:41 +01:00
|
|
|
~Result(void) {}
|
|
|
|
|
|
|
|
/** @name Read accessors */
|
|
|
|
//@{
|
2011-07-24 12:32:07 +02:00
|
|
|
const Request* get_request(void) const ;
|
2011-03-31 19:42:35 +02:00
|
|
|
const std::string& get_algorithm(void) const ;
|
2010-03-08 17:27:31 +01:00
|
|
|
const Point3D& get_position(void) const ;
|
2011-05-03 15:16:03 +02:00
|
|
|
float get_error(void) const ;
|
2011-07-29 00:05:52 +02:00
|
|
|
std::string in_which_area(void) const ;
|
2011-05-03 15:16:03 +02:00
|
|
|
//@}
|
|
|
|
|
|
|
|
/** @name Write accessors */
|
|
|
|
//@{
|
|
|
|
void compute_error(const Point3D &real_position) ;
|
2010-03-03 16:06:41 +01:00
|
|
|
//@}
|
|
|
|
|
|
|
|
/** @name Operators */
|
|
|
|
//@{
|
|
|
|
const Result& operator=(const Result &source) ;
|
2010-06-08 14:37:49 +02:00
|
|
|
bool operator==(const Result &source) const ;
|
|
|
|
bool operator!=(const Result &source) const ;
|
2010-03-03 16:06:41 +01:00
|
|
|
//@}
|
2010-03-03 17:57:32 +01:00
|
|
|
|
2011-04-05 14:45:27 +02:00
|
|
|
/** @name Conversion accessors */
|
|
|
|
//@{
|
2011-06-20 12:11:20 +02:00
|
|
|
/// Converts to a CSV string
|
2011-04-05 14:45:27 +02:00
|
|
|
const std::string to_csv(void) const ;
|
|
|
|
//@}
|
|
|
|
|
2010-03-03 17:57:32 +01:00
|
|
|
/// Displays a Result
|
|
|
|
friend std::ostream& operator<<(std::ostream &os, const Result &r) ;
|
2010-03-03 16:06:41 +01:00
|
|
|
} ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* *** Read accessors *** */
|
|
|
|
|
|
|
|
|
2011-07-24 12:32:07 +02:00
|
|
|
inline const Request* Result::get_request() const
|
|
|
|
{
|
|
|
|
return request ;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-03-31 19:42:35 +02:00
|
|
|
inline const std::string& Result::get_algorithm() const
|
|
|
|
{
|
|
|
|
return algorithm ;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-03-08 17:27:31 +01:00
|
|
|
inline const Point3D& Result::get_position() const
|
2010-03-03 16:06:41 +01:00
|
|
|
{
|
|
|
|
return position ;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-05-03 15:16:03 +02:00
|
|
|
inline float Result::get_error() const
|
|
|
|
{
|
|
|
|
return error ;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-03-03 16:06:41 +01:00
|
|
|
|
|
|
|
/* *** Operators *** */
|
|
|
|
|
|
|
|
|
2010-06-08 14:37:49 +02:00
|
|
|
inline bool Result::operator!=(const Result &source) const
|
2010-03-03 16:06:41 +01:00
|
|
|
{
|
|
|
|
return !(*this == source) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif // _OWLPS_POSITIONING_RESULT_HH_
|