54 template <
typename... Args>
70 template <
typename... Args>
76 return (_unit.length() > 0 && _unit !=
"%")
77 ?
join(
"//", type::get_label(), _unit)
81 auto _extra =
join(
'/', std::forward<Args>(
_args)...);
82 auto _label = uppercase(type::get_label());
83 _unit =
replace(_unit,
"", {
" " });
87 auto _ret =
join(
"//", _label, _name);
89 if(
_ret.length() > 0 &&
_ret.at(
_ret.length() - 1) ==
'/')
92 if(_unit.length() > 0 && _unit !=
"%")
102 template <
typename Tuple,
typename... Args,
size_t... Nt,
110 template <
typename Tuple,
typename... Args,
size_t Idx,
size_t... Nt,
113 Tuple _units, Args&&...
_args,
116 return generate_name(
_prefix, std::get<Idx>(_units),
117 std::forward<Args>(
_args)...);
120 template <
typename Tuple,
typename... Args,
size_t Idx,
size_t... Nt,
123 Tuple _units, Args&&...
_args,
124 index_sequence<Idx, Nt...>)
128 name_generator<Tuple>(
_prefix, _units, std::forward<Args>(
_args)...,
129 index_sequence<Idx>{}),
130 name_generator<Tuple>(
_prefix, _units, std::forward<Args>(
_args)...,
131 index_sequence<Nt...>{}));
138 template <
typename Tuple,
typename... Args>
142 constexpr size_t N = std::tuple_size<Tuple>::value;
143 return impl::template name_generator<Tuple>(
150 template <
typename T,
typename... Alloc,
typename... Args>
152 std::vector<T, Alloc...> _unit,
156 for(
auto& itr : _unit)
158 return join(
",", ret,
159 generate_name(
_prefix, itr, std::forward<Args>(
_args)...));
167 template <
typename T,
size_t N,
typename... Args>
169 std::array<T, N> _unit, Args&&...
_args)
172 for(
auto& itr : _unit)
174 return join(
",", ret,
175 generate_name(
_prefix, itr, std::forward<Args>(
_args)...));
183 template <
typename Vt>
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";
199 template <
typename Vt,
typename... ExtraT>
202 const std::vector<Vt, ExtraT...>& value)
204 auto _default_name = attributes[
"name"];
206 for(
const auto& itr : value)
208 std::stringstream ss;
209 ss <<
"INDEX_" << i++ <<
" ";
210 attributes[
"name"] = ss.str() + _default_name;
211 generate_measurement(
os, attributes, itr);
218 template <
typename Lhs,
typename Rhs,
typename... ExtraT>
221 const std::pair<Lhs, Rhs>& value)
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;
231 generate_measurement(
os, attributes, value.first);
233 generate_measurement(
os, attributes, value.second);
246 static const strset_t repl_chars = {
"\t",
"\n",
"<",
">" };
247 for(
const auto& itr : hierarchy)
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;
264 template <
typename Up = Tp,
typename Vt =
typename Up::value_type,
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();
278 generate_measurement(ss, attributes, _data);
279 std::cout << ss.str() << std::flush;
285 template <
typename Up = Tp,
typename Vt =
typename Up::value_type,
292 auto prefix = generate_prefix(hierarchy);
293 auto _data = obj.get();
299 auto _labels = obj.label_array();
300 auto _dunits = obj.display_unit_array();
301 for(
auto& itr : _data)
303 string_t _extra = (idx < _labels.size()) ? _labels.at(idx) :
"";
304 string_t _dunit = (idx < _labels.size()) ? _dunits.at(idx) :
"";
306 attributes[
"name"] = generate_name(prefix, _dunit, _extra);
307 generate_measurement(ss, attributes, itr);
309 std::cout << ss.str() << std::flush;
312 template <
typename... Args,
typename Up = Tp,
typename Vt =
typename Up::value_type,
std::string & replace(std::string &_path, char _c, const char *_v)
const hash_alias_ptr_t hash_value_t std::string *& _ret
This operation class echoes DartMeasurements for a CDash dashboard.
auto join(const char *sep, Arg &&arg, Args &&... args)
std::make_integer_sequence< size_t, Num > make_index_sequence
Alias template make_index_sequence.
std::array< char *, 4 > _args
char const std::string & _prefix
typename std::enable_if< B, T >::type enable_if_t
Alias template for enable_if.
tim::mpl::apply< std::string > string
const std::string std::ostream * os
std::integer_sequence< size_t, Idx... > index_sequence
Alias template index_sequence.
The declaration for the types for operations without definitions.
Include the macros for operations.
Declare the operations types.
common string manipulation utilities
std::vector< string_t > strvec_t
std::set< string_t > strset_t
std::stringstream stringstream_t
std::map< string_t, string_t > attributes_t
echo_measurement(Args &&...)
static void generate_measurement(std::ostream &os, const attributes_t &attributes, const Vt &value)
generate a measurement tag
echo_measurement(Up &obj, const strvec_t &hierarchy)
assumes type is not a iterable
static string_t generate_name(const string_t &_prefix, std::array< T, N > _unit, Args &&... _args)
generate a name attribute
static void generate_measurement(std::ostream &os, attributes_t attributes, const std::pair< Lhs, Rhs > &value)
generate a measurement tag
static string_t generate_prefix(const strvec_t &hierarchy)
generate the prefix
static void generate_measurement(std::ostream &os, attributes_t attributes, const std::vector< Vt, ExtraT... > &value)
generate a measurement tag
static string_t generate_name(const string_t &_prefix, Tuple _unit, Args &&... _args)
generate a name attribute
echo_measurement(Up &, Args &&...)
static string_t generate_name(const string_t &_prefix, std::vector< T, Alloc... > _unit, Args &&... _args)
generate a name attribute
static string_t generate_name(const string_t &_prefix, string_t _unit, Args &&... _args)
generate a name attribute
trait that signifies that data is an array type
trait that signifies that get() returns an iterable type