26 static const int32_t DEFAULT_TIMEOUT = 500;
31 HebiLookupPtr lookup_;
36 float initial_group_feedback_frequency_{100.0f};
41 int32_t initial_group_command_lifetime_{250};
68 Lookup(
const std::vector<std::string>& interfaces);
84 void reset(
const std::vector<std::string>& interfaces);
107 std::shared_ptr<Group>
getGroupFromNames(
const std::vector<std::string>& families,
108 const std::vector<std::string>& names, int32_t timeout_ms = DEFAULT_TIMEOUT)
const;
124 std::shared_ptr<Group>
getGroupFromMacs(
const std::vector<MacAddress>& addresses,
125 int32_t timeout_ms = DEFAULT_TIMEOUT)
const;
141 std::shared_ptr<Group>
getGroupFromFamily(
const std::string& family, int32_t timeout_ms = DEFAULT_TIMEOUT)
const;
162 int32_t timeout_ms = DEFAULT_TIMEOUT)
const;
241 uint32_t ip_address_;
249 HebiLookupEntryListPtr lookup_list_;
255 class Iterator final {
258 using value_type = Entry;
259 using difference_type = int;
260 using pointer = Entry*;
261 using reference = Entry;
262 using iterator_category = std::bidirectional_iterator_tag;
265 explicit Iterator(
const EntryList& list,
size_t current);
268 reference operator*()
const;
271 Iterator& operator++();
272 Iterator operator++(
int);
273 Iterator& operator--();
274 Iterator operator--(
int);
277 bool operator==(
const Iterator& rhs)
const;
278 bool operator!=(
const Iterator& rhs)
const;
289 EntryList(HebiLookupEntryListPtr lookup_list) : lookup_list_(lookup_list) {}
293 Entry operator[](
size_t index) const;
297 Iterator
begin() const;
298 Iterator
end() const;
EntryList(HebiLookupEntryListPtr lookup_list)
Definition: lookup.hpp:289
Lookup()
Creates a Lookup object which can create Module and Group references. Typically, only one Lookup obje...
Definition: lookup.cpp:7
double getLookupFrequencyHz() const
Gets the rate [Hz] at which "discovery" packets are broadcast.
Definition: lookup.cpp:92
std::shared_ptr< Group > getGroupFromFamily(const std::string &family, int32_t timeout_ms=DEFAULT_TIMEOUT) const
Get a group from all known modules with the given family.
Definition: lookup.cpp:59
A simple wrapper class for internal C-API HebiMacAddress objects to allow interfacing with API calls ...
Definition: mac_address.hpp:13
Iterator begin() const
Definition: lookup.cpp:166
Definition: lookup.hpp:236
#define HEBI_DISABLE_COPY_MOVE(Class)
Definition: util.hpp:6
std::shared_ptr< Group > getGroupFromNames(const std::vector< std::string > &families, const std::vector< std::string > &names, int32_t timeout_ms=DEFAULT_TIMEOUT) const
Get a group from modules with the given names and families.
Definition: lookup.cpp:27
std::shared_ptr< EntryList > getEntryList()
Definition: lookup.cpp:170
~EntryList() noexcept
Definition: lookup.cpp:130
~Lookup() noexcept
Destructor frees all resources created by Lookup object, and stops the background query thread.
Definition: lookup.cpp:17
void reset(const std::vector< std::string > &interfaces)
Resets the lookup object to its initial state without destructing and re-constructing the object.
Definition: lookup.cpp:19
std::shared_ptr< Group > getGroupFromMacs(const std::vector< MacAddress > &addresses, int32_t timeout_ms=DEFAULT_TIMEOUT) const
Get a group from modules with the given mac addresses.
Definition: lookup.cpp:47
int32_t getInitialGroupCommandLifetimeMs()
Gets the default command lifetime value for groups created from this lookup.
Definition: lookup.cpp:88
void setInitialGroupFeedbackFrequencyHz(float frequency)
Sets the default feedback frequency value for groups created from this lookup.
Definition: lookup.cpp:86
std::shared_ptr< Group > getConnectedGroupFromName(const std::string &family, const std::string &name, int32_t timeout_ms=DEFAULT_TIMEOUT) const
Get a group from all modules known to connect to a module with the given name and family.
Definition: lookup.cpp:67
Iterator end() const
Definition: lookup.cpp:168
bool setLookupFrequencyHz(double frequency)
Sets the lookup rate [Hz].
Definition: lookup.cpp:94
void setInitialGroupCommandLifetimeMs(int32_t ms)
Sets the default command lifetime value for groups created from this lookup.
Definition: lookup.cpp:90
Maintains a registry of network-connected modules and returns Group objects to the user.
Definition: lookup.hpp:24
std::shared_ptr< Group > getConnectedGroupFromMac(const MacAddress &address, int32_t timeout_ms=DEFAULT_TIMEOUT) const
Get a group from all modules known to connect to a module with the given mac address.
Definition: lookup.cpp:76
float getInitialGroupFeedbackFrequencyHz()
Gets the default feedback frequency value for groups created from this lookup.
Definition: lookup.cpp:84
size_t size() const
Definition: lookup.cpp:164