diff --git a/owlps-positioning/src/stock.cc b/owlps-positioning/src/stock.cc index e0d8df9..dee9a44 100644 --- a/owlps-positioning/src/stock.cc +++ b/owlps-positioning/src/stock.cc @@ -152,6 +152,19 @@ const Mobile& Stock::find_create_mobile(const string &mac) /* *** AccessPoint operations *** */ +/** + * @param mac The MAC address of the AccessPoint to search for. + * It must be a valid MAC address, as no check is performed. + * @return \em true if an AP with this MAC address exists. + * @return \em false if this MAC address was not found. + */ +bool Stock::ap_exists(const std::string &mac) +{ + unordered_map::const_iterator i = aps.find(mac) ; + return i != aps.end() ; +} + + /** * @param mac The MAC address of the AccessPoint to search for. * It must be a valid MAC address, as no check is performed. diff --git a/owlps-positioning/src/stock.hh b/owlps-positioning/src/stock.hh index 33b1021..ab4cbab 100644 --- a/owlps-positioning/src/stock.hh +++ b/owlps-positioning/src/stock.hh @@ -81,6 +81,8 @@ public: //@{ /// Returns the number of access points static unsigned int nb_aps(void) ; + /// Verify the existence of an AP + static bool ap_exists(const std::string &mac) ; /// Reads the AccessPoint corresponding to a given MAC address static const AccessPoint& get_ap(const std::string &mac) ; /// \brief Searches for an AccessPoint given its MAC address and