2012-02-06 16:44:09 +01:00
|
|
|
/*
|
2013-05-29 18:43:35 +02:00
|
|
|
* This file is part of the Owl Positioning System (OwlPS) project.
|
|
|
|
* It is subject to the copyright notice and license terms in the
|
|
|
|
* COPYRIGHT.t2t file found in the top-level directory of this
|
|
|
|
* distribution and at
|
2016-11-03 05:10:34 +01:00
|
|
|
* https://code.lm7.fr/mcy/owlps/src/master/COPYRIGHT.t2t
|
2013-05-29 18:43:35 +02:00
|
|
|
* No part of the OwlPS Project, including this file, may be copied,
|
|
|
|
* modified, propagated, or distributed except according to the terms
|
|
|
|
* contained in the COPYRIGHT.t2t file; the COPYRIGHT.t2t file must be
|
|
|
|
* distributed along with this file, either separately or by replacing
|
2013-06-22 23:30:17 +02:00
|
|
|
* this notice by the COPYRIGHT.t2t file's contents.
|
2012-02-06 16:44:09 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
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:
|
2014-05-13 23:50:53 +02:00
|
|
|
Result(const Request *const _request = nullptr,
|
2011-07-24 12:32:07 +02:00
|
|
|
const std::string &_algorithm = "UnknownAlgorithm"):
|
|
|
|
request(_request), algorithm(_algorithm), error(-1) {}
|
2013-10-02 20:38:45 +02:00
|
|
|
Result(const Request *const _request, const std::string &_algorithm,
|
2011-07-24 12:32:07 +02:00
|
|
|
const Point3D &_position):
|
|
|
|
request(_request), algorithm(_algorithm), position(_position),
|
|
|
|
error(-1) {}
|
2013-10-02 20:38:45 +02:00
|
|
|
Result(const Request *const _request, const std::string &_algorithm,
|
2011-07-24 12:32:07 +02:00
|
|
|
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 */
|
|
|
|
//@{
|
2014-05-13 01:41:38 +02:00
|
|
|
/// Sets the position
|
|
|
|
void set_position(const Point3D &_position) ;
|
2013-06-22 02:10:38 +02:00
|
|
|
/// Computes the distance between #position and `real_position`
|
2011-05-03 15:16:03 +02:00
|
|
|
void compute_error(const Point3D &real_position) ;
|
2010-03-03 16:06:41 +01:00
|
|
|
//@}
|
|
|
|
|
|
|
|
/** @name Operators */
|
|
|
|
//@{
|
2011-07-30 20:38:42 +02:00
|
|
|
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
|
|
|
|
2014-05-13 01:41:38 +02:00
|
|
|
/* *** Write accessors *** */
|
|
|
|
|
|
|
|
|
|
|
|
inline void Result::set_position(const Point3D &_position)
|
|
|
|
{
|
|
|
|
position = _position ;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
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_
|