forked from eclipse-iceoryx/iceoryx2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[eclipse-iceoryx#264] First final C++ API draft finished
- Loading branch information
Showing
28 changed files
with
921 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Copyright (c) 2024 Contributors to the Eclipse Foundation | ||
// | ||
// See the NOTICE file(s) distributed with this work for additional | ||
// information regarding copyright ownership. | ||
// | ||
// This program and the accompanying materials are made available under the | ||
// terms of the Apache Software License 2.0 which is available at | ||
// https://www.apache.org/licenses/LICENSE-2.0, or the MIT license | ||
// which is available at https://opensource.org/licenses/MIT. | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 OR MIT | ||
#ifndef IOX_LAYOUT_HPP_ | ||
#define IOX_LAYOUT_HPP_ | ||
|
||
#include <cstdint> | ||
|
||
namespace iox { | ||
class Layout { | ||
public: | ||
uint64_t size() const {} | ||
uint64_t alignment() const {} | ||
}; | ||
} // namespace iox | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Copyright (c) 2024 Contributors to the Eclipse Foundation | ||
// | ||
// See the NOTICE file(s) distributed with this work for additional | ||
// information regarding copyright ownership. | ||
// | ||
// This program and the accompanying materials are made available under the | ||
// terms of the Apache Software License 2.0 which is available at | ||
// https://www.apache.org/licenses/LICENSE-2.0, or the MIT license | ||
// which is available at https://opensource.org/licenses/MIT. | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 OR MIT | ||
#ifndef IOX2_CONNECTION_FAILURE_HPP_ | ||
#define IOX2_CONNECTION_FAILURE_HPP_ | ||
|
||
namespace iox2 { | ||
enum class ConnectionFailure {}; | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Copyright (c) 2024 Contributors to the Eclipse Foundation | ||
// | ||
// See the NOTICE file(s) distributed with this work for additional | ||
// information regarding copyright ownership. | ||
// | ||
// This program and the accompanying materials are made available under the | ||
// terms of the Apache Software License 2.0 which is available at | ||
// https://www.apache.org/licenses/LICENSE-2.0, or the MIT license | ||
// which is available at https://opensource.org/licenses/MIT. | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 OR MIT | ||
#ifndef IOX2_DYNAMIC_CONFIG_EVENT_HPP_ | ||
#define IOX2_DYNAMIC_CONFIG_EVENT_HPP_ | ||
|
||
#include <cstdint> | ||
|
||
namespace iox2 { | ||
class DynamicConfigEvent { | ||
public: | ||
uint64_t number_of_listeners() const {} | ||
uint64_t number_of_notifiers() const {} | ||
}; | ||
} // namespace iox2 | ||
|
||
#endif |
25 changes: 25 additions & 0 deletions
25
iceoryx2-ffi/cxx/include/iox2/dynamic_config_publish_subscribe.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Copyright (c) 2024 Contributors to the Eclipse Foundation | ||
// | ||
// See the NOTICE file(s) distributed with this work for additional | ||
// information regarding copyright ownership. | ||
// | ||
// This program and the accompanying materials are made available under the | ||
// terms of the Apache Software License 2.0 which is available at | ||
// https://www.apache.org/licenses/LICENSE-2.0, or the MIT license | ||
// which is available at https://opensource.org/licenses/MIT. | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 OR MIT | ||
#ifndef IOX2_DYNAMIC_CONFIG_PUBLISH_SUBSCRIBE_HPP_ | ||
#define IOX2_DYNAMIC_CONFIG_PUBLISH_SUBSCRIBE_HPP_ | ||
|
||
#include <cstdint> | ||
|
||
namespace iox2 { | ||
class DynamicConfigPublishSubscribe { | ||
public: | ||
uint64_t number_of_publishers() const {} | ||
uint64_t number_of_subscribers() const {} | ||
}; | ||
} // namespace iox2 | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Copyright (c) 2024 Contributors to the Eclipse Foundation | ||
// | ||
// See the NOTICE file(s) distributed with this work for additional | ||
// information regarding copyright ownership. | ||
// | ||
// This program and the accompanying materials are made available under the | ||
// terms of the Apache Software License 2.0 which is available at | ||
// https://www.apache.org/licenses/LICENSE-2.0, or the MIT license | ||
// which is available at https://opensource.org/licenses/MIT. | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 OR MIT | ||
#ifndef IOX2_EVENT_ID_HPP_ | ||
#define IOX2_EVENT_ID_HPP_ | ||
|
||
#include <cstdint> | ||
|
||
namespace iox2 { | ||
class EventId { | ||
public: | ||
EventId(const uint64_t value) : m_value{value} {} | ||
uint64_t as_value() const { return m_value; } | ||
|
||
private: | ||
uint64_t m_value; | ||
}; | ||
} // namespace iox2 | ||
|
||
#endif |
27 changes: 27 additions & 0 deletions
27
iceoryx2-ffi/cxx/include/iox2/header_publish_subscribe.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Copyright (c) 2024 Contributors to the Eclipse Foundation | ||
// | ||
// See the NOTICE file(s) distributed with this work for additional | ||
// information regarding copyright ownership. | ||
// | ||
// This program and the accompanying materials are made available under the | ||
// terms of the Apache Software License 2.0 which is available at | ||
// https://www.apache.org/licenses/LICENSE-2.0, or the MIT license | ||
// which is available at https://opensource.org/licenses/MIT. | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 OR MIT | ||
#ifndef IOX2_HEADER_PUBLISH_SUBSCRIBE_HPP_ | ||
#define IOX2_HEADER_PUBLISH_SUBSCRIBE_HPP_ | ||
|
||
#include "iox/layout.hpp" | ||
#include "service_type.hpp" | ||
#include "unique_port_id.hpp" | ||
|
||
namespace iox2 { | ||
class HeaderPublishSubscribe { | ||
public: | ||
UniquePublisherId publisher_id() const {} | ||
iox::Layout payload_type_layout() const {} | ||
}; | ||
} // namespace iox2 | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// Copyright (c) 2024 Contributors to the Eclipse Foundation | ||
// | ||
// See the NOTICE file(s) distributed with this work for additional | ||
// information regarding copyright ownership. | ||
// | ||
// This program and the accompanying materials are made available under the | ||
// terms of the Apache Software License 2.0 which is available at | ||
// https://www.apache.org/licenses/LICENSE-2.0, or the MIT license | ||
// which is available at https://opensource.org/licenses/MIT. | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 OR MIT | ||
#ifndef IOX2_LISTENER_HPP_ | ||
#define IOX2_LISTENER_HPP_ | ||
|
||
#include "event_id.hpp" | ||
#include "iox/duration.hpp" | ||
#include "iox/expected.hpp" | ||
#include "iox/function.hpp" | ||
#include "iox/optional.hpp" | ||
#include "service_type.hpp" | ||
#include "unique_port_id.hpp" | ||
|
||
namespace iox2 { | ||
enum class ListenerCreateError { | ||
/// The maximum amount of [`Listener`]s that can connect to a | ||
/// [`Service`](crate::service::Service) is | ||
/// defined in [`crate::config::Config`]. When this is exceeded no more | ||
/// [`Listener`]s | ||
/// can be created for a specific [`Service`](crate::service::Service). | ||
ExceedsMaxSupportedListeners, | ||
/// An underlying resource of the [`Service`](crate::service::Service) could | ||
/// not be created | ||
ResourceCreationFailed, | ||
}; | ||
|
||
enum class ListenerWaitError { | ||
ContractViolation, | ||
InternalFailure, | ||
InterruptSignal, | ||
}; | ||
|
||
template <ServiceType> | ||
class Listener { | ||
public: | ||
UniqueListenerId id() const {} | ||
|
||
iox::expected<void, ListenerWaitError> try_wait_all( | ||
const iox::function<void(EventId)>& callback) {} | ||
iox::expected<void, ListenerWaitError> timed_wait_all( | ||
const iox::function<void(EventId)>& callback, | ||
const iox::units::Duration& timeout) {} | ||
iox::expected<void, ListenerWaitError> blocking_wait_all( | ||
const iox::function<void(EventId)>& callback) {} | ||
|
||
iox::expected<iox::optional<EventId>, ListenerWaitError> try_wait_one() {} | ||
iox::expected<iox::optional<EventId>, ListenerWaitError> timed_wait_one( | ||
const iox::units::Duration& timeout) {} | ||
iox::expected<iox::optional<EventId>, ListenerWaitError> | ||
blocking_wait_one() {} | ||
}; | ||
} // namespace iox2 | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// Copyright (c) 2024 Contributors to the Eclipse Foundation | ||
// | ||
// See the NOTICE file(s) distributed with this work for additional | ||
// information regarding copyright ownership. | ||
// | ||
// This program and the accompanying materials are made available under the | ||
// terms of the Apache Software License 2.0 which is available at | ||
// https://www.apache.org/licenses/LICENSE-2.0, or the MIT license | ||
// which is available at https://opensource.org/licenses/MIT. | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 OR MIT | ||
#ifndef IOX2_MESSAGE_TYPE_DETAILS_HPP_ | ||
#define IOX2_MESSAGE_TYPE_DETAILS_HPP_ | ||
|
||
#include <cstdint> | ||
#include <string> | ||
|
||
namespace iox2 { | ||
/// Defines if the type is a slice with a runtime-size | ||
/// ([`TypeVariant::Dynamic`]) or if its a type that satisfies [`Sized`] | ||
/// ([`TypeVariant::FixedSize`]). | ||
enum class TypeVariant { | ||
/// A fixed size type like [`u64`] | ||
FixedSize, | ||
/// A dynamic sized type like a slice | ||
Dynamic, | ||
}; | ||
|
||
/// Contains all type details required to connect to a | ||
/// [`crate::service::Service`] | ||
struct TypeDetail { | ||
/// The [`TypeVariant`] of the type | ||
TypeVariant variant; | ||
/// Contains the output of [`core::any::type_name()`]. | ||
std::string type_name; | ||
/// The size of the underlying type. | ||
uint64_t size; | ||
/// The alignment of the underlying type. | ||
uint64_t alignment; | ||
}; | ||
|
||
struct MessageTypeDetails { | ||
/// The [`TypeDetail`] of the header of a message, the first iceoryx2 | ||
/// internal part. | ||
TypeDetail header; | ||
/// The [`TypeDetail`] of the user_header or the custom header, is located | ||
/// directly after the header. | ||
TypeDetail user_header; | ||
/// The [`TypeDetail`] of the payload of the message, the last part. | ||
TypeDetail payload; | ||
}; | ||
} // namespace iox2 | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Copyright (c) 2024 Contributors to the Eclipse Foundation | ||
// | ||
// See the NOTICE file(s) distributed with this work for additional | ||
// information regarding copyright ownership. | ||
// | ||
// This program and the accompanying materials are made available under the | ||
// terms of the Apache Software License 2.0 which is available at | ||
// https://www.apache.org/licenses/LICENSE-2.0, or the MIT license | ||
// which is available at https://opensource.org/licenses/MIT. | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 OR MIT | ||
#ifndef IOX2_NODE_DETAILS_HPP_ | ||
#define IOX2_NODE_DETAILS_HPP_ | ||
|
||
#include "config.hpp" | ||
#include "node_name.hpp" | ||
|
||
namespace iox2 { | ||
class NodeDetails { | ||
public: | ||
const NodeName& name() const; | ||
const Config& config() const; | ||
}; | ||
} // namespace iox2 | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Copyright (c) 2024 Contributors to the Eclipse Foundation | ||
// | ||
// See the NOTICE file(s) distributed with this work for additional | ||
// information regarding copyright ownership. | ||
// | ||
// This program and the accompanying materials are made available under the | ||
// terms of the Apache Software License 2.0 which is available at | ||
// https://www.apache.org/licenses/LICENSE-2.0, or the MIT license | ||
// which is available at https://opensource.org/licenses/MIT. | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 OR MIT | ||
#ifndef IOX2_NODE_FAILURE_ENUMS_HPP_ | ||
#define IOX2_NODE_FAILURE_ENUMS_HPP_ | ||
|
||
namespace iox2 { | ||
enum class NodeListFailure {}; | ||
|
||
enum class NodeCreationFailure { InsufficientPermissions, InternalError }; | ||
|
||
enum class NodeCleanupFailure {}; | ||
|
||
} // namespace iox2 | ||
|
||
#endif |
Oops, something went wrong.