From b17e2904e1682b48d278c81559242dcfdb58c888 Mon Sep 17 00:00:00 2001 From: Romain Forlot Date: Tue, 6 Jun 2017 10:18:08 +0200 Subject: Update generator at latest low level binding - renaming configuration to application - make message_set as a vector of shared_ptr - Setting up object parent in graphs at application object instanciation Change-Id: Ib33103d5cebbd9381375d2832582a25ae0f9f199 Signed-off-by: Romain Forlot --- CAN-config-generator/src/main.cpp | 39 +++++++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 10 deletions(-) (limited to 'CAN-config-generator/src') diff --git a/CAN-config-generator/src/main.cpp b/CAN-config-generator/src/main.cpp index 5f2e28f..d30428e 100644 --- a/CAN-config-generator/src/main.cpp +++ b/CAN-config-generator/src/main.cpp @@ -109,7 +109,7 @@ template <> std::ostream& operator<<(std::ostream& o, const generator& v) { o << v.line_prefix_ - << "can_message_set_t{" + << "{std::make_shared(can_message_set_t{" << "0," << gen(v.v_.name()) << ",\n" << "\t\t\t{ // beginning can_message_definition_ vector\n" @@ -118,7 +118,7 @@ std::ostream& operator<<(std::ostream& o, const generator& << "\t\t\t{ // beginning diagnostic_messages_ vector\n" << gen(v.v_.diagnostic_messages(),"\t\t\t") << "\n" << "\t\t\t} // end diagnostic_messages_ vector\n" - << "\t\t} // end can_message_set entry\n"; + << "\t\t})} // end can_message_set entry\n"; return o; } @@ -208,25 +208,44 @@ std::ostream& operator<<(std::ostream& o, const generator >& can_messages_definition = cms->get_can_message_definition();\n" + << " for(auto& cmd : can_messages_definition)\n" + << " {\n" + << " cmd->set_parent(cms.get());\n" + << " std::vector >& can_signals = cmd->get_can_signals();\n" + << " for(auto& sig: can_signals)\n" + << " {\n" + << " sig->set_parent(cmd.get());\n" + << " }\n" + << " }\n\n" + << " std::vector >& diagnostic_messages = cms->get_diagnostic_messages();\n" + << " for(auto& dm : diagnostic_messages)\n" + << " {\n" + << " dm->set_parent(cms.get());\n" + << " }\n" + << " }\n" + << " }\n\n" + << "const std::string application_t::get_diagnostic_bus() const\n" << "{\n"; std::string active_bus = ""; @@ -286,11 +305,11 @@ nlohmann::json read_json(const std::string& file) // function that show the help information void showhelpinfo(char *s) { -std::cout<<"Usage: "< [-o configuration-generated.cpp]"<< std::endl; +std::cout<<"Usage: "< [-o application-generated.cpp]"<< std::endl; std::cout<<"option: "<<"-m input.json : JSON file describing CAN messages and signals"<< std::endl; std::cout<<" "<<"-h header.cpp : header source file insert at the beginning of generated file"<< std::endl; std::cout<<" "<<"-f footer.cpp : footer source file append to generated file."<< std::endl; -std::cout<<" "<<"-o configuration-generated.cpp : output source file. Name has to be configuration-generated.cpp"<< std::endl; +std::cout<<" "<<"-o application-generated.cpp : output source file. Name has to be application-generated.cpp"<< std::endl; } /// @brief Entry point. -- cgit 1.2.3-korg