From 9cd243b8194b5f1a9015cd13219612c2d93ca005 Mon Sep 17 00:00:00 2001 From: Florian Raeth Date: Mon, 30 Sep 2019 11:08:06 +0200 Subject: [PATCH 1/5] add N, Z, B test --- .../someip/AdapterGenerationTest.java | 6 + .../someip/PrettyPrintGenerationTest.java | 11 +- src/test/resources/results/echo/ports.txt | 14 +- .../SomeIPAdapter_tests_a_compA.cpp | 212 ++++++++++++++++++ .../echoAdapter/SomeIPAdapter_tests_a_compA.h | 30 +++ src/test/resources/tests/a/CompA.emam | 6 + 6 files changed, 274 insertions(+), 5 deletions(-) diff --git a/src/test/java/de/monticore/lang/monticar/generator/someip/AdapterGenerationTest.java b/src/test/java/de/monticore/lang/monticar/generator/someip/AdapterGenerationTest.java index 22d4dc3..571908c 100644 --- a/src/test/java/de/monticore/lang/monticar/generator/someip/AdapterGenerationTest.java +++ b/src/test/java/de/monticore/lang/monticar/generator/someip/AdapterGenerationTest.java @@ -36,8 +36,14 @@ public class AdapterGenerationTest extends AbstractSymtabTest { // Connect component's ports to topics componentInstanceSymbol.getPortInstance("in1").orElse(null).setMiddlewareSymbol(new SomeIPConnectionSymbol(11,12,13/*,14,15*/)); componentInstanceSymbol.getPortInstance("in2").orElse(null).setMiddlewareSymbol(new SomeIPConnectionSymbol(21,22,23/*,24,25*/)); + componentInstanceSymbol.getPortInstance("in3").orElse(null).setMiddlewareSymbol(new SomeIPConnectionSymbol(31,32,33/*,34,35*/)); + componentInstanceSymbol.getPortInstance("in4").orElse(null).setMiddlewareSymbol(new SomeIPConnectionSymbol(41,42,43/*,44,45*/)); + componentInstanceSymbol.getPortInstance("in5").orElse(null).setMiddlewareSymbol(new SomeIPConnectionSymbol(51,52,53/*,54,55*/)); componentInstanceSymbol.getPortInstance("out1").orElse(null).setMiddlewareSymbol(new SomeIPConnectionSymbol(111,112,113/*,114,115*/)); componentInstanceSymbol.getPortInstance("out2").orElse(null).setMiddlewareSymbol(new SomeIPConnectionSymbol(121,122,123/*,124,125*/)); + componentInstanceSymbol.getPortInstance("out3").orElse(null).setMiddlewareSymbol(new SomeIPConnectionSymbol(131,132,133/*,134,135*/)); + componentInstanceSymbol.getPortInstance("out4").orElse(null).setMiddlewareSymbol(new SomeIPConnectionSymbol(141,142,143/*,144,145*/)); + componentInstanceSymbol.getPortInstance("out5").orElse(null).setMiddlewareSymbol(new SomeIPConnectionSymbol(151,152,153/*,154,155*/)); List files = generatorSomeIP.generateSomeIPAdapter(componentInstanceSymbol); diff --git a/src/test/java/de/monticore/lang/monticar/generator/someip/PrettyPrintGenerationTest.java b/src/test/java/de/monticore/lang/monticar/generator/someip/PrettyPrintGenerationTest.java index 7a9eb9b..f6e7fea 100644 --- a/src/test/java/de/monticore/lang/monticar/generator/someip/PrettyPrintGenerationTest.java +++ b/src/test/java/de/monticore/lang/monticar/generator/someip/PrettyPrintGenerationTest.java @@ -34,7 +34,16 @@ public class PrettyPrintGenerationTest extends AbstractSymtabTest { generatorSomeIP.setGenerationTargetPath("./target/generated-sources/"); // Connect component's ports to topics - componentInstanceSymbol.getPortInstance("in1").orElse(null).setMiddlewareSymbol(new SomeIPConnectionSymbol(1,2,3)); + componentInstanceSymbol.getPortInstance("in1").orElse(null).setMiddlewareSymbol(new SomeIPConnectionSymbol(11,12,13/*,14,15*/)); + componentInstanceSymbol.getPortInstance("in2").orElse(null).setMiddlewareSymbol(new SomeIPConnectionSymbol(21,22,23/*,24,25*/)); + componentInstanceSymbol.getPortInstance("in3").orElse(null).setMiddlewareSymbol(new SomeIPConnectionSymbol(31,32,33/*,34,35*/)); + componentInstanceSymbol.getPortInstance("in4").orElse(null).setMiddlewareSymbol(new SomeIPConnectionSymbol(41,42,43/*,44,45*/)); + componentInstanceSymbol.getPortInstance("in5").orElse(null).setMiddlewareSymbol(new SomeIPConnectionSymbol(51,52,53/*,54,55*/)); + componentInstanceSymbol.getPortInstance("out1").orElse(null).setMiddlewareSymbol(new SomeIPConnectionSymbol(111,112,113/*,114,115*/)); + componentInstanceSymbol.getPortInstance("out2").orElse(null).setMiddlewareSymbol(new SomeIPConnectionSymbol(121,122,123/*,124,125*/)); + componentInstanceSymbol.getPortInstance("out3").orElse(null).setMiddlewareSymbol(new SomeIPConnectionSymbol(131,132,133/*,134,135*/)); + componentInstanceSymbol.getPortInstance("out4").orElse(null).setMiddlewareSymbol(new SomeIPConnectionSymbol(141,142,143/*,144,145*/)); + componentInstanceSymbol.getPortInstance("out5").orElse(null).setMiddlewareSymbol(new SomeIPConnectionSymbol(151,152,153/*,154,155*/)); List files = generatorSomeIP.generatePrettyPrint(componentInstanceSymbol); diff --git a/src/test/resources/results/echo/ports.txt b/src/test/resources/results/echo/ports.txt index fec7778..2b2c78e 100644 --- a/src/test/resources/results/echo/ports.txt +++ b/src/test/resources/results/echo/ports.txt @@ -3,7 +3,13 @@ Component name: tests.a.compA Ports: -in1 : incoming (someip, serviceID: 1 instanceID: 2 eventgroupID: 3) -in2 : incoming (unknown symbol) -out1 : outgoing (unknown symbol) -out2 : outgoing (unknown symbol) +in1 : incoming (someip, serviceID: 11 instanceID: 12 eventgroupID: 13) +in2 : incoming (someip, serviceID: 21 instanceID: 22 eventgroupID: 23) +in3 : incoming (someip, serviceID: 31 instanceID: 32 eventgroupID: 33) +in4 : incoming (someip, serviceID: 41 instanceID: 42 eventgroupID: 43) +in5 : incoming (someip, serviceID: 51 instanceID: 52 eventgroupID: 53) +out1 : outgoing (someip, serviceID: 111 instanceID: 112 eventgroupID: 113) +out2 : outgoing (someip, serviceID: 121 instanceID: 122 eventgroupID: 123) +out3 : outgoing (someip, serviceID: 131 instanceID: 132 eventgroupID: 133) +out4 : outgoing (someip, serviceID: 141 instanceID: 142 eventgroupID: 143) +out5 : outgoing (someip, serviceID: 151 instanceID: 152 eventgroupID: 153) diff --git a/src/test/resources/results/echoAdapter/SomeIPAdapter_tests_a_compA.cpp b/src/test/resources/results/echoAdapter/SomeIPAdapter_tests_a_compA.cpp index c24602b..e59a530 100644 --- a/src/test/resources/results/echoAdapter/SomeIPAdapter_tests_a_compA.cpp +++ b/src/test/resources/results/echoAdapter/SomeIPAdapter_tests_a_compA.cpp @@ -33,6 +33,39 @@ void SomeIPAdapter_tests_a_compA::init(tests_a_compA *comp) { std::thread sender_in2(std::bind(&SomeIPAdapter_tests_a_compA::run_in2, this)); in2_Subscriber->start(); + in3_Subscriber = vsomeip::runtime::get()->create_application("Subscriber in3"); + if (!in3_Subscriber->init()) { + std::cerr << "Couldn't initialize Subscriber in3" << std::endl; + } + + in3_Subscriber->register_availability_handler(31, 32, std::bind(&SomeIPAdapter_tests_a_compA::on_availability_in3, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); + in3_Subscriber->request_service(31, 32); + in3_Subscriber->register_message_handler(31, 32, 0, std::bind(&SomeIPAdapter_tests_a_compA::on_message_in3, this, std::placeholders::_1)); + + std::thread sender_in3(std::bind(&SomeIPAdapter_tests_a_compA::run_in3, this)); + in3_Subscriber->start(); + in4_Subscriber = vsomeip::runtime::get()->create_application("Subscriber in4"); + if (!in4_Subscriber->init()) { + std::cerr << "Couldn't initialize Subscriber in4" << std::endl; + } + + in4_Subscriber->register_availability_handler(41, 42, std::bind(&SomeIPAdapter_tests_a_compA::on_availability_in4, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); + in4_Subscriber->request_service(41, 42); + in4_Subscriber->register_message_handler(41, 42, 0, std::bind(&SomeIPAdapter_tests_a_compA::on_message_in4, this, std::placeholders::_1)); + + std::thread sender_in4(std::bind(&SomeIPAdapter_tests_a_compA::run_in4, this)); + in4_Subscriber->start(); + in5_Subscriber = vsomeip::runtime::get()->create_application("Subscriber in5"); + if (!in5_Subscriber->init()) { + std::cerr << "Couldn't initialize Subscriber in5" << std::endl; + } + + in5_Subscriber->register_availability_handler(51, 52, std::bind(&SomeIPAdapter_tests_a_compA::on_availability_in5, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); + in5_Subscriber->request_service(51, 52); + in5_Subscriber->register_message_handler(51, 52, 0, std::bind(&SomeIPAdapter_tests_a_compA::on_message_in5, this, std::placeholders::_1)); + + std::thread sender_in5(std::bind(&SomeIPAdapter_tests_a_compA::run_in5, this)); + in5_Subscriber->start(); // Intitialize Publisher @@ -48,6 +81,24 @@ void SomeIPAdapter_tests_a_compA::init(tests_a_compA *comp) { } out2_Publisher->offer_service(121, 122); out2_Publisher->start(); + out3_Publisher = vsomeip::runtime::get()->create_application("Publisher out3"); + if (!out3_Publisher->init()) { + std::cerr << "Couldn't initialize Publisher out3" << std::endl; +} + out3_Publisher->offer_service(131, 132); + out3_Publisher->start(); + out4_Publisher = vsomeip::runtime::get()->create_application("Publisher out4"); + if (!out4_Publisher->init()) { + std::cerr << "Couldn't initialize Publisher out4" << std::endl; + } + out4_Publisher->offer_service(141, 142); + out4_Publisher->start(); + out5_Publisher = vsomeip::runtime::get()->create_application("Publisher out5"); + if (!out5_Publisher->init()) { + std::cerr << "Couldn't initialize Publisher out5" << std::endl; + } + out5_Publisher->offer_service(151, 152); + out5_Publisher->start(); } void SomeIPAdapter_tests_a_compA::run_in1() { @@ -65,7 +116,10 @@ void SomeIPAdapter_tests_a_compA::on_message_in1(const std::shared_ptr its_payload = _message->get_payload(); vsomeip::length_t l = its_payload->get_length(); double dataFromMessage = *((double*)its_payload->get_data()); + + // double component->in1 = dataFromMessage; + //print data to std out std::cout << "SERVICE in1: Received message from [" << std::setw(4) << std::setfill('0') << std::hex << _message->get_client() << "/" @@ -96,7 +150,10 @@ void SomeIPAdapter_tests_a_compA::on_message_in2(const std::shared_ptr its_payload = _message->get_payload(); vsomeip::length_t l = its_payload->get_length(); double dataFromMessage = *((double*)its_payload->get_data()); + + // double component->in2 = dataFromMessage; + //print data to std out std::cout << "SERVICE in2: Received message from [" << std::setw(4) << std::setfill('0') << std::hex << _message->get_client() << "/" @@ -112,11 +169,114 @@ void SomeIPAdapter_tests_a_compA::on_availability_in2(vsomeip::service_t _servic << std::endl; condition_in2.notify_one(); } +void SomeIPAdapter_tests_a_compA::run_in3() { + std::unique_lock its_lock(mutex_in3); + condition_in3.wait(its_lock); + + std::set event_group; + event_group.insert(33); + in3_Subscriber->request_event(31, 32, 0, event_group, true); + in3_Subscriber->subscribe(31, 32, 33); +} + +void SomeIPAdapter_tests_a_compA::on_message_in3(const std::shared_ptr &_message) { + //read received message + std::shared_ptr its_payload = _message->get_payload(); + vsomeip::length_t l = its_payload->get_length(); + double dataFromMessage = *((double*)its_payload->get_data()); + + //int + component->in3 = (int) round(dataFromMessage); + + //print data to std out + std::cout << "SERVICE in3: Received message from [" + << std::setw(4) << std::setfill('0') << std::hex << _message->get_client() << "/" + << std::setw(4) << std::setfill('0') << std::hex << _message->get_session() << "]: " + << dataFromMessage << std::endl; +} + +void SomeIPAdapter_tests_a_compA::on_availability_in3(vsomeip::service_t _service, vsomeip::instance_t _instance, bool _is_available) { + std::cout << "Service [" + << std::setw(4) << std::setfill('0') << std::hex << _service << "." << _instance + << "] is " + << (_is_available ? "available." : "NOT available.") + << std::endl; + condition_in3.notify_one(); +} +void SomeIPAdapter_tests_a_compA::run_in4() { + std::unique_lock its_lock(mutex_in4); + condition_in4.wait(its_lock); + + std::set event_group; + event_group.insert(43); + in4_Subscriber->request_event(41, 42, 0, event_group, true); + in4_Subscriber->subscribe(41, 42, 43); +} + +void SomeIPAdapter_tests_a_compA::on_message_in4(const std::shared_ptr &_message) { + //read received message + std::shared_ptr its_payload = _message->get_payload(); + vsomeip::length_t l = its_payload->get_length(); + double dataFromMessage = *((double*)its_payload->get_data()); + + //int + component->in4 = (int) round(dataFromMessage); + + //print data to std out + std::cout << "SERVICE in4: Received message from [" + << std::setw(4) << std::setfill('0') << std::hex << _message->get_client() << "/" + << std::setw(4) << std::setfill('0') << std::hex << _message->get_session() << "]: " + << dataFromMessage << std::endl; +} + +void SomeIPAdapter_tests_a_compA::on_availability_in4(vsomeip::service_t _service, vsomeip::instance_t _instance, bool _is_available) { + std::cout << "Service [" + << std::setw(4) << std::setfill('0') << std::hex << _service << "." << _instance + << "] is " + << (_is_available ? "available." : "NOT available.") + << std::endl; + condition_in4.notify_one(); +} +void SomeIPAdapter_tests_a_compA::run_in5() { + std::unique_lock its_lock(mutex_in5); + condition_in5.wait(its_lock); + + std::set event_group; + event_group.insert(53); + in5_Subscriber->request_event(51, 52, 0, event_group, true); + in5_Subscriber->subscribe(51, 52, 53); +} + +void SomeIPAdapter_tests_a_compA::on_message_in5(const std::shared_ptr &_message) { + //read received message + std::shared_ptr its_payload = _message->get_payload(); + vsomeip::length_t l = its_payload->get_length(); + double dataFromMessage = *((double*)its_payload->get_data()); + + //bool + component->in5 = (dataFromMessage > 1.0e-10); + + //print data to std out + std::cout << "SERVICE in5: Received message from [" + << std::setw(4) << std::setfill('0') << std::hex << _message->get_client() << "/" + << std::setw(4) << std::setfill('0') << std::hex << _message->get_session() << "]: " + << dataFromMessage << std::endl; +} + +void SomeIPAdapter_tests_a_compA::on_availability_in5(vsomeip::service_t _service, vsomeip::instance_t _instance, bool _is_available) { + std::cout << "Service [" + << std::setw(4) << std::setfill('0') << std::hex << _service << "." << _instance + << "] is " + << (_is_available ? "available." : "NOT available.") + << std::endl; + condition_in5.notify_one(); +} void SomeIPAdapter_tests_a_compA::publishout1_Publisher() { //Read data from component + // double double d = component->out1; const vsomeip::byte_t its_data[] = { (uint8_t) d }; @@ -132,6 +292,7 @@ void SomeIPAdapter_tests_a_compA::publishout1_Publisher() void SomeIPAdapter_tests_a_compA::publishout2_Publisher() { //Read data from component + // double double d = component->out2; const vsomeip::byte_t its_data[] = { (uint8_t) d }; @@ -144,10 +305,61 @@ void SomeIPAdapter_tests_a_compA::publishout2_Publisher() out2_Publisher->offer_event(121, 122, 0, event_group, true); out2_Publisher->notify(121, 122, 0, payload); } +void SomeIPAdapter_tests_a_compA::publishout3_Publisher() +{ + //Read data from component + //int + double d = 1.0 * component->out3; + + const vsomeip::byte_t its_data[] = { (uint8_t) d }; + std::shared_ptr payload = vsomeip::runtime::get()->create_payload(); + payload->set_data(its_data, sizeof(its_data)); + + //Publish + std::set event_group; + event_group.insert(133); + out3_Publisher->offer_event(131, 132, 0, event_group, true); + out3_Publisher->notify(131, 132, 0, payload); +} +void SomeIPAdapter_tests_a_compA::publishout4_Publisher() +{ + //Read data from component + //int + double d = 1.0 * component->out4; + + const vsomeip::byte_t its_data[] = { (uint8_t) d }; + std::shared_ptr payload = vsomeip::runtime::get()->create_payload(); + payload->set_data(its_data, sizeof(its_data)); + + //Publish + std::set event_group; + event_group.insert(143); + out4_Publisher->offer_event(141, 142, 0, event_group, true); + out4_Publisher->notify(141, 142, 0, payload); +} +void SomeIPAdapter_tests_a_compA::publishout5_Publisher() +{ + //Read data from component + //bool + double d = component->out5 ? 1.0 : 0.0; + + const vsomeip::byte_t its_data[] = { (uint8_t) d }; + std::shared_ptr payload = vsomeip::runtime::get()->create_payload(); + payload->set_data(its_data, sizeof(its_data)); + + //Publish + std::set event_group; + event_group.insert(153); + out5_Publisher->offer_event(151, 152, 0, event_group, true); + out5_Publisher->notify(151, 152, 0, payload); +} void SomeIPAdapter_tests_a_compA::tick() { publishout1_Publisher(); publishout2_Publisher(); + publishout3_Publisher(); + publishout4_Publisher(); + publishout5_Publisher(); } diff --git a/src/test/resources/results/echoAdapter/SomeIPAdapter_tests_a_compA.h b/src/test/resources/results/echoAdapter/SomeIPAdapter_tests_a_compA.h index 1c52029..08df549 100644 --- a/src/test/resources/results/echoAdapter/SomeIPAdapter_tests_a_compA.h +++ b/src/test/resources/results/echoAdapter/SomeIPAdapter_tests_a_compA.h @@ -43,6 +43,27 @@ private: void run_in2(); void on_message_in2(const std::shared_ptr &_message); void on_availability_in2(vsomeip::service_t _service, vsomeip::instance_t _instance, bool _is_available); + std::shared_ptr in3_Subscriber; + std::mutex mutex_in3; + std::condition_variable condition_in3; + + void run_in3(); + void on_message_in3(const std::shared_ptr &_message); + void on_availability_in3(vsomeip::service_t _service, vsomeip::instance_t _instance, bool _is_available); + std::shared_ptr in4_Subscriber; + std::mutex mutex_in4; + std::condition_variable condition_in4; + + void run_in4(); + void on_message_in4(const std::shared_ptr &_message); + void on_availability_in4(vsomeip::service_t _service, vsomeip::instance_t _instance, bool _is_available); + std::shared_ptr in5_Subscriber; + std::mutex mutex_in5; + std::condition_variable condition_in5; + + void run_in5(); + void on_message_in5(const std::shared_ptr &_message); + void on_availability_in5(vsomeip::service_t _service, vsomeip::instance_t _instance, bool _is_available); std::shared_ptr out1_Publisher; @@ -50,4 +71,13 @@ private: std::shared_ptr out2_Publisher; void publishout2_Publisher(); + std::shared_ptr out3_Publisher; + + void publishout3_Publisher(); + std::shared_ptr out4_Publisher; + + void publishout4_Publisher(); + std::shared_ptr out5_Publisher; + + void publishout5_Publisher(); }; diff --git a/src/test/resources/tests/a/CompA.emam b/src/test/resources/tests/a/CompA.emam index 3d7575e..00f51b7 100644 --- a/src/test/resources/tests/a/CompA.emam +++ b/src/test/resources/tests/a/CompA.emam @@ -4,6 +4,12 @@ package tests.a; component CompA{ port in Q in1; port in Q in2; + port in N in3; + port in Z in4; + port in B in5; port out Q out1; port out Q out2; + port out N out3; + port out Z out4; + port out B out5; } -- GitLab From 94a1fe7ff64a5ef8b1ff1b84ca8b364f5e9071a5 Mon Sep 17 00:00:00 2001 From: Florian Raeth Date: Mon, 30 Sep 2019 13:25:59 +0200 Subject: [PATCH 2/5] fix cmake {comp}.cpp / .h --- pom.xml | 2 +- .../lang/monticar/generator/someip/template/CMakeLists.ftl | 4 +--- src/test/resources/results/echoAdapter/CMakeLists.txt | 4 +--- src/test/resources/results/echoCMake/CMakeLists.txt | 4 +--- 4 files changed, 4 insertions(+), 10 deletions(-) diff --git a/pom.xml b/pom.xml index 4ec7d4f..aee55c1 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ de.monticore.lang.monticar embedded-montiarc-math-emam2someip-generator - 1.2-SNAPSHOT + 1.3-SNAPSHOT emam2someip diff --git a/src/main/resources/de/monticore/lang/monticar/generator/someip/template/CMakeLists.ftl b/src/main/resources/de/monticore/lang/monticar/generator/someip/template/CMakeLists.ftl index caf8770..12416a2 100644 --- a/src/main/resources/de/monticore/lang/monticar/generator/someip/template/CMakeLists.ftl +++ b/src/main/resources/de/monticore/lang/monticar/generator/someip/template/CMakeLists.ftl @@ -17,11 +17,9 @@ include_directories ( ) # Linking libraries to target -add_library(SomeIPAdapter_${model.getEscapedCompName()} SomeIPAdapter_${model.getEscapedCompName()}.cpp +add_library(SomeIPAdapter_${model.getEscapedCompName()} SomeIPAdapter_${model.getEscapedCompName()}.cpp SomeIPAdapter_${model.getEscapedCompName()}.h -${model.getEscapedCompName()}.cpp -${model.getEscapedCompName()}.h ) list(APPEND LIBRARIES ${model.getEscapedCompName()}) diff --git a/src/test/resources/results/echoAdapter/CMakeLists.txt b/src/test/resources/results/echoAdapter/CMakeLists.txt index 3bd5a56..f3da4b7 100644 --- a/src/test/resources/results/echoAdapter/CMakeLists.txt +++ b/src/test/resources/results/echoAdapter/CMakeLists.txt @@ -15,11 +15,9 @@ include_directories ( ) # Linking libraries to target -add_library(SomeIPAdapter_tests_a_compA SomeIPAdapter_tests_a_compA.cpp +add_library(SomeIPAdapter_tests_a_compA SomeIPAdapter_tests_a_compA.cpp SomeIPAdapter_tests_a_compA.h -tests_a_compA.cpp -tests_a_compA.h ) list(APPEND LIBRARIES tests_a_compA) diff --git a/src/test/resources/results/echoCMake/CMakeLists.txt b/src/test/resources/results/echoCMake/CMakeLists.txt index 3bd5a56..f3da4b7 100644 --- a/src/test/resources/results/echoCMake/CMakeLists.txt +++ b/src/test/resources/results/echoCMake/CMakeLists.txt @@ -15,11 +15,9 @@ include_directories ( ) # Linking libraries to target -add_library(SomeIPAdapter_tests_a_compA SomeIPAdapter_tests_a_compA.cpp +add_library(SomeIPAdapter_tests_a_compA SomeIPAdapter_tests_a_compA.cpp SomeIPAdapter_tests_a_compA.h -tests_a_compA.cpp -tests_a_compA.h ) list(APPEND LIBRARIES tests_a_compA) -- GitLab From 085d26d1fa446b127982f8e78e096f263ef82cfa Mon Sep 17 00:00:00 2001 From: Florian Raeth Date: Mon, 30 Sep 2019 13:36:48 +0200 Subject: [PATCH 3/5] fix constructor --- .../lang/monticar/generator/someip/template/Adapter.cpp.ftl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/de/monticore/lang/monticar/generator/someip/template/Adapter.cpp.ftl b/src/main/resources/de/monticore/lang/monticar/generator/someip/template/Adapter.cpp.ftl index b2fa089..68ed0cf 100644 --- a/src/main/resources/de/monticore/lang/monticar/generator/someip/template/Adapter.cpp.ftl +++ b/src/main/resources/de/monticore/lang/monticar/generator/someip/template/Adapter.cpp.ftl @@ -2,7 +2,7 @@ <#import "SomeIPMacros.ftl" as m> #include "<@m.mwIdent/>Adapter_${model.getEscapedCompName()}.h" -<@m.mwIdent/>Adapter_${model.getEscapedCompName()}::<@m.mwIdent/>Adapter_${model.getEscapedCompName()}() : public IAdapter_${model.getEscapedCompName()} { +<@m.mwIdent/>Adapter_${model.getEscapedCompName()}::<@m.mwIdent/>Adapter_${model.getEscapedCompName()}() { } -- GitLab From 2ca13f7474c9c917363aa828e23eae0aca0bbf4d Mon Sep 17 00:00:00 2001 From: Florian Raeth Date: Mon, 30 Sep 2019 13:37:30 +0200 Subject: [PATCH 4/5] fix constructor --- .../results/echoAdapter/SomeIPAdapter_tests_a_compA.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/resources/results/echoAdapter/SomeIPAdapter_tests_a_compA.cpp b/src/test/resources/results/echoAdapter/SomeIPAdapter_tests_a_compA.cpp index e59a530..ba17ecd 100644 --- a/src/test/resources/results/echoAdapter/SomeIPAdapter_tests_a_compA.cpp +++ b/src/test/resources/results/echoAdapter/SomeIPAdapter_tests_a_compA.cpp @@ -1,7 +1,7 @@ /* (c) https://github.com/MontiCore/monticore */ #include "SomeIPAdapter_tests_a_compA.h" -SomeIPAdapter_tests_a_compA::SomeIPAdapter_tests_a_compA() : public IAdapter_tests_a_compA { +SomeIPAdapter_tests_a_compA::SomeIPAdapter_tests_a_compA() { } -- GitLab From 5288ef22e4d675909e5decdbf12ccfcf9fe7c889 Mon Sep 17 00:00:00 2001 From: Florian Raeth Date: Mon, 30 Sep 2019 14:29:40 +0200 Subject: [PATCH 5/5] cmake fix --- .../monticar/generator/someip/template/CMakeLists.ftl | 9 +++++++-- src/test/resources/results/echoAdapter/CMakeLists.txt | 9 +++++++-- src/test/resources/results/echoCMake/CMakeLists.txt | 9 +++++++-- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/src/main/resources/de/monticore/lang/monticar/generator/someip/template/CMakeLists.ftl b/src/main/resources/de/monticore/lang/monticar/generator/someip/template/CMakeLists.ftl index 12416a2..678707b 100644 --- a/src/main/resources/de/monticore/lang/monticar/generator/someip/template/CMakeLists.ftl +++ b/src/main/resources/de/monticore/lang/monticar/generator/someip/template/CMakeLists.ftl @@ -6,6 +6,9 @@ cmake_minimum_required (VERSION 2.8) # Using C++ with flags set (CMAKE_CXX_FLAGS "-g -std=c++0x") +# Setting project name and description +project(${model.getCompName()}) + # Find vsomeip and boost packages find_package (vsomeip 2.10.0 REQUIRED) find_package( Boost 1.55 COMPONENTS system thread log REQUIRED ) @@ -25,9 +28,11 @@ SomeIPAdapter_${model.getEscapedCompName()}.h list(APPEND LIBRARIES ${model.getEscapedCompName()}) list(APPEND LIBRARIES IAdapter_${model.getEscapedCompName()}) -target_link_libraries(SomeIPAdapter_${model.getEscapedCompName()} vsomeip <#noparse>${Boost_LIBRARIES} <#noparse>${LIBRARIES}) +# Adding include directory to a target +target_include_directories(SomeIPAdapter_${model.getEscapedCompName()} PUBLIC <#noparse>${LIBRARIES} <#noparse>${INCLUDE_DIRS} <#noparse>${CMAKE_CURRENT_SOURCE_DIR}) -target_include_directories(SomeIPAdapter_${model.getEscapedCompName()} PUBLIC <#noparse>${INCLUDE_DIRS}) +# Linking libraries to target +target_link_libraries(SomeIPAdapter_${model.getEscapedCompName()} PUBLIC vsomeip <#noparse>${Boost_LIBRARIES} <#noparse>${LIBRARIES}) # Export target to a cmake module file for outside usage export(TARGETS SomeIPAdapter_${model.getEscapedCompName()} FILE SomeIPAdapter_${model.getEscapedCompName()}.cmake) diff --git a/src/test/resources/results/echoAdapter/CMakeLists.txt b/src/test/resources/results/echoAdapter/CMakeLists.txt index f3da4b7..78880e6 100644 --- a/src/test/resources/results/echoAdapter/CMakeLists.txt +++ b/src/test/resources/results/echoAdapter/CMakeLists.txt @@ -4,6 +4,9 @@ cmake_minimum_required (VERSION 2.8) # Using C++ with flags set (CMAKE_CXX_FLAGS "-g -std=c++0x") +# Setting project name and description +project(tests.a.compA) + # Find vsomeip and boost packages find_package (vsomeip 2.10.0 REQUIRED) find_package( Boost 1.55 COMPONENTS system thread log REQUIRED ) @@ -23,9 +26,11 @@ SomeIPAdapter_tests_a_compA.h list(APPEND LIBRARIES tests_a_compA) list(APPEND LIBRARIES IAdapter_tests_a_compA) -target_link_libraries(SomeIPAdapter_tests_a_compA vsomeip ${Boost_LIBRARIES} ${LIBRARIES}) +# Adding include directory to a target +target_include_directories(SomeIPAdapter_tests_a_compA PUBLIC ${LIBRARIES} ${INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}) -target_include_directories(SomeIPAdapter_tests_a_compA PUBLIC ${INCLUDE_DIRS}) +# Linking libraries to target +target_link_libraries(SomeIPAdapter_tests_a_compA PUBLIC vsomeip ${Boost_LIBRARIES} ${LIBRARIES}) # Export target to a cmake module file for outside usage export(TARGETS SomeIPAdapter_tests_a_compA FILE SomeIPAdapter_tests_a_compA.cmake) diff --git a/src/test/resources/results/echoCMake/CMakeLists.txt b/src/test/resources/results/echoCMake/CMakeLists.txt index f3da4b7..78880e6 100644 --- a/src/test/resources/results/echoCMake/CMakeLists.txt +++ b/src/test/resources/results/echoCMake/CMakeLists.txt @@ -4,6 +4,9 @@ cmake_minimum_required (VERSION 2.8) # Using C++ with flags set (CMAKE_CXX_FLAGS "-g -std=c++0x") +# Setting project name and description +project(tests.a.compA) + # Find vsomeip and boost packages find_package (vsomeip 2.10.0 REQUIRED) find_package( Boost 1.55 COMPONENTS system thread log REQUIRED ) @@ -23,9 +26,11 @@ SomeIPAdapter_tests_a_compA.h list(APPEND LIBRARIES tests_a_compA) list(APPEND LIBRARIES IAdapter_tests_a_compA) -target_link_libraries(SomeIPAdapter_tests_a_compA vsomeip ${Boost_LIBRARIES} ${LIBRARIES}) +# Adding include directory to a target +target_include_directories(SomeIPAdapter_tests_a_compA PUBLIC ${LIBRARIES} ${INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}) -target_include_directories(SomeIPAdapter_tests_a_compA PUBLIC ${INCLUDE_DIRS}) +# Linking libraries to target +target_link_libraries(SomeIPAdapter_tests_a_compA PUBLIC vsomeip ${Boost_LIBRARIES} ${LIBRARIES}) # Export target to a cmake module file for outside usage export(TARGETS SomeIPAdapter_tests_a_compA FILE SomeIPAdapter_tests_a_compA.cmake) -- GitLab