Skip to content

Commit e3d6212

Browse files
author
Poehnl Michael (CC-AD/ESW1)
committed
iox-eclipse-iceoryx#27-1: merging changes from master
Signed-off-by: Poehnl Michael (CC-AD/ESW1) <[email protected]>
2 parents b9f3c3a + 17dc499 commit e3d6212

File tree

69 files changed

+750
-548
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+750
-548
lines changed

.github/workflows/build-test.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ jobs:
2727
uses: actions/checkout@v2
2828

2929
- name: Build sources
30-
run: cmake -Bbuild -Hiceoryx_meta -Dtest=ON -Dbinding_c=ON -Dexamples=ON -Dintrospection=ON && cmake --build build
30+
run: |
31+
export NUM_CORES=`nproc`
32+
cmake -Bbuild -Hiceoryx_meta -Dtest=ON -Dbinding_c=ON -Dexamples=ON -Dintrospection=ON && cmake --build build -j$NUM_CORES
3133
3234
- name: Run timeless tests
3335
run: |

iceoryx_dds/CMakeLists.txt

+4-2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ project(iceoryx_dds VERSION ${iceoryx_dds_VERSION})
1919

2020
option(test "build test binaries")
2121

22+
find_package(cpptoml REQUIRED)
2223
find_package(iceoryx_posh REQUIRED)
2324
find_package(iceoryx_utils REQUIRED)
2425

@@ -51,8 +52,6 @@ endif()
5152
add_library(iceoryx_dds
5253
STATIC
5354
source/iceoryx_dds/log/logging.cpp
54-
source/iceoryx_dds/gateway/gateway_config.cpp
55-
source/iceoryx_dds/gateway/toml_gateway_config_parser.cpp
5655
)
5756
add_library(${PROJECT_NAMESPACE}::iceoryx_dds ALIAS iceoryx_dds)
5857

@@ -61,11 +60,14 @@ target_compile_options(iceoryx_dds PUBLIC -std=c++11)
6160
target_include_directories(iceoryx_dds
6261
PUBLIC
6362
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
63+
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/dependencies/install/include>
6464
$<INSTALL_INTERFACE:include/${PREFIX}>
6565
)
6666
target_link_libraries(iceoryx_dds
6767
PRIVATE
6868
iceoryx_posh::iceoryx_posh
69+
iceoryx_posh::iceoryx_posh_config
70+
iceoryx_posh::iceoryx_posh_gateway
6971
iceoryx_utils::iceoryx_utils
7072
)
7173

iceoryx_dds/examples/docker/publisher_node.entrypoint

+13
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,19 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17+
GATEWAY_CONF_PATH=/etc/iceoryx/gateway_config.toml
18+
19+
mkdir -p /etc/iceoryx
20+
21+
if [[ ! -f "$GATEWAY_CONF_PATH" ]]; then
22+
cat <<EOF >> /etc/iceoryx/gateway_config.toml
23+
[[services]]
24+
service = "Radar"
25+
instance = "FrontRight"
26+
event = "Counter"
27+
EOF
28+
fi
29+
1730
/usr/bin/iox-roudi &
1831
/usr/bin/iox-gw-iceoryx2dds &
1932
/usr/bin/iox-ex-publisher-simple

iceoryx_dds/include/iceoryx_dds/dds/dds_config.hpp

-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ namespace dds
2424
static constexpr units::Duration DISCOVERY_PERIOD = 1000_ms;
2525
static constexpr units::Duration FORWARDING_PERIOD = 50_ms;
2626
static constexpr uint32_t SUBSCRIBER_CACHE_SIZE = 128u;
27-
static constexpr uint32_t MAX_CHANNEL_NUMBER = iox::MAX_PUBLISHERS + iox::MAX_SUBSCRIBERS;
2827

2928
} // namespace dds
3029
} // namespace iox

iceoryx_dds/include/iceoryx_dds/gateway/dds_to_iox.hpp

+13-12
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,13 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
#ifndef IOX_DDS_GATEWAY_DDS_TO_IOX_HPP
16-
#define IOX_DDS_GATEWAY_DDS_TO_IOX_HPP
15+
#ifndef IOX_DDS_DDS_TO_IOX_HPP
16+
#define IOX_DDS_DDS_TO_IOX_HPP
1717

1818
#include "iceoryx_dds/dds/dds_types.hpp"
19-
#include "iceoryx_dds/gateway/channel.hpp"
20-
#include "iceoryx_dds/gateway/dds_gateway_generic.hpp"
19+
#include "iceoryx_posh/gateway/channel.hpp"
20+
#include "iceoryx_posh/gateway/gateway_generic.hpp"
21+
#include "iceoryx_posh/gateway/gateway_config.hpp"
2122
#include "iceoryx_posh/popo/publisher.hpp"
2223

2324
namespace iox
@@ -27,28 +28,28 @@ namespace dds
2728
///
2829
/// @brief DDS Gateway implementation for the DDS to iceoryx direction.
2930
///
30-
template <typename channel_t = iox::dds::Channel<iox::popo::Publisher, iox::dds::data_reader_t>,
31-
typename gateway_t = iox::dds::DDSGatewayGeneric<channel_t>>
31+
template <typename channel_t = gw::Channel<popo::Publisher, dds::data_reader_t>,
32+
typename gateway_t = gw::GatewayGeneric<channel_t>>
3233
class DDS2IceoryxGateway : public gateway_t
3334
{
34-
using ChannelFactory = std::function<channel_t(const iox::capro::ServiceDescription)>;
35+
using ChannelFactory = std::function<channel_t(const capro::ServiceDescription)>;
3536

3637
public:
3738
DDS2IceoryxGateway() noexcept;
3839
DDS2IceoryxGateway(ChannelFactory channelFactory) noexcept;
39-
void loadConfiguration(const GatewayConfig& config) noexcept;
40-
void discover(const iox::capro::CaproMessage& msg) noexcept;
40+
void loadConfiguration(const config::GatewayConfig& config) noexcept;
41+
void discover(const capro::CaproMessage& msg) noexcept;
4142
void forward(const channel_t& channel) noexcept;
4243

4344
private:
4445
void* m_reservedChunk = nullptr;
45-
iox::cxx::expected<channel_t, iox::dds::GatewayError>
46-
setupChannel(const iox::capro::ServiceDescription& service) noexcept;
46+
cxx::expected<channel_t, gw::GatewayError>
47+
setupChannel(const capro::ServiceDescription& service) noexcept;
4748
};
4849

4950
} // namespace dds
5051
} // namespace iox
5152

5253
#include "iceoryx_dds/internal/gateway/dds_to_iox.inl"
5354

54-
#endif // IOX_DDS_GATEWAY_DDS_TO_IOX_HPP
55+
#endif // IOX_DDS_DDS_TO_IOX_HPP

iceoryx_dds/include/iceoryx_dds/gateway/iox_to_dds.hpp

+11-11
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
#ifndef IOX_DDS_GATEWAY_IOX_TO_DDS_HPP
16-
#define IOX_DDS_GATEWAY_IOX_TO_DDS_HPP
15+
#ifndef IOX_DDS_IOX_TO_DDS_HPP
16+
#define IOX_DDS_IOX_TO_DDS_HPP
1717

1818
#include "iceoryx_dds/dds/dds_types.hpp"
19-
#include "iceoryx_dds/gateway/channel.hpp"
20-
#include "iceoryx_dds/gateway/dds_gateway_generic.hpp"
19+
#include "iceoryx_posh/gateway/channel.hpp"
20+
#include "iceoryx_posh/gateway/gateway_generic.hpp"
2121
#include "iceoryx_posh/popo/subscriber.hpp"
2222

2323
namespace iox
@@ -27,24 +27,24 @@ namespace dds
2727
///
2828
/// @brief DDS Gateway implementation for the iceoryx to DDS direction.
2929
///
30-
template <typename channel_t = iox::dds::Channel<iox::popo::Subscriber, iox::dds::data_writer_t>,
31-
typename gateway_t = iox::dds::DDSGatewayGeneric<channel_t>>
30+
template <typename channel_t = gw::Channel<popo::Subscriber, dds::data_writer_t>,
31+
typename gateway_t = gw::GatewayGeneric<channel_t>>
3232
class Iceoryx2DDSGateway : public gateway_t
3333
{
3434
public:
3535
Iceoryx2DDSGateway() noexcept;
36-
void loadConfiguration(const GatewayConfig& config) noexcept;
37-
void discover(const iox::capro::CaproMessage& msg) noexcept;
36+
void loadConfiguration(const config::GatewayConfig& config) noexcept;
37+
void discover(const capro::CaproMessage& msg) noexcept;
3838
void forward(const channel_t& channel) noexcept;
3939

4040
private:
41-
iox::cxx::expected<channel_t, iox::dds::GatewayError>
42-
setupChannel(const iox::capro::ServiceDescription& service) noexcept;
41+
cxx::expected<channel_t, gw::GatewayError>
42+
setupChannel(const capro::ServiceDescription& service) noexcept;
4343
};
4444

4545
} // namespace dds
4646
} // namespace iox
4747

4848
#include "iceoryx_dds/internal/gateway/iox_to_dds.inl"
4949

50-
#endif // IOX_DDS_GATEWAY_IOX_TO_DDS_HPP
50+
#endif // IOX_DDS_IOX_TO_DDS_HPP

iceoryx_dds/include/iceoryx_dds/internal/gateway/channel.inl

-97
This file was deleted.

iceoryx_dds/include/iceoryx_dds/internal/gateway/dds_to_iox.inl

+19-13
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
#ifndef IOX_DDS_INTERNAL_GATEWAY_DDS_TO_IOX_INL
16-
#define IOX_DDS_INTERNAL_GATEWAY_DDS_TO_IOX_INL
15+
#ifndef IOX_DDS_DDS_TO_IOX_INL
16+
#define IOX_DDS_DDS_TO_IOX_INL
1717

18+
#include "iceoryx_dds/dds/dds_config.hpp"
1819
#include "iceoryx_dds/internal/log/logging.hpp"
1920
#include "iceoryx_posh/capro/service_description.hpp"
2021
#include "iceoryx_utils/cxx/string.hpp"
@@ -25,26 +26,31 @@ namespace dds
2526
{
2627
template <typename channel_t, typename gateway_t>
2728
inline DDS2IceoryxGateway<channel_t, gateway_t>::DDS2IceoryxGateway() noexcept
28-
: gateway_t()
29+
: gateway_t(capro::Interfaces::DDS, DISCOVERY_PERIOD, FORWARDING_PERIOD)
2930
{
3031
}
3132

3233
template <typename channel_t, typename gateway_t>
33-
inline void DDS2IceoryxGateway<channel_t, gateway_t>::loadConfiguration(const GatewayConfig& config) noexcept
34+
inline void DDS2IceoryxGateway<channel_t, gateway_t>::loadConfiguration(const config::GatewayConfig& config) noexcept
3435
{
35-
iox::LogDebug() << "[DDS2IceoryxGateway] Configuring gateway.";
36+
LogDebug() << "[DDS2IceoryxGateway] Configuring gateway...";
3637
for (const auto& service : config.m_configuredServices)
3738
{
3839
if (!this->findChannel(service.m_serviceDescription).has_value())
3940
{
40-
setupChannel(service.m_serviceDescription);
41+
auto serviceDescription = service.m_serviceDescription;
42+
LogDebug() << "[DDS2IceoryxGateway] Setting up channel for service: {"
43+
<< serviceDescription.getServiceIDString() << ", "
44+
<< serviceDescription.getInstanceIDString() << ", "
45+
<< serviceDescription.getEventIDString() << "}";
46+
setupChannel(serviceDescription);
4147
}
4248
}
4349
}
4450

4551
template <typename channel_t, typename gateway_t>
4652
inline void
47-
DDS2IceoryxGateway<channel_t, gateway_t>::discover([[gnu::unused]] const iox::capro::CaproMessage& msg) noexcept
53+
DDS2IceoryxGateway<channel_t, gateway_t>::discover([[gnu::unused]] const capro::CaproMessage& msg) noexcept
4854
{
4955
/// @note not implemented - requires dds discovery which is currently not implemented in the used dds stack.
5056
}
@@ -53,7 +59,7 @@ template <typename channel_t, typename gateway_t>
5359
inline void DDS2IceoryxGateway<channel_t, gateway_t>::forward(const channel_t& channel) noexcept
5460
{
5561
auto publisher = channel.getIceoryxTerminal();
56-
auto reader = channel.getDDSTerminal();
62+
auto reader = channel.getExternalTerminal();
5763

5864
reader->peekNextSize().and_then([&](uint64_t size) {
5965
// reserve a chunk for the sample
@@ -67,19 +73,19 @@ inline void DDS2IceoryxGateway<channel_t, gateway_t>::forward(const channel_t& c
6773
})
6874
.or_else([&](DataReaderError err) {
6975
LogWarn() << "[DDS2IceoryxGateway] Encountered error reading from DDS network: "
70-
<< iox::dds::DataReaderErrorString[static_cast<uint8_t>(err)];
76+
<< dds::DataReaderErrorString[static_cast<uint8_t>(err)];
7177
});
7278
});
7379
}
7480

7581
// ======================================== Private ======================================== //
7682
template <typename channel_t, typename gateway_t>
77-
iox::cxx::expected<channel_t, iox::dds::GatewayError>
78-
DDS2IceoryxGateway<channel_t, gateway_t>::setupChannel(const iox::capro::ServiceDescription& service) noexcept
83+
cxx::expected<channel_t, gw::GatewayError>
84+
DDS2IceoryxGateway<channel_t, gateway_t>::setupChannel(const capro::ServiceDescription& service) noexcept
7985
{
8086
return this->addChannel(service).and_then([&service](channel_t channel) {
8187
auto publisher = channel.getIceoryxTerminal();
82-
auto reader = channel.getDDSTerminal();
88+
auto reader = channel.getExternalTerminal();
8389
publisher->offer();
8490
reader->connect();
8591
iox::LogDebug() << "[DDS2IceoryxGateway] Setup channel for service: {" << service.getServiceIDString() << ", "
@@ -90,4 +96,4 @@ DDS2IceoryxGateway<channel_t, gateway_t>::setupChannel(const iox::capro::Service
9096
} // namespace dds
9197
} // namespace iox
9298

93-
#endif
99+
#endif // IOX_DDS_DDS_TO_IOX_INL

0 commit comments

Comments
 (0)