@@ -69,7 +69,7 @@ type_name = referenced_type_description['type_name']
69
69
c_typename = type_name .replace (' /' , ' __' )
70
70
}@
71
71
@ [ if type_name not in full_type_names]@
72
- static const rosidl_type_hash_t @ (c_typename)__EXPECTED_HASH = @ (type_hash_to_c_definition (hash_lookup[type_name]));
72
+ static const rosidl_type_hash_t @ (unique_prefix)_ @ ( c_typename)__EXPECTED_HASH = @ (type_hash_to_c_definition (hash_lookup[type_name]));
73
73
@ [ end if ]@
74
74
@ [end for ]@
75
75
# endif
@@ -78,7 +78,7 @@ static const rosidl_type_hash_t @(c_typename)__EXPECTED_HASH = @(type_hash_to_c_
78
78
@ # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
79
79
@ # Names for all types
80
80
@ [for itype_description in all_type_descriptions]@
81
- static char @ (typename_to_c (itype_description[' type_name' ]))__TYPE_NAME[] = " @(itype_description['type_name'])" ;
81
+ static char @ (unique_prefix)_ @ ( typename_to_c (itype_description[' type_name' ]))__TYPE_NAME[] = " @(itype_description['type_name'])" ;
82
82
@ [end for ]@
83
83
@ # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
84
84
@@ -111,7 +111,7 @@ static rosidl_runtime_c__type_description__Field @(td_c_typename)__FIELDS[] = {
111
111
rosidl_runtime_c__type_description__FieldType__@ (FIELD_TYPE_ID_TO_NAME[field[' type' ][' type_id' ]]),
112
112
@ (field[' type' ][' capacity' ]),
113
113
@ (field[' type' ][' string_capacity' ]),
114
- @ (static_seq (f" {typename_to_c(field['type']['nested_type_name'])}__TYPE_NAME" , field[' type' ][' nested_type_name' ])),
114
+ @ (static_seq (f" {unique_prefix}_{ typename_to_c(field['type']['nested_type_name'])}__TYPE_NAME" , field[' type' ][' nested_type_name' ])),
115
115
},
116
116
@ (static_seq (f" {td_c_typename}__DEFAULT_VALUE__{field['name']}" , field[' default_value' ])),
117
117
},
@@ -124,7 +124,7 @@ static rosidl_runtime_c__type_description__Field @(td_c_typename)__FIELDS[] = {
124
124
static rosidl_runtime_c__type_description__IndividualTypeDescription @ (td_c_typename)__REFERENCED_TYPE_DESCRIPTIONS[] = {
125
125
@ [ for ref_td in ref_tds]@
126
126
{
127
- @ (static_seq (f" {typename_to_c(ref_td['type_name'])}__TYPE_NAME" , ref_td[' type_name' ])),
127
+ @ (static_seq (f" {unique_prefix}_{ typename_to_c(ref_td['type_name'])}__TYPE_NAME" , ref_td[' type_name' ])),
128
128
{NULL, 0 , 0 },
129
129
},
130
130
@ [ end for ]@
@@ -139,7 +139,7 @@ const rosidl_runtime_c__type_description__TypeDescription *
139
139
static bool constructed = false ;
140
140
static const rosidl_runtime_c__type_description__TypeDescription description = {
141
141
{
142
- @ (static_seq (f' {td_c_typename}__TYPE_NAME' , td_typename)),
142
+ @ (static_seq (f' {unique_prefix}_{ td_c_typename}__TYPE_NAME' , td_typename)),
143
143
@ (static_seq (f' {td_c_typename}__FIELDS' , msg[' type_description' ][' fields' ])),
144
144
},
145
145
@ (static_seq (f' {td_c_typename}__REFERENCED_TYPE_DESCRIPTIONS' , ref_tds)),
@@ -150,7 +150,7 @@ const rosidl_runtime_c__type_description__TypeDescription *
150
150
c_typename = typename_to_c (ref_td[' type_name' ])
151
151
}@
152
152
@ [ if ref_td[' type_name' ] not in full_type_names]@
153
- assert (0 == memcmp (& @ (c_typename)__EXPECTED_HASH, @ (c_typename)__@ (GET_HASH_FUNC)(NULL), sizeof (rosidl_type_hash_t)));
153
+ assert (0 == memcmp (& @ (unique_prefix)_ @ ( c_typename)__EXPECTED_HASH, @ (c_typename)__@ (GET_HASH_FUNC)(NULL), sizeof (rosidl_type_hash_t)));
154
154
@ [ end if ]@
155
155
description .referenced_type_descriptions .data [@ (idx)].fields = @ (c_typename)__@ (GET_DESCRIPTION_FUNC)(NULL )-> type_description .fields ;
156
156
@ [ end for ]@
@@ -164,16 +164,16 @@ c_typename = typename_to_c(ref_td['type_name'])
164
164
@ # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
165
165
@ # Define individual raw sources
166
166
@ [if raw_source_content]@
167
- static char toplevel_type_raw_source [] = @
167
+ static char @ (unique_prefix)_toplevel_type_raw_source [] = @
168
168
@ [ for line in raw_source_content .splitlines ()[: - 1 ]]
169
169
" @(utf8_encode(line))\n " @
170
170
@ [ end for ]
171
171
" @(utf8_encode(raw_source_content.splitlines()[-1]))" ;
172
172
@ [end if ]@
173
173
174
- static char @ (toplevel_encoding)_encoding[] = " @(toplevel_encoding)" ;
174
+ static char @ (unique_prefix)_ @ ( toplevel_encoding)_encoding[] = " @(toplevel_encoding)" ;
175
175
@ [if implicit_type_descriptions]@
176
- static char implicit_encoding [] = " implicit" ;
176
+ static char @ (unique_prefix)_implicit_encoding [] = " implicit" ;
177
177
@ [end if ]@
178
178
179
179
// Define all individual source functions
@@ -188,7 +188,7 @@ if td_typename in implicit_type_names:
188
188
contents = None
189
189
else :
190
190
encoding = toplevel_encoding
191
- contents_var = ' toplevel_type_raw_source '
191
+ contents_var = unique_prefix + ' _toplevel_type_raw_source '
192
192
contents = raw_source_content
193
193
}@
194
194
@@ -198,8 +198,8 @@ const rosidl_runtime_c__type_description__TypeSource *
198
198
{
199
199
(void )type_support;
200
200
static const rosidl_runtime_c__type_description__TypeSource source = {
201
- @ (static_seq (f' {td_c_typename}__TYPE_NAME' , td_typename)),
202
- @ (static_seq (f' {encoding}_encoding' , encoding)),
201
+ @ (static_seq (f' {unique_prefix}_{ td_c_typename}__TYPE_NAME' , td_typename)),
202
+ @ (static_seq (f' {unique_prefix}_{ encoding}_encoding' , encoding)),
203
203
@ (static_seq (contents_var, contents)),
204
204
};
205
205
return & source;
0 commit comments