Skip to content

Commit 1e600cb

Browse files
Changes to build with Fast DDS (#11)
* Changes to build with Fast DDS. Signed-off-by: Miguel Company <[email protected]> * Added content filter. Signed-off-by: Miguel Company <[email protected]> * Added NAME_ACCESSOR macro for cases where topic/type name are returned as a std::string. Signed-off-by: Miguel Company <[email protected]> * Added LISTENER_STATUS_MASK_NONE macro. Signed-off-by: Miguel Company <[email protected]> * Added SECONDS_FIELD_NAME macro. Signed-off-by: Miguel Company <[email protected]> * Added FIELD_ACCESSOR macro. Signed-off-by: Miguel Company <[email protected]> * Added GET_TOPIC_DESCRIPTION macro. Signed-off-by: Miguel Company <[email protected]> * Removed debug print. Signed-off-by: Miguel Company <[email protected]> * Using take_next_instance. Signed-off-by: Miguel Company <[email protected]> * Added STRING_ASSIGN macro. Signed-off-by: Miguel Company <[email protected]> * Added ADD_PARTITION macro. Signed-off-by: Miguel Company <[email protected]> * Build improvements. Signed-off-by: Miguel Company <[email protected]> * Avoid publishing type information. Signed-off-by: Miguel Company <[email protected]> * Create CLA_eProsima --------- Signed-off-by: Miguel Company <[email protected]> Co-authored-by: Jaime Martin Losa <[email protected]>
1 parent 6ad5a8c commit 1e600cb

File tree

4 files changed

+316
-104
lines changed

4 files changed

+316
-104
lines changed

CLA/CLA_eProsima

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
OMG DDS INTEROPERABILITY REPOSITORY - CONTRIBUTOR LICENSE AGREEMENT
2+
This Contributor License Agreement ("Agreement") specifies the terms under which the individual or corporate entity specified in the signature block below (“You”) agree to make intellectual property contributions to the OMG DDS Interoperability Repository. BY SIGNING BELOW YOU ARE AGREEING TO BE BOUND BY THE TERMS OF THIS AGREEMENT. If You are signing this Agreement in Your capacity as an employee, THEN YOUR EMPLOYER AND YOU ARE BOTH BOUND BY THIS AGREEMENT.
3+
4+
Definitions
5+
6+
"OMG DDS Interoperability Repository" (or “Repository”) means the Git repository https://github.com/omg-dds/dds-rtps.
7+
8+
"Moderator" means an entity or individual responsible for authorizing changes to the Repository.
9+
10+
"Submit" (or “Submitted”) means any submission, including source code, binaries, code, pull requests, issue reports, comments, etc., made to the Moderators for inclusion in the Repository either through the Git repository interface or through electronic file transfer.
11+
12+
A "Contribution" is any original work of authorship, including any modifications or additions to an existing work, that You Submit to the DDS Interoperability Repository.
13+
14+
A "User" is anyone who accesses the Repository.
15+
16+
Allowable Contribution Representations
17+
18+
You represent that You have the necessary rights to the Contribution(s) to meet the obligations of this Agreement. If You are employed, Your employer has authorized Contribution(s) under this Agreement.
19+
20+
You represent that you have no knowledge of third-party intellectual property rights that are likely to be infringed by the Contribution(s). You represent that you have no knowledge that such infringement or any allegation of misappropriation of intellectual property rights is likely to be claimed or has already been claimed.
21+
22+
License
23+
24+
You grant Moderators a perpetual, worldwide, non-exclusive, assignable, paid-up license to publish, display, and redistribute the Contribution as part of the Repository. You also license to Moderators under the same terms any other intellectual property rights required to publish, display, and redistribute the Contributions as part of the Repository. You further grant all Users of the Repository a license to the Contribution under the terms of the OMG DDS Interoperability Testing License included in the Repository. Moderators are under no obligation to publish Contributions.
25+
26+
No Warranty, Consequential Damages. Limited Liability
27+
28+
Other than explicitly stated herein, You provide the Contribution(s) "as is" with no warranty nor claims of fitness to any purpose. Neither party shall be liable for consequential or special damages of any kind. Other than for breach of warranty or representations herein, the liability of either party to the other shall be limited to $1000.
29+
30+
General
31+
32+
If You are an agency of the United States Government, then this Agreement will be governed by the United States federal common law. Otherwise, this Agreement will be governed by the laws of the State of California except with regard to its choice of law rules.
33+
34+
A party may assign this Agreement to an entity acquiring essentially all of the party’s relevant business.
35+
36+
Electronic Signatures
37+
38+
"Electronic Signature" means any electronic sound, symbol, or process attached to or logically associated with a record and executed and adopted by a party with the intent to sign such record.
39+
40+
Each party agrees that the Electronic Signatures, whether digital or encrypted, of the parties included in this Agreement are intended to authenticate this writing and to have the same force and effect as manual signatures.
41+
42+
IN WITNESS WHEREOF, You, intending to be legally bound, have executed this Agreement or caused Your employer’s proper and duly authorized officer to execute and deliver this Agreement, for good and valuable consideration, the sufficiency of which is hereby acknowledged, as of the day and year first written below.
43+
44+
For:
45+
46+
Entity Name: Proyectos y Sistemas de Mantenimiento SL (eProsima)
47+
48+
Address: Plaza de la Encina 10 2A, 28760 Tres Cantos (Madrid), Spain
49+
50+
("You")
51+
52+
By:
53+
54+
Name: Jaime Martin Losa
55+
56+
Title: CEO
57+
58+
Date: Jun 21, 2023
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Copyright 2023 Proyectos y Sistemas de Mantenimiento SL (eProsima).
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
cmake_minimum_required(VERSION 3.16.3)
16+
17+
project(eprosima-fast-dds_shape_main_linux LANGUAGES CXX)
18+
19+
# Find requirements
20+
set(FASTDDS_STATIC ON)
21+
find_package(fastcdr REQUIRED)
22+
find_package(fastrtps REQUIRED)
23+
find_program(FASTDDSGEN fastddsgen)
24+
25+
# Generate code from IDL
26+
file(MAKE_DIRECTORY ${CMAKE_SOURCE_DIR}/../GeneratedCode)
27+
set(
28+
GENERATED_TYPE_SUPPORT_FILES
29+
${CMAKE_SOURCE_DIR}/../GeneratedCode/shape.h
30+
${CMAKE_SOURCE_DIR}/../GeneratedCode/shape.cxx
31+
${CMAKE_SOURCE_DIR}/../GeneratedCode/shapePubSubTypes.h
32+
${CMAKE_SOURCE_DIR}/../GeneratedCode/shapePubSubTypes.cxx
33+
${CMAKE_SOURCE_DIR}/../GeneratedCode/shapeTypeObject.h
34+
${CMAKE_SOURCE_DIR}/../GeneratedCode/shapeTypeObject.cxx
35+
)
36+
add_custom_command(
37+
OUTPUT ${GENERATED_TYPE_SUPPORT_FILES}
38+
COMMAND ${FASTDDSGEN}
39+
-replace
40+
-typeobject
41+
-d ${CMAKE_SOURCE_DIR}/../GeneratedCode
42+
${CMAKE_SOURCE_DIR}/../shape.idl
43+
DEPENDS ${CMAKE_SOURCE_DIR}/../shape.idl
44+
COMMENT "Generating code with Fast DDS Gen" VERBATIM
45+
)
46+
47+
message(STATUS "Configuring application...")
48+
set(EXECUTABLE_NAME "eprosima_fast_dds_${fastrtps_VERSION}_shape_main_linux")
49+
add_executable(${EXECUTABLE_NAME}
50+
../shape_main.cxx
51+
${GENERATED_TYPE_SUPPORT_FILES}
52+
)
53+
target_compile_definitions(${EXECUTABLE_NAME} PRIVATE EPROSIMA_FAST_DDS=1)
54+
target_link_libraries(${EXECUTABLE_NAME} fastrtps)
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#include <fastdds/dds/domain/DomainParticipant.hpp>
2+
#include <fastdds/dds/domain/DomainParticipantFactory.hpp>
3+
#include <fastdds/dds/domain/DomainParticipantListener.hpp>
4+
#include <fastdds/dds/publisher/Publisher.hpp>
5+
#include <fastdds/dds/publisher/DataWriter.hpp>
6+
#include <fastdds/dds/publisher/DataWriterListener.hpp>
7+
#include <fastdds/dds/subscriber/Subscriber.hpp>
8+
#include <fastdds/dds/subscriber/DataReader.hpp>
9+
#include <fastdds/dds/subscriber/DataReaderListener.hpp>
10+
#include <fastdds/dds/subscriber/qos/DataReaderQos.hpp>
11+
#include <fastdds/dds/subscriber/SampleInfo.hpp>
12+
#include <fastdds/dds/topic/TypeSupport.hpp>
13+
14+
#include "GeneratedCode/shape.h"
15+
#include "GeneratedCode/shapePubSubTypes.h"
16+
#include "GeneratedCode/shapeTypeObject.h"
17+
18+
#define LISTENER_STATUS_MASK_ALL StatusMask::all()
19+
#define LISTENER_STATUS_MASK_NONE StatusMask::none()
20+
#define REGISTER_TYPE registershapeTypes(); TypeSupport ts(new ShapeTypePubSubType()); ts->auto_fill_type_object(false); ts->auto_fill_type_information(false); ts.register_type
21+
#define STRING_ASSIGN(field, value) field() = value
22+
#define STRING_IN .c_str()
23+
#define NAME_ACCESSOR .c_str()
24+
#define FIELD_ACCESSOR ()
25+
#define GET_TOPIC_DESCRIPTION(dr) const_cast<TopicDescription*>(dr->get_topicdescription())
26+
#define ADD_PARTITION(field, value) field().push_back(value)
27+
#define SECONDS_FIELD_NAME seconds
28+
29+
#define ShapeTypeDataReader DataReader
30+
#define ShapeTypeDataWriter DataWriter
31+
#define StringSeq std::vector<std::string>
32+
33+
namespace DDS = eprosima::fastdds::dds;
34+
#define RETCODE_OK ReturnCode_t::RETCODE_OK
35+
36+
const char* get_qos_policy_name(DDS::QosPolicyId_t policy_id)
37+
{
38+
switch (policy_id) {
39+
case DDS::USERDATA_QOS_POLICY_ID: return "USERDATA";
40+
case DDS::DURABILITY_QOS_POLICY_ID: return "DURABILITY";
41+
case DDS::PRESENTATION_QOS_POLICY_ID: return "PRESENTATION";
42+
case DDS::DEADLINE_QOS_POLICY_ID: return "DEADLINE";
43+
case DDS::LATENCYBUDGET_QOS_POLICY_ID: return "LATENCYBUDGET";
44+
case DDS::OWNERSHIP_QOS_POLICY_ID: return "OWNERSHIP";
45+
case DDS::OWNERSHIPSTRENGTH_QOS_POLICY_ID: return "OWNERSHIPSTRENGTH";
46+
case DDS::LIVELINESS_QOS_POLICY_ID: return "LIVELINESS";
47+
case DDS::TIMEBASEDFILTER_QOS_POLICY_ID: return "TIMEBASEDFILTER";
48+
case DDS::PARTITION_QOS_POLICY_ID: return "PARTITION";
49+
case DDS::RELIABILITY_QOS_POLICY_ID: return "RELIABILITY";
50+
case DDS::DESTINATIONORDER_QOS_POLICY_ID: return "DESTINATIONORDER";
51+
case DDS::HISTORY_QOS_POLICY_ID: return "HISTORY";
52+
case DDS::RESOURCELIMITS_QOS_POLICY_ID: return "RESOURCELIMITS";
53+
case DDS::ENTITYFACTORY_QOS_POLICY_ID: return "ENTITYFACTORY";
54+
case DDS::WRITERDATALIFECYCLE_QOS_POLICY_ID: return "WRITERDATALIFECYCLE";
55+
case DDS::READERDATALIFECYCLE_QOS_POLICY_ID: return "READERDATALIFECYCLE";
56+
case DDS::TOPICDATA_QOS_POLICY_ID: return "TOPICDATA";
57+
case DDS::GROUPDATA_QOS_POLICY_ID: return "GROUPDATA";
58+
case DDS::TRANSPORTPRIORITY_QOS_POLICY_ID: return "TRANSPORTPRIORITY";
59+
case DDS::LIFESPAN_QOS_POLICY_ID: return "LIFESPAN";
60+
case DDS::DURABILITYSERVICE_QOS_POLICY_ID: return "DURABILITYSERVICE";
61+
default: return "Unknown";
62+
}
63+
}

0 commit comments

Comments
 (0)