@@ -32,6 +32,9 @@ $fileHeader(ctx=ctx, file=[ctx.filename, "TypeObjectSupport.cxx"], description=[
32
32
#include <fastdds/dds/xtypes/type_representation/ITypeObjectRegistry.hpp>
33
33
#include <fastdds/dds/xtypes/type_representation/TypeObject.hpp>
34
34
#include <fastdds/dds/xtypes/type_representation/TypeObjectUtils.hpp>
35
+ $if(ctx.thereIsInterface || ctx.thereIsException)$
36
+ #include <fastdds/dds/rpc/RPCTypeObjectSupport.hpp>
37
+ $endif$
35
38
36
39
#include "$ctx.filename$.hpp"
37
40
@@ -65,7 +68,7 @@ namespace $annotation.name$ {
65
68
66
69
} // namespace $annotation.name$
67
70
68
- void register_$annotation.name $_type_identifier(
71
+ void register_$annotation.nameForTypeObjectRegistration $_type_identifier(
69
72
TypeIdentifierPair& type_ids_$annotation.name$)
70
73
{
71
74
ReturnCode_t return_code_$annotation.name$ {eprosima::fastdds::dds::RETCODE_OK};
@@ -94,8 +97,7 @@ void register_$annotation.name$_type_identifier(
94
97
>>
95
98
96
99
bitmask_type(ctx, parent, bitmask) ::= <<
97
- $if(!bitmask.declaredInsideInterface)$
98
- void register_$bitmask.name$_type_identifier(
100
+ void register_$bitmask.nameForTypeObjectRegistration$_type_identifier(
99
101
TypeIdentifierPair& type_ids_$bitmask.name$)
100
102
{
101
103
ReturnCode_t return_code_$bitmask.name$ {eprosima::fastdds::dds::RETCODE_OK};
@@ -119,13 +121,11 @@ void register_$bitmask.name$_type_identifier(
119
121
}
120
122
}
121
123
}
122
- $endif$
123
124
>>
124
125
125
126
126
127
bitset_type(ctx, parent, bitset, extensions) ::= <<
127
- $if(!bitset.declaredInsideInterface)$
128
- void register_$bitset.name$_type_identifier(
128
+ void register_$bitset.nameForTypeObjectRegistration$_type_identifier(
129
129
TypeIdentifierPair& type_ids_$bitset.name$)
130
130
{
131
131
ReturnCode_t return_code_$bitset.name$ {eprosima::fastdds::dds::RETCODE_OK};
@@ -147,13 +147,11 @@ void register_$bitset.name$_type_identifier(
147
147
}
148
148
}
149
149
}
150
- $endif$
151
150
>>
152
151
153
152
154
153
enum_type(ctx, parent, enum) ::= <<
155
- $if(!enum.declaredInsideInterface)$
156
- void register_$enum.name$_type_identifier(
154
+ void register_$enum.nameForTypeObjectRegistration$_type_identifier(
157
155
TypeIdentifierPair& type_ids_$enum.name$)
158
156
{
159
157
ReturnCode_t return_code_$enum.name$ {eprosima::fastdds::dds::RETCODE_OK};
@@ -177,13 +175,15 @@ void register_$enum.name$_type_identifier(
177
175
}
178
176
}
179
177
}
180
- $endif$
181
178
>>
182
179
183
180
struct_type(ctx, parent, struct, member_list) ::= <<
184
- $if(!struct.declaredInsideInterface)$
181
+ $content_for_struct_type(ctx, struct)$
182
+ >>
183
+
184
+ content_for_struct_type(ctx, struct) ::= <<
185
185
// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method
186
- void register_$struct.name $_type_identifier(
186
+ void register_$struct.nameForTypeObjectRegistration $_type_identifier(
187
187
TypeIdentifierPair& type_ids_$struct.name$)
188
188
{
189
189
$if (struct.nonForwardedContent)$
@@ -202,7 +202,7 @@ void register_$struct.name$_type_identifier(
202
202
$get_type_identifier(type=struct.inheritance, name=struct.name)$
203
203
if (return_code_$struct.name$ != eprosima::fastdds::dds::RETCODE_OK)
204
204
{
205
- $struct.inheritance.scope $::register_$struct.inheritance.name $_type_identifier(type_ids_$struct.name$);
205
+ $add_namespace( struct.inheritance) $::register_$struct.inheritance.nameForTypeObjectRegistration $_type_identifier(type_ids_$struct.name$);
206
206
}
207
207
$endif$
208
208
$complete_type_detail(type=struct, type_kind=" Structure", name=struct.name)$
@@ -242,12 +242,11 @@ void register_$struct.name$_type_identifier(
242
242
"$struct.scopedname$ contains forward declarations (not yet supported).");
243
243
$endif$
244
244
}
245
- $endif$
246
245
>>
247
246
248
247
typedef_decl(ctx, parent, typedefs, typedefs_type, declarator_type) ::= <<
249
248
$typedefs : { typedef |
250
- void register_$typedef.name $_type_identifier(
249
+ void register_$typedef.nameForTypeObjectRegistration $_type_identifier(
251
250
TypeIdentifierPair& type_ids_$typedef.name$)
252
251
{
253
252
$! TODO(jlbueno): annotated collections aliases are considered non-anonymous collections.
@@ -315,9 +314,8 @@ void register_$typedef.name$_type_identifier(
315
314
>>
316
315
317
316
union_type(ctx, parent, union, extensions, switch_type) ::= <<
318
- $if(!union.declaredInsideInterface)$
319
317
// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method
320
- void register_$union.name $_type_identifier(
318
+ void register_$union.nameForTypeObjectRegistration $_type_identifier(
321
319
TypeIdentifierPair& type_ids_$union.name$)
322
320
{
323
321
$if (union.nonForwardedContent)$
@@ -335,9 +333,9 @@ void register_$union.name$_type_identifier(
335
333
if (return_code_$union.name$ != eprosima::fastdds::dds::RETCODE_OK)
336
334
{
337
335
$if (union.discriminator.typecode.isAliasType)$
338
- $union.discriminator.typecode.scope $::register_$union.discriminator.typecode.name $_type_identifier(type_ids_$union.name$);
336
+ $add_namespace( union.discriminator.typecode) $::register_$union.discriminator.typecode.nameForTypeObjectRegistration $_type_identifier(type_ids_$union.name$);
339
337
$elseif (union.discriminator.typecode.isEnumType)$
340
- $union.discriminator.typecode.scope $::register_$union.discriminator.typecode.name $_type_identifier(type_ids_$union.name$);
338
+ $add_namespace( union.discriminator.typecode) $::register_$union.discriminator.typecode.nameForTypeObjectRegistration $_type_identifier(type_ids_$union.name$);
341
339
$else$
342
340
EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION,
343
341
"Union discriminator TypeIdentifier unknown to TypeObjectRegistry.");
@@ -380,17 +378,66 @@ void register_$union.name$_type_identifier(
380
378
"$union.scopedname$ contains forward declarations (not yet supported).");
381
379
$endif$
382
380
}
381
+ >>
382
+
383
+ exception(ctx, parent, exception, extensions) ::= <<
384
+ $content_for_struct_type(ctx, exception.typeCode)$
385
+ >>
386
+
387
+ interface(ctx, parent, interface, export_list) ::= <<
388
+
389
+ $export_list$
390
+
391
+ namespace detail {
392
+
393
+ $interface.operations : { operation | $operation_details(interface, operation)$ }; separator="\n"$
394
+
395
+ } // namespace detail
396
+
397
+ $if(!interface.annotatedAsNested)$
398
+ $content_for_struct_type(ctx, interface.requestTypeCode)$
399
+ $content_for_struct_type(ctx, interface.replyTypeCode)$
383
400
$endif$
384
401
>>
385
402
386
403
/***** Utils *****/
404
+ operation_details(interface, operation) ::= <<
405
+ //{ $operation.name$
406
+ $operation_in_struct(interface, operation)$
407
+
408
+ $operation.inputparam : { param | $if (param.annotationFeed)$$operation_feed_struct(interface, operation, param)$$endif$ }$
409
+
410
+ $operation_out_struct(interface, operation)$
411
+
412
+ $operation_result_struct(interface, operation)$
413
+
414
+ //} // $operation.name$
415
+
416
+ >>
417
+
418
+ operation_in_struct(interface, operation) ::= <<
419
+ $content_for_struct_type(ctx, operation.inTypeCode)$
420
+ >>
421
+
422
+ operation_feed_struct(interface, operation, param) ::= <<
423
+ $content_for_struct_type(ctx, param.feedTypeCode)$
424
+ >>
425
+
426
+ operation_out_struct(interface, operation) ::= <<
427
+ $content_for_struct_type(ctx, operation.outTypeCode)$
428
+ >>
429
+
430
+ operation_result_struct(interface, operation) ::= <<
431
+ $content_for_struct_type(ctx, operation.resultTypeCode)$
432
+ >>
433
+
387
434
register_type(ctx, object) ::= <<
388
435
$if (object.isTypeDeclaration)$
389
436
$if ((object.typeCode.isStructType || object.typeCode.isUnionType) && !object.typeCode.forwarded)$
390
- $if (! object.scope.empty)$$object.scope$::$endif$ register_$object.name $_type_identifier(type_id);
437
+ $add_namespace( object)$:: register_$object.nameForTypeObjectRegistration $_type_identifier(type_id);
391
438
$endif$
392
439
$elseif (object.isAnnotation)$
393
- $if (! object.scope.empty)$$object.scope$::$endif$ register_$object.name $_type_identifier(type_id);
440
+ $add_namespace( object)$:: register_$object.nameForTypeObjectRegistration $_type_identifier(type_id);
394
441
$endif$
395
442
>>
396
443
@@ -444,7 +491,7 @@ $endif$
444
491
$get_type_identifier_registry(typename=annotation.scopedname, name=annotation.name)$
445
492
if (return_code_$annotation.name$ != eprosima::fastdds::dds::RETCODE_OK)
446
493
{
447
- $annotation.annotationDeclaration.scope$::register_$annotation.annotationDeclaration.name $_type_identifier(type_ids_$annotation.annotationDeclaration.name$);
494
+ $annotation.annotationDeclaration.scope$::register_$annotation.annotationDeclaration.nameForTypeObjectRegistration $_type_identifier(type_ids_$annotation.annotationDeclaration.name$);
448
495
}
449
496
if (!tmp_applied_annotation_parameter_seq_$member.name$.empty())
450
497
{
@@ -511,9 +558,9 @@ annotation_parameter(param, parent) ::= <<
511
558
if (return_code_$param.name$ != eprosima::fastdds::dds::RETCODE_OK)
512
559
{
513
560
$if (param.typecode.isAliasType)$
514
- $param.typecode.scope $::register_$param.typecode.name $_type_identifier(type_ids_$param.name$);
561
+ $add_namespace( param.typecode) $::register_$param.typecode.nameForTypeObjectRegistration $_type_identifier(type_ids_$param.name$);
515
562
$elseif (param.typecode.isEnumType)$
516
- $param.typecode.scope $::register_$param.typecode.name $_type_identifier(type_ids_$param.name$);
563
+ $add_namespace( param.typecode) $::register_$param.typecode.nameForTypeObjectRegistration $_type_identifier(type_ids_$param.name$);
517
564
$elseif (param.typecode.isStringType)$
518
565
$register_string_type(string=param.typecode, name=param.name)$
519
566
$elseif (param.typecode.isWStringType)$
@@ -902,23 +949,23 @@ check_register_type_identifier(type, message, name) ::= <<
902
949
if (eprosima::fastdds::dds::RETCODE_OK != return_code_$name$)
903
950
{
904
951
$if (type.isAliasType)$
905
- $type.scope $::register_$type.name $_type_identifier(type_ids_$name$);
952
+ $add_namespace( type) $::register_$type.nameForTypeObjectRegistration $_type_identifier(type_ids_$name$);
906
953
$elseif (type.isStructType)$
907
- $type.scope $::register_$type.name $_type_identifier(type_ids_$name$);
954
+ $add_namespace( type) $::register_$type.nameForTypeObjectRegistration $_type_identifier(type_ids_$name$);
908
955
$elseif (type.isUnionType)$
909
- $type.scope $::register_$type.name $_type_identifier(type_ids_$name$);
956
+ $add_namespace( type) $::register_$type.nameForTypeObjectRegistration $_type_identifier(type_ids_$name$);
910
957
$elseif (type.isBitsetType)$
911
- $type.scope $::register_$type.name $_type_identifier(type_ids_$name$);
958
+ $add_namespace( type) $::register_$type.nameForTypeObjectRegistration $_type_identifier(type_ids_$name$);
912
959
$elseif (type.isSequenceType)$
913
960
$register_sequence_type(sequence=type, name=name)$
914
961
$elseif (type.isArrayType)$
915
962
$register_array_type(array=type, name=name)$
916
963
$elseif (type.isMapType)$
917
964
$register_map_type(map=type, name=name)$
918
965
$elseif (type.isEnumType)$
919
- $type.scope $::register_$type.name $_type_identifier(type_ids_$name$);
966
+ $add_namespace( type) $::register_$type.nameForTypeObjectRegistration $_type_identifier(type_ids_$name$);
920
967
$elseif (type.isBitmaskType)$
921
- $type.scope $::register_$type.name $_type_identifier(type_ids_$name$);
968
+ $add_namespace( type) $::register_$type.nameForTypeObjectRegistration $_type_identifier(type_ids_$name$);
922
969
$elseif (type.isStringType)$
923
970
$register_string_type(string=type, name=name)$
924
971
$elseif (type.isWStringType)$
@@ -973,6 +1020,10 @@ CollectionElementFlag element_flags_$collection_name$ = 0;
973
1020
PlainCollectionHeader header_$collection_name$ = TypeObjectUtils::build_plain_collection_header(equiv_kind_$collection_name$, element_flags_$collection_name$);
974
1021
>>
975
1022
1023
+ add_namespace(type) ::= <%
1024
+ $if (!type.namespace.empty)$::$type.namespace$$endif$
1025
+ %>
1026
+
976
1027
//{ Fast DDS-Gen extensions
977
1028
module_conversion(ctx, parent, modules, definition_list) ::= <<
978
1029
$modules : { module |
0 commit comments