diff --git a/code/DDSCodeTester.cpp b/code/DDSCodeTester.cpp index 7a1318921..604b26a6b 100644 --- a/code/DDSCodeTester.cpp +++ b/code/DDSCodeTester.cpp @@ -1,5 +1,6 @@ -#include #include +#include +#include #include diff --git a/code/Examples/C++/DDSHelloWorld/CMakeLists.txt b/code/Examples/C++/DDSHelloWorld/CMakeLists.txt index 5d0523502..0611d3f94 100644 --- a/code/Examples/C++/DDSHelloWorld/CMakeLists.txt +++ b/code/Examples/C++/DDSHelloWorld/CMakeLists.txt @@ -14,10 +14,6 @@ cmake_minimum_required(VERSION 3.22) - - - - project(DDSHelloWorld) # Find requirements diff --git a/code/Examples/C++/DDSHelloWorld/src/HelloWorldPublisher.cpp b/code/Examples/C++/DDSHelloWorld/src/HelloWorldPublisher.cpp index 9f4c94bac..07cbb376b 100644 --- a/code/Examples/C++/DDSHelloWorld/src/HelloWorldPublisher.cpp +++ b/code/Examples/C++/DDSHelloWorld/src/HelloWorldPublisher.cpp @@ -19,12 +19,15 @@ #include "HelloWorldPubSubTypes.h" -#include +#include +#include + #include -#include -#include +#include #include #include +#include +#include using namespace eprosima::fastdds::dds; diff --git a/code/Examples/C++/DDSHelloWorld/src/HelloWorldSubscriber.cpp b/code/Examples/C++/DDSHelloWorld/src/HelloWorldSubscriber.cpp index 4a0b6e76c..3fdf6d13a 100644 --- a/code/Examples/C++/DDSHelloWorld/src/HelloWorldSubscriber.cpp +++ b/code/Examples/C++/DDSHelloWorld/src/HelloWorldSubscriber.cpp @@ -19,14 +19,17 @@ #include "HelloWorldPubSubTypes.h" -#include +#include +#include + #include -#include -#include +#include #include #include #include #include +#include +#include using namespace eprosima::fastdds::dds; diff --git a/docs/fastdds/getting_started/simple_app/includes/publisher.rst b/docs/fastdds/getting_started/simple_app/includes/publisher.rst index 0bf6036ce..cd99ba363 100644 --- a/docs/fastdds/getting_started/simple_app/includes/publisher.rst +++ b/docs/fastdds/getting_started/simple_app/includes/publisher.rst @@ -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 @@ -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 @@ -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. @@ -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 @@ -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. @@ -137,7 +137,7 @@ 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 @@ -145,14 +145,14 @@ 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 """"""""""""""" @@ -162,7 +162,7 @@ files needed to build the executable, and links the executable and the library t .. literalinclude:: /../code/Examples/C++/DDSHelloWorld/CMakeLists.txt :language: bash - :lines: 47-48 + :lines: 43-44 At this point the project is ready for building, compiling and running the publisher application. From the build directory in the workspace, run the following commands. diff --git a/docs/fastdds/getting_started/simple_app/includes/subscriber.rst b/docs/fastdds/getting_started/simple_app/includes/subscriber.rst index 85208d7b0..5652141cb 100644 --- a/docs/fastdds/getting_started/simple_app/includes/subscriber.rst +++ b/docs/fastdds/getting_started/simple_app/includes/subscriber.rst @@ -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. @@ -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|. @@ -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. @@ -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. @@ -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 """"""""""""""" @@ -117,7 +117,7 @@ files needed to build the executable, and links the executable and the library t .. literalinclude:: /../code/Examples/C++/DDSHelloWorld/CMakeLists.txt :language: bash - :lines: 50-51 + :lines: 46-47 At this point the project is ready for building, compiling and running the subscriber application. From the build directory in the workspace, run the following commands.