32#include <initializer_list>
58 TIMEMORY_VISIBILITY(
"default");
60template <
typename... Types>
72template <
typename Arg,
typename... Args>
74join(
const char* sep, Arg&& arg, Args&&... args)
77 ss << std::forward<Arg>(arg);
79 ::std::initializer_list<int>{ (ss << sep << std::forward<Args>(args), 0)... });
89 if(std::is_same<typename Tp::value_type, void>::value)
104 _prefix = Tp::get_description();
109 auto _label = demangle<Tp>();
123template <
typename... Types>
135template <
typename... Types>
141template <
typename... Types>
151template <
typename... Types>
168 auto lowercase = [](
string_t _str) {
169 for(
auto& itr : _str)
174 auto contains = [&lowercase](
const string_t& str,
const std::set<string_t>& items) {
175 auto lstr = lowercase(str);
176 return std::any_of(items.begin(), items.end(), [&lstr](
const auto& itr) {
177 return lstr.find(itr) != string_t::npos;
181 auto is_numeric = [](
const string_t& str) ->
bool {
182 return (str.find_first_not_of(
"0123456789.e+-*/") == string_t::npos);
185 if(attributes.find(
"name") == attributes.end())
187 auto name = filepath;
188 if(name.find(
'/') != string_t::npos)
189 name = name.substr(name.find_last_of(
'/') + 1);
190 if(name.find(
'\\') != string_t::npos)
191 name = name.substr(name.find_last_of(
'\\') + 1);
192 if(name.find(
'.') != string_t::npos)
193 name.erase(name.find_last_of(
'.'));
194 attributes[
"name"] = name;
197 if(attributes.find(
"type") == attributes.end())
199 if(contains(filepath, {
".jpeg",
".jpg" }))
201 attributes[
"type"] =
"image/jpeg";
203 else if(contains(filepath, {
".png" }))
205 attributes[
"type"] =
"image/png";
207 else if(contains(filepath, {
".tiff",
".tif" }))
209 attributes[
"type"] =
"image/tiff";
211 else if(contains(filepath, {
".txt" }))
213 bool numeric_file =
true;
224 if(!is_numeric(
entry))
226 numeric_file =
false;
234 attributes[
"type"] =
"numeric/double";
238 attributes[
"type"] =
"text/string";
243 std::stringstream ss;
244 ss <<
"<DartMeasurementFile";
245 for(
const auto& itr : attributes)
246 ss <<
" " << attribute_string(itr.first, itr.second);
247 ss <<
">" << filepath <<
"</DartMeasurementFile>";
248 std::cout << ss.str() << std::endl;
typename std::enable_if< B, T >::type enable_if_t
auto join(const char *sep, Arg &&arg, Args &&... args)
void plot(string_t _prefix, const string_t &_dir, bool _echo_dart, string_t _json_file)
const string_t const string_t bool const string_t & _json_file
const string_t const string_t & _dir
void echo_dart_file(const string_t &filepath, attributes_t attributes)
const string_t const string_t bool _echo_dart
void plot(const std::string &_label, const std::string &_prefix, const std::string &_dir, bool _echo_dart, const std::string &_json_file)
std::map< string_t, string_t > attributes_t
tim::mpl::apply< std::string > string
void consume_parameters(ArgsT &&...)
static string_t compose_output_filename(string_t _tag, string_t _ext, bool _use_suffix=use_output_suffix(), int32_t _suffix=default_process_suffix(), bool _make_dir=false, std::string _explicit={})
trait that designates a type should always print a JSON output
#define TIMEMORY_FOLD_EXPRESSION(...)