OTB  9.0.0
Orfeo Toolbox
Functions | Variables
otb::Utils Namespace Reference

Functions

template<typename T >
void ConvertStringToVector (std::string const &str, T &ret, std::string const &errmsg, const char *delims=" ")
 
template<class T >
std::string ConvertToString (const T &v)
 
bool OTBCommon_EXPORT IsLonLatValid (double lon, double lat)
 
template<typename Res , typename In >
Res LexicalCast (In const &in, std::string const &kind)
 
void OTBCommon_EXPORT PrintNothing (const char *s)
 
template<typename T >
void SplitStringToSingleKeyValue (const std::string &str, std::string &key, T &value, const T &defValue, std::string const &errmsg, const std::string delims="=")
 

Variables

OTBCommon_EXPORT const bool FalseConstant
 
OTBCommon_EXPORT const bool TrueConstant
 

Function Documentation

◆ ConvertStringToVector()

template<typename T >
void otb::Utils::ConvertStringToVector ( std::string const &  str,
T &  ret,
std::string const &  errmsg,
const char *  delims = " " 
)

Converts a delimiter separated string into a collection of T's.

Template Parameters
Collectiontype. It shall define value_type and push_back()
Parameters
[out]retoutput collection.
[in]strinput string
[in]errmsga msg complement used to build the error message to be shown if there is lexical_cast exception. See otb:Utils::LexicalCast().
delimsdelimiter characters (space is default)
Exceptions
std::bad_allocin case of exhausted memory
std::runtime_errorin case an element from the input string cannot be converted into a valid T instance.
Precondition
delims shall not be null (untested)
See also
otb::Utils::LexicalCast()

Definition at line 83 of file otbStringUtils.h.

Referenced by otb::ImageFileWriter< TImage >::GenerateOutputInformation(), and otb::MultiImageFileWriter::Sink< TImage >::GetRegionToWrite().

◆ ConvertToString()

template<class T >
std::string otb::Utils::ConvertToString ( const T &  v)
inline

Definition at line 47 of file otbUtils.h.

◆ IsLonLatValid()

bool OTBCommon_EXPORT otb::Utils::IsLonLatValid ( double  lon,
double  lat 
)

Check that the values for lon, lat are reasonable

◆ LexicalCast()

template<typename Res , typename In >
Res otb::Utils::LexicalCast ( In const &  in,
std::string const &  kind 
)
inline

Definition at line 52 of file otbStringUtils.h.

◆ PrintNothing()

void OTBCommon_EXPORT otb::Utils::PrintNothing ( const char *  s)

Function that prints nothing (useful to disable libsvm logs)

Referenced by otb::LibSVMMachineLearningModel< TInputValue, TTargetValue >::LibSVMMachineLearningModel().

◆ SplitStringToSingleKeyValue()

template<typename T >
void otb::Utils::SplitStringToSingleKeyValue ( const std::string &  str,
std::string &  key,
T &  value,
const T &  defValue,
std::string const &  errmsg,
const std::string  delims = "=" 
)

split a given std::string of into key value based on given delimiter string. The default delimiter is '='. If the string does not have a delimiter the key is set to input string and value is set to defValue.

Parameters
[in]strinput string
key[out]An std::string reference where key will be stored
value[out]a reference of \cT where value will be stored
defValue[in]a default value if there is no delimiter
[in]errmsga msg complement used to build the error message to be shown if there is lexical_cast exception. See \cotb:Utils::LexicalCast().
delimsdelimiter characters (space is default)
Exceptions
std::bad_allocin case of exhausted memory
std::runtime_errorin case an element from the input string cannot be converted into a valid T instance.
Precondition
delims shall not be null (untested)
See also
otb::Utils::LexicalCast()

Definition at line 117 of file otbStringUtils.h.

Variable Documentation

◆ FalseConstant

OTBCommon_EXPORT const bool otb::Utils::FalseConstant

◆ TrueConstant

OTBCommon_EXPORT const bool otb::Utils::TrueConstant