Skip to content

Commit

Permalink
DDS ReturnCode_t generated from IDL file (#4041)
Browse files Browse the repository at this point in the history
* Refs #19975. Implementation on library

Signed-off-by: Ricardo González Moreno <ricardo@richiware.dev>

* Refs #19975. Fix all compilation errors

Signed-off-by: Ricardo González Moreno <ricardo@richiware.dev>

* Refs #19975. Fix forgotten compilation errors

Signed-off-by: Ricardo González Moreno <ricardo@richiware.dev>

* Refs #19975. Fix old use of operator !

Signed-off-by: Ricardo González Moreno <ricardo@richiware.dev>

---------

Signed-off-by: Ricardo González Moreno <ricardo@richiware.dev>
  • Loading branch information
richiware authored and JLBuenoLopez committed Feb 15, 2024
1 parent 05338cb commit 6aa5bd1
Show file tree
Hide file tree
Showing 134 changed files with 3,922 additions and 3,768 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ void HelloWorldSubscriber::SubListener::on_data_available(
DataReader* reader)
{
SampleInfo info;
while ((reader->take_next_sample(&hello_, &info) == ReturnCode_t::RETCODE_OK) && !is_stopped())
while ((reader->take_next_sample(&hello_, &info) == RETCODE_OK) && !is_stopped())
{
if (info.instance_state == ALIVE_INSTANCE_STATE)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ void HelloWorldSubscriber::SubListener::on_data_available(
DataReader* reader)
{
SampleInfo info;
while ((reader->take_next_sample(&hello_, &info) == ReturnCode_t::RETCODE_OK) && !is_stopped())
while ((reader->take_next_sample(&hello_, &info) == RETCODE_OK) && !is_stopped())
{
if (info.instance_state == ALIVE_INSTANCE_STATE)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ int main()
}
else if ( c == std::string("r"))
{
while (EarlyReader->read_next_sample(&my_sample, &sample_info) == ReturnCode_t::RETCODE_OK)
while (EarlyReader->read_next_sample(&my_sample, &sample_info) == RETCODE_OK)
{
std::cout << "Sample Received! Index:" << std::to_string(my_sample.index()) << " Key:" <<
std::to_string(my_sample.key_value()) << std::endl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ bool ContentFilteredTopicExampleSubscriber::init(
if (custom_filter)
{
// Register the filter factory
if (ReturnCode_t::RETCODE_OK !=
if (eprosima::fastdds::dds::RETCODE_OK !=
participant_->register_content_filter_factory("MY_CUSTOM_FILTER", &filter_factory))
{
return false;
Expand Down Expand Up @@ -159,7 +159,7 @@ void ContentFilteredTopicExampleSubscriber::on_data_available(
{
SampleInfo info;
// Take next sample from DataReader's history
if (ReturnCode_t::RETCODE_OK == reader->take_next_sample(&hello_, &info))
if (eprosima::fastdds::dds::RETCODE_OK == reader->take_next_sample(&hello_, &info))
{
// Some samples only update the instance state. Only if it is a valid sample (with data)
if (ALIVE_INSTANCE_STATE == info.instance_state)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ class MyCustomFilterFactory : public eprosima::fastdds::dds::IContentFilterFacto
* @param filter_parameters Parameters required by the filter
* @param filter_instance Instance of the filter to be evaluated
*
* @return eprosima::fastrtps::types::ReturnCode_t::RETCODE_BAD_PARAMETER if the requirements for creating the
* @return eprosima::fastdds::dds::RETCODE_BAD_PARAMETER if the requirements for creating the
* ContentFilteredTopic using this factory are not met
* eprosima::fastrtps::types::ReturnCode_t::RETCODE_OK if the ContentFilteredTopic is correctly created
* eprosima::fastdds::dds::RETCODE_OK if the ContentFilteredTopic is correctly created
*/
eprosima::fastrtps::types::ReturnCode_t create_content_filter(
eprosima::fastdds::dds::ReturnCode_t create_content_filter(
const char* filter_class_name, // My custom filter class name is 'MY_CUSTOM_FILTER'.
const char* type_name, // This custom filter only supports one type: 'HelloWorld'.
const eprosima::fastdds::dds::TopicDataType* /*data_type*/, // Not used in this implementation.
Expand All @@ -41,7 +41,7 @@ class MyCustomFilterFactory : public eprosima::fastdds::dds::IContentFilterFacto
// Check that the two mandatory filter parameters were set.
2 != filter_parameters.length())
{
return ReturnCode_t::RETCODE_BAD_PARAMETER;
return eprosima::fastdds::dds::RETCODE_BAD_PARAMETER;
}

// If there is an update, delete previous instance.
Expand All @@ -53,7 +53,7 @@ class MyCustomFilterFactory : public eprosima::fastdds::dds::IContentFilterFacto
// Instantiation of the Custom Filter.
filter_instance = new MyCustomFilter(std::stoi(filter_parameters[0]), std::stoi(filter_parameters[1]));

return ReturnCode_t::RETCODE_OK;
return eprosima::fastdds::dds::RETCODE_OK;
}

/**
Expand All @@ -62,11 +62,11 @@ class MyCustomFilterFactory : public eprosima::fastdds::dds::IContentFilterFacto
* @param filter_class_name Custom filter name
* @param filter_instance Instance of the filter to be deleted.
* After returning, the passed pointer becomes invalid.
* @return eprosima::fastrtps::types::ReturnCode_t::RETCODE_BAD_PARAMETER if the instance was created with another
* @return eprosima::fastdds::dds::RETCODE_BAD_PARAMETER if the instance was created with another
* factory
* eprosima::fastrtps::types::ReturnCode_t::RETCODE_OK if correctly deleted
* eprosima::fastdds::dds::RETCODE_OK if correctly deleted
*/
eprosima::fastrtps::types::ReturnCode_t delete_content_filter(
eprosima::fastdds::dds::ReturnCode_t delete_content_filter(
const char* filter_class_name,
eprosima::fastdds::dds::IContentFilter* filter_instance) override
{
Expand All @@ -75,7 +75,7 @@ class MyCustomFilterFactory : public eprosima::fastdds::dds::IContentFilterFacto
// Check the filter instance is valid
nullptr != filter_instance)
{
return ReturnCode_t::RETCODE_BAD_PARAMETER;
return eprosima::fastdds::dds::RETCODE_BAD_PARAMETER;
}

// Deletion of the Custom Filter.
Expand All @@ -84,7 +84,7 @@ class MyCustomFilterFactory : public eprosima::fastdds::dds::IContentFilterFacto
delete(dynamic_cast<MyCustomFilter*>(filter_instance));
}

return ReturnCode_t::RETCODE_OK;
return eprosima::fastdds::dds::RETCODE_OK;
}

};
Expand Down
4 changes: 2 additions & 2 deletions examples/cpp/dds/CustomListenerExample/CustomListeners.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ void CustomDataReaderListener::on_data_available(
DataReader* reader)
{
SampleInfo info;
if (reader->take_next_sample(&hello_, &info) == ReturnCode_t::RETCODE_OK)
if (reader->take_next_sample(&hello_, &info) == RETCODE_OK)
{
if (info.instance_state == ALIVE_INSTANCE_STATE)
{
Expand Down Expand Up @@ -152,7 +152,7 @@ void CustomDomainParticipantListener::on_data_available(
DataReader* reader)
{
SampleInfo info;
if (reader->take_next_sample(&hello_, &info) == ReturnCode_t::RETCODE_OK)
if (reader->take_next_sample(&hello_, &info) == RETCODE_OK)
{
if (info.instance_state == ALIVE_INSTANCE_STATE)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ void CustomPayloadPoolDataSubscriber::on_data_available(
DataReader* reader)
{
SampleInfo info;
if (reader->take_next_sample(&hello_, &info) == ReturnCode_t::RETCODE_OK)
if (reader->take_next_sample(&hello_, &info) == RETCODE_OK)
{
if (info.instance_state == ALIVE_INSTANCE_STATE)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ void deadlinepayloadSubscriber::SubListener::on_data_available(
{
SampleInfo info;
HelloMsg st;
if (reader->take_next_sample(&st, &info) == ReturnCode_t::RETCODE_OK)
if (reader->take_next_sample(&st, &info) == RETCODE_OK)
{
if (info.valid_data)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ void DisablePositiveACKsSubscriber::SubListener::on_data_available(
DataReader* reader)
{
SampleInfo info;
if (reader->take_next_sample(&hello, &info) == ReturnCode_t::RETCODE_OK)
if (reader->take_next_sample(&hello, &info) == RETCODE_OK)
{
if (info.valid_data)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ void HelloWorldSubscriber::SubListener::on_data_available(
DataReader* reader)
{
SampleInfo info;
while ((reader->take_next_sample(&hello_, &info) == ReturnCode_t::RETCODE_OK) && !is_stopped())
while ((reader->take_next_sample(&hello_, &info) == RETCODE_OK) && !is_stopped())
{
if (info.instance_state == ALIVE_INSTANCE_STATE)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
#include <fastrtps/types/DynamicDataHelper.hpp>

using namespace eprosima::fastdds::dds;
using eprosima::fastrtps::types::ReturnCode_t;

HelloWorldSubscriber::HelloWorldSubscriber()
: mp_participant(nullptr)
Expand All @@ -58,7 +57,7 @@ bool HelloWorldSubscriber::init()
{
return false;
}
if (mp_participant->enable() != ReturnCode_t::RETCODE_OK)
if (mp_participant->enable() != RETCODE_OK)
{
DomainParticipantFactory::get_instance()->delete_participant(mp_participant);
return false;
Expand Down Expand Up @@ -119,7 +118,7 @@ void HelloWorldSubscriber::SubListener::on_data_available(
{
eprosima::fastrtps::types::DynamicData_ptr data = dit->second;
SampleInfo info;
if (reader->take_next_sample(data.get(), &info) == ReturnCode_t::RETCODE_OK)
if (reader->take_next_sample(data.get(), &info) == RETCODE_OK)
{
if (info.instance_state == ALIVE_INSTANCE_STATE)
{
Expand Down
2 changes: 1 addition & 1 deletion examples/cpp/dds/Filtering/FilteringExampleSubscriber.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ void FilteringExampleSubscriber::SubListener::on_data_available(
{
SampleInfo info;
FilteringExample st;
if (reader->take_next_sample(&st, &info) == ReturnCode_t::RETCODE_OK)
if (reader->take_next_sample(&st, &info) == RETCODE_OK)
{
if (info.valid_data)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ void FlowControlExampleSubscriber::SubListener::on_data_available(
{
SampleInfo info;
FlowControlExample st;
if (reader->take_next_sample(&st, &info) == ReturnCode_t::RETCODE_OK)
if (reader->take_next_sample(&st, &info) == RETCODE_OK)
{
if (info.valid_data)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ void HelloWorldSubscriber::SubListener::on_data_available(
DataReader* reader)
{
SampleInfo info;
if (reader->take_next_sample(&hello_, &info) == ReturnCode_t::RETCODE_OK)
if (reader->take_next_sample(&hello_, &info) == RETCODE_OK)
{
if (info.instance_state == ALIVE_INSTANCE_STATE)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ void HelloWorldSubscriber::SubListener::on_data_available(
DataReader* reader)
{
SampleInfo info;
if (reader->take_next_sample(&hello_, &info) == ReturnCode_t::RETCODE_OK)
if (reader->take_next_sample(&hello_, &info) == RETCODE_OK)
{
if (info.instance_state == ALIVE_INSTANCE_STATE)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ void HelloWorldSubscriber::SubListener::on_data_available(
DataReader* reader)
{
SampleInfo info;
if (reader->take_next_sample(hello_.get(), &info) == ReturnCode_t::RETCODE_OK)
if (reader->take_next_sample(hello_.get(), &info) == RETCODE_OK)
{
if (info.valid_data)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ void HelloWorldSubscriber::SubListener::on_data_available(
DataReader* reader)
{
SampleInfo info;
if (reader->take_next_sample(&hello_, &info) == ReturnCode_t::RETCODE_OK)
if (reader->take_next_sample(&hello_, &info) == RETCODE_OK)
{
if (info.valid_data)
{
Expand Down
4 changes: 2 additions & 2 deletions examples/cpp/dds/HistoryKind/pastsamples.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,14 +193,14 @@ void pastsamples()

//Read the contents of both histories:
std::cout << "The Keep All Subscriber holds: " << std::endl;
while (myReader1->read_next_sample(&my_sample, &sample_info) == ReturnCode_t::RETCODE_OK)
while (myReader1->read_next_sample(&my_sample, &sample_info) == RETCODE_OK)
{
std::cout << std::to_string(my_sample.index()) << " ";
}
std::cout << std::endl;

std::cout << "The Keep Last (Depth 10) Subscriber holds: " << std::endl;
while (myReader2->read_next_sample(&my_sample, &sample_info) == ReturnCode_t::RETCODE_OK)
while (myReader2->read_next_sample(&my_sample, &sample_info) == RETCODE_OK)
{
std::cout << std::to_string(my_sample.index()) << " ";
}
Expand Down
4 changes: 2 additions & 2 deletions examples/cpp/dds/Keys/keys.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ class SubListener : public eprosima::fastdds::dds::DataReaderListener
DataReader* reader) override
{
SampleInfo info;
if (reader->take_next_sample(&m_sample, &info) == ReturnCode_t::RETCODE_OK)
if (reader->take_next_sample(&m_sample, &info) == RETCODE_OK)
{
if (info.valid_data)
{
Expand Down Expand Up @@ -365,7 +365,7 @@ void keys()
//Read the contents of both histories:
std::vector< std::pair<int, int>> sampleList;
std::cout << "The Subscriber holds: " << std::endl;
while (myReader->read_next_sample(&my_sample, &sample_info) == ReturnCode_t::RETCODE_OK)
while (myReader->read_next_sample(&my_sample, &sample_info) == RETCODE_OK)
{
sampleList.push_back(std::pair<int, int>(my_sample.index(), my_sample.key_value()));
}
Expand Down
4 changes: 2 additions & 2 deletions examples/cpp/dds/LateJoiners/latejoiners.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,13 +177,13 @@ void latejoiners()

//Read the contents of both histories:
std::cout << "The Transient Local Subscriber holds: " << std::endl;
while (myReader1->read_next_sample(&my_sample, &sample_info) == ReturnCode_t::RETCODE_OK)
while (myReader1->read_next_sample(&my_sample, &sample_info) == RETCODE_OK)
{
std::cout << std::to_string(my_sample.index()) << " ";
}
std::cout << std::endl;
std::cout << "The Volatile Subscriber holds: " << std::endl;
while (myReader2->read_next_sample(&my_sample, &sample_info) == ReturnCode_t::RETCODE_OK)
while (myReader2->read_next_sample(&my_sample, &sample_info) == RETCODE_OK)
{
std::cout << std::to_string(my_sample.index()) << " ";
}
Expand Down
4 changes: 2 additions & 2 deletions examples/cpp/dds/LifespanQoSExample/LifespanSubscriber.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ void LifespanSubscriber::SubListener::on_data_available(
DataReader* reader)
{
SampleInfo info;
if (reader->read_next_sample(&hello, &info) == ReturnCode_t::RETCODE_OK)
if (reader->read_next_sample(&hello, &info) == RETCODE_OK)
{
if (info.valid_data)
{
Expand Down Expand Up @@ -160,7 +160,7 @@ void LifespanSubscriber::run(

for ( uint32_t i = 0; i < listener.n_samples; i++ )
{
if (reader_->take_next_sample((void*) &data, &info) == ReturnCode_t::RETCODE_OK)
if (reader_->take_next_sample((void*) &data, &info) == RETCODE_OK)
{
std::cout << "Message " << data.message() << " " << data.index() << " read from history" << std::endl;
}
Expand Down
2 changes: 1 addition & 1 deletion examples/cpp/dds/LivelinessQoS/LivelinessSubscriber.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ void LivelinessSubscriber::SubListener::on_data_available(
DataReader* reader)
{
SampleInfo info;
if (reader->take_next_sample(&topic, &info) == ReturnCode_t::RETCODE_OK)
if (reader->take_next_sample(&topic, &info) == RETCODE_OK)
{
if (info.valid_data)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ void OwnershipStrengthSubscriber::SubListener::on_data_available(
{
SampleInfo info;
ExampleMessage st;
if (reader->take_next_sample(&st, &info) == ReturnCode_t::RETCODE_OK)
if (reader->take_next_sample(&st, &info) == RETCODE_OK)
{
if (info.valid_data && m_hierarchy.IsMessageStrong(st, info))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ void safest()

//Read the contents of both histories:
std::cout << "The Reliable Subscriber holds: " << std::endl;
while (myReader->read_next_sample(&my_sample, &sample_info) == ReturnCode_t::RETCODE_OK)
while (myReader->read_next_sample(&my_sample, &sample_info) == RETCODE_OK)
{
std::cout << std::to_string(my_sample.index()) << " (key " << static_cast<int>(my_sample.key_value()) << ")" <<
std::endl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ void triggers()

//Read the contents of both histories:
std::cout << "The Subscriber holds: " << std::endl;
while (myReader->take_next_sample(&my_sample, &sample_info) == ReturnCode_t::RETCODE_OK)
while (myReader->take_next_sample(&my_sample, &sample_info) == RETCODE_OK)
{
std::cout << std::to_string(my_sample.index()) << " ";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ void fastest()

//Read the contents of both histories:
std::cout << "The Reliable Subscriber (with a history depth of 5) holds: " << std::endl;
while (myReader->read_next_sample(&my_sample, &sample_info) == ReturnCode_t::RETCODE_OK)
while (myReader->read_next_sample(&my_sample, &sample_info) == RETCODE_OK)
{
std::cout << std::to_string(my_sample.index()) << " ";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ void HelloWorldSubscriber::SubListener::on_data_available(
DataReader* reader)
{
SampleInfo info;
if (reader->take_next_sample(&hello_, &info) == ReturnCode_t::RETCODE_OK)
if (reader->take_next_sample(&hello_, &info) == RETCODE_OK)
{
if (info.instance_state == ALIVE_INSTANCE_STATE)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ void HelloWorldSubscriber::SubListener::on_data_available(
DataReader* reader)
{
SampleInfo info;
if (reader->take_next_sample(&hello_, &info) == ReturnCode_t::RETCODE_OK)
if (reader->take_next_sample(&hello_, &info) == RETCODE_OK)
{
if (info.instance_state == ALIVE_INSTANCE_STATE)
{
Expand Down
4 changes: 2 additions & 2 deletions examples/cpp/dds/TypeLookupService/TypeLookupSubscriber.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ bool TypeLookupSubscriber::init()
{
return false;
}
if (mp_participant->enable() != ReturnCode_t::RETCODE_OK)
if (mp_participant->enable() != RETCODE_OK)
{
DomainParticipantFactory::get_instance()->delete_participant(mp_participant);
return false;
Expand Down Expand Up @@ -147,7 +147,7 @@ void TypeLookupSubscriber::SubListener::on_data_available(
{
types::DynamicData_ptr data = dit->second;
SampleInfo info;
if (reader->take_next_sample(data.get(), &info) == ReturnCode_t::RETCODE_OK)
if (reader->take_next_sample(data.get(), &info) == RETCODE_OK)
{
if (info.valid_data)
{
Expand Down
Loading

0 comments on commit 6aa5bd1

Please sign in to comment.