17#ifndef IOX_HOOFS_DESIGN_PATTERN_CREATION_HPP
18#define IOX_HOOFS_DESIGN_PATTERN_CREATION_HPP
20#include "iceoryx_hoofs/cxx/expected.hpp"
24namespace DesignPattern
97template <
typename DerivedClass,
typename ErrorType>
102 using result_t = iox::cxx::expected<DerivedClass, ErrorType>;
103 using errorType_t = ErrorType;
111 template <
typename... Targs>
112 static result_t
create(Targs&&... args)
noexcept;
118 static result_t
verify(DerivedClass&& newObject)
noexcept;
127 template <
typename... Targs>
141 bool m_isInitialized{
false};
142 ErrorType m_errorValue;
147#include "iceoryx_hoofs/internal/design_pattern/creation.inl"
This pattern can be used if you write an abstraction where you have to throw an exception in the cons...
Definition: creation.hpp:99
static result_t create(Targs &&... args) noexcept
factory method which guarantees that either a working object is produced or an error value describing...
bool isInitialized() const noexcept
returns true if the object was constructed successfully, otherwise false
static iox::cxx::expected< ErrorType > placementCreate(void *const memory, Targs &&... args) noexcept
factory method which guarantees that either a working object is produced or an error value describing...
static result_t verify(DerivedClass &&newObject) noexcept
verifies if a class was created successfully
expected implementation from the C++20 proposal with C++11. The interface is inspired by the proposal...
Definition: expected.hpp:147