owlps/owlps-positioning/building.hh

125 lines
2.5 KiB
C++
Raw Normal View History

#ifndef _OWLPS_POSITIONING_REFERENCEPOINT_HH_
#define _OWLPS_POSITIONING_REFERENCEPOINT_HH_
class Area ;
class Waypoint ;
#include <string>
#include <vector>
#include <ostream>
/// Represents a building, containing one or more Area
class Building
{
protected:
std::string name ; ///< Name of the Building
std::vector<Area*> areas ; ///< List of Area contained in the Building
std::vector<Waypoint*> waypoints ; ///< List of Waypoint in the Building
public :
/// Constructs a Building from its name (or default constructor)
Building(const std::string &_name = "Unnamed building") ;
/// Copy constructor
Building(const Building &b) ;
~Building(void) ; ///< Destructor
/** @name Read accessors */
//@{
/// #name read accessor
const std::string& get_name(void) const ;
/// #areas read accessor
const std::vector<Area*>& get_areas(void) const ;
/// #waypoints read accessor
const std::vector<Waypoint*>& get_waypoints(void) const ;
//@}
/** @name Write accessors */
//@{
/// #name write accessor
void set_name(const std::string &_name) ;
/// Adds an Area to the \link #areas list of areas\endlink
void add_area(const Area *a) ;
/// Adds a Waypoint to the \link #waypoints list of waypoints\endlink
void add_waypoint(const Waypoint *wp) ;
//@}
/** @name Operators */
//@{
const Building& operator=(const Building &p) ;
bool operator==(const Building &p) const ;
bool operator!=(const Building &p) const ;
//@}
/// Displays a Building
friend std::ostream& operator<<(std::ostream &os, const Building &b) ;
} ;
/* *** Read accessors *** */
inline const std::string& Building::get_name() const
{
return name ;
}
inline const std::vector<Area*>& Building::get_areas() const
{
return areas ;
}
inline const std::vector<Waypoint*>& Building::get_waypoints() const
{
return waypoints ;
}
/* *** Write accessors *** */
inline void Building::set_name(const std::string &_name)
{
name = _name ;
}
/**
* @param a A pointer to the Area to add. If \em a is NULL, nothing
* will be added.
*/
inline void Building::add_area(const Area *a)
{
if (a != NULL)
areas.push_back(const_cast<Area*>(a)) ;
}
/**
* @param wp A pointer to the Waypoint to add. If \em wp is NULL,
* nothing will be added.
*/
inline void Building::add_waypoint(const Waypoint *wp)
{
if (wp != NULL)
waypoints.push_back(const_cast<Waypoint*>(wp)) ;
}
/* *** Operators *** */
inline bool Building::operator!=(const Building &b) const
{
return !(*this == b) ;
}
#endif // _OWLPS_POSITIONING_REFERENCEPOINT_HH_