Just for testing purposes: This example loads dictionaries from the EDS library.
#include "logger.h"
#include "eds_library.h"
#include <algorithm>
#include <unordered_map>
void print_dictionary(const std::unordered_map<kaco::Address, kaco::Entry>& map) {
PRINT("\nHere is the dictionary:");
using EntryRef = std::reference_wrapper<const kaco::Entry>;
std::vector<EntryRef> entries;
for (const auto& pair : map) {
entries.push_back(std::ref(pair.second));
}
std::sort(entries.begin(), entries.end(),
[](const EntryRef& l, const EntryRef& r) { return l.get()<r.get(); });
for (const auto& entry : entries) {
entry.get().print();
}
}
int main() {
PRINT("This example loads dictionaries from the EDS library.");
std::unordered_map<kaco::Address, kaco::Entry> dictionary;
std::unordered_map<std::string, kaco::Address> name_to_address;
bool success = library.lookup_library();
if (!success) {
ERROR("EDS library not found.");
return EXIT_FAILURE;
}
success = library.load_default_eds(402);
if (!success) {
ERROR("load_default_eds(402) failed.");
} else {
print_dictionary(dictionary);
}
dictionary.clear();
name_to_address.clear();
success = library.load_default_eds(405);
if (!success) {
ERROR("load_default_eds(405) failed.");
} else {
print_dictionary(dictionary);
}
return EXIT_SUCCESS;
}