Skip to content
2 changes: 2 additions & 0 deletions iceoryx2-bb/cxx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@ add_library(iceoryx2-bb-cxx::iceoryx2-bb-cxx ALIAS iceoryx2-bb-cxx)

target_sources(iceoryx2-bb-cxx PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include/iox2/bb/detail/path_and_file_verifier.hpp>
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include/iox2/bb/detail/static_function.hpp>
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include/iox2/bb/duration.hpp>
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include/iox2/bb/file_name.hpp>
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include/iox2/bb/file_path.hpp>
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include/iox2/bb/static_function.hpp>
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include/iox2/bb/into.hpp>
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include/iox2/bb/path.hpp>
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include/iox2/bb/semantic_string.hpp>
Expand Down
526 changes: 526 additions & 0 deletions iceoryx2-bb/cxx/include/iox2/bb/detail/static_function.hpp

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,26 @@
//
// SPDX-License-Identifier: Apache-2.0 OR MIT

#ifndef IOX2_BB_FUNCTIONAL_FUNCTION_HPP
#define IOX2_BB_FUNCTIONAL_FUNCTION_HPP
#ifndef IOX2_BB_FUNCTION_HPP
#define IOX2_BB_FUNCTION_HPP

#include "iox2/legacy/detail/storable_function.hpp"
#include "iox2/bb/detail/static_function.hpp"

namespace iox2 {
namespace legacy {
namespace bb {
constexpr uint64_t DEFAULT_FUNCTION_CAPACITY { 128U };

/// @brief A static memory replacement for std::function
///
/// Allows storing a callable with a given signature if its size does not exceed a limit.
/// This limit can be adjusted by changing the Bytes parameter.
/// In contrast to iox2::legacy::function_ref iox2::legacy::function objects own everything needed
/// to invoke the underlying callable and can be safely stored.
/// They also support copy and move semantics in natural way
/// by copying or moving the underlying callable.
/// The iox2::bb::Function objects own everything needed to invoke the underlying callable and can be safely
/// stored. They also support copy and move semantics in natural way by copying or moving the underlying
/// callable.
///
/// Similarly to std::function, they cannot be stored in Shared Memory
/// to be invoked in a different process.
/// Similarly to std::function, they cannot be stored in Shared Memory to be invoked in a different process.
///
/// For the API see storable_function.
/// For the API see 'detail::StaticFunction'.
///
/// @tparam Signature The signature of the callable to be stored, e.g. int (char, void*).
/// @tparam Capacity The static storage capacity available to store a callable in bytes.
Expand All @@ -40,9 +39,9 @@ constexpr uint64_t DEFAULT_FUNCTION_CAPACITY { 128U };
///

template <typename Signature, uint64_t Capacity = DEFAULT_FUNCTION_CAPACITY>
using function = storable_function<Capacity, Signature>;
using StaticFunction = detail::StaticFunction<Capacity, Signature>;

} // namespace legacy
} // namespace bb
} // namespace iox2

#endif // IOX2_BB_FUNCTIONAL_FUNCTION_HPP
#endif // IOX2_BB_FUNCTION_HPP
6 changes: 3 additions & 3 deletions iceoryx2-bb/cxx/include/iox2/legacy/cli/option_definition.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
#ifndef IOX2_BB_CLI_OPTION_DEFINITION_HPP
#define IOX2_BB_CLI_OPTION_DEFINITION_HPP

#include "iox2/bb/static_function.hpp"
#include "iox2/legacy/cli/arguments.hpp"
#include "iox2/legacy/cli/types.hpp"
#include "iox2/legacy/function.hpp"
#include "iox2/legacy/vector.hpp"
#include <cstdint>

Expand All @@ -35,7 +35,7 @@ class OptionDefinition {
/// defined std::abort() is called
explicit OptionDefinition(
const OptionDescription_t& programDescription,
const function<void()>& onFailureCallback = [] { std::abort(); }) noexcept;
const bb::StaticFunction<void()>& onFailureCallback = [] { std::abort(); }) noexcept;

/// @brief Adds a command line switch argument
/// Calls the onFailureCallback when the option was already added or the shortOption and longOption are
Expand Down Expand Up @@ -83,7 +83,7 @@ class OptionDefinition {
private:
OptionDescription_t m_programDescription;
vector<OptionWithDetails, MAX_NUMBER_OF_ARGUMENTS> m_availableOptions;
function<void()> m_onFailureCallback;
bb::StaticFunction<void()> m_onFailureCallback;
};

std::ostream& operator<<(std::ostream& stream, const OptionWithDetails& option) noexcept;
Expand Down
6 changes: 3 additions & 3 deletions iceoryx2-bb/cxx/include/iox2/legacy/cli/option_manager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@
#ifndef IOX2_BB_CLI_OPTION_MANAGER_HPP
#define IOX2_BB_CLI_OPTION_MANAGER_HPP

#include "iox2/bb/static_function.hpp"
#include "iox2/legacy/cli/command_line_parser.hpp"
#include "iox2/legacy/cli/option_definition.hpp"
#include "iox2/legacy/function.hpp"
#include "iox2/legacy/std_string_support.hpp"
#include "iox2/legacy/vector.hpp"

namespace iox2 {
namespace legacy {
namespace cli {
using CmdAssignments_t = vector<function<void(Arguments&)>, MAX_NUMBER_OF_ARGUMENTS>;
using CmdAssignments_t = vector<bb::StaticFunction<void(Arguments&)>, MAX_NUMBER_OF_ARGUMENTS>;

/// @brief Manages command line options which were defined via the IOX2_CLI_ macros in a
/// user defined struct.
Expand All @@ -35,7 +35,7 @@ class OptionManager {
/// @param[in] programDescription the description of the application
/// @param[in] onFailureCallback callback which is called when a syntax error occurs, a required option is missing
/// or the wrong type as argument value is provided
OptionManager(const OptionDescription_t& programDescription, const function<void()>& onFailureCallback);
OptionManager(const OptionDescription_t& programDescription, const bb::StaticFunction<void()>& onFailureCallback);

/// @brief Defines a new option
/// @param[in] referenceToMember an uninitialized piece of memory where later the content is stored when
Expand Down
2 changes: 1 addition & 1 deletion iceoryx2-bb/cxx/include/iox2/legacy/cli_definition.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
char** argv, \
const iox2::legacy::cli::OptionDescription_t& programDescription, \
const uint64_t argcOffset = 1U, \
const ::iox2::legacy::function<void()>& onFailureCallback = [] { std::abort(); }) { \
const ::iox2::bb::StaticFunction<void()>& onFailureCallback = [] { std::abort(); }) { \
::iox2::legacy::cli::OptionManager optionManager(programDescription, onFailureCallback); \
return Name(optionManager, argc, argv, argcOffset); \
} \
Expand Down
107 changes: 0 additions & 107 deletions iceoryx2-bb/cxx/include/iox2/legacy/detail/static_storage.hpp

This file was deleted.

99 changes: 0 additions & 99 deletions iceoryx2-bb/cxx/include/iox2/legacy/detail/static_storage.inl

This file was deleted.

Loading