-
Notifications
You must be signed in to change notification settings - Fork 392
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Iox #65 initial implementation cyclonedds to iox gateway #135
Changes from all commits
4cdce1e
a0f38c7
73f7931
5a60e82
a95946a
331e48b
532cfd9
de970d9
e4c2adc
bc986bf
8c8dd01
3f50767
436c61b
54bf1d5
ce3f2b7
620d668
0505fe9
871633e
dd56561
0ce1ad5
38b5f67
4848f9c
1a8a906
59d1cf0
228b7de
47bf2a8
6467373
0b0e11c
ff24777
58333c7
62a0c87
5958dee
cbd8b4e
d614f08
e5cc9a8
a93d7e5
21870c0
3ef39c8
4ec6394
b8a19b5
9a7b977
e7ee7c6
5a2423a
cee04ae
f6cd43a
d74b0a2
5091808
01116fd
0fc4869
b1c4ed5
7f0c3ff
9b8a20f
6eee4e3
688b773
64fd03a
4b3e7d0
cc34dcd
abcc1f3
3a7474d
eef64e2
26dd024
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
cmake_minimum_required(VERSION 3.7) | ||
|
||
set(iceoryx_dds_gateway_VERSION 0.1.0) | ||
project(iceoryx_dds_gateway VERSION ${iceoryx_dds_gateway_VERSION}) | ||
file (STRINGS "../VERSION" iceoryx_dds_VERSION) | ||
project(iceoryx_dds VERSION ${iceoryx_dds_VERSION}) | ||
|
||
option(BUILD_TESTS "build test binaries") | ||
|
||
|
@@ -15,7 +15,7 @@ include(IceoryxPackageHelper) | |
# | ||
setup_package_name_and_create_files( | ||
NAME ${PROJECT_NAME} | ||
NAMESPACE iceoryx_dds_gateway | ||
NAMESPACE iceoryx_dds | ||
PROJECT_PREFIX ${PREFIX} | ||
) | ||
|
||
|
@@ -34,33 +34,34 @@ endif() | |
# | ||
########## build building-block library ########## | ||
# | ||
add_library(ioxdds | ||
add_library(iceoryx_dds | ||
STATIC | ||
source/ioxdds/log/logging.cpp | ||
source/iceoryx_dds/log/logging.cpp | ||
) | ||
add_library(${PROJECT_NAMESPACE}::ioxdds ALIAS ioxdds) | ||
add_library(${PROJECT_NAMESPACE}::iceoryx_dds ALIAS iceoryx_dds) | ||
|
||
target_compile_options(ioxdds PUBLIC -std=c++11) | ||
target_compile_options(iceoryx_dds PUBLIC -std=c++11) | ||
|
||
target_include_directories(ioxdds | ||
target_include_directories(iceoryx_dds | ||
PUBLIC | ||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> | ||
$<INSTALL_INTERFACE:include/${PREFIX}> | ||
) | ||
target_link_libraries(ioxdds | ||
target_link_libraries(iceoryx_dds | ||
PRIVATE | ||
iceoryx_posh::iceoryx_posh | ||
iceoryx_utils::iceoryx_utils | ||
) | ||
|
||
if(USE_CYCLONE_DDS) | ||
target_sources(ioxdds | ||
target_sources(iceoryx_dds | ||
PRIVATE | ||
source/ioxdds/dds/cyclone_data_writer.cpp | ||
source/iceoryx_dds/dds/cyclone_data_reader.cpp | ||
source/iceoryx_dds/dds/cyclone_data_writer.cpp | ||
) | ||
target_compile_definitions(ioxdds PUBLIC -DUSE_CYCLONE_DDS) | ||
target_compile_definitions(iceoryx_dds PUBLIC -DUSE_CYCLONE_DDS) | ||
idl_ddscxx_generate(mempoolMessages_lib "msg/Mempool.idl") | ||
target_link_libraries(ioxdds | ||
target_link_libraries(iceoryx_dds | ||
PUBLIC | ||
CycloneDDS_CXX_API::ddscxx | ||
mempoolMessages_lib | ||
|
@@ -70,12 +71,20 @@ endif() | |
# | ||
########## build gateway apps ########## | ||
# | ||
add_executable(gateway_iox2dds | ||
source/iox2dds_app/main.cpp | ||
add_executable(gateway_iceoryx2dds | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. question to all, do we have a naming convention for binaries? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I like the idea of a prefix for our binaries but I would exclude example binaries from that rule. Maybe iox or ix like ix_roudi, ix_dds2iceoryx_gw, ix_iceoryx2dds_gw?! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we have a vote ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. at first maybe just a discussion with the pros and cons There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will be addressed later, I have created an issue: #147 |
||
source/iceoryx2dds_app/main.cpp | ||
) | ||
target_link_libraries(gateway_iox2dds | ||
target_link_libraries(gateway_iceoryx2dds | ||
iceoryx_posh::iceoryx_posh | ||
${PROJECT_NAMESPACE}::ioxdds | ||
${PROJECT_NAMESPACE}::iceoryx_dds | ||
) | ||
|
||
add_executable(gateway_dds2iceoryx | ||
source/dds2iceoryx_app/main.cpp | ||
) | ||
target_link_libraries(gateway_dds2iceoryx | ||
iceoryx_posh::iceoryx_posh | ||
${PROJECT_NAMESPACE}::iceoryx_dds | ||
) | ||
|
||
# | ||
|
@@ -89,7 +98,7 @@ endif(BUILD_TESTS) | |
########## export library ########## | ||
# | ||
setup_install_directories_and_export_package( | ||
TARGETS gateway_iox2dds | ||
TARGETS gateway_iceoryx2dds gateway_dds2iceoryx | ||
INCLUDE_DIRECTORY include/ | ||
) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Copyright (c) 2020 by Robert Bosch GmbH. All rights reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#ifndef IOX_DDS_DDS_CYCLONE_DATA_READER_HPP | ||
#define IOX_DDS_DDS_CYCLONE_DATA_READER_HPP | ||
|
||
#include "iceoryx_dds/dds/data_reader.hpp" | ||
|
||
namespace iox | ||
{ | ||
namespace dds | ||
{ | ||
|
||
/// @note Implementation coming soon. | ||
class CycloneDataReader : DataReader<CycloneDataReader> | ||
{ | ||
public: | ||
CycloneDataReader(IdString serviceId, IdString instanceId, IdString eventId) noexcept; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please make every argument const. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. don't you want to do do something with the parameter? The implementation is empty There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Implementation comes in the next PR. This PR included the generic gateway and the "skeleton" of the gateway implementation. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. could you maybe add something like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are @todos allowed ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think in this case it should be allowed, since it's indicating that it soon will be implemented There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added a comment as a note, hope this is sufficient. |
||
}; | ||
|
||
} // namespace dds | ||
} // namespace iox | ||
|
||
#endif // IOX_DDS_DDS_CYCLONE_DATA_READER_HPP |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Copyright (c) 2020 by Robert Bosch GmbH. All rights reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#ifndef IOX_DDS_DDS_DATA_READER_HPP | ||
#define IOX_DDS_DDS_DATA_READER_HPP | ||
|
||
#include "iceoryx_utils/cxx/string.hpp" | ||
|
||
namespace iox | ||
{ | ||
namespace dds | ||
{ | ||
using IdString = iox::cxx::string<100u>; | ||
|
||
/// @note Implementation coming soon. | ||
template <typename Impl> | ||
class DataReader | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this unfinished code or code in progress? |
||
{ | ||
}; | ||
} | ||
} | ||
|
||
#endif // IOX_DDS_DDS_DATA_READER_HPP |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Copyright (c) 2020 by Robert Bosch GmbH. All rights reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#ifndef IOX_DDS_DDS_CONFIG_HPP | ||
#define IOX_DDS_DDS_CONFIG_HPP | ||
|
||
#include "iceoryx_posh/iceoryx_posh_types.hpp" | ||
|
||
namespace iox | ||
{ | ||
namespace dds | ||
{ | ||
static constexpr units::Duration DISCOVERY_PERIOD = 1000_ms; | ||
static constexpr units::Duration FORWARDING_PERIOD = 50_ms; | ||
static constexpr uint32_t SUBSCRIBER_CACHE_SIZE = 128u; | ||
static constexpr uint32_t MAX_CHANNEL_NUMBER = iox::MAX_PORT_NUMBER; | ||
|
||
} // namespace dds | ||
} // namespace iox | ||
|
||
#endif // IOX_DDS_DDS_CONFIG_HPP |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
// Copyright (c) 2020 by Robert Bosch GmbH. All rights reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#ifndef IOX_DDS_GATEWAY_CHANNEL_HPP | ||
#define IOX_DDS_GATEWAY_CHANNEL_HPP | ||
|
||
#include "iceoryx_dds/dds/dds_config.hpp" | ||
#include "iceoryx_posh/capro/service_description.hpp" | ||
#include "iceoryx_utils/cxx/expected.hpp" | ||
#include "iceoryx_utils/internal/objectpool/objectpool.hpp" | ||
|
||
#include <memory> | ||
|
||
namespace iox | ||
{ | ||
namespace dds | ||
{ | ||
|
||
enum class ChannelError : uint8_t | ||
{ | ||
OBJECT_POOL_FULL | ||
}; | ||
|
||
/// | ||
/// @class Channel | ||
/// @brief A data structure representing a channel between Iceoryx and DDS. | ||
/// | ||
/// The class couples related iceoryx and dds entities that communicate with eachother to form the communication | ||
/// channel. | ||
/// For example: An Iceoryx subscriber and its corresponding DDS data writer, which communicate eachother to form | ||
/// an outbound communication channel. | ||
/// These entites are conceptualized as channel "Terminals". | ||
/// | ||
/// The structure holds pointers to the instances of the terminals. | ||
/// The terminals can be created and managed externally, in which case the structure only serves as a means of coupling | ||
/// the two. | ||
/// This can be achieved by simply calling the constructor with pointers to them. | ||
/// | ||
/// Alternatively, the class can manage the terminals internally in a static object pool, automatically | ||
/// cleaning them up when the channel is discarded. | ||
/// This can be achieved via the Channel::create method. | ||
/// | ||
template <typename IceoryxTerminal, typename DDSTerminal> | ||
class Channel | ||
{ | ||
using IceoryxTerminalPtr = std::shared_ptr<IceoryxTerminal>; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we intend to certify this code? If so we cannot use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I fear not, @budrus are There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will leave this to be addressed later if it indeed needs to be certified. |
||
using IceoryxTerminalPool = iox::cxx::ObjectPool<IceoryxTerminal, MAX_CHANNEL_NUMBER>; | ||
using DDSTerminalPtr = std::shared_ptr<DDSTerminal>; | ||
using DDSTerminalPool = iox::cxx::ObjectPool<DDSTerminal, MAX_CHANNEL_NUMBER>; | ||
|
||
public: | ||
Channel(const iox::capro::ServiceDescription& service, | ||
const IceoryxTerminalPtr iceoryxTerminal, | ||
const DDSTerminalPtr ddsTerminal) noexcept; | ||
constexpr bool operator==(const Channel<IceoryxTerminal, DDSTerminal>& rhs) const noexcept; | ||
|
||
static iox::cxx::expected<Channel, ChannelError> create(const iox::capro::ServiceDescription& service) noexcept; | ||
|
||
iox::capro::ServiceDescription getService() const noexcept; | ||
IceoryxTerminalPtr getIceoryxTerminal() const noexcept; | ||
DDSTerminalPtr getDDSTerminal() const noexcept; | ||
|
||
private: | ||
static IceoryxTerminalPool s_iceoryxTerminals; | ||
static DDSTerminalPool s_ddsTerminals; | ||
|
||
iox::capro::ServiceDescription m_service; | ||
IceoryxTerminalPtr m_iceoryxTerminal; | ||
DDSTerminalPtr m_ddsTerminal; | ||
}; | ||
|
||
} // namespace dds | ||
} // namespace iox | ||
|
||
#include "iceoryx_dds/internal/gateway/channel.inl" | ||
|
||
#endif // IOX_DDS_DDS_DDS_TYPES_HPP |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't we use the same version throughout iceoryx?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No I don't think so, we should have completely different and independent versioning system here. It should be hexadecimal but with roman numbers. And of course 5 levels mixed with letters, like XI.blubb.12.ae.121 ;) What do you think @elBoberido @FerdinandSpitzschnueffler
Or we have a consistent version number throughout the project ... this would also be fine by me!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✔️