aGrUM 3.0.0
a C++ library for (probabilistic) graphical models
Utilities

About aGrUM utilities. More...

Collaboration diagram for Utilities:

Topics

 Math
 All the maths you'll need.
 Configuration
 About aGrUM configuration.
 Smart Pointers
 RefPtr are a replacement for the usual pointers: they keep track of the number of "smart" pointers pointing to a given element.
template<typename T1, typename T2>
using gum::forbidden_type = typename std::enable_if< !std::is_same< T1, T2 >::value, int >::type
 Forbidden_type<T1,T2> return the "int" type if T1 and T2 are of the same type, else nothing.
bool gum::Memcmp (const void *const in_, const void *const out_, unsigned long size)
 Cross-platform replacement for memcmp.
void gum::_atexit_ ()
 Used for debug purpose.
template<typename T1, typename T2>
ostream & std::operator<< (ostream &stream, const pair< T1, T2 > &val)
 'std::cout<<' operator for pairs.
template<typename T0, typename... T>
std::ostream & std::operator<< (std::ostream &os, const std::tuple< T0, T... > &t)
 'std::cout<<' operator for vectors.
template<typename T>
ostream & std::operator<< (ostream &stream, const vector< T > &val)
 'std::cout<<' operator for vectors.
template<typename T>
bool std::hasUniqueElts (std::vector< T > const &x)
 

Idx gum::randomValue (const Size max=2)
 Returns a random Idx between 0 and max-1 included.
double gum::randomProba ()
 Returns a random double between 0 and 1 included (i.e.
template<GUM_Numeric GUM_SCALAR>
std::vector< GUM_SCALAR > gum::randomDistribution (Size n)
 Return a random discrete distribution.
unsigned int gum::randomGeneratorSeed ()
 Returns the aGrUM's seed used by the std::generators.
unsigned int gum::currentRandomGeneratorValue ()
 returns the current generator's value
void gum::initRandom (unsigned int seed=0)
 Initialize random generator seed.
std::mt19937 & gum::randomGenerator ()
 define a random_engine with correct seed
std::string gum::getUniqueFileName ()
 Returns a path to a unique file name.
bool gum::endsWith (const std::string_view &value, const std::string_view &ending)
 Returns true if value ends with ending.
std::vector< std::string > gum::split (std::string_view orig, std::string_view delimiter)
 Split str using the delimiter.
std::string gum::replace (std::string_view s, std::string_view val, std::string_view new_val)
 Replace val by new_val in s.
bool gum::isIntegerWithResult (std::string_view val, int *res)
 return true is a string contains an integer value
bool gum::isNumericalWithResult (std::string_view val, double *res)
 return true is a string contains a numerical (double) value
std::string gum::toLower (std::string_view str)
 Returns the lowercase version of str.
bool gum::contains (std::string_view s, std::string_view needle)
 true if needle in s
bool gum::isInteger (std::string_view val)
 return true is a string contains an integer value
bool gum::isNumerical (std::string_view val)
 return true is a string contains a numerical (double) value
void gum::ltrim (std::string &s)
 trim from start (in place)
void gum::rtrim (std::string &s)
 trim from end (in place)
void gum::trim (std::string &s)
 trim from both ends (in place)
std::string gum::trim_copy (std::string_view s)
 trim from both ends (copying)
std::string gum::remove_newline (std::string_view s)
 remove all newlines in a string
template<typename T>
std::string gum::compact_tostr (T value)
 Returns a path to a unique file name.

Detailed Description

About aGrUM utilities.

Typedef Documentation

◆ forbidden_type

template<typename T1, typename T2>
using gum::forbidden_type = typename std::enable_if< !std::is_same< T1, T2 >::value, int >::type

Forbidden_type<T1,T2> return the "int" type if T1 and T2 are of the same type, else nothing.

Use it as a guard in template specification :

// Creates a template except if T is int or char
template<T,forbidden_type<T,int> =0,forbidden_type<T,char> =0> // ...
Parameters
T1The type to test for.
T2The expected type.

Definition at line 143 of file utils_misc.h.

Function Documentation

◆ _atexit_()

void gum::_atexit_ ( )

Used for debug purpose.

Definition at line 67 of file utils_misc.cpp.

67 {
68#ifdef GUM_DEBUG_MODE
69 gum::__debug__::_atexit_();
70#endif
71 }

◆ compact_tostr()

template<typename T>
std::string gum::compact_tostr ( T value)

Returns a path to a unique file name.

Returns
Returns a path to a unique file name.

Definition at line 51 of file utils_string_tpl.h.

51 {
52 std::ostringstream s;
53 s.precision(7);
54 s << value;
55 return s.str();
56 }

◆ contains()

INLINE bool gum::contains ( std::string_view s,
std::string_view needle )

true if needle in s

Parameters
s
needle*
Returns

Definition at line 67 of file utils_string_inl.h.

67 {
68 return s.find(needle) != std::string_view::npos;
69 }

Referenced by gum::MonteCarloSampling< GUM_SCALAR >::draw_(), gum::WeightedSampling< GUM_SCALAR >::draw_(), gum::Set< const gum::Observation * >::hashMap(), gum::Set< Key >::insert(), gum::Tensor< GUM_SCALAR >::KL(), gum::MarginalTargetedInference< GUM_SCALAR >::posterior(), gum::MarginalTargetedMRFInference< GUM_SCALAR >::posterior(), gum::Tensor< GUM_SCALAR >::putFirst(), gum::Tensor< GUM_SCALAR >::reorganize(), and gum::CausalModel< GUM_SCALAR >::toDot().

Here is the caller graph for this function:

◆ currentRandomGeneratorValue()

INLINE unsigned int gum::currentRandomGeneratorValue ( )

returns the current generator's value

Definition at line 87 of file utils_random_inl.h.

87{ return _rand_namespace_::generator()(); }
std::mt19937 & generator()

References gum::_rand_namespace_::generator().

Here is the call graph for this function:

◆ endsWith()

bool gum::endsWith ( const std::string_view & value,
const std::string_view & ending )

Returns true if value ends with ending.

Returns
Returns true if value ends with ending.

Definition at line 82 of file utils_string.cpp.

82 {
83 if (ending.size() > value.size()) return false;
84 return std::equal(ending.rbegin(), ending.rend(), value.rbegin());
85 }

Referenced by gum::prm::o3prm::O3NameSolver< GUM_SCALAR >::resolveClass(), gum::prm::o3prm::O3NameSolver< GUM_SCALAR >::resolveClassElement(), gum::prm::o3prm::O3NameSolver< GUM_SCALAR >::resolveInterface(), gum::prm::o3prm::O3NameSolver< GUM_SCALAR >::resolveSlotType(), and gum::prm::o3prm::O3NameSolver< GUM_SCALAR >::resolveType().

Here is the caller graph for this function:

◆ getUniqueFileName()

std::string gum::getUniqueFileName ( )

Returns a path to a unique file name.

Returns
Returns a path to a unique file name.

Definition at line 62 of file utils_string.cpp.

62 {
63 // Get the temporary directory path
64 std::filesystem::path temp_dir = std::filesystem::temp_directory_path();
65
66 // Generate a unique file name using a timestamp and a random number
67 auto now = std::chrono::system_clock::now();
68 auto timestamp
69 = std::chrono::duration_cast< std::chrono::milliseconds >(now.time_since_epoch()).count();
70
71 auto dis = gum::randomValue(1000);
72
73 std::string filename
74 = "tempfile_" + std::to_string(timestamp) + "_" + std::to_string(dis) + ".tmp";
75
76 // Combine the directory path and the file name
77 std::filesystem::path temp_file_path = temp_dir / filename;
78
79 return temp_file_path.string();
80 }
Idx randomValue(const Size max=2)
Returns a random Idx between 0 and max-1 included.

References randomValue().

Referenced by gum::credal::CredalNet< GUM_SCALAR >::_H2Vlrs_().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hasUniqueElts()

template<typename T>
bool std::hasUniqueElts ( std::vector< T > const & x)

check if a vector consists in unique values (no duplicate).

Template Parameters
TThe vector's elements type.
Parameters
xthe vector
Returns
Returns true if the vector has no duplicate.

Definition at line 109 of file utils_misc_tpl.h.

109 {
110 if (x.size() <= 1) return true;
111 if (x.size() == 2) return x[0] != x[1];
112
113 auto refless = [](T const* l, T const* r) { return *l < *r; };
114 auto refeq = [](T const* l, T const* r) { return *l == *r; };
115
116 std::vector< T const* > vp;
117 vp.reserve(x.size());
118 for (size_t i = 0; i < x.size(); ++i)
119 vp.push_back(&x[i]);
120 sort(vp.begin(), vp.end(), refless); // O(N log N)
121 // if no adjacent pair (vp_n,vp_n+1) has *vp_n == *vp_n+1
122 return std::adjacent_find(vp.begin(), vp.end(), refeq) == vp.end();
123 }

◆ initRandom()

INLINE void gum::initRandom ( unsigned int seed = 0)

Initialize random generator seed.

Definition at line 79 of file utils_random_inl.h.

79 {
80 if (seed == 0) seed = (unsigned int)std::chrono::system_clock::now().time_since_epoch().count();
81 std::seed_seq seq{seed + 1, seed + 2, seed + 3, seed + 4, seed + 5};
83 }

References gum::_rand_namespace_::generator().

Here is the call graph for this function:

◆ isInteger()

INLINE bool gum::isInteger ( std::string_view val)

return true is a string contains an integer value

Parameters
sA string
Returns
true if s exactly contains an int (s can start with "-" or "+")

Definition at line 99 of file utils_string_inl.h.

99{ return isIntegerWithResult(val, nullptr); }
bool isIntegerWithResult(std::string_view val, int *res)
return true is a string contains an integer value

References isIntegerWithResult().

Referenced by fastVariable().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isIntegerWithResult()

bool gum::isIntegerWithResult ( std::string_view val,
int * res )

return true is a string contains an integer value

Parameters
sA string
Returns
true if s exactly contains an int (s can start with "-" or "+")

Definition at line 112 of file utils_string.cpp.

112 {
113 if (val.empty()) return false;
114 std::size_t pos = 0;
115 if ((val[0] == '+') || (val[0] == '-')) { pos = 1; }
116 if (val.find_first_not_of("0123456789", pos) != std::string_view::npos) return false;
117
118 if (res != nullptr) {
119 // from_chars handles '-' natively but not '+'
120 const std::size_t from_pos = (val[0] == '+') ? 1 : 0;
121 std::from_chars(val.data() + from_pos, val.data() + val.size(), *res);
122 }
123 return true;
124 }

Referenced by isInteger().

Here is the caller graph for this function:

◆ isNumerical()

INLINE bool gum::isNumerical ( std::string_view val)

return true is a string contains a numerical (double) value

Parameters
sA string
Returns
true if s exactly contains a double

Definition at line 102 of file utils_string_inl.h.

102{ return isNumericalWithResult(val, nullptr); }
bool isNumericalWithResult(std::string_view val, double *res)
return true is a string contains a numerical (double) value

References isNumericalWithResult().

Referenced by fastVariable(), and gum::Tensor< GUM_SCALAR >::variance().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isNumericalWithResult()

bool gum::isNumericalWithResult ( std::string_view val,
double * res )

return true is a string contains a numerical (double) value

Parameters
sA string *
Returns
true if s exactly contains a double

Definition at line 126 of file utils_string.cpp.

126 {
127 std::string s(val);
128 char* endptr = nullptr;
129 const char* str = s.c_str();
130 double d = std::strtod(str, &endptr);
131
132 if (*endptr != '\0' || endptr == str) return false;
133 if (res != nullptr) *res = d;
134
135 return true;
136 }

Referenced by isNumerical().

Here is the caller graph for this function:

◆ ltrim()

INLINE void gum::ltrim ( std::string & s)

trim from start (in place)

Parameters
sA string

Definition at line 72 of file utils_string_inl.h.

72 {
73 s.erase(s.begin(),
74 std::ranges::find_if_not(s, [](unsigned char ch) { return std::isspace(ch); }));
75 }

Referenced by trim().

Here is the caller graph for this function:

◆ Memcmp()

bool gum::Memcmp ( const void *const in_,
const void *const out_,
unsigned long size )

Cross-platform replacement for memcmp.

Parameters
in_A pointer to the block of memory to copy.
out_A pointer to the block of memory receiving copy.
sizeNumber of bytes to copy.
Returns
Returns true if OK.

Definition at line 57 of file utils_misc.cpp.

57 {
58 unsigned char* in = (unsigned char*)in_;
59 unsigned char* out = (unsigned char*)out_;
60
61 for (unsigned long i = 0; i < size; ++i)
62 if (*(in++) != *(out++)) return false;
63
64 return true;
65 }

◆ operator<<() [1/3]

template<typename T1, typename T2>
ostream & std::operator<< ( ostream & stream,
const pair< T1, T2 > & val )

'std::cout<<' operator for pairs.

Template Parameters
T1The pair's first's type.
T2The pair's second's type.
Parameters
streamThe stream to print to.
valThe pair to print to stream.
Returns
Returns stream.

Definition at line 79 of file utils_misc_tpl.h.

79 {
80 stream << "(" << val.first << "," << val.second << ")";
81 return stream;
82 }

◆ operator<<() [2/3]

template<typename T>
ostream & std::operator<< ( ostream & stream,
const vector< T > & val )

'std::cout<<' operator for vectors.

Template Parameters
TThe vector's elements type.
Parameters
streamThe stream to print to.
valThe std::vector to print to stream.
Returns
Returns stream.

Definition at line 63 of file utils_misc_tpl.h.

63 {
64 bool deja = false;
65 stream << "[";
66
67 for (const auto& v: val) {
68 if (deja) stream << " , ";
69 else deja = true;
70 stream << v;
71 }
72
73 stream << "]";
74
75 return stream;
76 }

◆ operator<<() [3/3]

template<typename T0, typename... T>
std::ostream & std::operator<< ( std::ostream & os,
const std::tuple< T0, T... > & t )

'std::cout<<' operator for vectors.

Parameters
streamThe stream to print to.
Template Parameters
tThe std::tuple
Parameters
valThe std::vector to print to stream.
Returns
Returns stream.

Definition at line 101 of file utils_misc_tpl.h.

101 {
102 char quote = (std::is_convertible< T0, std::string >::value) ? '"' : 0;
103 os << '(' << quote << std::get< 0 >(t) << quote;
105 return os << ')';
106 }
static std::enable_if<(N< sizeof...(T))>::type print(std::ostream &os, const std::tuple< T... > &t)

References std::_auxiliary_print_tuple_< N >::print().

Here is the call graph for this function:

◆ randomDistribution()

template<GUM_Numeric GUM_SCALAR>
std::vector< GUM_SCALAR > gum::randomDistribution ( Size n)

Return a random discrete distribution.

Parameters
nThe number of modalities for the ditribution.
Returns
Return a random discrete distribution.
Template Parameters
GUM_SCALARThe type used for representing probabilities.

Definition at line 57 of file utils_random_tpl.h.

57 {
58 if (n < 2) n = 2;
59
60 if (n == std::numeric_limits< Size >::max()) {
61 GUM_ERROR(OutOfBounds, "randomDistribution: n is too large (SIZE_MAX would overflow n+1)")
62 }
63
64 // using sort method for uniformly distributed distributions
65 // https://doi.org/10.1016/0377-2217(82)90161-8
66 std::vector< GUM_SCALAR > v(n + 1);
67 std::vector< GUM_SCALAR > res(n);
68 v[0] = (GUM_SCALAR)0.0;
69 v[n] = (GUM_SCALAR)1.0;
70 for (Idx i = 1; i < n; i++) {
71 v[i] = (GUM_SCALAR)randomProba();
72 }
73 std::sort(v.begin(), v.end());
74
75 for (Idx i = 0; i < n; i++) {
76 res[i] = v[i + 1] - v[i];
77 }
78
79 return res;
80 }
Exception : out of bound.
#define GUM_ERROR(type, msg)
Definition exceptions.h:76
Size Idx
Type for indexes.
Definition types.h:79
double randomProba()
Returns a random double between 0 and 1 included (i.e.

References GUM_ERROR, and randomProba().

Referenced by gum::Tensor< GUM_SCALAR >::randomCPT(), and gum::Tensor< GUM_SCALAR >::randomDistribution().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ randomGenerator()

INLINE std::mt19937 & gum::randomGenerator ( )

define a random_engine with correct seed

Definition at line 98 of file utils_random_inl.h.

References gum::_rand_namespace_::generator().

Referenced by gum::MultiDimFunctionGraphGenerator::_generateVarPos_(), gum::Dirichlet::operator()(), gum::Dirichlet::operator()(), and gum::learning::BNDatabaseGenerator< GUM_SCALAR >::setRandomVarOrder().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ randomGeneratorSeed()

INLINE unsigned int gum::randomGeneratorSeed ( )

Returns the aGrUM's seed used by the std::generators.

Returns
Returns the aGrUM's seed used by the std::generators.

Definition at line 91 of file utils_random_inl.h.

91 {
92 return (unsigned int)((GUM_RANDOMSEED == 0)
93 ? std::chrono::system_clock::now().time_since_epoch().count()
94 : GUM_RANDOMSEED);
95 }

◆ randomProba()

INLINE double gum::randomProba ( )

Returns a random double between 0 and 1 included (i.e.

a proba).

Returns
Returns a random double between 0 and 1 included (i.e. a proba).

Definition at line 73 of file utils_random_inl.h.

73 {
74 std::uniform_real_distribution uni_real(0.0, 1.0);
75 return uni_real(_rand_namespace_::generator());
76 }

References gum::_rand_namespace_::generator().

Referenced by gum::MultiDimFunctionGraphGenerator::_createLeaf_(), gum::prm::ClusteredLayerGenerator< GUM_SCALAR >::_generateClassDag_(), gum::prm::LayerGenerator< GUM_SCALAR >::_generateClassDag_(), gum::prm::ClusteredLayerGenerator< GUM_SCALAR >::_generateSystem_(), gum::prm::LayerGenerator< GUM_SCALAR >::_generateSystem_(), gum::MCBayesNetGenerator< GUM_SCALAR, SimpleCPTGenerator, SimpleCPTDisturber >::disturbReducCPT(), gum::Tensor< GUM_SCALAR >::draw(), gum::learning::BNDatabaseGenerator< GUM_SCALAR >::drawSamples(), gum::MultiDimFunctionGraphGenerator::generate(), gum::SimpleBayesNetGenerator< GUM_SCALAR, ICPTGenerator >::generateBN(), gum::InfluenceDiagramGenerator< GUM_SCALAR >::generateID(), gum::SimpleUTGenerator::generateUT(), gum::SimpleUTGenerator::generateUT(), gum::FMDPSimulator::perform(), gum::Tensor< GUM_SCALAR >::random(), randomDistribution(), and gum::E_GreedyDecider::stateOptimalPolicy().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ randomValue()

INLINE Idx gum::randomValue ( const Size max = 2)

Returns a random Idx between 0 and max-1 included.

Returns
Returns a random idx between 0 and max-1 included . By default, max=2

Definition at line 66 of file utils_random_inl.h.

66 {
67 if (max == 0) { GUM_ERROR(OutOfBounds, "randomValue: max must be > 0") }
68 std::uniform_int_distribution< Idx > uni_int(0, int(max) - 1);
69 return uni_int(_rand_namespace_::generator());
70 }

References gum::_rand_namespace_::generator(), and GUM_ERROR.

Referenced by gum::MCBayesNetGenerator< GUM_SCALAR, SimpleCPTGenerator, SimpleCPTDisturber >::MCBayesNetGenerator(), gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::_chooseCloseNodes_(), gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::_createPartTree_(), gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::_createTree_(), gum::prm::ClusteredLayerGenerator< GUM_SCALAR >::_generateClass_(), gum::prm::ClusteredLayerGenerator< GUM_SCALAR >::_generateClassDag_(), gum::prm::LayerGenerator< GUM_SCALAR >::_generateClassDag_(), gum::prm::LayerGenerator< GUM_SCALAR >::_generateClasses_(), gum::prm::ClusteredLayerGenerator< GUM_SCALAR >::_generateCluster_(), gum::prm::ClusteredLayerGenerator< GUM_SCALAR >::_generateSystem_(), gum::prm::LayerGenerator< GUM_SCALAR >::_generateSystem_(), gum::credal::CNMonteCarloSampling< GUM_SCALAR, BNInferenceEngine >::_verticesSampling_(), gum::IBayesNetGenerator< GUM_SCALAR, SimpleCPTGenerator >::fillCPT(), gum::MultiDimFunctionGraphGenerator::generate(), gum::MCBayesNetGenerator< GUM_SCALAR, SimpleCPTGenerator, SimpleCPTDisturber >::generateBN(), gum::SimpleBayesNetGenerator< GUM_SCALAR, ICPTGenerator >::generateBN(), gum::InfluenceDiagramGenerator< GUM_SCALAR >::generateID(), getUniqueFileName(), gum::credal::CNLoopyPropagation< GUM_SCALAR >::makeInferenceByRandomOrder_(), gum::GibbsOperator< GUM_SCALAR >::nextSample(), gum::AbstractSimulator::randomState_(), and gum::SDYNA::takeAction().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ remove_newline()

INLINE std::string gum::remove_newline ( std::string_view s)

remove all newlines in a string

Parameters
sA string
Returns
the new string with no newline

Definition at line 91 of file utils_string_inl.h.

91 {
92 std::string res{s};
93 std::erase(res, '\n');
94 std::erase(res, '\r');
95 return res;
96 }

Referenced by gum::BayesNet< GUM_SCALAR >::fastPrototype(), and gum::InfluenceDiagram< GUM_SCALAR >::fastPrototype().

Here is the caller graph for this function:

◆ replace()

std::string gum::replace ( std::string_view s,
std::string_view val,
std::string_view new_val )

Replace val by new_val in s.

Parameters
sA string.
valThe value to replace in s.
new_valThe new value to replace val in s.
Returns
A new string with val replaced by new_val.

Definition at line 100 of file utils_string.cpp.

100 {
101 std::string retVal(s);
102 auto pos = retVal.find(val);
103 while (pos != std::string::npos) {
104 std::stringstream sBuff;
105 sBuff << retVal.substr(0, pos) << new_val << retVal.substr(pos + val.size());
106 retVal = sBuff.str();
107 pos = retVal.find(val);
108 }
109 return retVal;
110 }

Referenced by gum::prm::o3prm::O3prmReader< GUM_SCALAR >::_clean_().

Here is the caller graph for this function:

◆ rtrim()

INLINE void gum::rtrim ( std::string & s)

trim from end (in place)

Parameters
sA string

Definition at line 78 of file utils_string_inl.h.

78 {
79 auto it = std::ranges::find_if_not(s | std::views::reverse,
80 [](unsigned char ch) { return std::isspace(ch); });
81 s.erase(it.base(), s.end());
82 }

Referenced by trim().

Here is the caller graph for this function:

◆ split()

std::vector< std::string > gum::split ( std::string_view orig,
std::string_view delimiter )

Split str using the delimiter.

Parameters
origsearched string
delimiterstring
Returns
Vector of splitted strings

Definition at line 87 of file utils_string.cpp.

87 {
88 std::vector< std::string > tokens;
89 size_t prev = 0, pos = 0;
90 do {
91 pos = str.find(delim, prev);
92 if (pos == std::string::npos) pos = str.length();
93 std::string token(str.substr(prev, pos - prev));
94 if (!token.empty()) tokens.push_back(token);
95 prev = pos + delim.length();
96 } while (pos < str.length() && prev < str.length());
97 return tokens;
98 }

Referenced by gum::BayesNet< GUM_SCALAR >::fastPrototype(), gum::InfluenceDiagram< GUM_SCALAR >::fastPrototype(), and fastVariable().

Here is the caller graph for this function:

◆ toLower()

INLINE std::string gum::toLower ( std::string_view str)

Returns the lowercase version of str.

Returns
Returns the lowercase version of str.

Definition at line 60 of file utils_string_inl.h.

60 {
61 std::string result{str};
62 std::ranges::transform(result, result.begin(), [](unsigned char c) { return std::tolower(c); });
63 return result;
64 }

Referenced by gum::AggregatorDecomposition< GUM_SCALAR >::addAggregator_(), and gum::prm::PRMAggregate< GUM_SCALAR >::str2enum().

Here is the caller graph for this function:

◆ trim()

INLINE void gum::trim ( std::string & s)

trim from both ends (in place)

Parameters
sA string

Definition at line 85 of file utils_string_inl.h.

85 {
86 ltrim(s);
87 rtrim(s);
88 }
void ltrim(std::string &s)
trim from start (in place)
void rtrim(std::string &s)
trim from end (in place)

References ltrim(), and rtrim().

Referenced by fastVariable(), and trim_copy().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ trim_copy()

INLINE std::string gum::trim_copy ( std::string_view s)

trim from both ends (copying)

Parameters
sA string
Returns
the new string trimmed from start

Definition at line 105 of file utils_string_inl.h.

105 {
106 std::string res{s};
107 trim(res);
108 return res;
109 }
void trim(std::string &s)
trim from both ends (in place)

References trim().

Here is the call graph for this function: