[Positioning] Add Stock::mobile_exists()
This commit is contained in:
parent
0b43e7f5fc
commit
6b662a597a
|
@ -116,6 +116,19 @@ void Stock::waypoint_remove_building(const Waypoint &point,
|
||||||
/* *** Mobile operations *** */
|
/* *** Mobile operations *** */
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param mac The MAC address of the Mobile to search for.
|
||||||
|
* It must be a valid MAC address, as no check is performed.
|
||||||
|
* @return \em true if a mobile with this MAC address exists.
|
||||||
|
* @return \em false if this MAC address was not found.
|
||||||
|
*/
|
||||||
|
bool Stock::mobile_exists(const std::string &mac)
|
||||||
|
{
|
||||||
|
unordered_map<string, Mobile>::const_iterator i = mobiles.find(mac) ;
|
||||||
|
return i != mobiles.end() ;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param mac The MAC address of the Mobile to search for.
|
* @param mac The MAC address of the Mobile to search for.
|
||||||
* It must be a valid MAC address, as no check is performed.
|
* It must be a valid MAC address, as no check is performed.
|
||||||
|
|
|
@ -70,6 +70,8 @@ public:
|
||||||
//@{
|
//@{
|
||||||
/// Returns the number of mobiles
|
/// Returns the number of mobiles
|
||||||
static unsigned int nb_mobiles(void) ;
|
static unsigned int nb_mobiles(void) ;
|
||||||
|
/// Verify the existence of a mobile
|
||||||
|
static bool mobile_exists(const std::string &mac) ;
|
||||||
/// Reads the Mobile corresponding to a given MAC address
|
/// Reads the Mobile corresponding to a given MAC address
|
||||||
static const Mobile& get_mobile(const std::string &mac) ;
|
static const Mobile& get_mobile(const std::string &mac) ;
|
||||||
/// \brief Searches for a Mobile given its MAC address and creates
|
/// \brief Searches for a Mobile given its MAC address and creates
|
||||||
|
|
Loading…
Reference in New Issue