Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
BT::Any Class Reference

#include <safe_any.hpp>

Public Member Functions

 Any ()
 
 Any (Any &&other)
 
 Any (const Any &other)
 
 Any (const char *str)
 
 Any (const double &value)
 
 Any (const float &value)
 
 Any (const SafeAny::SimpleString &str)
 
 Any (const std::string &str)
 
 Any (const std::string_view &str)
 
 Any (const std::type_index &type)
 
template<typename T >
 Any (const T &value, EnableIntegral< T >=0)
 
template<typename T >
 Any (const T &value, EnableNonIntegral< T >=0)
 
 Any (const uint64_t &value)
 
template<typename T >
cast () const
 
const std::type_info & castedType () const noexcept
 
template<typename T >
T * castPtr ()
 
void copyInto (Any &dst)
 
bool empty () const noexcept
 
bool isIntegral () const
 
bool isNumber () const
 
bool isString () const
 
template<typename T >
bool isType () const
 
Anyoperator= (const Any &other)
 
template<typename T >
nonstd::expected< T, std::string > tryCast () const
 
const std::type_index & type () const noexcept
 
 ~Any ()=default
 

Private Types

template<typename T >
using EnableArithmetic = typename std::enable_if< std::is_arithmetic< T >::value >::type *
 
template<typename T >
using EnableEnum = typename std::enable_if< std::is_enum< T >::value >::type *
 
template<typename T >
using EnableIntegral = typename std::enable_if< std::is_integral< T >::value||std::is_enum< T >::value >::type *
 
template<typename T >
using EnableNonIntegral = typename std::enable_if<!std::is_integral< T >::value &&!std::is_enum< T >::value >::type *
 
template<typename T >
using EnableString = typename std::enable_if< std::is_same< T, std::string >::value >::type *
 
template<typename T >
using EnableUnknownType = typename std::enable_if<!std::is_arithmetic< T >::value &&!std::is_enum< T >::value &&!std::is_same< T, std::string >::value >::type *
 

Private Member Functions

template<typename DST >
nonstd::expected< DST, std::string > convert (EnableArithmetic< DST >=nullptr) const
 
template<typename DST >
nonstd::expected< DST, std::string > convert (EnableEnum< DST >=0) const
 
template<typename DST >
nonstd::expected< DST, std::string > convert (EnableString< DST >=0) const
 
template<typename DST >
nonstd::expected< DST, std::string > convert (EnableUnknownType< DST >=0) const
 
template<typename T >
std::string errorMsg () const
 
template<typename T >
nonstd::expected< T, std::string > stringToNumber () const
 

Private Attributes

linb::any _any
 
std::type_index _original_type
 

Detailed Description

Definition at line 36 of file safe_any.hpp.

Member Typedef Documentation

◆ EnableArithmetic

template<typename T >
using BT::Any::EnableArithmetic = typename std::enable_if<std::is_arithmetic<T>::value>::type*
private

Definition at line 51 of file safe_any.hpp.

◆ EnableEnum

template<typename T >
using BT::Any::EnableEnum = typename std::enable_if<std::is_enum<T>::value>::type*
private

Definition at line 54 of file safe_any.hpp.

◆ EnableIntegral

template<typename T >
using BT::Any::EnableIntegral = typename std::enable_if<std::is_integral<T>::value || std::is_enum<T>::value>::type*
private

Definition at line 40 of file safe_any.hpp.

◆ EnableNonIntegral

template<typename T >
using BT::Any::EnableNonIntegral = typename std::enable_if<!std::is_integral<T>::value && !std::is_enum<T>::value>::type*
private

Definition at line 44 of file safe_any.hpp.

◆ EnableString

template<typename T >
using BT::Any::EnableString = typename std::enable_if<std::is_same<T, std::string>::value>::type*
private

Definition at line 48 of file safe_any.hpp.

◆ EnableUnknownType

template<typename T >
using BT::Any::EnableUnknownType = typename std::enable_if<!std::is_arithmetic<T>::value && !std::is_enum<T>::value && !std::is_same<T, std::string>::value>::type*
private

Definition at line 59 of file safe_any.hpp.

Constructor & Destructor Documentation

◆ Any() [1/13]

BT::Any::Any ( )
inline

Definition at line 65 of file safe_any.hpp.

◆ ~Any()

BT::Any::~Any ( )
default

◆ Any() [2/13]

BT::Any::Any ( const Any other)
inline

Definition at line 70 of file safe_any.hpp.

◆ Any() [3/13]

BT::Any::Any ( Any &&  other)
inline

Definition at line 73 of file safe_any.hpp.

◆ Any() [4/13]

BT::Any::Any ( const double &  value)
inlineexplicit

Definition at line 76 of file safe_any.hpp.

◆ Any() [5/13]

BT::Any::Any ( const uint64_t &  value)
inlineexplicit

Definition at line 79 of file safe_any.hpp.

◆ Any() [6/13]

BT::Any::Any ( const float &  value)
inlineexplicit

Definition at line 82 of file safe_any.hpp.

◆ Any() [7/13]

BT::Any::Any ( const std::string &  str)
inlineexplicit

Definition at line 85 of file safe_any.hpp.

◆ Any() [8/13]

BT::Any::Any ( const char *  str)
inlineexplicit

Definition at line 89 of file safe_any.hpp.

◆ Any() [9/13]

BT::Any::Any ( const SafeAny::SimpleString str)
inlineexplicit

Definition at line 93 of file safe_any.hpp.

◆ Any() [10/13]

BT::Any::Any ( const std::string_view &  str)
inlineexplicit

Definition at line 97 of file safe_any.hpp.

◆ Any() [11/13]

template<typename T >
BT::Any::Any ( const T &  value,
EnableIntegral< T >  = 0 
)
inlineexplicit

Definition at line 103 of file safe_any.hpp.

◆ Any() [12/13]

BT::Any::Any ( const std::type_index &  type)
inline

Definition at line 107 of file safe_any.hpp.

◆ Any() [13/13]

template<typename T >
BT::Any::Any ( const T &  value,
EnableNonIntegral< T >  = 0 
)
inlineexplicit

Definition at line 112 of file safe_any.hpp.

Member Function Documentation

◆ cast()

template<typename T >
T BT::Any::cast ( ) const
inline

Definition at line 146 of file safe_any.hpp.

◆ castedType()

const std::type_info& BT::Any::castedType ( ) const
inlinenoexcept

Definition at line 202 of file safe_any.hpp.

◆ castPtr()

template<typename T >
T* BT::Any::castPtr ( )
inline

Definition at line 162 of file safe_any.hpp.

◆ convert() [1/4]

template<typename DST >
nonstd::expected< DST, std::string > BT::Any::convert ( EnableArithmetic< DST >  = nullptr) const
inlineprivate

Definition at line 452 of file safe_any.hpp.

◆ convert() [2/4]

template<typename DST >
nonstd::expected< DST, std::string > BT::Any::convert ( EnableEnum< DST >  = 0) const
inlineprivate

Definition at line 431 of file safe_any.hpp.

◆ convert() [3/4]

template<typename DST >
nonstd::expected< DST, std::string > BT::Any::convert ( EnableString< DST >  = 0) const
inlineprivate

Definition at line 362 of file safe_any.hpp.

◆ convert() [4/4]

template<typename DST >
nonstd::expected<DST, std::string> BT::Any::convert ( EnableUnknownType< DST >  = 0) const
inlineprivate

Definition at line 228 of file safe_any.hpp.

◆ copyInto()

void BT::Any::copyInto ( Any dst)
inline

Definition at line 322 of file safe_any.hpp.

◆ empty()

bool BT::Any::empty ( ) const
inlinenoexcept

Definition at line 207 of file safe_any.hpp.

◆ errorMsg()

template<typename T >
std::string BT::Any::errorMsg ( ) const
inlineprivate

Definition at line 234 of file safe_any.hpp.

◆ isIntegral()

bool BT::Any::isIntegral ( ) const
inline

Definition at line 317 of file safe_any.hpp.

◆ isNumber()

bool BT::Any::isNumber ( ) const
inline

Definition at line 311 of file safe_any.hpp.

◆ isString()

bool BT::Any::isString ( ) const
inline

Definition at line 124 of file safe_any.hpp.

◆ isType()

template<typename T >
bool BT::Any::isType ( ) const
inline

Definition at line 131 of file safe_any.hpp.

◆ operator=()

Any & BT::Any::operator= ( const Any other)
inline

Definition at line 304 of file safe_any.hpp.

◆ stringToNumber()

template<typename T >
nonstd::expected< T, std::string > BT::Any::stringToNumber
inlineprivate

Definition at line 387 of file safe_any.hpp.

◆ tryCast()

template<typename T >
nonstd::expected< T, std::string > BT::Any::tryCast
inline

Definition at line 479 of file safe_any.hpp.

◆ type()

const std::type_index& BT::Any::type ( ) const
inlinenoexcept

Definition at line 196 of file safe_any.hpp.

Member Data Documentation

◆ _any

linb::any BT::Any::_any
private

Definition at line 213 of file safe_any.hpp.

◆ _original_type

std::type_index BT::Any::_original_type
private

Definition at line 214 of file safe_any.hpp.


The documentation for this class was generated from the following file:


behaviortree_cpp_v4
Author(s): Davide Faconti
autogenerated on Fri Jun 28 2024 02:20:09