OTB  9.0.0
Orfeo Toolbox
Namespaces | Classes | Functions
otb::details Namespace Reference

Namespaces

 policy
 

Classes

class  generic_layout
 

Functions

template<std::vcl_size_t N>
std::vcl_size_t len (char const (&)[N])
 
std::vcl_size_t len (char const *ptr)
 
std::vcl_size_t len (char)
 
template<typename String >
std::vcl_size_t len (String const &s)
 
template<std::ptrdiff_t ... StaticExtents>
constexpr std::vcl_size_t rank_dynamic () noexcept
 
template<typename Int >
Int to_integer (string_view const &v, Int const def)
 
template<typename Int >
Int to_integer (string_view const &v, string_view const &context)
 
template<typename Int >
Int to_uinteger (string_view const &v, Int const def)
 
template<typename Int >
Int to_uinteger (string_view const &v, string_view const &context)
 

Function Documentation

◆ decode_uint()

unsigned int otb::details::decode_uint ( string_view v)
inline

Internal generic string to float conversion (w/ exception). Tries to convert the input string into a floating point type. If the string doesn't represent a floating point value, an exception is thrown.

Template Parameters
FloatTypefloating point type (float, double, long double)
Parameters
[in]vinput string
[in]contextcontext message for the exception thrown
Returns
The string as a float. The special "nan" string is converted to ossim::nan().
Exceptions
std::runtime_erroris the number cannot be converted.

Definition at line 770 of file otbStringUtilities.h.

References otb::string_view::empty(), otb::string_view::front(), and otb::string_view::remove_prefix().

◆ len() [1/4]

template<std::vcl_size_t N>
std::vcl_size_t otb::details::len ( char   const(&)[N])
inline

Definition at line 422 of file otbStringUtilities.h.

◆ len() [2/4]

std::vcl_size_t otb::details::len ( char const *  ptr)
inline

Definition at line 424 of file otbStringUtilities.h.

◆ len() [3/4]

std::vcl_size_t otb::details::len ( char  )
inline

◆ len() [4/4]

template<typename String >
std::vcl_size_t otb::details::len ( String const &  s)
inline

Definition at line 425 of file otbStringUtilities.h.

◆ rank_dynamic()

template<std::ptrdiff_t ... StaticExtents>
constexpr std::vcl_size_t otb::details::rank_dynamic ( )
constexprnoexcept

◆ to_float() [1/2]

template<typename FloatType >
FloatType otb::details::to_float ( string_view const &  v,
FloatType const  def 
)
inline

Internal generic string to float conversion (w/o exception). Tries to convert the input string into a floating point type. If the string doesn't represent a floating point value, the default value will be returned.

Template Parameters
FloatTypefloating point type (float, double, long double)
Parameters
[in]vinput string
[in]defdefault value returned in the conversion isn't possible
Returns
The string as a float. The special "nan" string is converted to ossim::nan().
def if the string cannot be converted to a floating point value.
Exceptions
None

Definition at line 754 of file otbStringUtilities.h.

References otb::contains(), and otb::string_view::empty().

◆ to_float() [2/2]

template<typename FloatType >
FloatType otb::details::to_float ( string_view const &  v,
string_view const &  context 
)
inline

Internal generic string to float conversion (w/ exception). Tries to convert the input string into a floating point type. If the string doesn't represent a floating point value, an exception is thrown.

Template Parameters
FloatTypefloating point type (float, double, long double)
Parameters
[in]vinput string
[in]contextcontext message for the exception thrown
Returns
The string as a float. The special "nan" string is converted to ossim::nan().
Exceptions
std::runtime_erroris the number cannot be converted.

Definition at line 723 of file otbStringUtilities.h.

References otb::contains(), and otb::string_view::empty().

◆ to_integer() [1/2]

template<typename Int >
Int otb::details::to_integer ( string_view const &  v,
Int const  def 
)
inline

Internal generic string to integer conversion (w/o exception). Tries to convert the input string into a integer type. If the string doesn't represent an integer value, the default value will be returned.

Template Parameters
IntIntegral type (In a perfect world, we'd used enable_if & co to restrict the code to integral types)
Parameters
[in]vinput string
[in]defdefault value returned in the conversion isn't possible
Returns
The string as an integer.
def if the string cannot be converted to an integer value.
Exceptions
None

Definition at line 617 of file otbStringUtilities.h.

References otb::string_view::begin(), and otb::string_view::end().

◆ to_integer() [2/2]

template<typename Int >
Int otb::details::to_integer ( string_view const &  v,
string_view const &  context 
)
inline

Internal generic string to integer conversion (w/ exception). Tries to convert the input string into a integer type. If the string doesn't represent an integer value, an exception is thrown.

Template Parameters
IntIntegral type (In a perfect world, we'd used enable_if & co to restrict the code to integral types)
Parameters
[in]vinput string
[in]contextcontext message for the exception thrown
Returns
The string as an integer.
Exceptions
std::runtime_erroris the number cannot be converted.
Todo:
Use a failure_policy in order to factorize code flavour (returns default value or throw an exception)

Definition at line 576 of file otbStringUtilities.h.

References otb::string_view::begin(), otb::string_view::end(), and OTB_FALLTHROUGH.

◆ to_uinteger() [1/2]

template<typename Int >
Int otb::details::to_uinteger ( string_view const &  v,
Int const  def 
)
inline

Internal generic string to unsigned integer conversion (w/o exception). Tries to convert the input string into a integer type. If the string doesn't represent an integer value, the default value will be returned.

Template Parameters
IntIntegral type (In a perfect world, we'd used enable_if & co to restrict the code to integral types)
Parameters
[in]vinput string
[in]defdefault value returned in the conversion isn't possible
Returns
The string as an integer.
def if the string cannot be converted to an integer value.
Exceptions
None

Definition at line 690 of file otbStringUtilities.h.

References otb::string_view::begin(), and otb::string_view::end().

◆ to_uinteger() [2/2]

template<typename Int >
Int otb::details::to_uinteger ( string_view const &  v,
string_view const &  context 
)
inline

Internal generic string to unsigned integer conversion (w/ exception). Tries to convert the input string into a integer type. If the string doesn't represent an integer value, an exception is thrown.

Template Parameters
IntIntegral type (In a perfect world, we'd used enable_if & co to restrict the code to integral types)
Parameters
[in]vinput string
[in]contextcontext message for the exception thrown
Returns
The string as an integer.
Exceptions
std::runtime_erroris the number cannot be converted.

Definition at line 655 of file otbStringUtilities.h.

References otb::string_view::begin(), and otb::string_view::end().