Skip to content

Commit

Permalink
Update Fast DDS-Gen documentation [8708] (#165)
Browse files Browse the repository at this point in the history
* Refs #8644: Restructured and updated according to the installation section.

* Refs #8644: Updated introduction.

Signed-off-by: RaulSanchez <raul@eprosima.com>

* Refs #8644: Updated simple pub/sub application.

Signed-off-by: RaulSanchez <raul@eprosima.com>

* Refs #8644: Added IDL data types section.

Signed-off-by: RaulSanchez <raul@eprosima.com>

* Refs #8644: Added usage section.

Signed-off-by: RaulSanchez <raul@eprosima.com>

* Refs #8644: Added Fast DDS-Gen CodeTester.

Signed-off-by: RaulSanchez <raul@eprosima.com>

* Refs #8644: Updated directories, rst files and hyperlinks to fastddsgen.

Signed-off-by: RaulSanchez <raul@eprosima.com>

* Refs #8644: Changed Fast DDS-Gen to italics.

Signed-off-by: RaulSanchez <raul@eprosima.com>

* Refs #8644: Applied suggested changes.

Signed-off-by: RaulSanchez <raul@eprosima.com>

* Refs #8644: Added IDL comments subsection.

Signed-off-by: RaulSanchez <raul@eprosima.com>

* Refs #8644: Fixed minor typos.

Signed-off-by: RaulSanchez <raul@eprosima.com>

* Refs #8644: Added windows dependencies and applied suggested changes.

Signed-off-by: RaulSanchez <raul@eprosima.com>

* Refs #8644: Added a reference to the fastddsgen tutorial in getting started.

Signed-off-by: RaulSanchez <raul@eprosima.com>

Co-authored-by: RaulSanchez <raul@eprosima.com>
  • Loading branch information
rsanchez15 and rsanchez15 committed Jun 18, 2020
1 parent 3fac664 commit e43063b
Show file tree
Hide file tree
Showing 27 changed files with 801 additions and 497 deletions.
2 changes: 1 addition & 1 deletion code/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ if(BUILDCOP)
####################################################################################################################
# Compile example
####################################################################################################################
add_executable(doctest CodeTester.cpp DDSCodeTester.cpp)
add_executable(doctest CodeTester.cpp DDSCodeTester.cpp FastDDSGenCodeTester.cpp)
target_include_directories(doctest PRIVATE ${PROJECT_BINARY_DIR}/external/eprosima/src/fastdds/src/cpp
${PROJECT_BINARY_DIR}/external/eprosima/src/fastdds/thirdparty/tinyxml2)
target_link_libraries(doctest fastrtps)
Expand Down
140 changes: 140 additions & 0 deletions code/FastDDSGenCodeTester.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
#include <stdint.h>
#include <string>
#include <bitset>

using octet = unsigned char;

// STRUCTURES_DATA_TYPE
class Structure
{
public:
Structure();
~Structure();
Structure(const Structure &x);
Structure(Structure &&x);
Structure& operator=(const Structure &x);
Structure& operator=(Structure &&x);

void octet_value(uint8_t _octet_value);
uint8_t octet_value() const;
uint8_t& octet_value();
void long_value(int64_t _long_value);
int64_t long_value() const;
int64_t& long_value();
void string_value(const std::string
&_string_value);
void string_value(std::string &&_string_value);
const std::string& string_value() const;
std::string& string_value();

private:
uint8_t m_octet_value;
int64_t m_long_value;
std::string m_string_value;
};
//!

// STRUCTURE_INHERITANCE
class ParentStruct
{
octet parent_member;
};

class ChildStruct : public ParentStruct
{
long child_member;
};
//!


// UNION_DATA_TYPE
class Union
{
public:
Union();
~Union();
Union(const Union &x);
Union(Union &&x);
Union& operator=(const Union &x);
Union& operator=(Union &&x);

void d(int32_t __d);
int32_t _d() const;
int32_t& _d();

void octet_value(uint8_t _octet_value);
uint8_t octet_value() const;
uint8_t& octet_value();
void long_value(int64_t _long_value);
int64_t long_value() const;
int64_t& long_value();
void string_value(const std::string
&_string_value);
void string_value(std:: string &&_string_value);
const std::string& string_value() const;
std::string& string_value();

private:
int32_t m__d;
uint8_t m_octet_value;
int64_t m_long_value;
std::string m_string_value;
};
//!

// BITSET_DATA_TYPE
class MyBitset
{
public:
void a(char _a);
char a() const;

void b(uint16_t _b);
uint16_t b() const;

void c(int32_t _c);
int32_t c() const;

private:
std::bitset<25> m_bitset;
};
//!

// BITSET_INHERITANCE
class ParentBitset
{
std::bitset<3> parent_member;
};

class ChildBitset : public ParentBitset
{
std::bitset<10> child_member;
};
//!

// ENUMERATION_DATA_TYPE
enum Enumeration : uint32_t
{
RED,
GREEN,
BLUE
};
//!

// BITMASK_DATA_TYPE
enum MyBitMask : uint8_t
{
flag0 = 0x01 << 0,
flag1 = 0x01 << 1,
flag4 = 0x01 << 4,
flag6 = 0x01 << 6,
flag7 = 0x01 << 7
};
//!

/*
// INCLUDE_MORE_IDL_FILES
#include "OtherFile.idl"
#include <AnotherFile.idl>
//!
/**/
4 changes: 2 additions & 2 deletions docs/02-formalia/titlepage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ distributed network paradigm that neatly allows separation of the publisher and
*eProsima Fast DDS* comprises:

* The :ref:`DDS API <dds_layer>` implementation.
* :ref:`Fast DDS-Gen <fastrtpsgen_intro>`, a generation tool for bridging typed interfaces with the middleware
* :ref:`Fast DDS-Gen <fastddsgen_intro>`, a generation tool for bridging typed interfaces with the middleware
implementation.
* The underlying :ref:`RTPS <rtps_layer>` wire protocol implementation.

Expand Down Expand Up @@ -64,7 +64,7 @@ Fast DDS-Gen

Relying on interfaces implies the need for a generation tool that translates type descriptions into appropriate
implementations that fill the gap between the interfaces and the middleware.
This task is carried out by a dedicated generation tool, :ref:`Fast DDS-Gen <fastrtpsgen_intro>`, a Java application
This task is carried out by a dedicated generation tool, :ref:`Fast DDS-Gen <fastddsgen_intro>`, a Java application
that generates source code using the data types defined in an
`Interface Definition Language (IDL) <https://www.omg.org/spec/IDL/About-IDL/>`__ file.

Expand Down
6 changes: 3 additions & 3 deletions docs/fastdds/dds_layer/topic/fastddsgen/fastddsgen.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Fast DDS-Gen for data types source code generation
translating an IDL specification of a data type to a functional implementation.
Thus, this tool automatically generates the source code of a data type defined using IDL.
A basic use of the tool is described below.
To learn about all the features that Fast DDS offers, please refer to :ref:`Fast DDS-Gen <fastrtpsgen_intro>` section.
To learn about all the features that Fast DDS offers, please refer to :ref:`Fast DDS-Gen <fastddsgen_intro>` section.

Basic usage
^^^^^^^^^^^
Expand All @@ -31,7 +31,7 @@ The IDL file containing the data type definition is given with the ``<IDLfile>``
| fastrtpsgen.bat [<options>] <IDLfile> [<IDLfile> ...] |
+----------------------------------------------------------------------------------------------------------------------+

Among the available arguments defined in :ref:`fastrtpsgen_use`, the main Fast DDS-Gen options for data type source
Among the available arguments defined in :ref:`fastddsgen_usage`, the main Fast DDS-Gen options for data type source
code generation are the following:

* ``-replace``: It replaces existing files in case the data type files have been previously generated.
Expand All @@ -42,7 +42,7 @@ code generation are the following:
the given ``platform``.
Thus, Fast DDS-Gen tool can generate a sample application using the provided data type, together with a
`Makefile`, to compile it on Linux distributions, and a Visual Studio project for Windows.
To see an example of this please refer to tutorial :ref:`fastrtpsgen_pubsub_app`.
To see an example of this please refer to tutorial :ref:`fastddsgen_pubsub_app`.

Output files
^^^^^^^^^^^^
Expand Down
4 changes: 2 additions & 2 deletions docs/fastdds/getting_started/simple_app/includes/dataType.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ Interface Description Language (IDL) file. This application can do two different
2. Generate a functional example that uses your topic data.

It will be the former that will be followed in this tutorial.
To see an example of application of the latter you can check this other :ref:`example <fastrtpsgen_pubsub_app>`.
See :ref:`fastrtpsgen_intro` for further details.
To see an example of application of the latter you can check this other :ref:`example <fastddsgen_pubsub_app>`.
See :ref:`fastddsgen_intro` for further details.
For this project, we will use the Fast DDS-Gen application to define the data type of the messages that will be sent
by the publishers and received by the subscribers.

Expand Down
3 changes: 3 additions & 0 deletions docs/fastdds/getting_started/simple_app/simple_app.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ Writing a simple publisher and subscriber application

This section details how to create an simple Fast DDS application with a publisher and a subscriber
step by step.
It is also possible to self-generate a similar example to the one implemented in this section by using the
*eProsima Fast DDS-Gen* tool.
This additional approach is explained in :ref:`fastddsgen_pubsub_app`.

.. contents::
:local:
Expand Down

0 comments on commit e43063b

Please sign in to comment.