Started with gobotrpc autogenerated parser and ctest (not working)
This commit is contained in:
13
gobotrpc/generator/templates/CMakeLists.txt.j2
Normal file
13
gobotrpc/generator/templates/CMakeLists.txt.j2
Normal file
@@ -0,0 +1,13 @@
|
||||
add_libary(gobotrpc STATIC)
|
||||
|
||||
target_sources(gobotrpc
|
||||
PRIVATE
|
||||
{%- for n in cpp_files %}
|
||||
{{ n }}
|
||||
{%- endfor %}
|
||||
)
|
||||
|
||||
target_include_directories(gobotrpc
|
||||
PUBLIC
|
||||
include
|
||||
)
|
||||
29
gobotrpc/generator/templates/package_struct_template.hpp.j2
Normal file
29
gobotrpc/generator/templates/package_struct_template.hpp.j2
Normal file
@@ -0,0 +1,29 @@
|
||||
#pragma once
|
||||
/**
|
||||
* This Header file was auto-generated by the GobotRPC-Protocol-Generator-Tool
|
||||
*/
|
||||
|
||||
#include {{ "<stdint.h>" }}
|
||||
#include "{{ enum_header_file }}"
|
||||
|
||||
enum {{ prefix }}RPCNames {{"{"}}
|
||||
{%- for n in rpcNames %}
|
||||
{{ n }} = {{ rpcNames[n] }},
|
||||
{%- endfor %}
|
||||
{{"}"}};
|
||||
|
||||
enum {{ prefix }}RPCTypes {{"{"}}
|
||||
{%- for n in rpcTypes %}
|
||||
{{ n }} = {{ rpcTypes[n] }},
|
||||
{%- endfor %}
|
||||
{{"}"}};
|
||||
|
||||
int getPackageSize(uint8_t data);
|
||||
|
||||
{% for struct in package_list %}
|
||||
struct {{ struct.name }} {{ "{" }}
|
||||
{% for field in struct.fields -%}
|
||||
{{ "\t" }}{{ field.type }} {{ field.name }} : {{ field.size_bits }};
|
||||
{% endfor -%}
|
||||
{{ "}" }};
|
||||
{% endfor %}
|
||||
20
gobotrpc/generator/templates/package_util.cpp.j2
Normal file
20
gobotrpc/generator/templates/package_util.cpp.j2
Normal file
@@ -0,0 +1,20 @@
|
||||
#pragma once
|
||||
/**
|
||||
* This Header file was auto-generated by the GobotRPC-Protocol-Generator-Tool
|
||||
*/
|
||||
|
||||
#include {{ "<stdint.h>" }}
|
||||
{%- for h in headers %}
|
||||
#include {{ "\"" + h + "\"" }}
|
||||
{%- endfor %}
|
||||
|
||||
int getPackageSize(uint8_t data) {
|
||||
switch(data) {
|
||||
{%- for n in rpcSizes %}
|
||||
case {{ prefix }}RPCNames::{{ n }}:
|
||||
return {{ rpcSizes[n] }};
|
||||
{%- endfor %}
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user