RTI Connext Modern C++ API
Version 6.0.1
|
<<extension>> Represents a value that can be initialized or not More...
#include <OptionalValue.hpp>
Public Member Functions | |
optional_value () | |
Creates an uninitialized value. | |
optional_value (const T &value) | |
Creates an instance with a value. | |
optional_value (bool condition, const T &value) | |
Conditionally creates an instance that can be uninitialized or initialized with a value. | |
optional_value (const optional_value< T > &other) | |
Copy constructor. | |
bool | is_set () const OMG_NOEXCEPT |
bool | has_value () const OMG_NOEXCEPT |
operator bool () const OMG_NOEXCEPT | |
void | reset () |
After calling this function, this optional_value is not set. | |
const T & | value () const |
Retrieves the underlying object if it exists. | |
T & | value () |
Retrieves the underlying object if it exists. | |
const T & | get () const |
Retrieves the underlying object if it exists. | |
T & | get () |
Retrieves the underlying object if it exists. | |
const T & | operator* () const |
T & | operator* () |
const T * | operator-> () const |
T * | operator-> () |
<<extension>> Represents a value that can be initialized or not
This class is similar to dds::core::optional and std::optional
.
They have different implementations. dds::core::optional is only used in IDL-generated types, while rti::core::optional_value is used in parts of the API.
|
inline |
Creates an uninitialized value.
|
inline |
Creates an instance with a value.
|
inline |
Conditionally creates an instance that can be uninitialized or initialized with a value.
condition | If it is true it assigns value , otherwise this optional_value is uninitialized |
value | The value to use if condition is true. |
|
inline |
Copy constructor.
This optional_value will be initialized only if other
is initialized.
|
inline |
Returns true only if the value is initialized.
[DEPRECATED] Use has_value()
|
inline |
Returns true only if the value is initialized.
|
inline |
Returns true only if the value is initialized.
|
inline |
After calling this function, this optional_value is not set.
|
inline |
Retrieves the underlying object if it exists.
This operation, unlike operator*
throws an exception if the underlying object doesn't exist.
dds::core::PreconditionNotMetError | if !has_value(). |
|
inline |
Retrieves the underlying object if it exists.
This operation, unlike operator*
throws an exception if the underlying object doesn't exist.
dds::core::PreconditionNotMetError | if !has_value(). |
|
inline |
Retrieves the underlying object if it exists.
[DEPRECATED] Use value() or operator*
dds::core::PreconditionNotMetError | if !has_value(). |
|
inline |
Retrieves the underlying object if it exists.
[DEPRECATED] Use value() or operator*
dds::core::PreconditionNotMetError | if !has_value(). |
|
inline |
Get the value, without checking if it exists
|
inline |
Get the value, without checking if it exists
|
inline |
Get the value.
dds::core::PreconditionNotMetError | if !has_value() |
|
inline |
Get the value.
dds::core::PreconditionNotMetError | if !has_value() |