63 lines
1.6 KiB
C++
63 lines
1.6 KiB
C++
#ifndef _OWLPS_POSITIONING_STOCK_HH_
|
|
#define _OWLPS_POSITIONING_STOCK_HH_
|
|
|
|
#include "mobile.hh"
|
|
#include "accesspoint.hh"
|
|
|
|
#include <unordered_map>
|
|
|
|
/// Storage class
|
|
class Stock
|
|
{
|
|
private:
|
|
/// List of known Mobile
|
|
static std::tr1::unordered_map<std::string, Mobile> mobiles ;
|
|
|
|
/// List of known AccessPoint
|
|
static std::tr1::unordered_map<std::string, AccessPoint> aps ;
|
|
|
|
public:
|
|
/// Read the Mobile corresponding to a given MAC address
|
|
static const Mobile& get_mobile(const std::string &mac) ;
|
|
/// Get a reference to the Mobile corresponding to a given MAC address
|
|
static Mobile& getw_mobile(const std::string &mac) ;
|
|
|
|
/// Read the AccessPoint corresponding to a given MAC address
|
|
static const AccessPoint& get_ap(const std::string &mac) ;
|
|
/// Get a reference to the AccessPoint corresponding to a given MAC address
|
|
static AccessPoint& getw_ap(const std::string &mac) ;
|
|
} ;
|
|
|
|
|
|
|
|
/* *** Read accessors *** */
|
|
|
|
|
|
/**
|
|
* If the Mobile corresponding to \em mac does not exist, it is created.
|
|
* @param mac The MAC address of the Mobile to search for. It must be a
|
|
* valid MAC address, as no check is performed.
|
|
* @return A modifiable reference to the Mobile.
|
|
*/
|
|
inline Mobile& Stock::getw_mobile(const std::string &mac)
|
|
{
|
|
return mobiles[mac] ;
|
|
}
|
|
|
|
|
|
/**
|
|
* If the AccessPoint corresponding to \em mac does not exist, it is
|
|
* created.
|
|
* @param mac The MAC address of the AccessPoint to search for.
|
|
* It must be a valid MAC address, as no check is performed.
|
|
* @return A modifiable reference to the AccessPoint.
|
|
*/
|
|
inline AccessPoint& Stock::getw_ap(const std::string &mac)
|
|
{
|
|
return aps[mac] ;
|
|
}
|
|
|
|
|
|
|
|
#endif // _OWLPS_POSITIONING_STOCK_HH_
|