12 const std::vector<std::string>& names, int32_t timeout_ms) {
13 std::shared_ptr<Group> ptr;
14 std::vector<const char*> names_cstrs;
15 std::vector<const char*> families_cstrs;
16 names_cstrs.reserve(names.size());
17 families_cstrs.reserve(families.size());
19 std::transform(std::begin(names), std::end(names), std::back_inserter(names_cstrs),
20 [](
const std::string& name) {
return name.c_str(); });
21 std::transform(std::begin(families), std::end(families), std::back_inserter(families_cstrs),
22 [](
const std::string& family) {
return family.c_str(); });
25 names_cstrs.data(), names_cstrs.size(), timeout_ms);
32 std::shared_ptr<Group> ptr;
33 std::vector<const HebiMacAddress*> addresses_c;
34 addresses_c.reserve(addresses.size());
35 std::transform(std::begin(addresses), std::end(addresses), std::back_inserter(addresses_c),
44 std::shared_ptr<Group> ptr;
53 std::shared_ptr<Group> ptr;
61 std::shared_ptr<Group> ptr;
120 size_t required_size;
122 auto buffer =
new char[required_size];
124 std::string name(buffer, required_size - 1);
128 buffer =
new char[required_size];
130 std::string family(buffer, required_size - 1);
138 Entry e = {name, family, mac};
149 std::shared_ptr<Lookup::EntryList> ptr;
151 if (entry_list !=
nullptr)
152 return std::make_shared<Lookup::EntryList>(entry_list);
float initial_group_feedback_frequency_
HebiGroupPtr hebiGroupCreateConnectedFromMac(HebiLookupPtr lookup, const HebiMacAddress *address, int32_t timeout_ms)
Create a group with all modules connected to module with the given MAC address.
Entry operator[](size_t index) const
bool operator!=(const Iterator &rhs) const
Lookup()
Creates a Lookup object which can create Module and Group references. Typically, only one Lookup obje...
double getLookupFrequencyHz() const
Gets the rate [Hz] at which "discovery" packets are broadcast.
A simple wrapper class for internal C-API HebiMacAddress objects to allow interfacing with API calls ...
HebiLookupPtr hebiLookupCreate(const char *const *ifaces, size_t ifaces_length)
Lookup API.
HebiStatusCode hebiLookupEntryListGetName(HebiLookupEntryListPtr lookup_list, size_t index, char *buffer, size_t *length)
reference operator*() const
std::shared_ptr< EntryList > getEntryList()
HebiGroupPtr hebiGroupCreateConnectedFromName(HebiLookupPtr lookup, const char *family, const char *name, int32_t timeout_ms)
Create a group with all modules connected to module with the given name and family.
std::shared_ptr< Group > getGroupFromFamily(const std::string &family, int32_t timeout_ms=DEFAULT_TIMEOUT)
Get a group from all known modules with the given family.
size_t hebiLookupEntryListGetSize(HebiLookupEntryListPtr lookup_list)
HebiGroupPtr hebiGroupCreateFromNames(HebiLookupPtr lookup, const char *const *families, size_t num_families, const char *const *names, size_t num_names, int32_t timeout_ms)
Create a group with modules matching the given names and families.
~Lookup() noexcept
Destructor frees all resources created by Lookup object, and stops the background query thread...
HebiLookupEntryListPtr hebiCreateLookupEntryList(HebiLookupPtr lookup)
Return a snapshot of the contents of the module registry – i.e., which modules have been found by th...
std::shared_ptr< Group > getConnectedGroupFromMac(const MacAddress &address, int32_t timeout_ms=DEFAULT_TIMEOUT)
Get a group from all modules known to connect to a module with the given mac address.
std::shared_ptr< Group > getGroupFromMacs(const std::vector< MacAddress > &addresses, int32_t timeout_ms=DEFAULT_TIMEOUT)
Get a group from modules with the given mac addresses.
HebiStatusCode hebiLookupEntryListGetFamily(HebiLookupEntryListPtr lookup_list, size_t index, char *buffer, size_t *length)
int32_t getInitialGroupCommandLifetimeMs()
Gets the default command lifetime value for groups created from this lookup.
HebiLookupEntryListPtr lookup_list_
HebiGroupPtr hebiGroupCreateFromFamily(HebiLookupPtr lookup, const char *family, int32_t timeout_ms)
Create a group with all modules known to the lookup with the given family.
bool operator==(const Iterator &rhs) const
void setInitialGroupFeedbackFrequencyHz(float frequency)
Sets the default feedback frequency value for groups created from this lookup.
bool setLookupFrequencyHz(double frequency)
Sets the lookup rate [Hz].
HebiStatusCode hebiLookupSetLookupFrequencyHz(HebiLookupPtr lookup, double frequency)
sets the lookup request rate [Hz]
void setInitialGroupCommandLifetimeMs(int32_t ms)
Sets the default command lifetime value for groups created from this lookup.
std::shared_ptr< Group > getConnectedGroupFromName(const std::string &family, const std::string &name, int32_t timeout_ms=DEFAULT_TIMEOUT)
Get a group from all modules known to connect to a module with the given name and family...
HebiStatusCode hebiLookupEntryListGetMacAddress(HebiLookupEntryListPtr lookup_list, size_t index, HebiMacAddress *mac_address)
HebiGroupPtr hebiGroupCreateFromMacs(HebiLookupPtr lookup, const HebiMacAddress *const *addresses, size_t num_addresses, int32_t timeout_ms)
Create a group of modules with the given MAC addresses.
double hebiLookupGetLookupFrequencyHz(HebiLookupPtr lookup)
gets the lookup request rate [Hz]
int32_t initial_group_command_lifetime_
float getInitialGroupFeedbackFrequencyHz()
Gets the default feedback frequency value for groups created from this lookup.
struct HebiGroup_ * HebiGroupPtr
The C-style's API representation of a group.
void hebiLookupEntryListRelease(HebiLookupEntryListPtr lookup_list)
Release resources for a given lookup entry list; list should not be used after this call...
std::shared_ptr< Group > getGroupFromNames(const std::vector< std::string > &families, const std::vector< std::string > &names, int32_t timeout_ms=DEFAULT_TIMEOUT)
Get a group from modules with the given names and families.
void hebiLookupRelease(HebiLookupPtr lookup)
Frees resources created by the lookup object.