32 #include "eds_reader.h"
42 int main(
int argc,
char** argv) {
44 PRINT(
"This example reads an EDS file and prints the resulting dictionary.");
46 std::unordered_map<kaco::Address, kaco::Entry> dictionary;
47 std::unordered_map<std::string, kaco::Address> name_to_address;
53 if (argc>1 && argv[1]) {
55 path = std::string(argv[1]);
56 PRINT(
"Loading EDS file from "<<path);
57 success = reader.load_file(path);
61 path = SHARE_SOURCE_PATH
"/example.eds";
62 PRINT(
"Loading default EDS file from "<<path);
63 success = reader.load_file(path);
67 path = SHARE_INSTALLED_PATH
"/example.eds";
68 PRINT(
"Another try: Loading default EDS file from "<<path);
69 success = reader.load_file(path);
75 ERROR(
"Loading file not successful. You can specify the path to the EDS file as command line argument.");
79 success = reader.import_entries();
82 ERROR(
"Importing entries failed.");
86 PRINT(
"Here is the dictionary:");
88 using EntryRef = std::reference_wrapper<const kaco::Entry>;
89 std::vector<EntryRef> entries;
91 for (
const auto& pair : dictionary) {
92 entries.push_back(std::ref(pair.second));
96 std::sort(entries.begin(), entries.end(),
97 [](
const EntryRef& l,
const EntryRef& r) {
return l.get()<r.get(); });
99 for (
const auto& entry : entries) {
This class allows reading EDS files (like standardized in CiA 306) and inserting all contained entrie...