2010-02-01 17:11:36 +01:00
|
|
|
#ifndef _OWLPS_POSITIONING_BUILDING_HH_
|
|
|
|
#define _OWLPS_POSITIONING_BUILDING_HH_
|
2009-12-07 16:03:53 +01:00
|
|
|
|
|
|
|
class Area ;
|
|
|
|
class Waypoint ;
|
|
|
|
|
2010-01-06 01:18:14 +01:00
|
|
|
#include <string>
|
2009-12-07 16:03:53 +01:00
|
|
|
#include <vector>
|
2010-01-06 01:18:14 +01:00
|
|
|
#include <ostream>
|
2009-12-07 16:03:53 +01:00
|
|
|
|
2010-01-16 12:23:07 +01:00
|
|
|
/// Represents a building, containing one or more Area
|
2009-12-07 16:03:53 +01:00
|
|
|
class Building
|
|
|
|
{
|
|
|
|
protected:
|
2010-03-05 17:24:18 +01:00
|
|
|
std::string name ;
|
|
|
|
/// List of Area contained in the Building
|
|
|
|
std::vector<Area*> areas ;
|
|
|
|
/// List of Waypoint in the Building
|
|
|
|
std::vector<Waypoint*> waypoints ;
|
2009-12-07 16:03:53 +01:00
|
|
|
|
|
|
|
public :
|
2010-03-05 17:24:18 +01:00
|
|
|
Building(const std::string &_name = "Unnamed building"):
|
|
|
|
name(_name) {}
|
2009-12-07 16:03:53 +01:00
|
|
|
|
2010-03-05 17:24:18 +01:00
|
|
|
Building(const Building &source):
|
|
|
|
name(source.name), areas(source.areas),
|
|
|
|
waypoints(source.waypoints) {}
|
|
|
|
|
|
|
|
~Building(void) ;
|
2009-12-07 16:03:53 +01:00
|
|
|
|
2010-01-16 12:23:07 +01:00
|
|
|
/** @name Read accessors */
|
|
|
|
//@{
|
2010-01-13 15:29:44 +01:00
|
|
|
const std::string& get_name(void) const ;
|
|
|
|
const std::vector<Area*>& get_areas(void) const ;
|
|
|
|
const std::vector<Waypoint*>& get_waypoints(void) const ;
|
2010-01-16 12:23:07 +01:00
|
|
|
//@}
|
2009-12-07 16:03:53 +01:00
|
|
|
|
2010-01-16 12:23:07 +01:00
|
|
|
/** @name Write accessors */
|
|
|
|
//@{
|
2010-01-04 17:10:42 +01:00
|
|
|
void set_name(const std::string &_name) ;
|
2010-01-16 12:23:07 +01:00
|
|
|
/// Adds an Area to the \link #areas list of areas\endlink
|
2009-12-07 16:03:53 +01:00
|
|
|
void add_area(const Area *a) ;
|
2010-01-16 12:23:07 +01:00
|
|
|
/// Adds a Waypoint to the \link #waypoints list of waypoints\endlink
|
2009-12-07 16:03:53 +01:00
|
|
|
void add_waypoint(const Waypoint *wp) ;
|
2010-01-16 12:23:07 +01:00
|
|
|
//@}
|
2009-12-07 16:03:53 +01:00
|
|
|
|
2010-01-16 12:23:07 +01:00
|
|
|
/** @name Operators */
|
|
|
|
//@{
|
2010-03-05 17:24:18 +01:00
|
|
|
const Building& operator=(const Building &source) ;
|
|
|
|
bool operator==(const Building &source) const ;
|
|
|
|
bool operator!=(const Building &source) const ;
|
2010-01-16 12:23:07 +01:00
|
|
|
//@}
|
2009-12-07 16:03:53 +01:00
|
|
|
|
2010-01-16 12:23:07 +01:00
|
|
|
/// Displays a Building
|
2010-01-04 17:10:42 +01:00
|
|
|
friend std::ostream& operator<<(std::ostream &os, const Building &b) ;
|
2009-12-07 16:03:53 +01:00
|
|
|
} ;
|
|
|
|
|
2010-01-05 11:50:24 +01:00
|
|
|
|
|
|
|
|
2010-01-16 12:23:07 +01:00
|
|
|
/* *** Read accessors *** */
|
2010-01-05 11:50:24 +01:00
|
|
|
|
|
|
|
|
2010-01-13 15:29:44 +01:00
|
|
|
inline const std::string& Building::get_name() const
|
2010-01-05 11:50:24 +01:00
|
|
|
{
|
|
|
|
return name ;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-01-13 15:29:44 +01:00
|
|
|
inline const std::vector<Area*>& Building::get_areas() const
|
2010-01-05 11:50:24 +01:00
|
|
|
{
|
|
|
|
return areas ;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-01-13 15:29:44 +01:00
|
|
|
inline const std::vector<Waypoint*>& Building::get_waypoints() const
|
2010-01-05 11:50:24 +01:00
|
|
|
{
|
|
|
|
return waypoints ;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-01-16 12:23:07 +01:00
|
|
|
/* *** Write accessors *** */
|
2010-01-05 11:50:24 +01:00
|
|
|
|
|
|
|
|
|
|
|
inline void Building::set_name(const std::string &_name)
|
|
|
|
{
|
|
|
|
name = _name ;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-01-16 12:23:07 +01:00
|
|
|
/**
|
|
|
|
* @param a A pointer to the Area to add. If \em a is NULL, nothing
|
|
|
|
* will be added.
|
|
|
|
*/
|
2010-01-05 11:50:24 +01:00
|
|
|
inline void Building::add_area(const Area *a)
|
|
|
|
{
|
2010-01-16 12:23:07 +01:00
|
|
|
if (a != NULL)
|
2010-01-18 14:19:57 +01:00
|
|
|
areas.push_back(const_cast<Area*>(a)) ;
|
2010-01-05 11:50:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-01-16 12:23:07 +01:00
|
|
|
/**
|
|
|
|
* @param wp A pointer to the Waypoint to add. If \em wp is NULL,
|
|
|
|
* nothing will be added.
|
|
|
|
*/
|
2010-01-05 11:50:24 +01:00
|
|
|
inline void Building::add_waypoint(const Waypoint *wp)
|
|
|
|
{
|
2010-01-16 12:23:07 +01:00
|
|
|
if (wp != NULL)
|
2010-01-18 14:19:57 +01:00
|
|
|
waypoints.push_back(const_cast<Waypoint*>(wp)) ;
|
2010-01-05 11:50:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-01-16 12:23:07 +01:00
|
|
|
/* *** Operators *** */
|
2010-01-05 11:50:24 +01:00
|
|
|
|
|
|
|
|
|
|
|
inline bool Building::operator!=(const Building &b) const
|
|
|
|
{
|
|
|
|
return !(*this == b) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-02-01 17:11:36 +01:00
|
|
|
#endif // _OWLPS_POSITIONING_BUILDING_HH_
|