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
|
|
|
|
* http://code.lm7.fr/p/owlps/source/tree/master/COPYRIGHT.t2t
|
|
|
|
* 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
|
|
|
|
* this notice by the COPYRITGHT.t2t file's contents.
|
2012-02-06 16:44:09 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
2010-02-16 19:31:25 +01:00
|
|
|
#ifndef _OWLPS_POSITIONING_CALIBRATIONREQUEST_HH_
|
|
|
|
#define _OWLPS_POSITIONING_CALIBRATIONREQUEST_HH_
|
|
|
|
|
|
|
|
#include "request.hh"
|
2010-02-19 11:40:55 +01:00
|
|
|
#include "direction.hh"
|
2013-05-30 20:13:44 +02:00
|
|
|
#include "referencepoint.hh"
|
|
|
|
#include "posutil.hh"
|
2010-02-16 19:31:25 +01:00
|
|
|
|
|
|
|
/// Represents a calibration Request sent by a mobile
|
|
|
|
class CalibrationRequest: public Request
|
|
|
|
{
|
|
|
|
protected:
|
2011-06-20 12:11:20 +02:00
|
|
|
/// Reference point that the mobile calibrates
|
2010-02-16 19:31:25 +01:00
|
|
|
ReferencePoint *reference_point ;
|
2011-06-20 12:11:20 +02:00
|
|
|
/// Direction in which the mobile was during the measurement
|
2010-02-19 11:40:55 +01:00
|
|
|
Direction direction ;
|
2010-02-16 19:31:25 +01:00
|
|
|
|
|
|
|
public:
|
2011-04-26 16:34:58 +02:00
|
|
|
CalibrationRequest(uint_fast8_t _type) ;
|
|
|
|
|
2010-02-16 19:31:25 +01:00
|
|
|
CalibrationRequest(const CalibrationRequest &source):
|
2010-02-19 11:40:55 +01:00
|
|
|
Request(source), reference_point(source.reference_point),
|
|
|
|
direction(source.direction) {}
|
2011-04-26 16:34:58 +02:00
|
|
|
|
2010-02-16 19:31:25 +01:00
|
|
|
CalibrationRequest(const Request &source,
|
2011-03-31 17:08:24 +02:00
|
|
|
ReferencePoint *_reference_point,
|
2011-04-26 16:34:58 +02:00
|
|
|
const Direction &_direction,
|
|
|
|
uint_fast8_t _type) ;
|
2010-02-16 19:31:25 +01:00
|
|
|
|
|
|
|
~CalibrationRequest(void) {}
|
|
|
|
|
|
|
|
/** @name Read accessors */
|
|
|
|
//@{
|
2010-02-19 11:40:55 +01:00
|
|
|
const Direction& get_direction(void) const ;
|
2010-02-16 19:31:25 +01:00
|
|
|
ReferencePoint* get_reference_point(void) const ;
|
|
|
|
//@}
|
|
|
|
|
|
|
|
/** @name Write accessors */
|
|
|
|
//@{
|
2010-02-19 11:40:55 +01:00
|
|
|
void set_direction(const Direction &_direction) ;
|
2010-02-16 19:31:25 +01:00
|
|
|
void set_reference_point(const ReferencePoint *_rp) ;
|
2011-06-20 12:11:20 +02:00
|
|
|
/// Adds the CalibrationRequest to the #reference_point list of requests
|
2010-02-19 11:40:55 +01:00
|
|
|
void reference_point_backward_link(void) const ;
|
2011-06-20 11:43:17 +02:00
|
|
|
/// Deletes all the requests of #reference_point
|
|
|
|
void reference_point_delete_requests(void) const ;
|
2010-02-16 19:31:25 +01:00
|
|
|
void clear(void) ;
|
|
|
|
//@}
|
|
|
|
|
|
|
|
/** @name Operators */
|
|
|
|
//@{
|
2011-07-30 20:38:42 +02:00
|
|
|
CalibrationRequest& operator=(const CalibrationRequest &source) ;
|
2010-06-08 14:37:49 +02:00
|
|
|
bool operator==(const CalibrationRequest &source) const ;
|
|
|
|
bool operator!=(const CalibrationRequest &source) const ;
|
2010-02-16 19:31:25 +01:00
|
|
|
//@}
|
|
|
|
} ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* *** Read accessors *** */
|
|
|
|
|
|
|
|
|
|
|
|
inline ReferencePoint* CalibrationRequest::get_reference_point(void) const
|
|
|
|
{
|
|
|
|
return reference_point ;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-02-19 11:40:55 +01:00
|
|
|
inline const Direction& CalibrationRequest::get_direction(void) const
|
|
|
|
{
|
|
|
|
return direction ;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-02-16 19:31:25 +01:00
|
|
|
|
|
|
|
/* *** Write accessors *** */
|
|
|
|
|
|
|
|
|
|
|
|
inline void CalibrationRequest::set_reference_point(
|
|
|
|
const ReferencePoint *_rp)
|
|
|
|
{
|
|
|
|
reference_point = const_cast<ReferencePoint*>(_rp) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-02-19 11:40:55 +01:00
|
|
|
inline void CalibrationRequest::
|
|
|
|
set_direction(const Direction &_direction)
|
|
|
|
{
|
|
|
|
direction = _direction ;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-02-16 19:31:25 +01:00
|
|
|
|
|
|
|
/* *** Operators *** */
|
|
|
|
|
|
|
|
|
2010-06-08 14:37:49 +02:00
|
|
|
inline bool CalibrationRequest::
|
|
|
|
operator!=(const CalibrationRequest &source) const
|
2010-02-16 19:31:25 +01:00
|
|
|
{
|
|
|
|
return !(*this == source) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-05-30 20:13:44 +02:00
|
|
|
namespace std
|
|
|
|
{
|
|
|
|
template<> struct hash<CalibrationRequest>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
size_t operator()(const CalibrationRequest &source) const
|
|
|
|
{
|
|
|
|
size_t seed = 0 ;
|
|
|
|
|
|
|
|
PosUtil::hash_combine(seed, static_cast<Request>(source)) ;
|
|
|
|
PosUtil::hash_combine(seed, source.get_direction()) ;
|
|
|
|
if (source.get_reference_point() != NULL)
|
|
|
|
PosUtil::hash_combine(seed, *source.get_reference_point()) ;
|
|
|
|
|
|
|
|
return seed ;
|
|
|
|
}
|
|
|
|
} ;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-02-16 19:31:25 +01:00
|
|
|
#endif // _OWLPS_POSITIONING_CALIBRATIONREQUEST_HH_
|