Skip to content

Commit

Permalink
[#264] Use string unsafe_raw_access; initialize all handles with nullptr
Browse files Browse the repository at this point in the history
  • Loading branch information
elfenpiff committed Dec 18, 2024
1 parent ce1a959 commit 5fa47fd
Show file tree
Hide file tree
Showing 36 changed files with 92 additions and 115 deletions.
2 changes: 1 addition & 1 deletion iceoryx2-ffi/cxx/include/iox2/attribute.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class AttributeView {
friend class AttributeSetView;
explicit AttributeView(iox2_attribute_h_ref handle);

iox2_attribute_h_ref m_handle;
iox2_attribute_h_ref m_handle = nullptr;
};
} // namespace iox2
//
Expand Down
2 changes: 1 addition & 1 deletion iceoryx2-ffi/cxx/include/iox2/attribute_set.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class AttributeSetView {

explicit AttributeSetView(iox2_attribute_set_h_ref handle);

iox2_attribute_set_h_ref m_handle;
iox2_attribute_set_h_ref m_handle = nullptr;
};
} // namespace iox2

Expand Down
2 changes: 1 addition & 1 deletion iceoryx2-ffi/cxx/include/iox2/attribute_specifier.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class AttributeSpecifier {

void drop();

iox2_attribute_specifier_h m_handle;
iox2_attribute_specifier_h m_handle = nullptr;
};
} // namespace iox2

Expand Down
2 changes: 1 addition & 1 deletion iceoryx2-ffi/cxx/include/iox2/attribute_verifier.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class AttributeVerifier {

void drop();

iox2_attribute_verifier_h m_handle;
iox2_attribute_verifier_h m_handle = nullptr;
};
} // namespace iox2

Expand Down
14 changes: 7 additions & 7 deletions iceoryx2-ffi/cxx/include/iox2/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class Node {
friend class Global;
explicit Node(iox2_config_h* config);

iox2_config_h* m_config;
iox2_config_h* m_config = nullptr;
};

/// All configurable settings of a [`Service`].
Expand Down Expand Up @@ -103,7 +103,7 @@ class Service {
friend class Global;
explicit Service(iox2_config_h* config);

iox2_config_h* m_config;
iox2_config_h* m_config = nullptr;
};

/// The global settings
Expand All @@ -128,7 +128,7 @@ class Global {
friend class ::iox2::Config;
explicit Global(iox2_config_h* config);

iox2_config_h* m_config;
iox2_config_h* m_config = nullptr;
};

/// Default settings for the publish-subscribe messaging pattern. These settings are used unless
Expand Down Expand Up @@ -188,7 +188,7 @@ class PublishSubscribe {
friend class Defaults;
explicit PublishSubscribe(iox2_config_h* config);

iox2_config_h* m_config;
iox2_config_h* m_config = nullptr;
};

/// Default settings for the event messaging pattern. These settings are used unless
Expand Down Expand Up @@ -217,7 +217,7 @@ class Event {
friend class Defaults;
explicit Event(iox2_config_h* config);

iox2_config_h* m_config;
iox2_config_h* m_config = nullptr;
};

/// Default settings. These values are used when the user in the code does not specify anything
Expand All @@ -233,7 +233,7 @@ class Defaults {
friend class ::iox2::Config;
explicit Defaults(iox2_config_h* config);

iox2_config_h* m_config;
iox2_config_h* m_config = nullptr;
};
} // namespace config

Expand All @@ -258,7 +258,7 @@ class ConfigView {
friend class Service;

explicit ConfigView(iox2_config_ptr ptr);
iox2_config_ptr m_ptr;
iox2_config_ptr m_ptr = nullptr;
};

/// Represents the configuration that iceoryx2 will utilize. It is divided into two sections:
Expand Down
2 changes: 1 addition & 1 deletion iceoryx2-ffi/cxx/include/iox2/header_publish_subscribe.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class HeaderPublishSubscribe {
explicit HeaderPublishSubscribe(iox2_publish_subscribe_header_h handle);
void drop();

iox2_publish_subscribe_header_h m_handle;
iox2_publish_subscribe_header_h m_handle = nullptr;
};
} // namespace iox2

Expand Down
10 changes: 5 additions & 5 deletions iceoryx2-ffi/cxx/include/iox2/listener.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ class Listener : public FileDescriptorBased {
/// currently available [`EventId`]s in buffer.
/// For every received [`EventId`] the provided callback is called with the [`EventId`] as
/// input argument.
auto timed_wait_all(const iox::function<void(EventId)>& callback,
const iox::units::Duration& timeout) -> iox::expected<void, ListenerWaitError>;
auto timed_wait_all(const iox::function<void(EventId)>& callback, const iox::units::Duration& timeout)
-> iox::expected<void, ListenerWaitError>;

/// Blocking wait for new [`EventId`]s. Collects either
/// all [`EventId`]s that were received
Expand All @@ -75,8 +75,8 @@ class Listener : public FileDescriptorBased {
/// has passed. If no [`EventId`] was notified it returns [`None`].
/// On error it returns [`ListenerWaitError`] is returned which describes the error
/// in detail.
auto
timed_wait_one(const iox::units::Duration& timeout) -> iox::expected<iox::optional<EventId>, ListenerWaitError>;
auto timed_wait_one(const iox::units::Duration& timeout)
-> iox::expected<iox::optional<EventId>, ListenerWaitError>;

/// Blocking wait for a new [`EventId`].
/// Sporadic wakeups can occur and if no [`EventId`] was notified it returns [`None`].
Expand All @@ -93,7 +93,7 @@ class Listener : public FileDescriptorBased {
explicit Listener(iox2_listener_h handle);
void drop();

iox2_listener_h m_handle;
iox2_listener_h m_handle = nullptr;
};
} // namespace iox2

Expand Down
4 changes: 2 additions & 2 deletions iceoryx2-ffi/cxx/include/iox2/node.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class Node {

friend class NodeBuilder;

iox2_node_h m_handle;
iox2_node_h m_handle = nullptr;
};

/// Creates a new [`Node`].
Expand Down Expand Up @@ -106,7 +106,7 @@ class NodeBuilder {
auto create() const&& -> iox::expected<Node<T>, NodeCreationFailure>;

private:
iox2_node_builder_h m_handle;
iox2_node_builder_h m_handle = nullptr;
};
} // namespace iox2

Expand Down
12 changes: 5 additions & 7 deletions iceoryx2-ffi/cxx/include/iox2/node_name.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,12 @@ class NodeNameView {
friend class Node;
friend class NodeName;
template <ServiceType>
friend auto list_callback(iox2_node_state_e,
iox2_node_id_ptr,
iox2_node_name_ptr,
iox2_config_ptr,
iox2_callback_context) -> iox2_callback_progression_e;
friend auto
list_callback(iox2_node_state_e, iox2_node_id_ptr, iox2_node_name_ptr, iox2_config_ptr, iox2_callback_context)
-> iox2_callback_progression_e;

explicit NodeNameView(iox2_node_name_ptr ptr);
iox2_node_name_ptr m_ptr;
iox2_node_name_ptr m_ptr = nullptr;
};

/// Represent the name for a [`Node`].
Expand Down Expand Up @@ -79,7 +77,7 @@ class NodeName {
void drop() noexcept;
static auto create_impl(const char* value, size_t value_len) -> iox::expected<NodeName, SemanticStringError>;

iox2_node_name_h m_handle;
iox2_node_name_h m_handle = nullptr;
};
} // namespace iox2

Expand Down
2 changes: 1 addition & 1 deletion iceoryx2-ffi/cxx/include/iox2/notifier.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class Notifier {
explicit Notifier(iox2_notifier_h handle);
void drop();

iox2_notifier_h m_handle;
iox2_notifier_h m_handle = nullptr;
};
} // namespace iox2

Expand Down
2 changes: 1 addition & 1 deletion iceoryx2-ffi/cxx/include/iox2/port_factory_event.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class PortFactoryEvent {
explicit PortFactoryEvent(iox2_port_factory_event_h handle);
void drop() noexcept;

iox2_port_factory_event_h m_handle;
iox2_port_factory_event_h m_handle = nullptr;
};
} // namespace iox2

Expand Down
2 changes: 1 addition & 1 deletion iceoryx2-ffi/cxx/include/iox2/port_factory_listener.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class PortFactoryListener {

explicit PortFactoryListener(iox2_port_factory_listener_builder_h handle);

iox2_port_factory_listener_builder_h m_handle;
iox2_port_factory_listener_builder_h m_handle = nullptr;
};
} // namespace iox2

Expand Down
2 changes: 1 addition & 1 deletion iceoryx2-ffi/cxx/include/iox2/port_factory_notifier.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class PortFactoryNotifier {

explicit PortFactoryNotifier(iox2_port_factory_notifier_builder_h handle);

iox2_port_factory_notifier_builder_h m_handle;
iox2_port_factory_notifier_builder_h m_handle = nullptr;
};
} // namespace iox2

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#include "iox/assertions_addendum.hpp"
#include "iox/expected.hpp"
#include "iox/function.hpp"
#include "iox/string.hpp"
#include "iox2/attribute_set.hpp"
#include "iox2/callback_progression.hpp"
#include "iox2/dynamic_config_publish_subscribe.hpp"
Expand Down Expand Up @@ -81,7 +80,7 @@ class PortFactoryPublishSubscribe {
explicit PortFactoryPublishSubscribe(iox2_port_factory_pub_sub_h handle);
void drop();

iox2_port_factory_pub_sub_h m_handle { nullptr };
iox2_port_factory_pub_sub_h m_handle = nullptr;
};

template <ServiceType S, typename Payload, typename UserHeader>
Expand Down Expand Up @@ -145,8 +144,8 @@ inline auto PortFactoryPublishSubscribe<S, Payload, UserHeader>::static_config()
}

template <ServiceType S, typename Payload, typename UserHeader>
inline auto
PortFactoryPublishSubscribe<S, Payload, UserHeader>::dynamic_config() const -> const DynamicConfigPublishSubscribe& {
inline auto PortFactoryPublishSubscribe<S, Payload, UserHeader>::dynamic_config() const
-> const DynamicConfigPublishSubscribe& {
IOX_TODO();
}

Expand Down
2 changes: 1 addition & 1 deletion iceoryx2-ffi/cxx/include/iox2/port_factory_publisher.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class PortFactoryPublisher {

explicit PortFactoryPublisher(iox2_port_factory_publisher_builder_h handle);

iox2_port_factory_publisher_builder_h m_handle;
iox2_port_factory_publisher_builder_h m_handle = nullptr;
iox::optional<uint64_t> m_max_slice_len;
iox::optional<AllocationStrategy> m_allocation_strategy;
};
Expand Down
3 changes: 1 addition & 2 deletions iceoryx2-ffi/cxx/include/iox2/port_factory_subscriber.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#ifndef IOX2_PORTFACTORY_SUBSCRIBER_HPP
#define IOX2_PORTFACTORY_SUBSCRIBER_HPP

#include "iox/assertions_addendum.hpp"
#include "iox/builder_addendum.hpp"
#include "iox/expected.hpp"
#include "iox2/internal/iceoryx2.hpp"
Expand Down Expand Up @@ -47,7 +46,7 @@ class PortFactorySubscriber {

explicit PortFactorySubscriber(iox2_port_factory_subscriber_builder_h handle);

iox2_port_factory_subscriber_builder_h m_handle;
iox2_port_factory_subscriber_builder_h m_handle = nullptr;
};

template <ServiceType S, typename Payload, typename UserHeader>
Expand Down
7 changes: 3 additions & 4 deletions iceoryx2-ffi/cxx/include/iox2/publisher.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#ifndef IOX2_PUBLISHER_HPP
#define IOX2_PUBLISHER_HPP

#include "iox/assertions_addendum.hpp"
#include "iox/expected.hpp"
#include "iox/slice.hpp"
#include "iox2/connection_failure.hpp"
Expand Down Expand Up @@ -109,7 +108,7 @@ class Publisher {
explicit Publisher(iox2_publisher_h handle);
void drop();

iox2_publisher_h m_handle { nullptr };
iox2_publisher_h m_handle = nullptr;
};

template <ServiceType S, typename Payload, typename UserHeader>
Expand Down Expand Up @@ -218,8 +217,8 @@ inline auto Publisher<S, Payload, UserHeader>::loan_uninit()

template <ServiceType S, typename Payload, typename UserHeader>
template <typename T, typename>
inline auto
Publisher<S, Payload, UserHeader>::loan() -> iox::expected<SampleMut<S, Payload, UserHeader>, PublisherLoanError> {
inline auto Publisher<S, Payload, UserHeader>::loan()
-> iox::expected<SampleMut<S, Payload, UserHeader>, PublisherLoanError> {
auto sample = loan_uninit();

if (sample.has_error()) {
Expand Down
3 changes: 1 addition & 2 deletions iceoryx2-ffi/cxx/include/iox2/sample.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#ifndef IOX2_SAMPLE_HPP
#define IOX2_SAMPLE_HPP

#include "iox/assertions_addendum.hpp"
#include "iox/slice.hpp"
#include "iox2/header_publish_subscribe.hpp"
#include "iox2/internal/iceoryx2.hpp"
Expand Down Expand Up @@ -80,7 +79,7 @@ class Sample {
void drop();

iox2_sample_t m_sample;
iox2_sample_h m_handle { nullptr };
iox2_sample_h m_handle = nullptr;
};

template <ServiceType S, typename Payload, typename UserHeader>
Expand Down
3 changes: 1 addition & 2 deletions iceoryx2-ffi/cxx/include/iox2/sample_mut.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#ifndef IOX2_SAMPLE_MUT_HPP
#define IOX2_SAMPLE_MUT_HPP

#include "iox/assertions.hpp"
#include "iox/expected.hpp"
#include "iox/slice.hpp"
#include "iox2/header_publish_subscribe.hpp"
Expand Down Expand Up @@ -109,7 +108,7 @@ class SampleMut {

// NOLINTNEXTLINE(cppcoreguidelines-pro-type-member-init,hicpp-member-init) will not be accessed directly but only via m_handle and will be set together with m_handle
iox2_sample_mut_t m_sample;
iox2_sample_mut_h m_handle { nullptr };
iox2_sample_mut_h m_handle = nullptr;
};

template <ServiceType S, typename Payload, typename UserHeader>
Expand Down
1 change: 0 additions & 1 deletion iceoryx2-ffi/cxx/include/iox2/sample_mut_uninit.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#ifndef IOX2_SAMPLE_MUT_UNINIT_HPP
#define IOX2_SAMPLE_MUT_UNINIT_HPP

#include "iox/assertions_addendum.hpp"
#include "iox/function.hpp"
#include "iox/slice.hpp"
#include "iox2/header_publish_subscribe.hpp"
Expand Down
3 changes: 1 addition & 2 deletions iceoryx2-ffi/cxx/include/iox2/service_builder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#ifndef IOX2_SERVICE_BUILDER_HPP
#define IOX2_SERVICE_BUILDER_HPP

#include "iox/assertions_addendum.hpp"
#include "iox2/service_builder_event.hpp"
#include "iox2/service_builder_publish_subscribe.hpp"
#include "iox2/service_type.hpp"
Expand Down Expand Up @@ -44,7 +43,7 @@ class ServiceBuilder {
friend class Node;
ServiceBuilder(iox2_node_h_ref node_handle, iox2_service_name_ptr service_name_ptr);

iox2_service_builder_h m_handle;
iox2_service_builder_h m_handle = nullptr;
};

template <ServiceType S>
Expand Down
2 changes: 1 addition & 1 deletion iceoryx2-ffi/cxx/include/iox2/service_builder_event.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class ServiceBuilderEvent {

void set_parameters();

iox2_service_builder_event_h m_handle;
iox2_service_builder_event_h m_handle = nullptr;
};
} // namespace iox2

Expand Down
Loading

0 comments on commit 5fa47fd

Please sign in to comment.