Skip to content

Commit

Permalink
Refs #19645: Add missing includes
Browse files Browse the repository at this point in the history
Signed-off-by: EduPonz <[email protected]>
  • Loading branch information
EduPonz committed Nov 10, 2023
1 parent b889486 commit feb8eae
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 30 deletions.
3 changes: 2 additions & 1 deletion code/DDSCodeTester.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <sstream>
#include <memory>
#include <sstream>
#include <thread>

#include <fastcdr/Cdr.h>

Expand Down
4 changes: 0 additions & 4 deletions code/Examples/C++/DDSHelloWorld/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@

cmake_minimum_required(VERSION 3.22)





project(DDSHelloWorld)

# Find requirements
Expand Down
9 changes: 6 additions & 3 deletions code/Examples/C++/DDSHelloWorld/src/HelloWorldPublisher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,15 @@

#include "HelloWorldPubSubTypes.h"

#include <fastdds/dds/domain/DomainParticipantFactory.hpp>
#include <chrono>
#include <thread>

#include <fastdds/dds/domain/DomainParticipant.hpp>
#include <fastdds/dds/topic/TypeSupport.hpp>
#include <fastdds/dds/publisher/Publisher.hpp>
#include <fastdds/dds/domain/DomainParticipantFactory.hpp>
#include <fastdds/dds/publisher/DataWriter.hpp>
#include <fastdds/dds/publisher/DataWriterListener.hpp>
#include <fastdds/dds/publisher/Publisher.hpp>
#include <fastdds/dds/topic/TypeSupport.hpp>

using namespace eprosima::fastdds::dds;

Expand Down
9 changes: 6 additions & 3 deletions code/Examples/C++/DDSHelloWorld/src/HelloWorldSubscriber.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,17 @@

#include "HelloWorldPubSubTypes.h"

#include <fastdds/dds/domain/DomainParticipantFactory.hpp>
#include <chrono>
#include <thread>

#include <fastdds/dds/domain/DomainParticipant.hpp>
#include <fastdds/dds/topic/TypeSupport.hpp>
#include <fastdds/dds/subscriber/Subscriber.hpp>
#include <fastdds/dds/domain/DomainParticipantFactory.hpp>
#include <fastdds/dds/subscriber/DataReader.hpp>
#include <fastdds/dds/subscriber/DataReaderListener.hpp>
#include <fastdds/dds/subscriber/qos/DataReaderQos.hpp>
#include <fastdds/dds/subscriber/SampleInfo.hpp>
#include <fastdds/dds/subscriber/Subscriber.hpp>
#include <fastdds/dds/topic/TypeSupport.hpp>

using namespace eprosima::fastdds::dds;

Expand Down
20 changes: 10 additions & 10 deletions docs/fastdds/getting_started/simple_app/includes/publisher.rst
Original file line number Diff line number Diff line change
Expand Up @@ -52,20 +52,20 @@ The next block includes the C++ header files that allow the use of the Fast DDS

.. literalinclude:: /../code/Examples/C++/DDSHelloWorld/src/HelloWorldPublisher.cpp
:language: C++
:lines: 22-27
:lines: 22-30

Next, we define the namespace that contains the eProsima Fast DDS classes and functions that we are going to use in
our application.

.. literalinclude:: /../code/Examples/C++/DDSHelloWorld/src/HelloWorldPublisher.cpp
:language: C++
:lines: 29
:lines: 32

The next line creates the :class:`HelloWorldPublisher` class that implements a publisher.

.. literalinclude:: /../code/Examples/C++/DDSHelloWorld/src/HelloWorldPublisher.cpp
:language: C++
:lines: 31
:lines: 34

Continuing with the private data members of the class, the ``hello_`` data member is defined as an object of the
:class:`HelloWorld` class that defines the data type
Expand All @@ -77,7 +77,7 @@ in the DomainParticipant.

.. literalinclude:: /../code/Examples/C++/DDSHelloWorld/src/HelloWorldPublisher.cpp
:language: C++
:lines: 33-45
:lines: 36-48

Then, the :class:`PubListener` class is defined by inheriting from the |DataWriterListener-api| class.
This class overrides the default DataWriter listener callbacks, which allows the execution of routines in case of an
Expand All @@ -93,7 +93,7 @@ Finally, the ``listener_`` object of the class is defined as an instance of :cla

.. literalinclude:: /../code/Examples/C++/DDSHelloWorld/src/HelloWorldPublisher.cpp
:language: C++
:lines: 47-83
:lines: 50-86
:dedent: 4

The public constructor and destructor of the :class:`HelloWorldPublisher` class are defined below.
Expand All @@ -103,7 +103,7 @@ The class destructor removes these data members and thus cleans the system memor

.. literalinclude:: /../code/Examples/C++/DDSHelloWorld/src/HelloWorldPublisher.cpp
:language: C++
:lines: 87-111
:lines: 90-114
:dedent: 4

Continuing with the public member functions of the :class:`HelloWorldPublisher` class, the next snippet of code defines
Expand All @@ -125,7 +125,7 @@ The default value of the QoS of each DDS Entity can be checked in the

.. literalinclude:: /../code/Examples/C++/DDSHelloWorld/src/HelloWorldPublisher.cpp
:language: C++
:lines: 113-155
:lines: 116-158
:dedent: 4

To make the publication, the public member function ``publish()`` is implemented.
Expand All @@ -137,22 +137,22 @@ This is simply the `writing` of a change by the DataWriter object.

.. literalinclude:: /../code/Examples/C++/DDSHelloWorld/src/HelloWorldPublisher.cpp
:language: C++
:lines: 157-167
:lines: 160-170
:dedent: 4

The public *run* function executes the action of publishing a given number of times, waiting for 1 second between
publications.

.. literalinclude:: /../code/Examples/C++/DDSHelloWorld/src/HelloWorldPublisher.cpp
:language: C++
:lines: 169-184
:lines: 172-187
:dedent: 4

Finally, the HelloWorldPublisher is initialized and run in main.

.. literalinclude:: /../code/Examples/C++/DDSHelloWorld/src/HelloWorldPublisher.cpp
:language: C++
:lines: 187-202
:lines: 190-205

CMakeLists.txt
"""""""""""""""
Expand Down
18 changes: 9 additions & 9 deletions docs/fastdds/getting_started/simple_app/includes/subscriber.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,17 @@ the data reader class.
* |DataReaderQoS-api|.
Structure that defines the QoS of the DataReader.
* |SampleInfo-api|.
It is the information that accompanies each sample that is read or taken.’
It is the information that accompanies each sample that is 'read' or 'taken'.

.. literalinclude:: /../code/Examples/C++/DDSHelloWorld/src/HelloWorldSubscriber.cpp
:language: C++
:lines: 22,29
:lines: 25-32

The next line defines the :class:`HelloWorldSubscriber` class that implements a subscriber.

.. literalinclude:: /../code/Examples/C++/DDSHelloWorld/src/HelloWorldSubscriber.cpp
:language: C++
:lines: 33
:lines: 36

Starting with the private data members of the class, it is worth mentioning the implementation of the data reader
listener.
Expand All @@ -60,7 +60,7 @@ analog of the |DataWriterListener::on_publication_matched-api| callback of the D

.. literalinclude:: /../code/Examples/C++/DDSHelloWorld/src/HelloWorldSubscriber.cpp
:language: C++
:lines: 60-77
:lines: 63-80
:dedent: 8

The second overridden callback is |DataReaderListener::on_data_available-api|.
Expand All @@ -71,14 +71,14 @@ Each time a sample is read, the counter of samples received is increased.

.. literalinclude:: /../code/Examples/C++/DDSHelloWorld/src/HelloWorldSubscriber.cpp
:language: C++
:lines: 79-92
:lines: 82-95
:dedent: 8

The public constructor and destructor of the class is defined below.

.. literalinclude:: /../code/Examples/C++/DDSHelloWorld/src/HelloWorldSubscriber.cpp
:language: C++
:lines: 102-126
:lines: 105-129
:dedent: 4

Next comes the subscriber initialization public member function.
Expand All @@ -90,7 +90,7 @@ The default value of the QoS of each DDS Entity can be checked in the

.. literalinclude:: /../code/Examples/C++/DDSHelloWorld/src/HelloWorldSubscriber.cpp
:language: C++
:lines: 128-168
:lines: 131-171
:dedent: 4

The public member function :func:`run` ensures that the subscriber runs until all the samples have been received.
Expand All @@ -99,14 +99,14 @@ This member function implements an active wait of the subscriber, with a 100ms s

.. literalinclude:: /../code/Examples/C++/DDSHelloWorld/src/HelloWorldSubscriber.cpp
:language: C++
:lines: 170-178
:lines: 173-181
:dedent: 4

Finally, the participant that implements a subscriber is initialized and run in main.

.. literalinclude:: /../code/Examples/C++/DDSHelloWorld/src/HelloWorldSubscriber.cpp
:language: C++
:lines: 181-196
:lines: 184-199

CMakeLists.txt
"""""""""""""""
Expand Down

0 comments on commit feb8eae

Please sign in to comment.