owlps/owlps-positioning/src/referencepoint.hh

99 lines
2.4 KiB
C++
Raw Normal View History

#ifndef _OWLPS_POSITIONING_REFERENCEPOINT_HH_
#define _OWLPS_POSITIONING_REFERENCEPOINT_HH_
class CalibrationRequest ;
#include "point3d.hh"
#include <vector>
#include <ostream>
/// Represents a reference point in 3-D space
class ReferencePoint: public Point3D
{
protected:
/// List of CalibrationRequest associated with the ReferencePoint
/** Note that \em requests is a \em pointer list: only pointers
are stored, not values. */
std::vector<CalibrationRequest*> requests ;
public:
/// 3-float constructor or default constructor
ReferencePoint(const float &_x = 0, const float &_y = 0, const float &_z = 0):
Point3D(_x, _y, _z) {}
/// Constructs a ReferencePoint from a Point3D
ReferencePoint(const Point3D &p): Point3D(p) {}
/// Copy constructor
ReferencePoint(const ReferencePoint &source):
Point3D(source), requests(source.requests) {}
~ReferencePoint(void) ; ///< Destructor
/** @name Read accessors */
//@{
/// #requests read accessor
const std::vector<CalibrationRequest*>& get_requests(void) const ;
//@}
/** @name Write accessors */
//@{
/// Adds a Request to the \link #requests request list\endlink
void add_request(const CalibrationRequest *cm) ;
// float get_ss_square_distance(const vector<CalibrationRequest> &m) const ;
// bool get_power_for_ap(const string &ap_mac, float *p) const ;
//@}
/** @name Operators */
//@{
const ReferencePoint& operator=(const ReferencePoint &source) ;
bool operator==(const ReferencePoint &source) const ;
bool operator!=(const ReferencePoint &source) const ;
//@}
/// Displays a ReferencePoint
friend std::ostream &operator<<(std::ostream &os, const ReferencePoint &rp) ;
} ;
/* *** Read accessors *** */
inline const
std::vector<CalibrationRequest*>& ReferencePoint::get_requests() const
{
return requests ;
}
/* *** Write accessors *** */
/**
* @param cm A pointer to the CalibrationRequest to add. If it is
* NULL, nothing will be done.
* The memory pointed by this pointer must not be deallocated before
* the ReferencePoint destruction (do \em not pass a pointer to a local
* variable!).
*/
inline void ReferencePoint::add_request(const CalibrationRequest *cm)
{
if (cm != NULL)
requests.push_back(const_cast<CalibrationRequest*>(cm)) ;
}
/* *** Operators *** */
inline bool ReferencePoint::operator!=(const ReferencePoint &source) const
{
return !(*this == source) ;
}
#endif // _OWLPS_POSITIONING_REFERENCEPOINT_HH_