33 #include "eds_library.h"
36 #include <unordered_map>
38 void print_dictionary(
const std::unordered_map<kaco::Address, kaco::Entry>& map) {
40 PRINT(
"\nHere is the dictionary:");
42 using EntryRef = std::reference_wrapper<const kaco::Entry>;
43 std::vector<EntryRef> entries;
45 for (
const auto& pair : map) {
46 entries.push_back(std::ref(pair.second));
50 std::sort(entries.begin(), entries.end(),
51 [](
const EntryRef& l,
const EntryRef& r) {
return l.get()<r.get(); });
53 for (
const auto& entry : entries) {
61 PRINT(
"This example loads dictionaries from the EDS library.");
63 std::unordered_map<kaco::Address, kaco::Entry> dictionary;
64 std::unordered_map<std::string, kaco::Address> name_to_address;
66 bool success = library.lookup_library();
69 ERROR(
"EDS library not found.");
73 success = library.load_default_eds(402);
75 ERROR(
"load_default_eds(402) failed.");
77 print_dictionary(dictionary);
82 name_to_address.clear();
83 success = library.load_default_eds(405);
85 ERROR(
"load_default_eds(405) failed.");
87 print_dictionary(dictionary);
This class provides access to KaCanOpen's EDS library. It manages device specific as well as generic ...