aboutsummaryrefslogtreecommitdiff
path: root/msg
diff options
context:
space:
mode:
authorThomas Gubler <thomasgubler@gmail.com>2015-01-21 14:34:05 +0100
committerThomas Gubler <thomasgubler@gmail.com>2015-01-21 14:34:05 +0100
commit632a0866ef16723dd6e1f0a2f7c575706b9e10cc (patch)
tree995e674a07d9691936ee2bdafa3237c90f66af32 /msg
parentcadcad6ffbdfbe9b92a5936f4d894138f912b4ff (diff)
downloadpx4-firmware-632a0866ef16723dd6e1f0a2f7c575706b9e10cc.tar.gz
px4-firmware-632a0866ef16723dd6e1f0a2f7c575706b9e10cc.tar.bz2
px4-firmware-632a0866ef16723dd6e1f0a2f7c575706b9e10cc.zip
remove unneeded functionality in template
Diffstat (limited to 'msg')
-rw-r--r--msg/templates/msg.h.template69
1 files changed, 12 insertions, 57 deletions
diff --git a/msg/templates/msg.h.template b/msg/templates/msg.h.template
index 826418d11..cc128c1ea 100644
--- a/msg/templates/msg.h.template
+++ b/msg/templates/msg.h.template
@@ -95,17 +95,17 @@ for field in spec.parsed_fields():
@##############################
@{
-type_map = {'int8': ['int8_t', '0'],
- 'int16': ['int16_t', '0'],
- 'int32': ['int32_t', '0'],
- 'int64': ['int64_t', '0'],
- 'uint8': ['uint8_t', '0'],
- 'uint16': ['uint16_t', '0'],
- 'uint32': ['uint32_t', '0'],
- 'uint64': ['uint64_t', '0'],
- 'float32': ['float', '0.0f'],
- 'bool': ['bool', 'false'],
- 'fence_vertex': ['fence_vertex', '']}
+type_map = {'int8': 'int8_t',
+ 'int16': 'int16_t',
+ 'int32': 'int32_t',
+ 'int64': 'int64_t',
+ 'uint8': 'uint8_t',
+ 'uint16': 'uint16_t',
+ 'uint32': 'uint32_t',
+ 'uint64': 'uint64_t',
+ 'float32': 'float',
+ 'bool': 'bool',
+ 'fence_vertex': 'fence_vertex'}
# Function to print a standard ros type
def print_field_def(field):
@@ -129,41 +129,12 @@ def print_field_def(field):
if type in type_map:
# need to add _t: int8 --> int8_t
- type_px4 = type_map[type][0]
+ type_px4 = type_map[type]
else:
raise Exception("Type {0} not supported, add to to template file!".format(type))
print('\t%s%s%s %s%s;'%(type_prefix, type_px4, type_appendix, field.name, array_size))
-# Function to init fields
-def get_field_init(field):
- type = field.type
- # detect embedded types
- sl_pos = type.find('/')
- type_appendix = ''
- type_prefix = ''
- if (sl_pos >= 0):
- type = type[sl_pos + 1:]
- type_prefix = 'struct '
- type_appendix = '_s'
-
- # detect arrays
- a_pos = type.find('[')
- array_size = ''
- if (a_pos >= 0):
- # field is array
- array_size = type[a_pos:]
- type = type[:a_pos]
- return '\n\t%s{},'%(field.name)
-
- if type in type_map:
- # need to add _t: int8 --> int8_t
- type_px4 = type_map[type][0]
- init_value = type_map[type][1]
- else:
- raise Exception("Type {0} not supported, add to to template file!".format(type))
-
- return '\n\t%s(%s),'%(field.name, init_value)
}
#ifdef __cplusplus
@#class @(spec.short_name)_s {
@@ -178,22 +149,6 @@ for field in spec.parsed_fields():
if (not field.is_header):
print_field_def(field)
}@
-
-@##ifdef __cplusplus
-@#@(spec.short_name)_s() :
-@#@{
-@#field_init = ''
-@## loop over all fields and init
-@#for field in spec.parsed_fields():
-@# if (not field.is_header):
-@# field_init += get_field_init(field)
-@#
-@#print(field_init[:-1])
-@#}@
-@#{}
-@#virtual ~@(spec.short_name)_s() {}
-@##endif
-
};
/**