Skip to content

Commit

Permalink
Avoid multiple includes for nested array functions (#72)
Browse files Browse the repository at this point in the history
Signed-off-by: Jacob Perron <jacob@openrobotics.org>
  • Loading branch information
jacobperron committed Jul 20, 2019
1 parent 6ec55cb commit cc7f838
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion rosidl_generator_py/resource/_msg_support.c.em
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,17 @@ if isinstance(member.type, AbstractNestedType) and isinstance(member.type.value_
@[if nested_types]@
// Nested array functions includes
@[ for type_ in sorted(nested_types)]@
#include "@('/'.join(type_[:-1]))/@(convert_camel_case_to_lower_case_underscore(type_[-1]))__functions.h"
@{
nested_header = '/'.join(type_[:-1] + (convert_camel_case_to_lower_case_underscore(type_[-1]),))
nested_header += '__functions.h'
}@
@[ if nested_header in include_directives]@
// already included above
// @
@[ else]@
@{include_directives.add(nested_header)}@
@[ end if]@
#include "@(nested_header)"
@[ end for]@
// end nested array functions include
@[end if]@
Expand Down

0 comments on commit cc7f838

Please sign in to comment.