timemory 3.3.0
Modular C++ Toolkit for Performance Analysis and Logging. Profiling API and Tools for C, C++, CUDA, Fortran, and Python. The C++ template API is essentially a framework to creating tools: it is designed to provide a unifying interface for recording various performance measurements alongside data logging and interfaces to other tools.
tim::operation::echo_measurement< Tp, true > Struct Template Reference

#include "timemory/operations/types/echo_measurement.hpp"

+ Collaboration diagram for tim::operation::echo_measurement< Tp, true >:

Public Types

using type = Tp
 
using attributes_t = std::map< std::string, std::string >
 
using strset_t = std::set< string_t >
 
using stringstream_t = std::stringstream
 
using strvec_t = std::vector< string_t >
 
using sizevector_t = std::vector< size_t >
 

Public Member Functions

template<typename Up = Tp, typename Vt = typename Up::value_type, enable_if_t< is_enabled< Up >::value, char > = 0, enable_if_t<!(trait::array_serialization< Up >::value||trait::iterable_measurement< Up >::value), int > = 0>
 echo_measurement (Up &obj, const strvec_t &hierarchy)
 assumes type is not a iterable More...
 
template<typename Up = Tp, typename Vt = typename Up::value_type, enable_if_t< is_enabled< Up >::value, char > = 0, enable_if_t< trait::array_serialization< Up >::value||trait::iterable_measurement< Up >::value, int > = 0>
 echo_measurement (Up &obj, const strvec_t &hierarchy)
 assumes type is iterable More...
 
template<typename... Args, typename Up = Tp, typename Vt = typename Up::value_type, enable_if_t<!is_enabled< Up >::value, char > = 0>
 echo_measurement (Up &, Args &&...)
 

Static Public Member Functions

template<typename... Args>
static string_t generate_name (const string_t &_prefix, string_t _unit, Args &&... _args)
 generate a name attribute More...
 
template<typename Tuple , typename... Args>
static string_t generate_name (const string_t &_prefix, Tuple _unit, Args &&... _args)
 generate a name attribute More...
 
template<typename T , typename... Alloc, typename... Args>
static string_t generate_name (const string_t &_prefix, std::vector< T, Alloc... > _unit, Args &&... _args)
 generate a name attribute More...
 
template<typename T , size_t N, typename... Args>
static string_t generate_name (const string_t &_prefix, std::array< T, N > _unit, Args &&... _args)
 generate a name attribute More...
 
template<typename Vt >
static void generate_measurement (std::ostream &os, const attributes_t &attributes, const Vt &value)
 generate a measurement tag More...
 
template<typename Vt , typename... ExtraT>
static void generate_measurement (std::ostream &os, attributes_t attributes, const std::vector< Vt, ExtraT... > &value)
 generate a measurement tag More...
 
template<typename Lhs , typename Rhs , typename... ExtraT>
static void generate_measurement (std::ostream &os, attributes_t attributes, const std::pair< Lhs, Rhs > &value)
 generate a measurement tag More...
 
static string_t generate_prefix (const strvec_t &hierarchy)
 generate the prefix More...
 
template<typename Head , typename... Tail>
static constexpr bool not_string (enable_if_t< sizeof...(Tail)==0, int >=0)
 
template<typename Head , typename... Tail>
static constexpr bool not_string (enable_if_t< sizeof...(Tail) !=0, int >=0)
 
template<typename Head , typename... Tail>
static constexpr bool is_string (enable_if_t< sizeof...(Tail)==0, int >=0)
 
template<typename Head , typename... Tail>
static constexpr bool is_string (enable_if_t< sizeof...(Tail) !=0, int >=0)
 
template<typename Tp >
static size_t get_distance (const Tp &_data)
 
template<typename Tp , enable_if_t< std::is_arithmetic< Tp >::value, int > = 0>
static Tp get_entry (const Tp &_data, size_t)
 
template<typename Tp , enable_if_t<!std::is_arithmetic< Tp >::value, int > = 0>
static auto get_entry (const Tp &_data, size_t _idx) -> decltype(get_entry_sfinae_(_data, _idx))
 
template<typename Tp , size_t Idx>
static Tp get_entry (const Tp &_data, size_t)
 
template<typename Tp , typename Wp , typename Pp >
static void write (std::vector< std::stringstream * > &_os, std::ios_base::fmtflags _format, const Tp &_data, const Wp &_width, const Pp &_prec)
 
template<typename... Tp, size_t... Idx, typename Wp , typename Pp >
static void write (std::vector< std::stringstream * > &_os, std::ios_base::fmtflags _format, const std::tuple< Tp... > &_data, const Wp &_width, const Pp &_prec, index_sequence< Idx... >)
 
template<typename... Tp, typename Wp , typename Pp >
static void write (std::vector< std::stringstream * > &_os, std::ios_base::fmtflags _format, const std::tuple< Tp... > &_data, const Wp &_width, const Pp &_prec)
 
template<typename Tp >
static int64_t get_labels_size (const Tp &_data)
 
template<typename Tp >
static strvec_t get_labels (const Tp &_data)
 
template<typename T >
static strvec_t as_string_vec (const T &_data)
 
template<typename... T, size_t... Idx>
static strvec_t as_string_vec (const std::tuple< T... > &_obj, index_sequence< Idx... >)
 
template<typename... T>
static strvec_t as_string_vec (const std::tuple< T... > &_obj)
 
template<typename Tp >
static std::string as_string (const Tp &_obj)
 
template<typename Tp >
static strvec_t get_display_units (const Tp &_data)
 
template<typename Tp >
static sizevector_t get_widths (const Tp &_data)
 
static string_t attribute_string (const string_t &key, const string_t &item)
 generate an attribute More...
 
static string_t replace (string_t &item, const string_t &str, const strset_t &values)
 replace matching values in item with str More...
 
static string_t lowercase (string_t _str)
 convert to lowercase More...
 
static string_t uppercase (string_t _str)
 convert to uppercase More...
 
static bool contains (const string_t &str, const strset_t &items)
 check if str contains any of the string items More...
 
template<typename Tp , typename... Args>
static string_t join (Tp &&_delim, Args &&... _args)
 shorthand for apply<string_t>::join(...) More...
 
static bool is_empty (const std::string &obj)
 
template<typename Tp , typename... _Extra>
static bool is_empty (const std::vector< Tp, _Extra... > &obj)
 
template<template< typename... > class Tuple, typename... Tp>
static bool is_empty (const Tuple< Tp... > &obj)
 
template<bool EnabledV, typename Arg , enable_if_t< EnabledV, int > = 0>
static void print_tag (std::ostream &os, const Arg &_arg)
 
template<bool EnabledV, typename Arg , enable_if_t<!EnabledV, int > = 0>
static void print_tag (std::ostream &, const Arg &)
 

Detailed Description

template<typename Tp>
struct tim::operation::echo_measurement< Tp, true >

Definition at line 62 of file echo_measurement.hpp.

Member Typedef Documentation

◆ attributes_t

template<typename Tp >
using tim::operation::echo_measurement< Tp, true >::attributes_t = std::map<std::string, std::string>

Definition at line 65 of file echo_measurement.hpp.

◆ sizevector_t

using tim::operation::common_utils::sizevector_t = std::vector<size_t>
inherited

Definition at line 452 of file declaration.hpp.

◆ stringstream_t

using tim::operation::common_utils::stringstream_t = std::stringstream
inherited

Definition at line 198 of file declaration.hpp.

◆ strset_t

using tim::operation::common_utils::strset_t = std::set<string_t>
inherited

Definition at line 197 of file declaration.hpp.

◆ strvec_t

using tim::operation::common_utils::strvec_t = std::vector<string_t>
inherited

Definition at line 199 of file declaration.hpp.

◆ type

template<typename Tp >
using tim::operation::echo_measurement< Tp, true >::type = Tp

Definition at line 64 of file echo_measurement.hpp.

Constructor & Destructor Documentation

◆ echo_measurement() [1/3]

template<typename Tp >
template<typename Up = Tp, typename Vt = typename Up::value_type, enable_if_t< is_enabled< Up >::value, char > = 0, enable_if_t<!(trait::array_serialization< Up >::value||trait::iterable_measurement< Up >::value), int > = 0>
tim::operation::echo_measurement< Tp, true >::echo_measurement ( Up &  obj,
const strvec_t hierarchy 
)
inline

assumes type is not a iterable

Definition at line 269 of file echo_measurement.hpp.

270 {
271 auto prefix = generate_prefix(hierarchy);
272 auto _unit = type::get_display_unit();
273 auto name = generate_name(prefix, _unit);
274 auto _data = obj.get();
275
276 attributes_t attributes = { { "name", name } };
278 generate_measurement(ss, attributes, _data);
279 std::cout << ss.str() << std::flush;
280 }
std::stringstream stringstream_t
static void generate_measurement(std::ostream &os, const attributes_t &attributes, const Vt &value)
generate a measurement tag
static string_t generate_prefix(const strvec_t &hierarchy)
generate the prefix
std::map< std::string, std::string > attributes_t
static string_t generate_name(const string_t &_prefix, string_t _unit, Args &&... _args)
generate a name attribute

◆ echo_measurement() [2/3]

template<typename Tp >
template<typename Up = Tp, typename Vt = typename Up::value_type, enable_if_t< is_enabled< Up >::value, char > = 0, enable_if_t< trait::array_serialization< Up >::value||trait::iterable_measurement< Up >::value, int > = 0>
tim::operation::echo_measurement< Tp, true >::echo_measurement ( Up &  obj,
const strvec_t hierarchy 
)
inline

assumes type is iterable

Definition at line 290 of file echo_measurement.hpp.

291 {
292 auto prefix = generate_prefix(hierarchy);
293 auto _data = obj.get();
294
295 attributes_t attributes = {};
297
298 uint64_t idx = 0;
299 auto _labels = obj.label_array();
300 auto _dunits = obj.display_unit_array();
301 for(auto& itr : _data)
302 {
303 string_t _extra = (idx < _labels.size()) ? _labels.at(idx) : "";
304 string_t _dunit = (idx < _labels.size()) ? _dunits.at(idx) : "";
305 ++idx;
306 attributes["name"] = generate_name(prefix, _dunit, _extra);
307 generate_measurement(ss, attributes, itr);
308 }
309 std::cout << ss.str() << std::flush;
310 }
std::string string_t
Definition: library.cpp:57

◆ echo_measurement() [3/3]

template<typename Tp >
template<typename... Args, typename Up = Tp, typename Vt = typename Up::value_type, enable_if_t<!is_enabled< Up >::value, char > = 0>
tim::operation::echo_measurement< Tp, true >::echo_measurement ( Up &  ,
Args &&  ... 
)
inline

Definition at line 314 of file echo_measurement.hpp.

315 {}

Member Function Documentation

◆ as_string()

template<typename Tp >
static std::string tim::operation::common_utils::as_string ( const Tp &  _obj)
inlinestaticinherited

Definition at line 397 of file declaration.hpp.

398 {
399 std::stringstream ss;
400 ss << _obj;
401 return ss.str();
402 }

Referenced by tim::operation::common_utils::as_string_vec().

◆ as_string_vec() [1/3]

template<typename... T>
static strvec_t tim::operation::common_utils::as_string_vec ( const std::tuple< T... > &  _obj)
inlinestaticinherited

Definition at line 413 of file declaration.hpp.

414 {
415 constexpr size_t N = sizeof...(T);
416 return as_string_vec(_obj, make_index_sequence<N>{});
417 }
static strvec_t as_string_vec(const T &_data)

References tim::operation::common_utils::as_string_vec().

◆ as_string_vec() [2/3]

template<typename... T, size_t... Idx>
static strvec_t tim::operation::common_utils::as_string_vec ( const std::tuple< T... > &  _obj,
index_sequence< Idx... >   
)
inlinestaticinherited

Definition at line 405 of file declaration.hpp.

406 {
407 using init_list_type = std::initializer_list<std::string>;
408 auto&& ret = init_list_type{ (as_string(std::get<Idx>(_obj)))... };
409 return strvec_t(ret);
410 }
std::vector< string_t > strvec_t
static std::string as_string(const Tp &_obj)

References tim::operation::common_utils::as_string().

◆ as_string_vec() [3/3]

template<typename T >
static strvec_t tim::operation::common_utils::as_string_vec ( const T &  _data)
inlinestaticinherited

Definition at line 391 of file declaration.hpp.

392 {
393 return strvec_t{ _data };
394 }

Referenced by tim::operation::common_utils::as_string_vec().

◆ attribute_string()

static string_t tim::operation::common_utils::attribute_string ( const string_t key,
const string_t item 
)
inlinestaticinherited

generate an attribute

Definition at line 478 of file declaration.hpp.

479 {
480 return mpl::apply<string_t>::join("", key, "=", "\"", item, "\"");
481 }
static string_t join(SepT &&separator, Tuple &&__tup, index_sequence< Idx... >) noexcept
Definition: apply.hpp:408

References tim::mpl::apply< Ret >::join().

◆ contains()

static bool tim::operation::common_utils::contains ( const string_t str,
const strset_t items 
)
inlinestaticinherited

check if str contains any of the string items

Definition at line 519 of file declaration.hpp.

520 {
521 auto lstr = lowercase(str);
522 return std::any_of(items.begin(), items.end(), [&lstr](const auto& itr) {
523 return lstr.find(itr) != string_t::npos;
524 });
525 }
static string_t lowercase(string_t _str)
convert to lowercase

References tim::operation::common_utils::lowercase().

◆ generate_measurement() [1/3]

template<typename Tp >
template<typename Lhs , typename Rhs , typename... ExtraT>
static void tim::operation::echo_measurement< Tp, true >::generate_measurement ( std::ostream &  os,
attributes_t  attributes,
const std::pair< Lhs, Rhs > &  value 
)
inlinestatic

generate a measurement tag

Definition at line 219 of file echo_measurement.hpp.

222 {
223 auto default_name = attributes["name"];
224 auto set_name = [&](int i) {
225 std::stringstream ss;
226 ss << "INDEX_" << i << " ";
227 attributes["name"] = ss.str() + default_name;
228 };
229
230 set_name(0);
231 generate_measurement(os, attributes, value.first);
232 set_name(1);
233 generate_measurement(os, attributes, value.second);
234 }
const std::string std::ostream * os

References tim::os.

◆ generate_measurement() [2/3]

template<typename Tp >
template<typename Vt , typename... ExtraT>
static void tim::operation::echo_measurement< Tp, true >::generate_measurement ( std::ostream &  os,
attributes_t  attributes,
const std::vector< Vt, ExtraT... > &  value 
)
inlinestatic

generate a measurement tag

Definition at line 200 of file echo_measurement.hpp.

203 {
204 auto _default_name = attributes["name"];
205 int i = 0;
206 for(const auto& itr : value)
207 {
208 std::stringstream ss;
209 ss << "INDEX_" << i++ << " ";
210 attributes["name"] = ss.str() + _default_name;
211 generate_measurement(os, attributes, itr);
212 }
213 }

References tim::os.

◆ generate_measurement() [3/3]

template<typename Tp >
template<typename Vt >
static void tim::operation::echo_measurement< Tp, true >::generate_measurement ( std::ostream &  os,
const attributes_t attributes,
const Vt &  value 
)
inlinestatic

generate a measurement tag

Definition at line 184 of file echo_measurement.hpp.

187 {
188 os << "<DartMeasurement";
189 os << " " << attribute_string("type", "numeric/double");
190 for(const auto& itr : attributes)
191 os << " " << attribute_string(itr.first, itr.second);
192 os << ">" << std::setprecision(type::get_precision()) << value
193 << "</DartMeasurement>\n";
194 }
static string_t attribute_string(const string_t &key, const string_t &item)
generate an attribute

References tim::os.

◆ generate_name() [1/4]

template<typename Tp >
template<typename T , size_t N, typename... Args>
static string_t tim::operation::echo_measurement< Tp, true >::generate_name ( const string_t _prefix,
std::array< T, N >  _unit,
Args &&...  _args 
)
inlinestatic

generate a name attribute

Definition at line 168 of file echo_measurement.hpp.

170 {
171 string_t ret;
172 for(auto& itr : _unit)
173 {
174 return join(",", ret,
175 generate_name(_prefix, itr, std::forward<Args>(_args)...));
176 }
177 return ret;
178 }
std::array< char *, 4 > _args
char const std::string & _prefix
Definition: config.cpp:55
static string_t join(Tp &&_delim, Args &&... _args)
shorthand for apply<string_t>::join(...)

References tim::_args, tim::_prefix, and tim::plotting::operation::join().

◆ generate_name() [2/4]

template<typename Tp >
template<typename T , typename... Alloc, typename... Args>
static string_t tim::operation::echo_measurement< Tp, true >::generate_name ( const string_t _prefix,
std::vector< T, Alloc... >  _unit,
Args &&...  _args 
)
inlinestatic

generate a name attribute

Definition at line 151 of file echo_measurement.hpp.

154 {
155 string_t ret;
156 for(auto& itr : _unit)
157 {
158 return join(",", ret,
159 generate_name(_prefix, itr, std::forward<Args>(_args)...));
160 }
161 return ret;
162 }

References tim::_args, tim::_prefix, and tim::plotting::operation::join().

◆ generate_name() [3/4]

template<typename Tp >
template<typename... Args>
static string_t tim::operation::echo_measurement< Tp, true >::generate_name ( const string_t _prefix,
string_t  _unit,
Args &&...  _args 
)
inlinestatic

generate a name attribute

Definition at line 71 of file echo_measurement.hpp.

73 {
75 {
76 return (_unit.length() > 0 && _unit != "%")
77 ? join("//", type::get_label(), _unit)
78 : type::get_label();
79 }
80
81 auto _extra = join('/', std::forward<Args>(_args)...);
82 auto _label = uppercase(type::get_label());
83 _unit = replace(_unit, "", { " " });
84 string_t _name =
85 (_extra.length() > 0) ? join("//", _extra, _prefix) : join("//", _prefix);
86
87 auto _ret = join("//", _label, _name);
88
89 if(_ret.length() > 0 && _ret.at(_ret.length() - 1) == '/')
90 _ret.erase(_ret.length() - 1);
91
92 if(_unit.length() > 0 && _unit != "%")
93 _ret += "//" + _unit;
94
95 return _ret;
96 }
const hash_alias_ptr_t hash_value_t std::string *& _ret
Definition: definition.hpp:300
dart_label
Definition: settings.cpp:1671
static string_t uppercase(string_t _str)
convert to uppercase
static string_t replace(string_t &item, const string_t &str, const strset_t &values)
replace matching values in item with str

References tim::_args, tim::_prefix, tim::dart_label, tim::plotting::operation::join(), and tim::filepath::replace().

◆ generate_name() [4/4]

template<typename Tp >
template<typename Tuple , typename... Args>
static string_t tim::operation::echo_measurement< Tp, true >::generate_name ( const string_t _prefix,
Tuple  _unit,
Args &&...  _args 
)
inlinestatic

generate a name attribute

Definition at line 139 of file echo_measurement.hpp.

141 {
142 constexpr size_t N = std::tuple_size<Tuple>::value;
143 return impl::template name_generator<Tuple>(
144 _prefix, _unit, std::forward<Args>(_args)..., make_index_sequence<N>{});
145 }

References tim::_args, and tim::_prefix.

◆ generate_prefix()

template<typename Tp >
static string_t tim::operation::echo_measurement< Tp, true >::generate_prefix ( const strvec_t hierarchy)
inlinestatic

generate the prefix

Definition at line 239 of file echo_measurement.hpp.

240 {
242 return string_t("");
243
244 string_t ret_prefix{};
245 string_t add_prefix{};
246 static const strset_t repl_chars = { "\t", "\n", "<", ">" };
247 for(const auto& itr : hierarchy)
248 {
249 auto prefix = itr;
250 prefix = replace(prefix, "", { ">>>" });
251 prefix = replace(prefix, "", { "|_" });
252 prefix = replace(prefix, "_", repl_chars);
253 prefix = replace(prefix, "_", { "__" });
254 if(prefix.length() > 0 && prefix.at(prefix.length() - 1) == '_')
255 prefix.erase(prefix.length() - 1);
256 ret_prefix += add_prefix + prefix;
257 }
258 return ret_prefix;
259 }
std::string string_t
Definition: utility.hpp:98
std::set< string_t > strset_t

References tim::dart_label, and tim::filepath::replace().

◆ get_display_units()

template<typename Tp >
static strvec_t tim::operation::common_utils::get_display_units ( const Tp &  _data)
inlinestaticinherited

Definition at line 421 of file declaration.hpp.

422 {
423 return get_display_units_sfinae(_data, 0, 0);
424 }

Referenced by tim::operation::print< Tp >::print().

◆ get_distance()

template<typename Tp >
static size_t tim::operation::common_utils::get_distance ( const Tp &  _data)
inlinestaticinherited

Definition at line 228 of file declaration.hpp.

229 {
230 return get_distance_sfinae(_data);
231 }

Referenced by tim::operation::common_utils::write().

◆ get_entry() [1/3]

template<typename Tp , enable_if_t<!std::is_arithmetic< Tp >::value, int > = 0>
static auto tim::operation::common_utils::get_entry ( const Tp &  _data,
size_t  _idx 
) -> decltype(get_entry_sfinae_(_data, _idx))
inlinestaticinherited

Definition at line 262 of file declaration.hpp.

264 {
265 return get_entry_sfinae_<Tp>(_data, _idx);
266 }

◆ get_entry() [2/3]

template<typename Tp , enable_if_t< std::is_arithmetic< Tp >::value, int > = 0>
static Tp tim::operation::common_utils::get_entry ( const Tp &  _data,
size_t   
)
inlinestaticinherited

Definition at line 256 of file declaration.hpp.

257 {
258 return _data;
259 }

◆ get_entry() [3/3]

template<typename Tp , size_t Idx>
static Tp tim::operation::common_utils::get_entry ( const Tp &  _data,
size_t   
)
inlinestaticinherited

Definition at line 269 of file declaration.hpp.

270 {
271 return _data;
272 }

◆ get_labels()

template<typename Tp >
static strvec_t tim::operation::common_utils::get_labels ( const Tp &  _data)
inlinestaticinherited

Definition at line 360 of file declaration.hpp.

361 {
362 return get_labels_sfinae(_data, 0, 0);
363 }

Referenced by tim::operation::print< Tp >::print(), and tim::operation::print_header< Tp >::print_header().

◆ get_labels_size()

template<typename Tp >
static int64_t tim::operation::common_utils::get_labels_size ( const Tp &  _data)
inlinestaticinherited

Definition at line 339 of file declaration.hpp.

340 {
341 return get_labels_size_sfinae(_data, 0);
342 }

◆ get_widths()

template<typename Tp >
static sizevector_t tim::operation::common_utils::get_widths ( const Tp &  _data)
inlinestaticinherited

Definition at line 455 of file declaration.hpp.

456 {
457 return get_widths_sfinae(_data, 0);
458 }

◆ is_empty() [1/3]

static bool tim::operation::common_utils::is_empty ( const std::string &  obj)
inlinestaticinherited

Definition at line 539 of file declaration.hpp.

539{ return obj.empty(); }

Referenced by tim::operation::common_utils::print_tag().

◆ is_empty() [2/3]

template<typename Tp , typename... _Extra>
static bool tim::operation::common_utils::is_empty ( const std::vector< Tp, _Extra... > &  obj)
inlinestaticinherited

Definition at line 544 of file declaration.hpp.

545 {
546 for(const auto& itr : obj)
547 {
548 if(!itr.empty())
549 return false;
550 }
551 return true;
552 }

◆ is_empty() [3/3]

template<template< typename... > class Tuple, typename... Tp>
static bool tim::operation::common_utils::is_empty ( const Tuple< Tp... > &  obj)
inlinestaticinherited

Definition at line 557 of file declaration.hpp.

558 {
559 using input_type = Tuple<Tp...>;
560 constexpr size_t N = sizeof...(Tp);
561 std::bitset<N> _bits;
563 _bits[index_of<Tp, input_type>::value] =
564 (std::get<index_of<Tp, input_type>::value>(obj).empty()));
565 return _bits.all();
566 }
std::tuple_element< N, std::tuple< Types... > >::type & get(tim::auto_bundle< Tag, Types... > &obj)
std::array< bool, scope_count > input_type
Definition: types.hpp:400
#define TIMEMORY_FOLD_EXPRESSION(...)
Definition: types.hpp:56

References std::get(), and TIMEMORY_FOLD_EXPRESSION.

◆ is_string() [1/2]

template<typename Head , typename... Tail>
static constexpr bool tim::operation::common_utils::is_string ( enable_if_t< sizeof...(Tail) !=0, int >  = 0)
inlinestaticconstexprinherited

Definition at line 221 of file declaration.hpp.

222 {
223 return std::is_same<decay_t<Head>, std::string>::value && is_string<Tail...>();
224 }
tim::mpl::apply< std::string > string
Definition: macros.hpp:53
static constexpr bool is_string(enable_if_t< sizeof...(Tail)==0, int >=0)

References tim::operation::common_utils::is_string().

◆ is_string() [2/2]

template<typename Head , typename... Tail>
static constexpr bool tim::operation::common_utils::is_string ( enable_if_t< sizeof...(Tail)==0, int >  = 0)
inlinestaticconstexprinherited

Definition at line 215 of file declaration.hpp.

216 {
217 return std::is_same<decay_t<Head>, std::string>::value;
218 }

Referenced by tim::operation::common_utils::is_string().

◆ join()

template<typename Tp , typename... Args>
static string_t tim::operation::common_utils::join ( Tp &&  _delim,
Args &&...  _args 
)
inlinestaticinherited

shorthand for apply<string_t>::join(...)

Definition at line 531 of file declaration.hpp.

532 {
533 return mpl::apply<string_t>::join(std::forward<Tp>(_delim),
534 std::forward<Args>(_args)...);
535 }

References tim::_args, and tim::mpl::apply< Ret >::join().

◆ lowercase()

static string_t tim::operation::common_utils::lowercase ( string_t  _str)
inlinestaticinherited

convert to lowercase

Definition at line 499 of file declaration.hpp.

500 {
501 for(auto& itr : _str)
502 itr = tolower(itr);
503 return _str;
504 }

Referenced by tim::operation::common_utils::contains().

◆ not_string() [1/2]

template<typename Head , typename... Tail>
static constexpr bool tim::operation::common_utils::not_string ( enable_if_t< sizeof...(Tail) !=0, int >  = 0)
inlinestaticconstexprinherited

Definition at line 209 of file declaration.hpp.

210 {
211 return !std::is_same<decay_t<Head>, std::string>::value && not_string<Tail...>();
212 }
static constexpr bool not_string(enable_if_t< sizeof...(Tail)==0, int >=0)

References tim::operation::common_utils::not_string().

◆ not_string() [2/2]

template<typename Head , typename... Tail>
static constexpr bool tim::operation::common_utils::not_string ( enable_if_t< sizeof...(Tail)==0, int >  = 0)
inlinestaticconstexprinherited

Definition at line 203 of file declaration.hpp.

204 {
205 return !std::is_same<decay_t<Head>, std::string>::value;
206 }

Referenced by tim::operation::common_utils::not_string().

◆ print_tag() [1/2]

template<bool EnabledV, typename Arg , enable_if_t<!EnabledV, int > = 0>
static void tim::operation::common_utils::print_tag ( std::ostream &  ,
const Arg &   
)
inlinestaticinherited

Definition at line 580 of file declaration.hpp.

581 {}

◆ print_tag() [2/2]

template<bool EnabledV, typename Arg , enable_if_t< EnabledV, int > = 0>
static void tim::operation::common_utils::print_tag ( std::ostream &  os,
const Arg &  _arg 
)
inlinestaticinherited

Definition at line 571 of file declaration.hpp.

572 {
573 if(!is_empty(_arg))
574 os << " " << _arg;
575 }
static bool is_empty(const std::string &obj)

References tim::operation::common_utils::is_empty(), and tim::os.

◆ replace()

static string_t tim::operation::common_utils::replace ( string_t item,
const string_t str,
const strset_t values 
)
inlinestaticinherited

replace matching values in item with str

Definition at line 486 of file declaration.hpp.

487 {
488 for(const auto& itr : values)
489 {
490 while(item.find(itr) != string_t::npos)
491 item = item.replace(item.find(itr), itr.length(), str);
492 }
493 return item;
494 }

◆ uppercase()

static string_t tim::operation::common_utils::uppercase ( string_t  _str)
inlinestaticinherited

convert to uppercase

Definition at line 509 of file declaration.hpp.

510 {
511 for(auto& itr : _str)
512 itr = toupper(itr);
513 return _str;
514 }

◆ write() [1/3]

template<typename... Tp, typename Wp , typename Pp >
static void tim::operation::common_utils::write ( std::vector< std::stringstream * > &  _os,
std::ios_base::fmtflags  _format,
const std::tuple< Tp... > &  _data,
const Wp &  _width,
const Pp &  _prec 
)
inlinestaticinherited

Definition at line 329 of file declaration.hpp.

332 {
333 constexpr size_t N = sizeof...(Tp);
334 write(_os, _format, _data, _width, _prec, make_index_sequence<N>{});
335 }
static void write(std::vector< std::stringstream * > &_os, std::ios_base::fmtflags _format, const Tp &_data, const Wp &_width, const Pp &_prec)

References tim::operation::common_utils::write().

◆ write() [2/3]

template<typename... Tp, size_t... Idx, typename Wp , typename Pp >
static void tim::operation::common_utils::write ( std::vector< std::stringstream * > &  _os,
std::ios_base::fmtflags  _format,
const std::tuple< Tp... > &  _data,
const Wp &  _width,
const Pp &  _prec,
index_sequence< Idx... >   
)
inlinestaticinherited

Definition at line 320 of file declaration.hpp.

323 {
325 write(_os, _format, std::get<Idx>(_data), _width, _prec));
326 }

References TIMEMORY_FOLD_EXPRESSION, and tim::operation::common_utils::write().

◆ write() [3/3]

template<typename Tp , typename Wp , typename Pp >
static void tim::operation::common_utils::write ( std::vector< std::stringstream * > &  _os,
std::ios_base::fmtflags  _format,
const Tp &  _data,
const Wp &  _width,
const Pp &  _prec 
)
inlinestaticinherited

Definition at line 301 of file declaration.hpp.

304 {
305 size_t num_data = get_distance(_data);
306
307 for(size_t i = 0; i < num_data; ++i)
308 {
309 auto _idata = get_entry<Tp>(_data, i);
310 auto _iwidth = get_entry<Wp>(_width, i);
311 auto _iprec = get_entry<Pp>(_prec, i);
312 auto* ss = new std::stringstream;
313 ss->setf(_format);
314 (*ss) << std::setw(_iwidth) << std::setprecision(_iprec) << _idata;
315 _os.emplace_back(ss);
316 }
317 }
static size_t get_distance(const Tp &_data)

References tim::operation::common_utils::get_distance().

Referenced by tim::operation::common_utils::write().


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