[Positioning] Code and comments clean-up
- Where possible, use initialisation lists in class definition instead of explicit variable initialisations in source file. - Rename some variables (use of "source" in copy constructors and operators…). - Suppress useless Doxygen comments, allow non-documented members in Doxyfile.
This commit is contained in:
parent
be8f0cf728
commit
ee0499afad
|
@ -297,7 +297,7 @@ SYMBOL_CACHE_SIZE = 0
|
||||||
# Private class members and static file members will be hidden unless
|
# Private class members and static file members will be hidden unless
|
||||||
# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
|
# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
|
||||||
|
|
||||||
EXTRACT_ALL = NO
|
EXTRACT_ALL = YES
|
||||||
|
|
||||||
# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
|
# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
|
||||||
# will be included in the documentation.
|
# will be included in the documentation.
|
||||||
|
|
|
@ -20,7 +20,7 @@ MKDIR = mkdir -pv
|
||||||
# Other tools
|
# Other tools
|
||||||
STYLE = astyle --style=gnu --formatted
|
STYLE = astyle --style=gnu --formatted
|
||||||
CPPCHECK = cppcheck --enable=all
|
CPPCHECK = cppcheck --enable=all
|
||||||
DOXYGEN = doxygen
|
DOXYGEN = doxygen >/dev/null
|
||||||
|
|
||||||
# Compilation tools and flags
|
# Compilation tools and flags
|
||||||
GXX = g++-4.4
|
GXX = g++-4.4
|
||||||
|
|
|
@ -16,18 +16,28 @@
|
||||||
Stock ? (Pour l'instant ils ne sont pas dans Stock.)
|
Stock ? (Pour l'instant ils ne sont pas dans Stock.)
|
||||||
|
|
||||||
- AccessPoint
|
- AccessPoint
|
||||||
Attribut float friis_index ?
|
° Attribut float friis_index ?
|
||||||
|
° Lancer une exception si le canal Wi-Fi est mauvais (ou
|
||||||
|
directement dans PosUtil::channel_to_frequency() ?).
|
||||||
|
|
||||||
- ReferencePoint
|
- ReferencePoint
|
||||||
° La liste des requêtes devrait être un unordered_set (et pas un
|
° La liste des requêtes devrait être un unordered_set (et pas un
|
||||||
vector), pour garantir l'unicité des entrées.
|
vector), pour garantir l'unicité des entrées.
|
||||||
|
° Faire quelque chose pour le code commenté (idem dans
|
||||||
|
Measurement).
|
||||||
|
|
||||||
- Mobile
|
- Mobile
|
||||||
Attributs Viterbi ? (Cf. l'ancien clientinfo.hh.)
|
Attributs Viterbi ? (Cf. l'ancien clientinfo.hh.)
|
||||||
|
|
||||||
|
- Renommages de membres
|
||||||
|
° Request : timestamp −> date_sent
|
||||||
|
° InputMedium :
|
||||||
|
°° current_line_nb et get_current_line_nb()
|
||||||
|
°° get_next_request() −> read_next_request()
|
||||||
|
° Input : get_next_request() −> read_next_request()
|
||||||
|
° Area : p_min et p_max ?
|
||||||
|
|
||||||
- Doxygen
|
- Doxygen
|
||||||
° Supprimer les commentaires inutiles et autoriser les membres non
|
|
||||||
documentés dans Doxyfile.
|
|
||||||
° Pourquoi une description détaillée placée dans un .cc ne s'affiche
|
° Pourquoi une description détaillée placée dans un .cc ne s'affiche
|
||||||
pas pour operator<<() ?
|
pas pour operator<<() ?
|
||||||
|
|
||||||
|
|
|
@ -8,28 +8,28 @@ using namespace std ;
|
||||||
/* *** Operators *** */
|
/* *** Operators *** */
|
||||||
|
|
||||||
|
|
||||||
const AccessPoint& AccessPoint::operator=(const AccessPoint &ap)
|
const AccessPoint& AccessPoint::operator=(const AccessPoint &source)
|
||||||
{
|
{
|
||||||
if (this == &ap)
|
if (this == &source)
|
||||||
return *this ;
|
return *this ;
|
||||||
|
|
||||||
this->WifiDevice::operator=(ap) ;
|
this->WifiDevice::operator=(source) ;
|
||||||
coordinates = ap.coordinates ;
|
coordinates = source.coordinates ;
|
||||||
frequency = ap.frequency ;
|
frequency = source.frequency ;
|
||||||
|
|
||||||
return *this ;
|
return *this ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool AccessPoint::operator==(const AccessPoint &ap) const
|
bool AccessPoint::operator==(const AccessPoint &source) const
|
||||||
{
|
{
|
||||||
if (this == &ap)
|
if (this == &source)
|
||||||
return true ;
|
return true ;
|
||||||
|
|
||||||
return
|
return
|
||||||
this->WifiDevice::operator==(ap) &&
|
this->WifiDevice::operator==(source) &&
|
||||||
coordinates == ap.coordinates &&
|
coordinates == source.coordinates &&
|
||||||
frequency == ap.frequency ;
|
frequency == source.frequency ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -12,19 +12,15 @@
|
||||||
class AccessPoint: public WifiDevice
|
class AccessPoint: public WifiDevice
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
Point3D coordinates ; ///< Coordinates of the AccessPoint
|
Point3D coordinates ;
|
||||||
unsigned int frequency ; ///< Frequency (channel) in Hz
|
unsigned int frequency ; ///< Frequency (channel) in Hz
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// \brief Constructs an AccessPoint by defining all of its
|
|
||||||
/// attributes (or default constructor)
|
|
||||||
/**
|
/**
|
||||||
* @param _coordinates Coordinates.
|
* Special parameters:
|
||||||
* @param _ip_addr IP address.
|
* - \em _antenna_gain Antenna gain in dBi.
|
||||||
* @param _mac_addr MAC address.
|
* - \em _trx_power Transmit power in dBm.
|
||||||
* @param _antenna_gain Antenna gain in dBi.
|
* - \em channel Wi-Fi channel the AP is listening to (integer
|
||||||
* @param _trx_power Transmit power in dBm.
|
|
||||||
* @param channel Wi-Fi channel the AP is listening to (integer
|
|
||||||
* between 1 and 14). It will be converted to a frequency in Hz.
|
* between 1 and 14). It will be converted to a frequency in Hz.
|
||||||
*/
|
*/
|
||||||
AccessPoint(const Point3D &_coordinates = Point3D(),
|
AccessPoint(const Point3D &_coordinates = Point3D(),
|
||||||
|
@ -37,46 +33,39 @@ public:
|
||||||
coordinates(_coordinates),
|
coordinates(_coordinates),
|
||||||
frequency(PosUtil::channel_to_frequency(channel)) {}
|
frequency(PosUtil::channel_to_frequency(channel)) {}
|
||||||
|
|
||||||
/// Constructs an AccessPoint from a WifiDevice, a Point3D and a frequency
|
AccessPoint(const WifiDevice &source,
|
||||||
AccessPoint(const WifiDevice &wd,
|
|
||||||
const Point3D &_coordinates,
|
const Point3D &_coordinates,
|
||||||
const unsigned int &channel = AP_DEFAULT_CHANNEL):
|
const unsigned int &channel = AP_DEFAULT_CHANNEL):
|
||||||
WifiDevice(wd), coordinates(_coordinates),
|
WifiDevice(source), coordinates(_coordinates),
|
||||||
frequency(PosUtil::channel_to_frequency(channel)) {}
|
frequency(PosUtil::channel_to_frequency(channel)) {}
|
||||||
|
|
||||||
/// Constructs an AccessPoint from a WifiDevice
|
AccessPoint(const WifiDevice &source):
|
||||||
AccessPoint(const WifiDevice &wd):
|
WifiDevice(source), coordinates(Point3D()), frequency(0) {}
|
||||||
WifiDevice(wd), coordinates(Point3D()), frequency(0) {}
|
|
||||||
|
|
||||||
/// Copy constructor
|
AccessPoint(const AccessPoint &source):
|
||||||
AccessPoint(const AccessPoint &ap):
|
WifiDevice(source), coordinates(source.coordinates),
|
||||||
WifiDevice(ap), coordinates(ap.coordinates), frequency(ap.frequency) {}
|
frequency(source.frequency) {}
|
||||||
|
|
||||||
~AccessPoint(void) {} ///< Destructor (do nothing)
|
~AccessPoint(void) {}
|
||||||
|
|
||||||
/** @name Read accessors */
|
/** @name Read accessors */
|
||||||
//@{
|
//@{
|
||||||
/// #coordinates read accessor
|
|
||||||
const Point3D& get_coordinates(void) const ;
|
const Point3D& get_coordinates(void) const ;
|
||||||
/// #frequency read accessor
|
|
||||||
unsigned int get_frequency(void) const ;
|
unsigned int get_frequency(void) const ;
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
/** @name Write accessors */
|
/** @name Write accessors */
|
||||||
//@{
|
//@{
|
||||||
/// #coordinates write accessor
|
|
||||||
void set_coordinates(const Point3D &_coordinates) ;
|
void set_coordinates(const Point3D &_coordinates) ;
|
||||||
/// Set #frequency with a Wi-Fi channel
|
|
||||||
void set_channel(const unsigned int channel) ;
|
void set_channel(const unsigned int channel) ;
|
||||||
/// #frequency write accessor
|
|
||||||
void set_frequency(const unsigned int _frequency) ;
|
void set_frequency(const unsigned int _frequency) ;
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
/** @name Operators */
|
/** @name Operators */
|
||||||
//@{
|
//@{
|
||||||
const AccessPoint& operator=(const AccessPoint &ap) ;
|
const AccessPoint& operator=(const AccessPoint &source) ;
|
||||||
bool operator==(const AccessPoint &ap) const ;
|
bool operator==(const AccessPoint &source) const ;
|
||||||
bool operator!=(const AccessPoint &ap) const ;
|
bool operator!=(const AccessPoint &source) const ;
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
/// Displays an AccessPoint
|
/// Displays an AccessPoint
|
||||||
|
@ -138,9 +127,9 @@ inline void AccessPoint::set_frequency(const unsigned int _frequency)
|
||||||
/* *** Operators *** */
|
/* *** Operators *** */
|
||||||
|
|
||||||
|
|
||||||
inline bool AccessPoint::operator!=(const AccessPoint &ap) const
|
inline bool AccessPoint::operator!=(const AccessPoint &source) const
|
||||||
{
|
{
|
||||||
return !(*this == ap) ;
|
return !(*this == source) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -9,23 +9,13 @@ using namespace std ;
|
||||||
|
|
||||||
|
|
||||||
Area::Area(const Building *_building, const string &_name,
|
Area::Area(const Building *_building, const string &_name,
|
||||||
const Point3D &p1, const Point3D &p2)
|
const Point3D &p1, const Point3D &p2):
|
||||||
|
building(const_cast<Building*>(_building)), name(_name)
|
||||||
{
|
{
|
||||||
building = const_cast<Building*>(_building) ;
|
|
||||||
name = _name ;
|
|
||||||
set_coordinates(p1, p2) ;
|
set_coordinates(p1, p2) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Area::Area(const Area &a)
|
|
||||||
{
|
|
||||||
building = a.building ;
|
|
||||||
name = a.name ;
|
|
||||||
p_min = a.p_min ;
|
|
||||||
p_max = a.p_max ;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* *** Operations *** */
|
/* *** Operations *** */
|
||||||
|
|
||||||
|
@ -128,30 +118,30 @@ void Area::reorder_coordinates()
|
||||||
/* *** Operators *** */
|
/* *** Operators *** */
|
||||||
|
|
||||||
|
|
||||||
const Area& Area::operator=(const Area &a)
|
const Area& Area::operator=(const Area &source)
|
||||||
{
|
{
|
||||||
if (this == &a)
|
if (this == &source)
|
||||||
return *this ;
|
return *this ;
|
||||||
|
|
||||||
building = a.building ;
|
building = source.building ;
|
||||||
name = a.name ;
|
name = source.name ;
|
||||||
p_min = a.p_min ;
|
p_min = source.p_min ;
|
||||||
p_max = a.p_max ;
|
p_max = source.p_max ;
|
||||||
|
|
||||||
return *this ;
|
return *this ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Area::operator==(const Area &a) const
|
bool Area::operator==(const Area &source) const
|
||||||
{
|
{
|
||||||
if (this == &a)
|
if (this == &source)
|
||||||
return true ;
|
return true ;
|
||||||
|
|
||||||
return
|
return
|
||||||
building == a.building &&
|
building == source.building &&
|
||||||
name == a.name &&
|
name == source.name &&
|
||||||
p_min == a.p_min &&
|
p_min == source.p_min &&
|
||||||
p_max == a.p_max ;
|
p_max == source.p_max ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -13,37 +13,35 @@ class Area
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
Building *building ; ///< The Building in which the Area is
|
Building *building ; ///< The Building in which the Area is
|
||||||
std::string name ; ///< Name of the Area
|
std::string name ;
|
||||||
Point3D p_min ; ///< First coordinate of the Area
|
Point3D p_min ; ///< First coordinate of the Area
|
||||||
Point3D p_max ; ///< Second coordinate of the Area
|
Point3D p_max ; ///< Second coordinate of the Area
|
||||||
|
|
||||||
void reorder_coordinates(void) ; ///< Reorders #p_min and #p_max
|
void reorder_coordinates(void) ; ///< Reorders #p_min and #p_max
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// \brief Constructs an Area from a Building, a name and two 3-float
|
|
||||||
/// defined points (or default constructor)
|
|
||||||
Area(const Building *_building = NULL,
|
Area(const Building *_building = NULL,
|
||||||
const std::string &_name = "Unnamed area",
|
const std::string &_name = "Unnamed area",
|
||||||
const Point3D &p1 = Point3D(0,0,0),
|
const Point3D &p1 = Point3D(0,0,0),
|
||||||
const Point3D &p2 = Point3D(0,0,0)) ;
|
const Point3D &p2 = Point3D(0,0,0)) ;
|
||||||
/// Copy constructor
|
|
||||||
Area(const Area &a) ;
|
|
||||||
|
|
||||||
~Area(void) {} ///< Destructor (do nothing)
|
Area(const Area &source):
|
||||||
|
building(source.building), name(source.name),
|
||||||
|
p_min(source.p_min), p_max(source.p_max) {}
|
||||||
|
|
||||||
|
~Area(void) {}
|
||||||
|
|
||||||
/** @name Read accessors */
|
/** @name Read accessors */
|
||||||
//@{
|
//@{
|
||||||
Building* get_building(void) const ; ///< #building read accessor
|
Building* get_building(void) const ;
|
||||||
const std::string& get_name(void) const ; ///< #name read accessor
|
const std::string& get_name(void) const ;
|
||||||
const Point3D& get_p_min(void) const ; ///< #p_min read accessor
|
const Point3D& get_p_min(void) const ;
|
||||||
const Point3D& get_p_max(void) const ; ///< #p_max read accessor
|
const Point3D& get_p_max(void) const ;
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
/** @name Write accessors */
|
/** @name Write accessors */
|
||||||
//@{
|
//@{
|
||||||
/// #building write accessor
|
|
||||||
void set_building(const Building *_building) ;
|
void set_building(const Building *_building) ;
|
||||||
/// #name write accessor
|
|
||||||
void set_name(const std::string &_name) ;
|
void set_name(const std::string &_name) ;
|
||||||
/// Sets the coordinates of the Area and reorder them
|
/// Sets the coordinates of the Area and reorder them
|
||||||
void set_coordinates(const Point3D &p1, const Point3D &p2) ;
|
void set_coordinates(const Point3D &p1, const Point3D &p2) ;
|
||||||
|
@ -57,9 +55,9 @@ public:
|
||||||
|
|
||||||
/** @name Operators */
|
/** @name Operators */
|
||||||
//@{
|
//@{
|
||||||
const Area& operator=(const Area &a) ;
|
const Area& operator=(const Area &source) ;
|
||||||
bool operator==(const Area &a) const ;
|
bool operator==(const Area &source) const ;
|
||||||
bool operator!=(const Area &a) const ;
|
bool operator!=(const Area &source) const ;
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
/// Displays an Area
|
/// Displays an Area
|
||||||
|
@ -123,9 +121,9 @@ inline void Area::set_coordinates(const Point3D &p1, const Point3D &p2)
|
||||||
/* *** Operators *** */
|
/* *** Operators *** */
|
||||||
|
|
||||||
|
|
||||||
inline bool Area::operator!=(const Area &a) const
|
inline bool Area::operator!=(const Area &source) const
|
||||||
{
|
{
|
||||||
return !(*this == a) ;
|
return !(*this == source) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -10,22 +10,6 @@ using namespace std ;
|
||||||
/* *** Constructors *** */
|
/* *** Constructors *** */
|
||||||
|
|
||||||
|
|
||||||
Building::Building(const string &_name)
|
|
||||||
{
|
|
||||||
name = _name ;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Building::Building(const Building &b)
|
|
||||||
{
|
|
||||||
name = b.name ;
|
|
||||||
areas = b.areas ;
|
|
||||||
waypoints = b.waypoints ;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Note: deletes (unallocates) all elements in #areas; deletes elements
|
* Note: deletes (unallocates) all elements in #areas; deletes elements
|
||||||
* in #waypoints that belong only to this Building (waypoints that link
|
* in #waypoints that belong only to this Building (waypoints that link
|
||||||
|
@ -55,28 +39,28 @@ Building::~Building()
|
||||||
/* *** Operators *** */
|
/* *** Operators *** */
|
||||||
|
|
||||||
|
|
||||||
const Building& Building::operator=(const Building &b)
|
const Building& Building::operator=(const Building &source)
|
||||||
{
|
{
|
||||||
if (this == &b)
|
if (this == &source)
|
||||||
return *this ;
|
return *this ;
|
||||||
|
|
||||||
name = b.name ;
|
name = source.name ;
|
||||||
areas = b.areas ;
|
areas = source.areas ;
|
||||||
waypoints = b.waypoints ;
|
waypoints = source.waypoints ;
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Building::operator==(const Building &b) const
|
bool Building::operator==(const Building &source) const
|
||||||
{
|
{
|
||||||
if (this == &b)
|
if (this == &source)
|
||||||
return true ;
|
return true ;
|
||||||
|
|
||||||
return
|
return
|
||||||
name == b.name &&
|
name == source.name &&
|
||||||
areas == b.areas &&
|
areas == source.areas &&
|
||||||
waypoints == b.waypoints ;
|
waypoints == source.waypoints ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -12,31 +12,31 @@ class Waypoint ;
|
||||||
class Building
|
class Building
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
std::string name ; ///< Name of the Building
|
std::string name ;
|
||||||
std::vector<Area*> areas ; ///< List of Area contained in the Building
|
/// List of Area contained in the Building
|
||||||
std::vector<Waypoint*> waypoints ; ///< List of Waypoint in the Building
|
std::vector<Area*> areas ;
|
||||||
|
/// List of Waypoint in the Building
|
||||||
|
std::vector<Waypoint*> waypoints ;
|
||||||
|
|
||||||
public :
|
public :
|
||||||
/// Constructs a Building from its name (or default constructor)
|
Building(const std::string &_name = "Unnamed building"):
|
||||||
Building(const std::string &_name = "Unnamed building") ;
|
name(_name) {}
|
||||||
/// Copy constructor
|
|
||||||
Building(const Building &b) ;
|
|
||||||
|
|
||||||
~Building(void) ; ///< Destructor
|
Building(const Building &source):
|
||||||
|
name(source.name), areas(source.areas),
|
||||||
|
waypoints(source.waypoints) {}
|
||||||
|
|
||||||
|
~Building(void) ;
|
||||||
|
|
||||||
/** @name Read accessors */
|
/** @name Read accessors */
|
||||||
//@{
|
//@{
|
||||||
/// #name read accessor
|
|
||||||
const std::string& get_name(void) const ;
|
const std::string& get_name(void) const ;
|
||||||
/// #areas read accessor
|
|
||||||
const std::vector<Area*>& get_areas(void) const ;
|
const std::vector<Area*>& get_areas(void) const ;
|
||||||
/// #waypoints read accessor
|
|
||||||
const std::vector<Waypoint*>& get_waypoints(void) const ;
|
const std::vector<Waypoint*>& get_waypoints(void) const ;
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
/** @name Write accessors */
|
/** @name Write accessors */
|
||||||
//@{
|
//@{
|
||||||
/// #name write accessor
|
|
||||||
void set_name(const std::string &_name) ;
|
void set_name(const std::string &_name) ;
|
||||||
/// Adds an Area to the \link #areas list of areas\endlink
|
/// Adds an Area to the \link #areas list of areas\endlink
|
||||||
void add_area(const Area *a) ;
|
void add_area(const Area *a) ;
|
||||||
|
@ -46,9 +46,9 @@ public :
|
||||||
|
|
||||||
/** @name Operators */
|
/** @name Operators */
|
||||||
//@{
|
//@{
|
||||||
const Building& operator=(const Building &p) ;
|
const Building& operator=(const Building &source) ;
|
||||||
bool operator==(const Building &p) const ;
|
bool operator==(const Building &source) const ;
|
||||||
bool operator!=(const Building &p) const ;
|
bool operator!=(const Building &source) const ;
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
/// Displays a Building
|
/// Displays a Building
|
||||||
|
|
|
@ -18,12 +18,11 @@ protected:
|
||||||
public:
|
public:
|
||||||
CalibrationRequest(void):
|
CalibrationRequest(void):
|
||||||
reference_point(NULL), direction(Direction()) {}
|
reference_point(NULL), direction(Direction()) {}
|
||||||
/// Copy constructor
|
|
||||||
CalibrationRequest(const CalibrationRequest &source):
|
CalibrationRequest(const CalibrationRequest &source):
|
||||||
Request(source), reference_point(source.reference_point),
|
Request(source), reference_point(source.reference_point),
|
||||||
direction(source.direction) {}
|
direction(source.direction) {}
|
||||||
/// \brief Constructs a CalibrationRequest from a Request and
|
|
||||||
/// possibly a ReferencePoint and a Direction)
|
|
||||||
CalibrationRequest(const Request &source,
|
CalibrationRequest(const Request &source,
|
||||||
ReferencePoint *_reference_point = NULL,
|
ReferencePoint *_reference_point = NULL,
|
||||||
const Direction &_direction = Direction()):
|
const Direction &_direction = Direction()):
|
||||||
|
@ -34,21 +33,16 @@ public:
|
||||||
|
|
||||||
/** @name Read accessors */
|
/** @name Read accessors */
|
||||||
//@{
|
//@{
|
||||||
/// #direction read accessor
|
|
||||||
const Direction& get_direction(void) const ;
|
const Direction& get_direction(void) const ;
|
||||||
/// #reference_point read accessor
|
|
||||||
ReferencePoint* get_reference_point(void) const ;
|
ReferencePoint* get_reference_point(void) const ;
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
/** @name Write accessors */
|
/** @name Write accessors */
|
||||||
//@{
|
//@{
|
||||||
/// #direction write accessor
|
|
||||||
void set_direction(const Direction &_direction) ;
|
void set_direction(const Direction &_direction) ;
|
||||||
/// #reference_point write accessor
|
|
||||||
void set_reference_point(const ReferencePoint *_rp) ;
|
void set_reference_point(const ReferencePoint *_rp) ;
|
||||||
/// Add the CalibrationRequest to the #reference_point list of requests
|
/// Add the CalibrationRequest to the #reference_point list of requests
|
||||||
void reference_point_backward_link(void) const ;
|
void reference_point_backward_link(void) const ;
|
||||||
/// Reinitialises all attributes
|
|
||||||
void clear(void) ;
|
void clear(void) ;
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
|
|
|
@ -6,9 +6,9 @@
|
||||||
/* *** Constructors *** */
|
/* *** Constructors *** */
|
||||||
|
|
||||||
|
|
||||||
Direction::Direction(const char source)
|
Direction::Direction(const char source):
|
||||||
|
direction(source)
|
||||||
{
|
{
|
||||||
direction = source ;
|
|
||||||
assert_valid() ;
|
assert_valid() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,11 +10,8 @@ class Direction
|
||||||
protected:
|
protected:
|
||||||
char direction ;
|
char direction ;
|
||||||
|
|
||||||
/** @name Operations */
|
|
||||||
//@{
|
|
||||||
void assert_valid(void) const ;
|
void assert_valid(void) const ;
|
||||||
bool is_valid(void) const ;
|
bool is_valid(void) const ;
|
||||||
//@}
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum {north = 1, east, south, west} ;
|
enum {north = 1, east, south, west} ;
|
||||||
|
|
|
@ -11,12 +11,13 @@
|
||||||
using namespace std ;
|
using namespace std ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* *** Constructors *** */
|
/* *** Constructors *** */
|
||||||
|
|
||||||
|
|
||||||
Input::Input()
|
Input::Input():
|
||||||
|
medium(NULL)
|
||||||
{
|
{
|
||||||
medium = NULL ;
|
|
||||||
initialise_input_medium() ;
|
initialise_input_medium() ;
|
||||||
initialise_log_media() ;
|
initialise_log_media() ;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,28 +6,22 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
/// Reads requests (Request) from a CSV file
|
/// Reads \link Request requests \endlink from a CSV file
|
||||||
class InputCSV: public InputMedium
|
class InputCSV: public InputMedium
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
/// Name of the input CSV file
|
|
||||||
std::string input_file_name ;
|
std::string input_file_name ;
|
||||||
/// Stream corresponding to the input CSV file
|
|
||||||
std::ifstream input_file ;
|
std::ifstream input_file ;
|
||||||
/// Current line contents
|
/// Current line contents
|
||||||
std::string current_line ;
|
std::string current_line ;
|
||||||
|
|
||||||
/** @name Operations */
|
|
||||||
//@{
|
|
||||||
/// Checks if the file is readable and closes it if not
|
/// Checks if the file is readable and closes it if not
|
||||||
bool eof_close(void) ;
|
bool eof_close(void) ;
|
||||||
/// Reads the next line
|
|
||||||
void read_next_line(void) ;
|
void read_next_line(void) ;
|
||||||
//@}
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// Constructs an InputCSV from a CSV input file name
|
|
||||||
InputCSV(const std::string &filename) ;
|
InputCSV(const std::string &filename) ;
|
||||||
|
|
||||||
~InputCSV(void) ;
|
~InputCSV(void) ;
|
||||||
|
|
||||||
/** @name Read accessors */
|
/** @name Read accessors */
|
||||||
|
@ -44,7 +38,6 @@ public:
|
||||||
|
|
||||||
/** @name Operators */
|
/** @name Operators */
|
||||||
//@{
|
//@{
|
||||||
/// Cast to bool operator
|
|
||||||
operator bool(void) const ;
|
operator bool(void) const ;
|
||||||
//@}
|
//@}
|
||||||
} ;
|
} ;
|
||||||
|
|
|
@ -19,10 +19,9 @@ using std::tr1::unordered_map ;
|
||||||
* @param filename The name of the file to open.
|
* @param filename The name of the file to open.
|
||||||
* @throw error_opening_input_file if the file cannot be opened.
|
* @throw error_opening_input_file if the file cannot be opened.
|
||||||
*/
|
*/
|
||||||
InputLogCSV::InputLogCSV(const string &filename)
|
InputLogCSV::InputLogCSV(const string &filename):
|
||||||
|
log_file_name(filename)
|
||||||
{
|
{
|
||||||
log_file_name = filename ;
|
|
||||||
|
|
||||||
log_file.open(log_file_name.c_str()) ;
|
log_file.open(log_file_name.c_str()) ;
|
||||||
if (! log_file)
|
if (! log_file)
|
||||||
throw error_opening_input_file(log_file_name) ;
|
throw error_opening_input_file(log_file_name) ;
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
/// Log Request to a CSV file
|
/// Log \link Request requests \endlink to a CSV file
|
||||||
class InputLogCSV: public InputLogMedium
|
class InputLogCSV: public InputLogMedium
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -16,7 +16,7 @@ public:
|
||||||
/** @name Operations */
|
/** @name Operations */
|
||||||
//@{
|
//@{
|
||||||
virtual bool log_request(const Request &request) = 0 ;
|
virtual bool log_request(const Request &request) = 0 ;
|
||||||
//@} // End Operations
|
//@}
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
#endif // _OWLPS_POSITIONING_INPUTLOGMEDIUM_HH_
|
#endif // _OWLPS_POSITIONING_INPUTLOGMEDIUM_HH_
|
||||||
|
|
|
@ -6,10 +6,10 @@
|
||||||
/* *** Constructors *** */
|
/* *** Constructors *** */
|
||||||
|
|
||||||
|
|
||||||
InputMedium::InputMedium()
|
InputMedium::InputMedium():
|
||||||
|
current_line_nb(0)
|
||||||
{
|
{
|
||||||
current_request = new Request() ;
|
current_request = new Request() ;
|
||||||
current_line_nb = 0 ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@ InputMedium::~InputMedium()
|
||||||
|
|
||||||
/* *** Operations *** */
|
/* *** Operations *** */
|
||||||
|
|
||||||
|
|
||||||
void InputMedium::current_request_to_calibration_request()
|
void InputMedium::current_request_to_calibration_request()
|
||||||
{
|
{
|
||||||
if (dynamic_cast<CalibrationRequest*>(current_request) != NULL)
|
if (dynamic_cast<CalibrationRequest*>(current_request) != NULL)
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
class InputMedium
|
class InputMedium
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
/// The Request just read
|
|
||||||
Request *current_request ;
|
Request *current_request ;
|
||||||
/// Number of the current line proceeded
|
/// Number of the current line proceeded
|
||||||
unsigned long current_line_nb ;
|
unsigned long current_line_nb ;
|
||||||
|
@ -24,10 +23,8 @@ public:
|
||||||
/** @name Read accessors */
|
/** @name Read accessors */
|
||||||
//@{
|
//@{
|
||||||
|
|
||||||
/// #current_request read accessor
|
|
||||||
const Request& get_current_request(void) const ;
|
const Request& get_current_request(void) const ;
|
||||||
|
|
||||||
/// #current_line_nb read accessor
|
|
||||||
unsigned int get_current_line_nb(void) const ;
|
unsigned int get_current_line_nb(void) const ;
|
||||||
|
|
||||||
/// Checks if the last request has been reached
|
/// Checks if the last request has been reached
|
||||||
|
|
|
@ -8,32 +8,22 @@ using namespace std ;
|
||||||
/* *** Constructors *** */
|
/* *** Constructors *** */
|
||||||
|
|
||||||
|
|
||||||
Measurement::Measurement(const AccessPoint *_ap)
|
Measurement::Measurement(const AccessPoint *_ap):
|
||||||
|
ap(const_cast<AccessPoint*>(_ap)), average_ss(0)
|
||||||
{
|
{
|
||||||
ap = const_cast<AccessPoint*>(_ap) ;
|
|
||||||
ss_list.reserve(10) ;
|
ss_list.reserve(10) ;
|
||||||
average_ss = 0 ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Measurement::Measurement(const AccessPoint *_ap,
|
Measurement::Measurement(const AccessPoint *_ap,
|
||||||
const vector<int> &_ss_list)
|
const vector<int> &_ss_list):
|
||||||
|
ap(const_cast<AccessPoint*>(_ap)), ss_list(_ss_list)
|
||||||
{
|
{
|
||||||
ap = const_cast<AccessPoint*>(_ap) ;
|
|
||||||
ss_list = _ss_list ;
|
|
||||||
ss_list.reserve(10) ;
|
ss_list.reserve(10) ;
|
||||||
update_average_ss() ;
|
update_average_ss() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Measurement::Measurement(const Measurement &m)
|
|
||||||
{
|
|
||||||
ap = m.ap ;
|
|
||||||
ss_list = m.ss_list ;
|
|
||||||
average_ss = m.average_ss ;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Note that values pointed by #ap are not deleted.
|
* Note that values pointed by #ap are not deleted.
|
||||||
|
@ -49,7 +39,6 @@ Measurement::~Measurement()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* #average_ss is updated to include the new value.
|
|
||||||
* @param ss_dbm The signal strength to add to #ss_list (in dBm).
|
* @param ss_dbm The signal strength to add to #ss_list (in dBm).
|
||||||
*/
|
*/
|
||||||
void Measurement::add_ss(const int &ss_dbm)
|
void Measurement::add_ss(const int &ss_dbm)
|
||||||
|
@ -65,10 +54,6 @@ void Measurement::add_ss(const int &ss_dbm)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* update_average_ss() is automatically called to recalculate
|
|
||||||
* #average_ss.
|
|
||||||
*/
|
|
||||||
void Measurement::set_ss_list(const std::vector<int> &_ss_list)
|
void Measurement::set_ss_list(const std::vector<int> &_ss_list)
|
||||||
{
|
{
|
||||||
ss_list = _ss_list ;
|
ss_list = _ss_list ;
|
||||||
|
|
|
@ -26,37 +26,31 @@ protected:
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// Constructs a Measurement from an AccessPoint (or default constructor)
|
|
||||||
Measurement(const AccessPoint *_ap = NULL) ;
|
Measurement(const AccessPoint *_ap = NULL) ;
|
||||||
/// \brief Constructs a Measurement from an AccessPoint and a list
|
|
||||||
/// of signal strengths
|
|
||||||
Measurement(const AccessPoint *_ap,
|
Measurement(const AccessPoint *_ap,
|
||||||
const std::vector<int> &_ss_list) ;
|
const std::vector<int> &_ss_list) ;
|
||||||
/// Copy constructor
|
|
||||||
Measurement(const Measurement &m) ;
|
|
||||||
|
|
||||||
~Measurement(void) ; ///< Destructor
|
Measurement(const Measurement &source):
|
||||||
|
ap(source.ap), ss_list(source.ss_list),
|
||||||
|
average_ss(source.average_ss) {}
|
||||||
|
|
||||||
|
~Measurement(void) ;
|
||||||
|
|
||||||
/** @name Read accessors */
|
/** @name Read accessors */
|
||||||
//@{
|
//@{
|
||||||
/// #ap read accessor
|
|
||||||
AccessPoint* get_ap() const ;
|
AccessPoint* get_ap() const ;
|
||||||
/// #ss_list read accessor
|
|
||||||
const std::vector<int>& get_ss_list() const ;
|
const std::vector<int>& get_ss_list() const ;
|
||||||
/// #average_ss read accessor
|
|
||||||
double get_average_ss() const ;
|
double get_average_ss() const ;
|
||||||
//float get_ss_square_distance(const float &ss) const ;
|
//float get_ss_square_distance(const float &ss) const ;
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
/** @name Write accessors */
|
/** @name Write accessors */
|
||||||
//@{
|
//@{
|
||||||
/// #ap write accessor
|
|
||||||
void set_ap(const AccessPoint *_ap) ;
|
void set_ap(const AccessPoint *_ap) ;
|
||||||
/// Adds a signal strength to #ss_list
|
/// Adds a signal strength to #ss_list
|
||||||
void add_ss(const int &ss_dbm) ;
|
void add_ss(const int &ss_dbm) ;
|
||||||
/// #ss_list write accessor
|
|
||||||
void set_ss_list(const std::vector<int> &_ss_list) ;
|
void set_ss_list(const std::vector<int> &_ss_list) ;
|
||||||
/// Reinitialises the Measurement
|
|
||||||
void clear(void) ;
|
void clear(void) ;
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
|
@ -65,7 +59,7 @@ public:
|
||||||
const Measurement& operator=(const Measurement &m) ;
|
const Measurement& operator=(const Measurement &m) ;
|
||||||
bool operator==(const Measurement &m) const ;
|
bool operator==(const Measurement &m) const ;
|
||||||
bool operator!=(const Measurement &m) const ;
|
bool operator!=(const Measurement &m) const ;
|
||||||
operator bool(void) const ; ///< Cast to bool operator
|
operator bool(void) const ;
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
/// Displays a Measurement
|
/// Displays a Measurement
|
||||||
|
|
|
@ -12,21 +12,19 @@
|
||||||
class Mobile: public WifiDevice
|
class Mobile: public WifiDevice
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/// Constructs a Mobile by defining all (or none) of its attributes
|
|
||||||
/** This constructor is just a mapping of WifiDevice(). */
|
|
||||||
Mobile(const std::string &_ip_addr = "",
|
Mobile(const std::string &_ip_addr = "",
|
||||||
const std::string &_mac_addr = "",
|
const std::string &_mac_addr = "",
|
||||||
const float &_antenna_gain = MOBILE_DEFAULT_ANTENNA_GAIN,
|
const float &_antenna_gain = MOBILE_DEFAULT_ANTENNA_GAIN,
|
||||||
const float &_trx_power = WIFIDEVICE_DEFAULT_TRX_POWER):
|
const float &_trx_power = WIFIDEVICE_DEFAULT_TRX_POWER):
|
||||||
WifiDevice(_ip_addr, _mac_addr, _antenna_gain, _trx_power) {}
|
WifiDevice(_ip_addr, _mac_addr, _antenna_gain, _trx_power) {}
|
||||||
/// Constructs a Mobile from a WifiDevice
|
|
||||||
Mobile(const WifiDevice &wd):
|
Mobile(const WifiDevice &wd):
|
||||||
WifiDevice(wd) {}
|
WifiDevice(wd) {}
|
||||||
/// Copy constructor
|
|
||||||
Mobile(const Mobile &m):
|
Mobile(const Mobile &m):
|
||||||
WifiDevice(m) {}
|
WifiDevice(m) {}
|
||||||
|
|
||||||
~Mobile(void) {} ///< Destructor (do nothing)
|
~Mobile(void) {}
|
||||||
|
|
||||||
/** @name Operators */
|
/** @name Operators */
|
||||||
//@{
|
//@{
|
||||||
|
|
|
@ -13,7 +13,7 @@ protected:
|
||||||
/// List of output media used
|
/// List of output media used
|
||||||
std::vector<OutputMedium*> output_media ;
|
std::vector<OutputMedium*> output_media ;
|
||||||
|
|
||||||
/** @name Internal operations */
|
/** @name Operations */
|
||||||
//@{
|
//@{
|
||||||
void initialise_output_media(void) ;
|
void initialise_output_media(void) ;
|
||||||
void initialise_output_terminal(void) ;
|
void initialise_output_terminal(void) ;
|
||||||
|
|
|
@ -18,7 +18,7 @@ public:
|
||||||
/** @name Operations */
|
/** @name Operations */
|
||||||
//@{
|
//@{
|
||||||
virtual void write(const Result &result) = 0 ;
|
virtual void write(const Result &result) = 0 ;
|
||||||
//@} // End Operations
|
//@}
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
#endif // _OWLPS_POSITIONING_OUTPUTMEDIUM_HH_
|
#endif // _OWLPS_POSITIONING_OUTPUTMEDIUM_HH_
|
||||||
|
|
|
@ -3,33 +3,6 @@
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
|
|
||||||
/* *** Constructors *** */
|
|
||||||
|
|
||||||
|
|
||||||
Point3D::Point3D(const float &_x, const float &_y, const float &_z)
|
|
||||||
{
|
|
||||||
x = _x ;
|
|
||||||
y = _y ;
|
|
||||||
z = _z ;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Point3D::Point3D(const Point3D &source)
|
|
||||||
{
|
|
||||||
x = source.x ;
|
|
||||||
y = source.y ;
|
|
||||||
z = source.z ;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Point3D::Point3D(const float source[3])
|
|
||||||
{
|
|
||||||
x = source[0] ;
|
|
||||||
y = source[1] ;
|
|
||||||
z = source[2] ;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* *** Distance operations *** */
|
/* *** Distance operations *** */
|
||||||
|
|
||||||
|
|
|
@ -13,28 +13,31 @@ protected:
|
||||||
float z ; ///< Vertical coordinate
|
float z ; ///< Vertical coordinate
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// 3 float constructor or default constructor
|
Point3D(const float &_x = 0, const float &_y = 0, const float &_z = 0):
|
||||||
Point3D(const float &_x = 0, const float &_y = 0, const float &_z = 0) ;
|
x(_x), y(_y), z(_z) {}
|
||||||
/// Copy constructor
|
|
||||||
Point3D(const Point3D &source) ;
|
|
||||||
/// 3-float array constructor
|
|
||||||
Point3D(const float source[3]) ;
|
|
||||||
|
|
||||||
virtual ~Point3D(void) {} ///< Destructor (do nothing)
|
Point3D(const Point3D &source):
|
||||||
|
x(source.x), y(source.y), z(source.z) {}
|
||||||
|
|
||||||
|
Point3D(const float source[3]):
|
||||||
|
x(source[0]), y(source[1]), z(source[2]) {}
|
||||||
|
|
||||||
|
virtual ~Point3D(void) {}
|
||||||
|
|
||||||
/** @name Read accessors */
|
/** @name Read accessors */
|
||||||
//@{
|
//@{
|
||||||
float get_x(void) const ; ///< #x read accessor
|
float get_x(void) const ;
|
||||||
float get_y(void) const ; ///< #y read accessor
|
float get_y(void) const ;
|
||||||
float get_z(void) const ; ///< #z read accessor
|
float get_z(void) const ;
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
/** @name Write accessors */
|
/** @name Write accessors */
|
||||||
//@{
|
//@{
|
||||||
void set_x(const float &_x) ; ///< #x write accessor
|
void set_x(const float &_x) ;
|
||||||
void set_y(const float &_y) ; ///< #y write accessor
|
void set_y(const float &_y) ;
|
||||||
void set_z(const float &_z) ; ///< #z write accessor
|
void set_z(const float &_z) ;
|
||||||
void set_coordinates(const Point3D &source) ; ///< Sets all coordinates
|
/// Sets all coordinates
|
||||||
|
void set_coordinates(const Point3D &source) ;
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
/** @name Distance operations */
|
/** @name Distance operations */
|
||||||
|
|
|
@ -18,20 +18,18 @@ protected:
|
||||||
std::vector<CalibrationRequest*> requests ;
|
std::vector<CalibrationRequest*> requests ;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// 3-float constructor or default constructor
|
|
||||||
ReferencePoint(const float &_x = 0, const float &_y = 0, const float &_z = 0):
|
ReferencePoint(const float &_x = 0, const float &_y = 0, const float &_z = 0):
|
||||||
Point3D(_x, _y, _z) {}
|
Point3D(_x, _y, _z) {}
|
||||||
/// Constructs a ReferencePoint from a Point3D
|
|
||||||
ReferencePoint(const Point3D &p): Point3D(p) {}
|
ReferencePoint(const Point3D &p): Point3D(p) {}
|
||||||
/// Copy constructor
|
|
||||||
ReferencePoint(const ReferencePoint &source):
|
ReferencePoint(const ReferencePoint &source):
|
||||||
Point3D(source), requests(source.requests) {}
|
Point3D(source), requests(source.requests) {}
|
||||||
|
|
||||||
~ReferencePoint(void) ; ///< Destructor
|
~ReferencePoint(void) ;
|
||||||
|
|
||||||
/** @name Read accessors */
|
/** @name Read accessors */
|
||||||
//@{
|
//@{
|
||||||
/// #requests read accessor
|
|
||||||
const std::vector<CalibrationRequest*>& get_requests(void) const ;
|
const std::vector<CalibrationRequest*>& get_requests(void) const ;
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
|
|
|
@ -9,40 +9,6 @@ using std::tr1::unordered_map ;
|
||||||
/* *** Constructors *** */
|
/* *** Constructors *** */
|
||||||
|
|
||||||
|
|
||||||
Request::Request(const unordered_map<string, Measurement> &_measurements)
|
|
||||||
{
|
|
||||||
mobile = NULL ;
|
|
||||||
measurements = _measurements ;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Request::Request(const Timestamp &_timestamp,
|
|
||||||
const unordered_map<string, Measurement> &_measurements)
|
|
||||||
{
|
|
||||||
mobile = NULL ;
|
|
||||||
timestamp = _timestamp ;
|
|
||||||
measurements = _measurements ;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Request::Request(const Mobile *_mobile, const Timestamp &_timestamp,
|
|
||||||
const unordered_map<string, Measurement> &_measurements)
|
|
||||||
{
|
|
||||||
mobile = const_cast<Mobile*>(_mobile) ;
|
|
||||||
timestamp = _timestamp ;
|
|
||||||
measurements = _measurements ;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Request::Request(const Request &source)
|
|
||||||
{
|
|
||||||
mobile = source.mobile ;
|
|
||||||
timestamp = source.timestamp ;
|
|
||||||
measurements = source.measurements ;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Note that the value pointed by #mobile is not deleted.
|
* Note that the value pointed by #mobile is not deleted.
|
||||||
*/
|
*/
|
||||||
|
@ -56,6 +22,7 @@ Request::~Request()
|
||||||
/* *** Write accessors *** */
|
/* *** Write accessors *** */
|
||||||
|
|
||||||
|
|
||||||
|
/// Reinitialises all attributes
|
||||||
/**
|
/**
|
||||||
* - #mobile is NULLified, but the value it pointed to is not deleted.
|
* - #mobile is NULLified, but the value it pointed to is not deleted.
|
||||||
* - The fields of #timestamp are initialised to 0.
|
* - The fields of #timestamp are initialised to 0.
|
||||||
|
|
|
@ -24,18 +24,28 @@ protected:
|
||||||
std::tr1::unordered_map<std::string, Measurement> measurements ;
|
std::tr1::unordered_map<std::string, Measurement> measurements ;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Request(const std::tr1::unordered_map<std::string, Measurement>
|
Request(const Mobile *_mobile = NULL,
|
||||||
|
const Timestamp &_timestamp = Timestamp(),
|
||||||
|
const std::tr1::unordered_map<std::string, Measurement>
|
||||||
&_measurements =
|
&_measurements =
|
||||||
std::tr1::unordered_map<std::string, Measurement>()) ;
|
std::tr1::unordered_map<std::string, Measurement>()):
|
||||||
|
mobile(const_cast<Mobile*>(_mobile)), timestamp(_timestamp),
|
||||||
|
measurements(_measurements) {}
|
||||||
|
|
||||||
|
Request(const std::tr1::unordered_map<std::string, Measurement>
|
||||||
|
&_measurements):
|
||||||
|
mobile(NULL), measurements(_measurements) {}
|
||||||
|
|
||||||
Request(const Timestamp &_timestamp,
|
Request(const Timestamp &_timestamp,
|
||||||
const std::tr1::unordered_map<std::string, Measurement>
|
const std::tr1::unordered_map<std::string, Measurement>
|
||||||
&_measurements =
|
&_measurements =
|
||||||
std::tr1::unordered_map<std::string, Measurement>()) ;
|
std::tr1::unordered_map<std::string, Measurement>()):
|
||||||
Request(const Mobile *_mobile, const Timestamp &_timestamp,
|
mobile(NULL), timestamp(_timestamp),
|
||||||
const std::tr1::unordered_map<std::string, Measurement>
|
measurements(_measurements) {}
|
||||||
&_measurements =
|
|
||||||
std::tr1::unordered_map<std::string, Measurement>()) ;
|
Request(const Request &source):
|
||||||
Request(const Request &source) ;
|
mobile(source.mobile), timestamp(source.timestamp),
|
||||||
|
measurements(source.measurements) {}
|
||||||
|
|
||||||
virtual ~Request(void) ;
|
virtual ~Request(void) ;
|
||||||
|
|
||||||
|
@ -53,7 +63,6 @@ public:
|
||||||
void set_timestamp(const Timestamp &_timestamp) ;
|
void set_timestamp(const Timestamp &_timestamp) ;
|
||||||
void set_measurements(const std::tr1::unordered_map
|
void set_measurements(const std::tr1::unordered_map
|
||||||
<std::string, Measurement> &_measurements) ;
|
<std::string, Measurement> &_measurements) ;
|
||||||
/// Reinitialises all attributes
|
|
||||||
void clear(void) ;
|
void clear(void) ;
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
|
@ -62,7 +71,7 @@ public:
|
||||||
const Request& operator=(const Request &source) ;
|
const Request& operator=(const Request &source) ;
|
||||||
bool operator==(const Request &comp) const ;
|
bool operator==(const Request &comp) const ;
|
||||||
bool operator!=(const Request &comp) const ;
|
bool operator!=(const Request &comp) const ;
|
||||||
operator bool(void) const ; ///< Cast to bool operator
|
operator bool(void) const ;
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
/// Displays a Request
|
/// Displays a Request
|
||||||
|
|
|
@ -7,8 +7,8 @@
|
||||||
|
|
||||||
/// Represents a timestamp with a millisecond precision
|
/// Represents a timestamp with a millisecond precision
|
||||||
/**
|
/**
|
||||||
* This class boxes <em>struct timespec</em> from <ctime> to integrate
|
* This class boxes <em>struct timespec</em> from ctime (time.h) to
|
||||||
* time manipulation functions.
|
* integrate time manipulation functions.
|
||||||
*/
|
*/
|
||||||
class Timestamp
|
class Timestamp
|
||||||
{
|
{
|
||||||
|
|
|
@ -20,10 +20,17 @@ namespace po = boost::program_options ;
|
||||||
/* *** Constructors *** */
|
/* *** Constructors *** */
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \em argc and \em argv are (normally) the ones passed to the main()
|
||||||
|
* function.
|
||||||
|
* @param argc Number of arguments passed to the program.
|
||||||
|
* @param argv Values of the arguments.
|
||||||
|
*/
|
||||||
UserInterface::UserInterface(const int argc, char **argv)
|
UserInterface::UserInterface(const int argc, char **argv)
|
||||||
{
|
{
|
||||||
cli_argument_count = argc ;
|
assert(argv) ;
|
||||||
cli_argument_values = argv ;
|
cli_argument_values = argv ;
|
||||||
|
cli_argument_count = argc ;
|
||||||
config_file_name = DEFAULT_CONFIG_FILE_NAME ;
|
config_file_name = DEFAULT_CONFIG_FILE_NAME ;
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -68,22 +75,25 @@ void UserInterface::fill_cli_options()
|
||||||
("help,h", "Print help")
|
("help,h", "Print help")
|
||||||
("config-file,f", po::value<string>(),
|
("config-file,f", po::value<string>(),
|
||||||
"Alternative configuration file")
|
"Alternative configuration file")
|
||||||
;
|
; // End of options
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void UserInterface::fill_file_options()
|
void UserInterface::fill_file_options()
|
||||||
{
|
{
|
||||||
file_options->add_options()
|
file_options->add_options()
|
||||||
|
|
||||||
// Server options
|
// Server options
|
||||||
("server.port,l", po::value<int>()
|
("server.port,l", po::value<int>()
|
||||||
->default_value(DEFAULT_LISTENING_PORT),
|
->default_value(DEFAULT_LISTENING_PORT),
|
||||||
"Server listening port.")
|
"Server listening port.")
|
||||||
|
|
||||||
// Input options
|
// Input options
|
||||||
("input.medium,I", po::value<string>(),
|
("input.medium,I", po::value<string>(),
|
||||||
"Medium from which requests are read. Allowed: CSV.")
|
"Medium from which requests are read. Allowed: CSV.")
|
||||||
("input.csv-file,C", po::value<string>(),
|
("input.csv-file,C", po::value<string>(),
|
||||||
"CSV file to use for input (when input.medium = CSV).")
|
"CSV file to use for input (when input.medium = CSV).")
|
||||||
|
|
||||||
// Log options
|
// Log options
|
||||||
("log.medium,L", po::value< vector<string> >()->composing(),
|
("log.medium,L", po::value< vector<string> >()->composing(),
|
||||||
"Medium to which the requests will be logged. You can specify \
|
"Medium to which the requests will be logged. You can specify \
|
||||||
|
@ -91,16 +101,19 @@ this option more than once. Allowed: none, CSV. The `none` value \
|
||||||
completely disables logging.")
|
completely disables logging.")
|
||||||
("log.csv-file", po::value<string>(),
|
("log.csv-file", po::value<string>(),
|
||||||
"CSV file to use for logging (when log.medium = CSV).")
|
"CSV file to use for logging (when log.medium = CSV).")
|
||||||
|
|
||||||
// Positioning algorithm options
|
// Positioning algorithm options
|
||||||
("positioning.algorithm,A", po::value< vector<string> >()->composing(),
|
("positioning.algorithm,A", po::value< vector<string> >()->composing(),
|
||||||
"Algorithms used to compute positions. You can specify \
|
"Algorithms used to compute positions. You can specify \
|
||||||
this option more than once (but at least once). Allowed: Real.")
|
this option more than once (but at least once). Allowed: Real.")
|
||||||
|
|
||||||
// Output options
|
// Output options
|
||||||
("output.medium,O", po::value< vector<string> >()->composing(),
|
("output.medium,O", po::value< vector<string> >()->composing(),
|
||||||
"Medium to which the results will be wrote. You can specify \
|
"Medium to which the results will be wrote. You can specify \
|
||||||
this option more than once. Allowed: Terminal. If this option is \
|
this option more than once. Allowed: Terminal. If this option is \
|
||||||
absent, results will be printed on the terminal.")
|
absent, results will be printed on the terminal.")
|
||||||
;
|
|
||||||
|
; // End of options
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -11,9 +11,13 @@ using namespace std ;
|
||||||
/**
|
/**
|
||||||
* @param _b A pointer to the (first) Building to add to #buildings.
|
* @param _b A pointer to the (first) Building to add to #buildings.
|
||||||
* If it is NULL, #buildings will remain empty.
|
* If it is NULL, #buildings will remain empty.
|
||||||
* @param p Coordinates of the Waypoint.
|
* @param _x X coordinate.
|
||||||
|
* @param _y Y coordinate.
|
||||||
|
* @param _z Z coordinate.
|
||||||
*/
|
*/
|
||||||
Waypoint::Waypoint(const Building *_b, const Point3D &p): Point3D(p)
|
Waypoint::Waypoint(const Building *_b,
|
||||||
|
const float &_x, const float &_y, const float &_z
|
||||||
|
): Point3D(_x, _y, _z)
|
||||||
{
|
{
|
||||||
if (_b != NULL)
|
if (_b != NULL)
|
||||||
buildings.push_back(const_cast<Building*>(_b)) ;
|
buildings.push_back(const_cast<Building*>(_b)) ;
|
||||||
|
@ -23,13 +27,9 @@ Waypoint::Waypoint(const Building *_b, const Point3D &p): Point3D(p)
|
||||||
/**
|
/**
|
||||||
* @param _b A pointer to the (first) Building to add to #buildings.
|
* @param _b A pointer to the (first) Building to add to #buildings.
|
||||||
* If it is NULL, #buildings will remain empty.
|
* If it is NULL, #buildings will remain empty.
|
||||||
* @param _x X coordinate.
|
* @param p Coordinates of the Waypoint.
|
||||||
* @param _y Y coordinate.
|
|
||||||
* @param _z Z coordinate.
|
|
||||||
*/
|
*/
|
||||||
Waypoint::Waypoint(const Building *_b,
|
Waypoint::Waypoint(const Building *_b, const Point3D &p): Point3D(p)
|
||||||
const float &_x, const float &_y, const float &_z
|
|
||||||
): Point3D(_x, _y, _z)
|
|
||||||
{
|
{
|
||||||
if (_b != NULL)
|
if (_b != NULL)
|
||||||
buildings.push_back(const_cast<Building*>(_b)) ;
|
buildings.push_back(const_cast<Building*>(_b)) ;
|
||||||
|
|
|
@ -20,29 +20,24 @@ class Waypoint: public Point3D
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
/// List of Building associated with the Waypoint
|
/// List of Building associated with the Waypoint
|
||||||
/** Note that \em buildings is a \em pointer list: only pointers
|
|
||||||
are stored, not values. */
|
|
||||||
std::vector<Building*> buildings ;
|
std::vector<Building*> buildings ;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// Constructs a Waypoint from a Building pointer and a Point3D
|
|
||||||
Waypoint(const Building *_b, const Point3D &p) ;
|
|
||||||
/// \brief Constructs a Waypoint from a Building pointer and a
|
|
||||||
/// 3-float defined point (or default constructor)
|
|
||||||
Waypoint(const Building *_b = NULL, const float &_x = 0,
|
Waypoint(const Building *_b = NULL, const float &_x = 0,
|
||||||
const float &_y = 0, const float &_z = 0) ;
|
const float &_y = 0, const float &_z = 0) ;
|
||||||
/// Constructs a Waypoint from a Point3D
|
|
||||||
|
Waypoint(const Building *_b, const Point3D &p) ;
|
||||||
|
|
||||||
Waypoint(const Point3D &p): Point3D(p) {}
|
Waypoint(const Point3D &p): Point3D(p) {}
|
||||||
/// Copy constructor
|
|
||||||
Waypoint(const Waypoint &wp): Point3D(wp), buildings(wp.buildings) {}
|
Waypoint(const Waypoint &wp): Point3D(wp), buildings(wp.buildings) {}
|
||||||
|
|
||||||
~Waypoint(void) ; ///< Destructor
|
~Waypoint(void) ;
|
||||||
|
|
||||||
/** @name Read accessors */
|
/** @name Read accessors */
|
||||||
//@{
|
//@{
|
||||||
/// #buildings's first element read accessor
|
/// #buildings's first element read accessor
|
||||||
Building* get_1st_building(void) const ;
|
Building* get_1st_building(void) const ;
|
||||||
/// #buildings read accessor
|
|
||||||
const std::vector<Building*>& get_buildings(void) const ;
|
const std::vector<Building*>& get_buildings(void) const ;
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
|
|
|
@ -4,31 +4,6 @@ using namespace std ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* *** Constructors *** */
|
|
||||||
|
|
||||||
|
|
||||||
WifiDevice::WifiDevice(const string &_ip_addr,
|
|
||||||
const string &_mac_addr,
|
|
||||||
const float _antenna_gain,
|
|
||||||
const float _trx_power)
|
|
||||||
{
|
|
||||||
ip_addr = _ip_addr ;
|
|
||||||
mac_addr = _mac_addr ;
|
|
||||||
antenna_gain = _antenna_gain ;
|
|
||||||
trx_power = _trx_power ;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
WifiDevice::WifiDevice(const WifiDevice &wd)
|
|
||||||
{
|
|
||||||
ip_addr = wd.ip_addr ;
|
|
||||||
mac_addr = wd.mac_addr ;
|
|
||||||
antenna_gain = wd.antenna_gain ;
|
|
||||||
trx_power = wd.trx_power ;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* *** Operators *** */
|
/* *** Operators *** */
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -15,43 +15,38 @@
|
||||||
class WifiDevice
|
class WifiDevice
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
std::string ip_addr ; ///< IP address
|
std::string ip_addr ;
|
||||||
std::string mac_addr ; ///< MAC address
|
std::string mac_addr ;
|
||||||
float antenna_gain ; ///< Antenna gain in dBi
|
float antenna_gain ; ///< Antenna gain in dBi
|
||||||
float trx_power ; ///< Transmit power in dBm
|
float trx_power ; ///< Transmit power in dBm
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// Constructs a WifiDevice by defining all (or none) of its attributes
|
|
||||||
WifiDevice(const std::string &_ip_addr = "",
|
WifiDevice(const std::string &_ip_addr = "",
|
||||||
const std::string &_mac_addr = "",
|
const std::string &_mac_addr = "",
|
||||||
const float _antenna_gain = WIFIDEVICE_DEFAULT_ANTENNA_GAIN,
|
const float _antenna_gain = WIFIDEVICE_DEFAULT_ANTENNA_GAIN,
|
||||||
const float _trx_power = WIFIDEVICE_DEFAULT_TRX_POWER) ;
|
const float _trx_power = WIFIDEVICE_DEFAULT_TRX_POWER):
|
||||||
/// Copy constructor
|
ip_addr(_ip_addr), mac_addr(_mac_addr),
|
||||||
WifiDevice(const WifiDevice &wd) ;
|
antenna_gain(_antenna_gain), trx_power(_trx_power) {}
|
||||||
|
|
||||||
virtual ~WifiDevice(void) {} ///< Destructor (do nothing)
|
WifiDevice(const WifiDevice &source):
|
||||||
|
ip_addr(source.ip_addr), mac_addr(source.mac_addr),
|
||||||
|
antenna_gain(source.antenna_gain), trx_power(source.trx_power) {}
|
||||||
|
|
||||||
|
virtual ~WifiDevice(void) {}
|
||||||
|
|
||||||
/** @name Read accessors */
|
/** @name Read accessors */
|
||||||
//@{
|
//@{
|
||||||
/// #ip_addr read accessor
|
|
||||||
const std::string& get_ip_addr(void) const ;
|
const std::string& get_ip_addr(void) const ;
|
||||||
/// #mac_addr read accessor
|
|
||||||
const std::string& get_mac_addr(void) const ;
|
const std::string& get_mac_addr(void) const ;
|
||||||
/// #antenna_gain read accessor
|
|
||||||
float get_antenna_gain(void) const ;
|
float get_antenna_gain(void) const ;
|
||||||
/// #trx_power read accessor
|
|
||||||
float get_trx_power(void) const ;
|
float get_trx_power(void) const ;
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
/** @name Write accessors */
|
/** @name Write accessors */
|
||||||
//@{
|
//@{
|
||||||
/// #ip_addr write accessor
|
|
||||||
void set_ip_addr(const std::string &_ip_addr) ;
|
void set_ip_addr(const std::string &_ip_addr) ;
|
||||||
/// #mac_addr write accessor
|
|
||||||
void set_mac_addr(const std::string &_mac_addr) ;
|
void set_mac_addr(const std::string &_mac_addr) ;
|
||||||
/// #antenna_gain write accessor
|
|
||||||
void set_antenna_gain(float _antenna_gain) ;
|
void set_antenna_gain(float _antenna_gain) ;
|
||||||
/// #trx_power write accessor
|
|
||||||
void set_trx_power(float _trx_power) ;
|
void set_trx_power(float _trx_power) ;
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue