Commit 46fd35bc authored by Wei Lu's avatar Wei Lu

Changed name into DynamicInterface

parent 238086d3
Pipeline #201997 passed with stages
in 30 minutes and 26 seconds
......@@ -483,13 +483,13 @@ public class GeneratorCPP implements Generator {
private static FileContent generateAutopilotAdapterH(AutopilotAdapterDataModel dm) {
String fileContents = AllTemplates.generateAutopilotAdapterH(dm);
return new FileContent(fileContents, "AutopilotAdapter.h");
return new FileContent(fileContents, "DynamicInterface.h");
}
private static FileContent generateAutopilotAdapterCpp(AutopilotAdapterDataModel dm) {
String fileContents = AllTemplates.generateAutopilotAdapterCpp(dm);
if (currentInstance.generateCMake)
addAutopilotAdapterCMakeConfig();
return new FileContent(fileContents, "AutopilotAdapter.cpp");
return new FileContent(fileContents, "DynamicInterface.cpp");
}
private static void addAutopilotAdapterCMakeConfig() {
......
......@@ -37,8 +37,8 @@ public final class AllTemplates {
TESTS_MAIN_ENTRY = conf.getTemplate("/test/TestsMainEntry.ftl");
STRUCT = conf.getTemplate("/type/Struct.ftl");
ENUM = conf.getTemplate("/type/Enum.ftl");
AUTOPILOT_ADAPTER_CPP = conf.getTemplate("/autopilotadapter/AutopilotAdapterCpp.ftl");
AUTOPILOT_ADAPTER_H = conf.getTemplate("/autopilotadapter/AutopilotAdapterH.ftl");
AUTOPILOT_ADAPTER_CPP = conf.getTemplate("/autopilotadapter/DynamicInterfaceCpp.ftl");
AUTOPILOT_ADAPTER_H = conf.getTemplate("/autopilotadapter/DynamicInterfaceH.ftl");
SERVER_WRAPPER = conf.getTemplate("/serverwrapper/ServerWrapper.ftl");
DYNAMICS_EVENT_PortValueCheker = conf.getTemplate("/dynamics/events_port_value_check_h.ftl");
DYNAMICS_EVENT_DynamicHelper = conf.getTemplate("/dynamics/dynamic_port_request_connect_helper_h.ftl");
......
<#-- (c) https://github.com/MontiCore/monticore -->
<#include "/Common.ftl">
#include "DynamicInterface.h"
#include "./${viewModel.mainModelName}.h"
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include "armadillo"
void copy_double_array_to_mat(double *data, int size, mat &dest){
for (int i=0; i<size; ++i) {
dest(0,i) = data[i];
}
}
${viewModel.mainModelName} AUTOPILOT_INSTANCE;
int input_count = ${viewModel.inputCount};
int output_count = ${viewModel.outputCount};
const char *input_names[] = { ${viewModel.inputNames}
};
const char *output_names[] = { ${viewModel.outputNames}
};
const char *input_types[] = { ${viewModel.inputTypes}
};
const char *output_types[] = { ${viewModel.outputTypes}
};
extern "C" {
EXPORT int get_count_input(){
return input_count;
}
EXPORT const char *get_name_input(int index){
return input_names[index];
}
EXPORT const char *get_type_input(int index){
return input_types[index];
}
EXPORT int get_count_output(){
return output_count;
}
EXPORT const char *get_name_output(int index){
return output_names[index];
}
EXPORT const char *get_type_output(int index){
return output_types[index];
}
EXPORT void init(){
srand(time(NULL));
AUTOPILOT_INSTANCE.init();
}
EXPORT void execute(){
AUTOPILOT_INSTANCE.execute();
}
${viewModel.functionImplementations}
${viewModel.structCountFuncImplementations}
${viewModel.structNameFuncImplementations}
${viewModel.structTypeFuncImplementations}
}
<#-- (c) https://github.com/MontiCore/monticore -->
<#include "/Common.ftl">
#pragma once
#if defined(_MSC_VER)
// Microsoft
#define EXPORT __declspec(dllexport)
#define IMPORT __declspec(dllimport)
#elif defined(__GNUC__)
// GCC
#define EXPORT __attribute__((visibility("default")))
#define IMPORT
#else
// do nothing and hope for the best?
#define EXPORT
#define IMPORT
#pragma warning Unknown dynamic link import/export semantics.
#endif
extern "C" {
EXPORT int get_count_input();
EXPORT const char *get_name_input(int index);
EXPORT const char *get_type_input(int index);
EXPORT int get_count_output();
EXPORT const char *get_name_output(int index);
EXPORT const char *get_type_output(int index);
EXPORT void init();
EXPORT void execute();
${viewModel.functionDeclarations}
${viewModel.structCountFuncDeclarations}
${viewModel.structNameFuncDeclarations}
${viewModel.structTypeFuncDeclarations}
}
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