Commit abbaed68 authored by Georg Vinogradov's avatar Georg Vinogradov

Prepare templates for integration

parent d0f0d0ec
Pipeline #165548 passed with stages
in 2 minutes and 18 seconds
......@@ -2,7 +2,7 @@
#include "<@m.mwIdent/>Adapter_${model.getEscapedCompName()}.h"
<@m.mwIdent/>Adapter_${model.getEscapedCompName()}::<@m.mwIdent/>Adapter_${model.getEscapedCompName()}()
<@m.mwIdent/>Adapter_${model.getEscapedCompName()}::<@m.mwIdent/>Adapter_${model.getEscapedCompName()}() : public IAdapter_${model.getEscapedCompName()}
{
}
......@@ -19,12 +19,12 @@ void <@m.mwIdent/>Adapter_${model.getEscapedCompName()}::init(${model.getEscaped
// Intitialize callbacks, subscribers and publishers
<#list model.getIncomingPorts() as sub>
_sub_${sub.getName()} = new client(SERVER_ADDRESS, ${sub.getName()});
_callback_${sub.getName()} = new Callback(*_sub_${sub.getName()}, component->${sub.getName()});
_sub_${sub.getName()} = new client(SERVER_ADDRESS, ${sub.getName()});
_callback_${sub.getName()} = new Callback(*_sub_${sub.getName()}, component->${sub.getName()});
</#list>
<#list model.getOutgoingPorts() as pub>
_pub_${pub.getName()} = new client(SERVER_ADDRESS, ${pub.getName()});
_pub_${pub.getName()} = new client(SERVER_ADDRESS, ${pub.getName()});
</#list>
// Connect subscribers, publishers and subscribe to the topics
......@@ -64,6 +64,6 @@ void <@m.mwIdent/>Adapter_${model.getEscapedCompName()}::publish_echo_${pub.getN
void <@m.mwIdent/>Adapter_${model.getEscapedCompName()}::tick()
{
<#list model.getOutgoingPorts() as pub>
publish_echo_${pub.getName()}();
publish_echo_${pub.getName()}();
</#list>
}
......@@ -3,12 +3,13 @@
#pragma once
#include "${model.getEscapedCompName()}.h"
#include "IAdapter_${model.getEscapedCompName()}.h"
<@m.mwDefaultIncludes/>
using namespace std;
using namespace <@m.smallIdent/>;
class <@m.mwIdent/>Adapter_${model.getEscapedCompName()} {
class <@m.mwIdent/>Adapter_${model.getEscapedCompName()} : public IAdapter_${model.getEscapedCompName()} {
public:
......@@ -17,10 +18,9 @@ public:
void init(${model.getEscapedCompName()}* comp);
<#list model.getOutgoingPorts() as pub>
void publish_echo_${pub.getName()}();
void publish_echo_${pub.getName()}();
</#list>
void tick();
private:
......@@ -30,11 +30,11 @@ private:
// Callbacks, subscribers
<#list model.getIncomingPorts() as sub>
Callback* _callback_${sub.getName()} = nullptr;
client* _sub_${sub.getName()} = nullptr;
Callback* _callback_${sub.getName()} = nullptr;
client* _sub_${sub.getName()} = nullptr;
</#list>
// Publishers
<#list model.getOutgoingPorts() as pub>
client* _pub_${pub.getName()} = nullptr;
client* _pub_${pub.getName()} = nullptr;
</#list>
};
......@@ -34,8 +34,8 @@ MqttAdapter_${model.getEscapedCompName()}.h
${model.getEscapedCompName()}.h
)
list(APPEND LIBRARIES ${model.getCompName()})
list(APPEND LIBRARIES IAdapter_${model.getCompName()})
list(APPEND LIBRARIES ${model.getEscapedCompName()})
list(APPEND LIBRARIES IAdapter_${model.getEscapedCompName()})
# Checking if everything was found
if(SEARCH_MQTT)
......
......@@ -33,8 +33,8 @@ MqttAdapter_tests_a_compA.h
tests_a_compA.h
)
list(APPEND LIBRARIES tests.a.compA)
list(APPEND LIBRARIES IAdapter_tests.a.compA)
list(APPEND LIBRARIES tests_a_compA)
list(APPEND LIBRARIES IAdapter_tests_a_compA)
# Checking if everything was found
if(SEARCH_MQTT)
......
#include "MqttAdapter_tests_a_compA.h"
MqttAdapter_tests_a_compA::MqttAdapter_tests_a_compA()
MqttAdapter_tests_a_compA::MqttAdapter_tests_a_compA() : public IAdapter_tests_a_compA
{
}
......@@ -17,13 +17,13 @@ void MqttAdapter_tests_a_compA::init(tests_a_compA *comp)
connOpts.set_clean_session(true);
// Intitialize callbacks, subscribers and publishers
_sub_portA = new client(SERVER_ADDRESS, portA);
_callback_portA = new Callback(*_sub_portA, component->portA);
_sub_portB = new client(SERVER_ADDRESS, portB);
_callback_portB = new Callback(*_sub_portB, component->portB);
_sub_portA = new client(SERVER_ADDRESS, portA);
_callback_portA = new Callback(*_sub_portA, component->portA);
_sub_portB = new client(SERVER_ADDRESS, portB);
_callback_portB = new Callback(*_sub_portB, component->portB);
_pub_portC = new client(SERVER_ADDRESS, portC);
_pub_portD = new client(SERVER_ADDRESS, portD);
_pub_portC = new client(SERVER_ADDRESS, portC);
_pub_portD = new client(SERVER_ADDRESS, portD);
// Connect subscribers, publishers and subscribe to the topics
try {
......@@ -72,6 +72,6 @@ void MqttAdapter_tests_a_compA::publish_echo_portD()
void MqttAdapter_tests_a_compA::tick()
{
publish_echo_portC();
publish_echo_portD();
publish_echo_portC();
publish_echo_portD();
}
......@@ -2,13 +2,14 @@
#pragma once
#include "tests_a_compA.h"
#include "IAdapter_tests_a_compA.h"
#include "mqtt/client.h"
#include "Callback.hpp"
using namespace std;
using namespace mqtt;
class MqttAdapter_tests_a_compA {
class MqttAdapter_tests_a_compA : public IAdapter_tests_a_compA {
public:
......@@ -16,8 +17,8 @@ public:
void init(tests_a_compA* comp);
void publish_echo_portC();
void publish_echo_portD();
void publish_echo_portC();
void publish_echo_portD();
void tick();
......@@ -28,11 +29,11 @@ private:
tests_a_compA* component = nullptr;
// Callbacks, subscribers
Callback* _callback_portA = nullptr;
client* _sub_portA = nullptr;
Callback* _callback_portB = nullptr;
client* _sub_portB = nullptr;
Callback* _callback_portA = nullptr;
client* _sub_portA = nullptr;
Callback* _callback_portB = nullptr;
client* _sub_portB = nullptr;
// Publishers
client* _pub_portC = nullptr;
client* _pub_portD = nullptr;
client* _pub_portC = nullptr;
client* _pub_portD = nullptr;
};
......@@ -33,8 +33,8 @@ MqttAdapter_tests_a_compA.h
tests_a_compA.h
)
list(APPEND LIBRARIES tests.a.compA)
list(APPEND LIBRARIES IAdapter_tests.a.compA)
list(APPEND LIBRARIES tests_a_compA)
list(APPEND LIBRARIES IAdapter_tests_a_compA)
# Checking if everything was found
if(SEARCH_MQTT)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment