2012-02-06 16:44:09 +01:00
|
|
|
/*
|
2013-05-29 18:43:35 +02:00
|
|
|
* This file is part of the Owl Positioning System (OwlPS) project.
|
|
|
|
* It is subject to the copyright notice and license terms in the
|
|
|
|
* COPYRIGHT.t2t file found in the top-level directory of this
|
|
|
|
* distribution and at
|
|
|
|
* http://code.lm7.fr/p/owlps/source/tree/master/COPYRIGHT.t2t
|
|
|
|
* No part of the OwlPS Project, including this file, may be copied,
|
|
|
|
* modified, propagated, or distributed except according to the terms
|
|
|
|
* contained in the COPYRIGHT.t2t file; the COPYRIGHT.t2t file must be
|
|
|
|
* distributed along with this file, either separately or by replacing
|
2013-06-22 23:30:17 +02:00
|
|
|
* this notice by the COPYRIGHT.t2t file's contents.
|
2012-02-06 16:44:09 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
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>
|
|
|
|
#include <ostream>
|
2013-05-30 20:13:44 +02:00
|
|
|
#include <unordered_set>
|
|
|
|
#include <unordered_map>
|
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
|
2013-05-30 20:13:44 +02:00
|
|
|
std::unordered_map<std::string, Area*> areas ;
|
2010-03-05 17:24:18 +01:00
|
|
|
/// List of Waypoint in the Building
|
2013-05-30 20:13:44 +02:00
|
|
|
std::unordered_set<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 ;
|
2013-05-30 20:13:44 +02:00
|
|
|
const std::unordered_map<std::string, Area*>&
|
2010-04-02 10:56:52 +02:00
|
|
|
get_areas(void) const ;
|
2013-05-30 20:13:44 +02:00
|
|
|
const std::unordered_set<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) ;
|
2013-05-30 21:23:05 +02:00
|
|
|
/// Adds an Area to the [list of areas](@ref #areas)
|
2010-04-02 10:56:52 +02:00
|
|
|
void add_area(Area *&a) ;
|
2013-05-30 21:23:05 +02:00
|
|
|
/// Adds a Waypoint to the [list of waypoints](@ref #waypoints)
|
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 */
|
|
|
|
//@{
|
2011-07-30 20:38:42 +02:00
|
|
|
Building& operator=(const Building &source) ;
|
2010-03-05 17:24:18 +01:00
|
|
|
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 ;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-05-30 20:13:44 +02:00
|
|
|
inline const std::unordered_map<std::string, Area*>&
|
2010-04-02 10:56:52 +02:00
|
|
|
Building::get_areas() const
|
2010-01-05 11:50:24 +01:00
|
|
|
{
|
|
|
|
return areas ;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-05-30 20:13:44 +02:00
|
|
|
inline const std::unordered_set<Waypoint*>&
|
2010-04-02 10:56:52 +02:00
|
|
|
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
|
|
|
/**
|
2013-05-30 21:23:05 +02:00
|
|
|
* @param wp A pointer to the Waypoint to add. If `wp` is NULL,
|
2010-01-16 12:23:07 +01:00
|
|
|
* 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-04-02 10:56:52 +02:00
|
|
|
waypoints.insert(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_
|