owlps/owlps-positioning/referencepoint.hh

99 lines
2.5 KiB
C++

#ifndef _OWLPS_POSITIONING_REFERENCEPOINT_HH_
#define _OWLPS_POSITIONING_REFERENCEPOINT_HH_
class CalibrationMeasurement ;
#include "point3d.hh"
#include <vector>
#include <ostream>
/// Represents a reference point in 3-D space
class ReferencePoint: public Point3D
{
protected:
/// List of CalibrationMeasurement associated with the ReferencePoint
/** Note that \em measurements is a \em pointer list: only pointers
are stored, not values. */
std::vector<CalibrationMeasurement*> measurements ;
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 &rp):
Point3D(rp), measurements(rp.measurements) {}
~ReferencePoint(void) ; ///< Destructor
/** @name Read accessors */
//@{
/// #measurements read accessor
const std::vector<CalibrationMeasurement*>& get_measurements(void) const ;
//@}
/** @name Write accessors */
//@{
/// Adds a Measurement to the \link #measurements measurement list\endlink
void add_measurement(const CalibrationMeasurement *cm) ;
// float get_ss_square_distance(const vector<CalibrationMeasurement> &m) const ;
// bool get_power_for_ap(const string &ap_mac, float *p) const ;
//@}
/** @name Operators */
//@{
const ReferencePoint& operator=(const ReferencePoint &rp) ;
bool operator==(const ReferencePoint &rp) const ;
bool operator!=(const ReferencePoint &rp) const ;
//@}
/// Displays a ReferencePoint
friend std::ostream &operator<<(std::ostream &os, const ReferencePoint &rp) ;
} ;
/* *** Read accessors *** */
inline const
std::vector<CalibrationMeasurement*>& ReferencePoint::get_measurements() const
{
return measurements ;
}
/* *** Write accessors *** */
/**
* @param cm A pointer to the CalibrationMeasurement 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_measurement(const CalibrationMeasurement *cm)
{
if (cm != NULL)
measurements.push_back((CalibrationMeasurement *) cm) ;
}
/* *** Operators *** */
inline bool ReferencePoint::operator!=(const ReferencePoint &rp) const
{
return !(*this == rp) ;
}
#endif // _OWLPS_POSITIONING_REFERENCEPOINT_HH_