93 lines
1.9 KiB
C++
93 lines
1.9 KiB
C++
#ifndef _OWLPS_POSITIONING_RESULT_HH_
|
|
#define _OWLPS_POSITIONING_RESULT_HH_
|
|
|
|
#include "point3d.hh"
|
|
|
|
#include <string>
|
|
|
|
/// Represents a result computed by a positioning algorithm
|
|
class Result
|
|
{
|
|
protected:
|
|
/// Computed coordinates of the mobile
|
|
Point3D position ;
|
|
/// Algorithm used to compute the position
|
|
std::string algorithm ;
|
|
/// Distance error between the real coordinates and the computed point
|
|
/** The error is set to -1 if the real coordinates are unknown. */
|
|
float error ;
|
|
|
|
public:
|
|
Result(const std::string &_algorithm = "UnknownAlgorithm"):
|
|
algorithm(_algorithm), error(-1) {}
|
|
Result(const Point3D &_position, const std::string &_algorithm):
|
|
position(_position), algorithm(_algorithm), error(-1) {}
|
|
Result(const Point3D &_position, const std::string &_algorithm,
|
|
const Point3D &real_position) ;
|
|
~Result(void) {}
|
|
|
|
/** @name Read accessors */
|
|
//@{
|
|
const std::string& get_algorithm(void) const ;
|
|
const Point3D& get_position(void) const ;
|
|
float get_error(void) const ;
|
|
//@}
|
|
|
|
/** @name Write accessors */
|
|
//@{
|
|
void compute_error(const Point3D &real_position) ;
|
|
//@}
|
|
|
|
/** @name Operators */
|
|
//@{
|
|
const Result& operator=(const Result &source) ;
|
|
bool operator==(const Result &source) const ;
|
|
bool operator!=(const Result &source) const ;
|
|
//@}
|
|
|
|
/** @name Conversion accessors */
|
|
//@{
|
|
/// Converts to a CSV string
|
|
const std::string to_csv(void) const ;
|
|
//@}
|
|
|
|
/// Displays a Result
|
|
friend std::ostream& operator<<(std::ostream &os, const Result &r) ;
|
|
} ;
|
|
|
|
|
|
|
|
/* *** Read accessors *** */
|
|
|
|
|
|
inline const std::string& Result::get_algorithm() const
|
|
{
|
|
return algorithm ;
|
|
}
|
|
|
|
|
|
inline const Point3D& Result::get_position() const
|
|
{
|
|
return position ;
|
|
}
|
|
|
|
|
|
inline float Result::get_error() const
|
|
{
|
|
return error ;
|
|
}
|
|
|
|
|
|
|
|
/* *** Operators *** */
|
|
|
|
|
|
inline bool Result::operator!=(const Result &source) const
|
|
{
|
|
return !(*this == source) ;
|
|
}
|
|
|
|
|
|
|
|
#endif // _OWLPS_POSITIONING_RESULT_HH_
|