Skip to content

Commit 4fed0bd

Browse files
Fix HelloWorld DataSharing example idl (#3714)
* Refs #19089: Fix HelloWorld DataSharing example idl as bounded Signed-off-by: JesusPoderoso <[email protected]> * Refs #19089: Revert uncrustify fix in types Signed-off-by: JesusPoderoso <[email protected]> --------- Signed-off-by: JesusPoderoso <[email protected]>
1 parent ab56fa8 commit 4fed0bd

File tree

5 files changed

+13
-14
lines changed

5 files changed

+13
-14
lines changed

examples/cpp/dds/HelloWorldExampleDataSharing/HelloWorld.cxx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ uint32_t& HelloWorld::index()
126126
* @param _message New value to be copied in member message
127127
*/
128128
void HelloWorld::message(
129-
const std::string& _message)
129+
const eprosima::fastcdr::fixed_string<20>& _message)
130130
{
131131
m_message = _message;
132132
}
@@ -136,7 +136,7 @@ void HelloWorld::message(
136136
* @param _message New value to be moved in member message
137137
*/
138138
void HelloWorld::message(
139-
std::string&& _message)
139+
eprosima::fastcdr::fixed_string<20>&& _message)
140140
{
141141
m_message = std::move(_message);
142142
}
@@ -145,7 +145,7 @@ void HelloWorld::message(
145145
* @brief This function returns a constant reference to member message
146146
* @return Constant reference to member message
147147
*/
148-
const std::string& HelloWorld::message() const
148+
const eprosima::fastcdr::fixed_string<20>& HelloWorld::message() const
149149
{
150150
return m_message;
151151
}
@@ -154,7 +154,7 @@ const std::string& HelloWorld::message() const
154154
* @brief This function returns a reference to member message
155155
* @return Reference to member message
156156
*/
157-
std::string& HelloWorld::message()
157+
eprosima::fastcdr::fixed_string<20>& HelloWorld::message()
158158
{
159159
return m_message;
160160
}

examples/cpp/dds/HelloWorldExampleDataSharing/HelloWorld.h

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -152,32 +152,31 @@ class HelloWorld
152152
* @param _message New value to be copied in member message
153153
*/
154154
eProsima_user_DllExport void message(
155-
const std::string& _message);
155+
const eprosima::fastcdr::fixed_string<20>& _message);
156156

157157
/*!
158158
* @brief This function moves the value in member message
159159
* @param _message New value to be moved in member message
160160
*/
161161
eProsima_user_DllExport void message(
162-
std::string&& _message);
162+
eprosima::fastcdr::fixed_string<20>&& _message);
163163

164164
/*!
165165
* @brief This function returns a constant reference to member message
166166
* @return Constant reference to member message
167167
*/
168-
eProsima_user_DllExport const std::string& message() const;
168+
eProsima_user_DllExport const eprosima::fastcdr::fixed_string<20>& message() const;
169169

170170
/*!
171171
* @brief This function returns a reference to member message
172172
* @return Reference to member message
173173
*/
174-
eProsima_user_DllExport std::string& message();
174+
eProsima_user_DllExport eprosima::fastcdr::fixed_string<20>& message();
175175

176176
private:
177177

178178
uint32_t m_index{0};
179-
std::string m_message;
180-
179+
eprosima::fastcdr::fixed_string<20> m_message;
181180
};
182181

183182
#endif // _FAST_DDS_GENERATED_HELLOWORLD_H_
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
struct HelloWorld
22
{
33
unsigned long index;
4-
string message;
4+
string<20> message;
55
};

examples/cpp/dds/HelloWorldExampleDataSharing/HelloWorldCdrAux.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
#include "HelloWorld.h"
2626

27-
constexpr uint32_t HelloWorld_max_cdr_typesize {268UL};
27+
constexpr uint32_t HelloWorld_max_cdr_typesize {33UL};
2828
constexpr uint32_t HelloWorld_max_key_cdr_typesize {0UL};
2929

3030

@@ -42,4 +42,4 @@ eProsima_user_DllExport void serialize_key(
4242
} // namespace fastcdr
4343
} // namespace eprosima
4444

45-
#endif // _FAST_DDS_GENERATED_HELLOWORLDCDRAUX_HPP_
45+
#endif // _FAST_DDS_GENERATED_HELLOWORLDCDRAUX_HPP_

examples/cpp/dds/HelloWorldExampleDataSharing/HelloWorldPubSubTypes.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ class HelloWorldPubSubType : public eprosima::fastdds::dds::TopicDataType
9191
#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED
9292
eProsima_user_DllExport inline bool is_bounded() const override
9393
{
94-
return false;
94+
return true;
9595
}
9696

9797
#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED

0 commit comments

Comments
 (0)