1
+ // Copyright 2025 Proyectos y Sistemas de Mantenimiento SL (eProsima).
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+
15
+ group InterfaceDetails;
16
+
17
+ import "eprosima.stg"
18
+
19
+ main(ctx, definitions) ::= <<
20
+ $fileHeader(ctx=ctx, file=[ctx.filename, "_details.hpp"], description=["This header file contains support data structures for RPC communication."])$
21
+
22
+ #ifndef FAST_DDS_GENERATED__$ctx.headerGuardName$_DETAILS_HPP
23
+ #define FAST_DDS_GENERATED__$ctx.headerGuardName$_DETAILS_HPP
24
+
25
+ #include <fastcdr/xcdr/optional.hpp>
26
+ #include <fastdds/dds/rpc/RemoteExceptionCode_t.hpp>
27
+ #include <fastdds/dds/rpc/interfaces/RpcStatusCode.hpp>
28
+
29
+ #include "$ctx.filename$.hpp"
30
+
31
+ $definitions; separator="\n"$
32
+
33
+ #endif //FAST_DDS_GENERATED__$ctx.headerGuardName$_DETAILS_HPP
34
+ >>
35
+
36
+ struct_type(ctx, parent, struct, member_list) ::= <<>>
37
+
38
+ union_type(ctx, parent, union, switch_type) ::= <<>>
39
+
40
+ bitmask_type(ctx, parent, bitmask) ::= <<>>
41
+
42
+ bitset_type(ctx, parent, bitset) ::= <<>>
43
+
44
+ module(ctx, parent, module, definition_list) ::= <<
45
+ namespace $module.name$ {
46
+ $definition_list$
47
+ } // namespace $module.name$
48
+ >>
49
+
50
+ interface(ctx, parent, interface, export_list) ::= <<
51
+ namespace detail {
52
+
53
+ //{ $interface.name$ interface
54
+
55
+ $interface.all_operations : { operation | $operation_details(interface, operation)$ }; separator="\n"$
56
+
57
+ //{ top level
58
+
59
+ struct $interface.name$_Request
60
+ {
61
+ $interface.all_operations : { operation | $operation_request_members(interface, operation)$ }; separator="\n"$
62
+ };
63
+
64
+ struct $interface.name$_Reply
65
+ {
66
+ $interface.all_operations : { operation | $operation_reply_members(interface, operation)$ }; separator="\n"$
67
+ eprosima::fastcdr::optional<eprosima::fastdds::dds::rpc::RemoteExceptionCode_t\> remoteEx;
68
+ };
69
+
70
+ //} // top level
71
+
72
+ //} // $interface.name$ interface
73
+
74
+ } // namespace detail
75
+ >>
76
+
77
+ operation_details(interface, operation) ::= <<
78
+ //{ $operation.name$
79
+ $operation_in_struct(interface, operation)$
80
+
81
+ $operation.inputparam : { param | $if (param.annotationFeed)$$operation_feed_struct(interface, operation, param)$$endif$ }$
82
+
83
+ $operation_out_struct(interface, operation)$
84
+
85
+ $operation_result_struct(interface, operation)$
86
+
87
+ //} // $operation.name$
88
+
89
+ >>
90
+
91
+ operation_in_struct(interface, operation) ::= <<
92
+ struct $interface.name$_$operation.name$_In
93
+ {
94
+ $if(operation.inputparam)$
95
+ $operation.inputparam : { param | $if (!param.annotationFeed)$$parameter_declaration(param)$$endif$ }; separator="\n"$
96
+ $endif$
97
+ };
98
+ >>
99
+
100
+ operation_feed_struct(interface, operation, param) ::= <<
101
+ struct $interface.name$_$operation.name$_$param.name$_Feed
102
+ {
103
+ eprosima::fastcdr::optional<$param.typecode.cppTypename$> value;
104
+ eprosima::fastcdr::optional<eprosima::fastdds::dds::rpc::RpcStatusCode> finished_;
105
+ };
106
+ >>
107
+
108
+ operation_out_struct(interface, operation) ::= <<
109
+ struct $interface.name$_$operation.name$_Out
110
+ {
111
+ $if(operation.annotationFeed)$
112
+ eprosima::fastcdr::optional<$operation.rettypeparam.typecode.cppTypename$\> $operation.rettypeparam.name$;
113
+ eprosima::fastcdr::optional<bool\> finished_;
114
+ $else$
115
+ $if([operation.outputparam, operation.rettypeparam])$
116
+ $[operation.outputparam, operation.rettypeparam]:{param | $parameter_declaration(param)$}; separator="\n"$
117
+ $endif$
118
+ $endif$
119
+ };
120
+ >>
121
+
122
+ operation_result_struct(interface, operation) ::= <<
123
+ struct $interface.name$_$operation.name$_Result
124
+ {
125
+ eprosima::fastcdr::optional<$interface.name$_$operation.name$_Out\> result;
126
+ $operation.exceptions : { exception |$operation_result_exception(typename=exception.scopedname, name=[exception.formatedScopedname, "_ex"])$}; separator="\n"$
127
+ };
128
+ >>
129
+
130
+ parameter_declaration(param) ::= <%
131
+ $param.typecode.cppTypename$ $param.name$;
132
+ %>
133
+
134
+ operation_result_exception(typename, name) ::= <%
135
+ eprosima::fastcdr::optional<$typename$> $name$;
136
+ %>
137
+
138
+ operation_request_members(interface, operation) ::= <%
139
+ eprosima::fastcdr::optional<$interface.name$_$operation.name$_In> $operation.name$;
140
+ $operation.inputparam : { param | $if (param.annotationFeed)$$operation_request_feed(interface, operation, param)$$endif$ }$
141
+ %>
142
+
143
+ operation_request_feed(interface, operation, param) ::= <<
144
+
145
+ eprosima::fastcdr::optional<$interface.name$_$operation.name$_$param.name$_Feed\> $operation.name$_$param.name$;
146
+ >>
147
+
148
+ operation_reply_members(interface, operation) ::= <<
149
+ eprosima::fastcdr::optional<$interface.name$_$operation.name$_Result\> $operation.name$;
150
+ >>
0 commit comments