Skip to content

Commit

Permalink
Fix HelloWorld DataSharing example idl (#3714)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
JesusPoderoso committed Sep 28, 2023
1 parent ab56fa8 commit 4fed0bd
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 14 deletions.
8 changes: 4 additions & 4 deletions examples/cpp/dds/HelloWorldExampleDataSharing/HelloWorld.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ uint32_t& HelloWorld::index()
* @param _message New value to be copied in member message
*/
void HelloWorld::message(
const std::string& _message)
const eprosima::fastcdr::fixed_string<20>& _message)
{
m_message = _message;
}
Expand All @@ -136,7 +136,7 @@ void HelloWorld::message(
* @param _message New value to be moved in member message
*/
void HelloWorld::message(
std::string&& _message)
eprosima::fastcdr::fixed_string<20>&& _message)
{
m_message = std::move(_message);
}
Expand All @@ -145,7 +145,7 @@ void HelloWorld::message(
* @brief This function returns a constant reference to member message
* @return Constant reference to member message
*/
const std::string& HelloWorld::message() const
const eprosima::fastcdr::fixed_string<20>& HelloWorld::message() const
{
return m_message;
}
Expand All @@ -154,7 +154,7 @@ const std::string& HelloWorld::message() const
* @brief This function returns a reference to member message
* @return Reference to member message
*/
std::string& HelloWorld::message()
eprosima::fastcdr::fixed_string<20>& HelloWorld::message()
{
return m_message;
}
Expand Down
11 changes: 5 additions & 6 deletions examples/cpp/dds/HelloWorldExampleDataSharing/HelloWorld.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,32 +152,31 @@ class HelloWorld
* @param _message New value to be copied in member message
*/
eProsima_user_DllExport void message(
const std::string& _message);
const eprosima::fastcdr::fixed_string<20>& _message);

/*!
* @brief This function moves the value in member message
* @param _message New value to be moved in member message
*/
eProsima_user_DllExport void message(
std::string&& _message);
eprosima::fastcdr::fixed_string<20>&& _message);

/*!
* @brief This function returns a constant reference to member message
* @return Constant reference to member message
*/
eProsima_user_DllExport const std::string& message() const;
eProsima_user_DllExport const eprosima::fastcdr::fixed_string<20>& message() const;

/*!
* @brief This function returns a reference to member message
* @return Reference to member message
*/
eProsima_user_DllExport std::string& message();
eProsima_user_DllExport eprosima::fastcdr::fixed_string<20>& message();

private:

uint32_t m_index{0};
std::string m_message;

eprosima::fastcdr::fixed_string<20> m_message;
};

#endif // _FAST_DDS_GENERATED_HELLOWORLD_H_
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
struct HelloWorld
{
unsigned long index;
string message;
string<20> message;
};
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

#include "HelloWorld.h"

constexpr uint32_t HelloWorld_max_cdr_typesize {268UL};
constexpr uint32_t HelloWorld_max_cdr_typesize {33UL};
constexpr uint32_t HelloWorld_max_key_cdr_typesize {0UL};


Expand All @@ -42,4 +42,4 @@ eProsima_user_DllExport void serialize_key(
} // namespace fastcdr
} // namespace eprosima

#endif // _FAST_DDS_GENERATED_HELLOWORLDCDRAUX_HPP_
#endif // _FAST_DDS_GENERATED_HELLOWORLDCDRAUX_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class HelloWorldPubSubType : public eprosima::fastdds::dds::TopicDataType
#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED
eProsima_user_DllExport inline bool is_bounded() const override
{
return false;
return true;
}

#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED
Expand Down

0 comments on commit 4fed0bd

Please sign in to comment.