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::lightweight_tuple< Types > Class Template Reference

This is a variadic component wrapper which provides the least amount of runtime and compilation overhead. More...

#include "timemory/variadic/lightweight_tuple.hpp"

+ Collaboration diagram for tim::lightweight_tuple< Types >:

Public Types

using captured_location_t = source_location::captured
 
using this_type = lightweight_tuple< Types... >
 
using type_list_type = type_list< Types... >
 
using data_type = typename bundle_type::data_type
 
using tuple_type = typename bundle_type::tuple_type
 
using sample_type = typename bundle_type::sample_type
 
using reference_type = typename bundle_type::reference_type
 
using user_bundle_types = typename bundle_type::user_bundle_types
 
using size_type = typename bundle_type::size_type
 
using string_t = typename bundle_type::string_t
 
template<template< typename > class Op, typename Tuple = impl_type>
using operation_t = typename bundle_type::template generic_operation< Op, Tuple >::type
 
template<template< typename > class Op, typename Tuple = impl_type>
using custom_operation_t = typename bundle_type::template custom_operation< Op, Tuple >::type
 
using auto_type = mpl::append_type_t< quirk::auto_start, this_type >
 
using component_type = mpl::remove_type_t< quirk::auto_start, this_type >
 
using type = convert_t< tuple_type, lightweight_tuple<> >
 
using initializer_type = std::function< void(this_type &)>
 
using transient_func_t = utility::transient_function< void(this_type &)>
 
template<typename T , typename... U>
using quirk_config = tim::variadic::impl::quirk_config< T, type_list< Types... >, U... >
 

Public Member Functions

 lightweight_tuple ()=default
 
template<typename... T>
 lightweight_tuple (const string_t &key, quirk::config< T... >={}, transient_func_t=get_initializer())
 
template<typename... T>
 lightweight_tuple (const captured_location_t &loc, quirk::config< T... >={}, transient_func_t=get_initializer())
 
template<typename... T>
 lightweight_tuple (size_t _hash, quirk::config< T... >={}, transient_func_t=get_initializer())
 
 lightweight_tuple (size_t _hash, scope::config _scope, transient_func_t=get_initializer())
 
 lightweight_tuple (const string_t &key, scope::config _scope, transient_func_t=get_initializer())
 
 lightweight_tuple (const captured_location_t &loc, scope::config _scope, transient_func_t=get_initializer())
 
 ~lightweight_tuple ()
 
 lightweight_tuple (const lightweight_tuple &)=default
 
 lightweight_tuple (lightweight_tuple &&)=default
 
lightweight_tupleoperator= (const lightweight_tuple &rhs)=default
 
lightweight_tupleoperator= (lightweight_tuple &&)=default
 
lightweight_tuple clone (bool store, scope::config _scope=scope::get_default())
 
this_typepush ()
 generic push into storage More...
 
this_typepop ()
 generic pop out of storage More...
 
template<typename... Tp>
this_typepush (mpl::piecewise_select< Tp... >)
 selective push More...
 
template<typename... Tp>
this_typepush (mpl::piecewise_ignore< Tp... >)
 selective push More...
 
template<typename... Tp>
this_typepop (mpl::piecewise_select< Tp... >)
 selective pop More...
 
template<typename... Tp>
this_typepop (mpl::piecewise_ignore< Tp... >)
 selective pop More...
 
template<typename... Args>
this_typestart (Args &&...)
 start all applicable components More...
 
template<typename... Tp, typename... Args>
this_typestart (mpl::piecewise_select< Tp... >, Args &&...)
 selective start More...
 
template<typename... Tp, typename... Args>
this_typestart (mpl::piecewise_ignore< Tp... >, Args &&...)
 selective start More...
 
template<typename... Args>
this_typestop (Args &&...)
 stop all applicable components More...
 
template<typename... Tp, typename... Args>
this_typestop (mpl::piecewise_select< Tp... >, Args &&...)
 selective stop More...
 
template<typename... Tp, typename... Args>
this_typestop (mpl::piecewise_ignore< Tp... >, Args &&...)
 selection stop More...
 
template<typename... Args>
this_typemeasure (Args &&...)
 generic More...
 
template<typename... Args>
this_typesample (Args &&...)
 generic More...
 
template<typename... Args>
this_typerecord (Args &&...)
 generic More...
 
template<typename... Args>
this_typereset (Args &&...)
 generic More...
 
template<typename... Args>
auto get (Args &&...) const
 generic More...
 
template<typename... Args>
auto get_labeled (Args &&...) const
 generic More...
 
data_typedata ()
 get tuple More...
 
const data_typedata () const
 get tuple More...
 
this_typeset_scope (scope::config)
 set scope configuration More...
 
template<typename FuncT , typename... Args>
decltype(auto) execute (FuncT &&func, Args &&... args)
 when chaining together operations, this function enables executing a function inside the chain More...
 
template<typename... Args>
this_typeconstruct (Args &&... _args)
 construct the objects that have constructors with matching arguments More...
 
this_typeassemble ()
 provide preliminary info to the objects with matching arguments. This is typically used to notify a component that it has been bundled alongside another component that it can extract data from. More...
 
template<typename... Args, size_t N = sizeof...(Args), enable_if_t< N !=0, int > = 0>
this_typeassemble (Args &&... _args)
 
this_typederive ()
 provide conclusive info to the objects with matching arguments. This is typically used by components to extract data from another component it has been bundled alongside, e.g. the cpu_util component can extract data from tim::component::wall_clock and tim::component::cpu_clock More...
 
template<typename... Args, size_t N = sizeof...(Args), enable_if_t< N !=0, int > = 0>
this_typederive (Args &&... _args)
 
template<typename... Args>
this_typemark_begin (Args &&... _args)
 mark a beginning position in the execution (typically used by asynchronous structures) More...
 
template<typename... Args>
this_typemark_end (Args &&... _args)
 mark a beginning position in the execution (typically used by asynchronous structures) More...
 
template<typename... Args>
this_typestore (Args &&... _args)
 store a value More...
 
template<typename... Args>
this_typeaudit (Args &&... _args)
 allow the components to inspect the incoming arguments before start or out-going return value before returning (typically using in GOTCHA components) More...
 
template<typename... Args>
this_typeadd_secondary (Args &&... _args)
 perform an add_secondary operation. This operation allows components to add additional entries to storage which are their direct descendant More...
 
template<typename... Args>
this_typeupdate_statistics (Args &&... _args)
 perform an add_secondary operation. This operation allows components to add additional entries to storage which are their direct descendant More...
 
template<template< typename > class OpT, typename... Args>
this_typeinvoke (Args &&... _args)
 apply a user-defined operation to all the components More...
 
template<template< typename > class OpT, typename... Tp, typename... Args>
this_typeinvoke (mpl::piecewise_select< Tp... >, Args &&... _args)
 generic member function for invoking user-provided operations on a specific set of component types More...
 
template<template< typename > class OpT, typename... Tp, typename... Args>
this_typeinvoke (mpl::piecewise_ignore< Tp... >, Args &&... _args)
 generic member function for invoking user-provided operations on a specific set of component types More...
 
template<typename T , enable_if_t< is_one_of< T, data_type >::value, int > = 0>
T * get ()
 get member functions taking either a type More...
 
template<typename T , enable_if_t< is_one_of< T, data_type >::value, int > = 0>
const T * get () const
 
template<typename T , enable_if_t<!is_one_of< T, data_type >::value, int > = 0>
T * get () const
 
this_typeget (void *&ptr, size_t _hash) const
 
template<typename T , typename FuncT >
decltype(auto) get (FuncT &&_func)
 get member functions finding component and applying lambda More...
 
template<typename T , typename FuncT >
decltype(auto) get (FuncT &&_func) const
 
template<typename U , typename T = std::remove_pointer_t<decay_t<U>>, enable_if_t< trait::is_available< T >::value &&is_one_of< T, data_type >::value, int > = 0>
auto get_component ()
 this is a simple alternative to get<T>() when used from SFINAE in operation namespace which has a struct get also templated. Usage there can cause error with older compilers More...
 
template<typename T , typename... Args, enable_if_t<!is_one_of< T, reference_type >::value &&has_user_bundle_v, int > = 0>
bool init (Args &&...)
 
template<typename T , typename... Args, enable_if_t<!is_one_of< T, reference_type >::value &&!has_user_bundle_v, int > = 0>
bool init (Args &&...)
 
template<typename... T, typename... Args>
auto initialize (Args &&... args)
 variadic initialization More...
 
template<typename T , typename Func , typename... Args, enable_if_t< is_one_of< T, data_type >::value, int > = 0>
this_typetype_apply (Func &&_func, Args &&... _args)
 apply a member function to a type that is in variadic list AND is available More...
 
template<typename T , typename Func , typename... Args, enable_if_t<!is_one_of< T, data_type >::value, int > = 0>
this_typetype_apply (Func &&, Args &&...)
 
this_typeoperator-= (const this_type &rhs)
 
this_typeoperator-= (this_type &rhs)
 
this_typeoperator+= (const this_type &rhs)
 
this_typeoperator+= (this_type &rhs)
 
template<typename Op >
this_typeoperator-= (Op &&rhs)
 
template<typename Op >
this_typeoperator+= (Op &&rhs)
 
template<typename Op >
this_typeoperator*= (Op &&rhs)
 
template<typename Op >
this_typeoperator/= (Op &&rhs)
 
template<bool PrintPrefix = true, bool PrintLaps = true>
this_typeprint (std::ostream &os, bool skip_wo_hash=true) const
 
template<typename Archive >
void serialize (Archive &ar, const unsigned int)
 
int64_t laps () const
 
std::string key () const
 
uint64_t hash () const
 
bool & store ()
 
const bool & store () const
 
auto prefix () const
 
auto get_prefix () const
 
void rekey (const string_t &_key)
 
void rekey (const captured_location_t &_loc)
 
void rekey (uint64_t _hash)
 
data_typeget_data ()
 
const data_typeget_data () const
 
template<typename... Tp>
lightweight_tuple< Types... > & push (mpl::piecewise_select< Tp... >)
 
template<typename... Tp>
lightweight_tuple< Types... > & push (mpl::piecewise_ignore< Tp... >)
 
template<typename... Tp>
lightweight_tuple< Types... > & pop (mpl::piecewise_select< Tp... >)
 
template<typename... Tp>
lightweight_tuple< Types... > & pop (mpl::piecewise_ignore< Tp... >)
 
template<typename... Args>
lightweight_tuple< Types... > & measure (Args &&... args)
 
template<typename... Args>
lightweight_tuple< Types... > & sample (Args &&... args)
 
template<typename... Args>
lightweight_tuple< Types... > & start (Args &&... args)
 
template<typename... Tp, typename... Args>
lightweight_tuple< Types... > & start (mpl::piecewise_select< Tp... >, Args &&... args)
 
template<typename... Tp, typename... Args>
lightweight_tuple< Types... > & start (mpl::piecewise_ignore< Tp... >, Args &&... args)
 
template<typename... Args>
lightweight_tuple< Types... > & stop (Args &&... args)
 
template<typename... Tp, typename... Args>
lightweight_tuple< Types... > & stop (mpl::piecewise_select< Tp... >, Args &&... args)
 
template<typename... Tp, typename... Args>
lightweight_tuple< Types... > & stop (mpl::piecewise_ignore< Tp... >, Args &&... args)
 
template<typename... Args>
lightweight_tuple< Types... > & record (Args &&... args)
 
template<typename... Args>
lightweight_tuple< Types... > & reset (Args &&... args)
 
template<typename... Args>
auto get (Args &&... args) const
 
template<typename... Args>
auto get_labeled (Args &&... args) const
 

Static Public Member Functions

static initializer_typeget_initializer ()
 
static constexpr std::size_t size ()
 
static void init_storage ()
 requests the component initialize their storage More...
 

Static Public Attributes

static constexpr bool has_gotcha_v = bundle_type::has_gotcha_v
 
static constexpr bool has_user_bundle_v = bundle_type::has_user_bundle_v
 

Protected Types

using apply_v = mpl::apply< void >
 
using bundle_type = stack_bundle< mpl::available_t< type_list< Types... > > >
 
using impl_type = typename bundle_type::impl_type
 

Protected Member Functions

void set_prefix (const string_t &) const
 
void set_prefix (size_t) const
 

Protected Attributes

data_type m_data = data_type{}
 

Friends

template<typename... Tp>
class impl::base_bundle
 
this_type operator+ (const this_type &lhs, const this_type &rhs)
 
this_type operator- (const this_type &lhs, const this_type &rhs)
 
template<typename Op >
this_type operator* (const this_type &lhs, Op &&rhs)
 
template<typename Op >
this_type operator/ (const this_type &lhs, Op &&rhs)
 
std::ostream & operator<< (std::ostream &os, const this_type &obj)
 

Detailed Description

template<typename... Types>
class tim::lightweight_tuple< Types >

This is a variadic component wrapper which provides the least amount of runtime and compilation overhead.

Template Parameters
TypesSpecification of the component types to bundle together

Definition at line 67 of file lightweight_tuple.hpp.

Member Typedef Documentation

◆ apply_v

template<typename... Types>
using tim::lightweight_tuple< Types >::apply_v = mpl::apply<void>
protected

Definition at line 72 of file lightweight_tuple.hpp.

◆ auto_type

template<typename... Types>
using tim::lightweight_tuple< Types >::auto_type = mpl::append_type_t<quirk::auto_start, this_type>

Definition at line 101 of file lightweight_tuple.hpp.

◆ bundle_type

template<typename... Types>
using tim::lightweight_tuple< Types >::bundle_type = stack_bundle<mpl::available_t<type_list<Types...> >>
protected

Definition at line 73 of file lightweight_tuple.hpp.

◆ captured_location_t

template<typename... Types>
using tim::lightweight_tuple< Types >::captured_location_t = source_location::captured

Definition at line 80 of file lightweight_tuple.hpp.

◆ component_type

template<typename... Types>
using tim::lightweight_tuple< Types >::component_type = mpl::remove_type_t<quirk::auto_start, this_type>

Definition at line 102 of file lightweight_tuple.hpp.

◆ custom_operation_t

template<typename... Types>
template<template< typename > class Op, typename Tuple = impl_type>
using tim::lightweight_tuple< Types >::custom_operation_t = typename bundle_type::template custom_operation<Op, Tuple>::type

Definition at line 98 of file lightweight_tuple.hpp.

◆ data_type

template<typename... Types>
using tim::lightweight_tuple< Types >::data_type = typename bundle_type::data_type

Definition at line 85 of file lightweight_tuple.hpp.

◆ impl_type

template<typename... Types>
using tim::lightweight_tuple< Types >::impl_type = typename bundle_type::impl_type
protected

Definition at line 74 of file lightweight_tuple.hpp.

◆ initializer_type

template<typename... Types>
using tim::lightweight_tuple< Types >::initializer_type = std::function<void(this_type&)>

Definition at line 104 of file lightweight_tuple.hpp.

◆ operation_t

template<typename... Types>
template<template< typename > class Op, typename Tuple = impl_type>
using tim::lightweight_tuple< Types >::operation_t = typename bundle_type::template generic_operation<Op, Tuple>::type

Definition at line 95 of file lightweight_tuple.hpp.

◆ quirk_config

template<typename... Types>
template<typename T , typename... U>
using tim::lightweight_tuple< Types >::quirk_config = tim::variadic::impl::quirk_config<T, type_list<Types...>, U...>

Definition at line 118 of file lightweight_tuple.hpp.

◆ reference_type

template<typename... Types>
using tim::lightweight_tuple< Types >::reference_type = typename bundle_type::reference_type

Definition at line 88 of file lightweight_tuple.hpp.

◆ sample_type

template<typename... Types>
using tim::lightweight_tuple< Types >::sample_type = typename bundle_type::sample_type

Definition at line 87 of file lightweight_tuple.hpp.

◆ size_type

template<typename... Types>
using tim::lightweight_tuple< Types >::size_type = typename bundle_type::size_type

Definition at line 91 of file lightweight_tuple.hpp.

◆ string_t

template<typename... Types>
using tim::lightweight_tuple< Types >::string_t = typename bundle_type::string_t

Definition at line 92 of file lightweight_tuple.hpp.

◆ this_type

template<typename... Types>
using tim::lightweight_tuple< Types >::this_type = lightweight_tuple<Types...>

Definition at line 82 of file lightweight_tuple.hpp.

◆ transient_func_t

template<typename... Types>
using tim::lightweight_tuple< Types >::transient_func_t = utility::transient_function<void(this_type&)>

Definition at line 105 of file lightweight_tuple.hpp.

◆ tuple_type

template<typename... Types>
using tim::lightweight_tuple< Types >::tuple_type = typename bundle_type::tuple_type

Definition at line 86 of file lightweight_tuple.hpp.

◆ type

template<typename... Types>
using tim::lightweight_tuple< Types >::type = convert_t<tuple_type, lightweight_tuple<> >

Definition at line 103 of file lightweight_tuple.hpp.

◆ type_list_type

template<typename... Types>
using tim::lightweight_tuple< Types >::type_list_type = type_list<Types...>

Definition at line 83 of file lightweight_tuple.hpp.

◆ user_bundle_types

template<typename... Types>
using tim::lightweight_tuple< Types >::user_bundle_types = typename bundle_type::user_bundle_types

Definition at line 89 of file lightweight_tuple.hpp.

Constructor & Destructor Documentation

◆ lightweight_tuple() [1/9]

template<typename... Types>
tim::lightweight_tuple< Types >::lightweight_tuple ( )
default

◆ lightweight_tuple() [2/9]

template<typename... Types>
template<typename... T>
tim::lightweight_tuple< Types >::lightweight_tuple ( const string_t key,
quirk::config< T... >  _config = {},
transient_func_t  _init_func = get_initializer() 
)
explicit

Definition at line 45 of file lightweight_tuple.cpp.

48: bundle_type(bundle_type::handle(type_list_type{}, _key, false_type{}, _config))
49, m_data(invoke::construct<data_type>(_key, _config))
50{
51 bundle_type::init(type_list_type{}, *this, m_data, std::move(_init_func), _config);
52}
type_list< Types... > type_list_type
stack_bundle< mpl::available_t< type_list< Types... > > > bundle_type
void init(Args &&... args)
Definition: types.hpp:111

◆ lightweight_tuple() [3/9]

template<typename... Types>
template<typename... T>
tim::lightweight_tuple< Types >::lightweight_tuple ( const captured_location_t loc,
quirk::config< T... >  _config = {},
transient_func_t  _init_func = get_initializer() 
)
explicit

Definition at line 58 of file lightweight_tuple.cpp.

61: bundle_type(bundle_type::handle(type_list_type{}, _loc, false_type{}, _config))
62, m_data(invoke::construct<data_type>(_loc, _config))
63{
64 bundle_type::init(type_list_type{}, *this, m_data, std::move(_init_func), _config);
65}

◆ lightweight_tuple() [4/9]

template<typename... Types>
template<typename... T>
tim::lightweight_tuple< Types >::lightweight_tuple ( size_t  _hash,
quirk::config< T... >  _config = {},
transient_func_t  _init_func = get_initializer() 
)
explicit

Definition at line 71 of file lightweight_tuple.cpp.

73: bundle_type(bundle_type::handle(type_list_type{}, _hash, false_type{}, _config))
74, m_data(invoke::construct<data_type>(_hash, _config))
75{
76 bundle_type::init(type_list_type{}, *this, m_data, std::move(_init_func), _config);
77}

◆ lightweight_tuple() [5/9]

template<typename... Types>
tim::lightweight_tuple< Types >::lightweight_tuple ( size_t  _hash,
scope::config  _scope,
transient_func_t  _init_func = get_initializer() 
)
explicit

Definition at line 82 of file lightweight_tuple.cpp.

84: bundle_type(bundle_type::handle(type_list_type{}, _hash, false_type{}, _scope))
85, m_data(invoke::construct<data_type>(_hash, m_scope))
86{
87 bundle_type::init(type_list_type{}, *this, m_data, std::move(_init_func));
88}

◆ lightweight_tuple() [6/9]

template<typename... Types>
tim::lightweight_tuple< Types >::lightweight_tuple ( const string_t key,
scope::config  _scope,
transient_func_t  _init_func = get_initializer() 
)
explicit

Definition at line 93 of file lightweight_tuple.cpp.

95: bundle_type(bundle_type::handle(type_list_type{}, _key, false_type{}, _scope))
96{
97 bundle_type::init(type_list_type{}, *this, m_data, std::move(_init_func));
98}

References tim::init(), and tim::lightweight_tuple< Types >::m_data.

◆ lightweight_tuple() [7/9]

template<typename... Types>
tim::lightweight_tuple< Types >::lightweight_tuple ( const captured_location_t loc,
scope::config  _scope,
transient_func_t  _init_func = get_initializer() 
)
explicit

Definition at line 103 of file lightweight_tuple.cpp.

106: lightweight_tuple(loc.get_hash(), _scope, std::move(_init_func))
107{}

◆ ~lightweight_tuple()

template<typename... Types>
tim::lightweight_tuple< Types >::~lightweight_tuple

Definition at line 112 of file lightweight_tuple.cpp.

113{
114 IF_CONSTEXPR(!quirk_config<quirk::explicit_stop>::value)
115 {
116 if(m_is_active())
117 stop();
118 }
119}
this_type & stop(Args &&...)
stop all applicable components
#define IF_CONSTEXPR(...)
Definition: language.hpp:72

References IF_CONSTEXPR, and tim::invoke::stop().

◆ lightweight_tuple() [8/9]

template<typename... Types>
tim::lightweight_tuple< Types >::lightweight_tuple ( const lightweight_tuple< Types > &  )
default

◆ lightweight_tuple() [9/9]

template<typename... Types>
tim::lightweight_tuple< Types >::lightweight_tuple ( lightweight_tuple< Types > &&  )
default

Member Function Documentation

◆ add_secondary()

template<typename... Types>
template<typename... Args>
this_type & tim::lightweight_tuple< Types >::add_secondary ( Args &&...  _args)
inline

perform an add_secondary operation. This operation allows components to add additional entries to storage which are their direct descendant

Definition at line 344 of file lightweight_tuple.hpp.

345 {
346 return invoke<operation::add_secondary>(std::forward<Args>(_args)...);
347 }
std::array< char *, 4 > _args

References tim::_args.

◆ assemble() [1/2]

template<typename... Types>
this_type & tim::lightweight_tuple< Types >::assemble ( )
inline

provide preliminary info to the objects with matching arguments. This is typically used to notify a component that it has been bundled alongside another component that it can extract data from.

Definition at line 280 of file lightweight_tuple.hpp.

280{ invoke::assemble(m_data, *this); }
void assemble(TupleT< Tp... > &obj, Args &&... args)
Definition: functional.cpp:868

References tim::invoke::assemble(), and tim::lightweight_tuple< Types >::m_data.

◆ assemble() [2/2]

template<typename... Types>
template<typename... Args, size_t N = sizeof...(Args), enable_if_t< N !=0, int > = 0>
this_type & tim::lightweight_tuple< Types >::assemble ( Args &&...  _args)
inline

Definition at line 283 of file lightweight_tuple.hpp.

284 {
285 invoke::assemble(m_data, std::forward<Args>(_args)...);
286 return get_this_type();
287 }

References tim::_args, tim::invoke::assemble(), and tim::lightweight_tuple< Types >::m_data.

◆ audit()

template<typename... Types>
template<typename... Args>
this_type & tim::lightweight_tuple< Types >::audit ( Args &&...  _args)
inline

allow the components to inspect the incoming arguments before start or out-going return value before returning (typically using in GOTCHA components)

Definition at line 335 of file lightweight_tuple.hpp.

336 {
337 invoke::audit(m_data, std::forward<Args>(_args)...);
338 return get_this_type();
339 }
void audit(TupleT< Tp... > &obj, Args &&... args)
Definition: functional.cpp:939

References tim::_args, tim::invoke::audit(), and tim::lightweight_tuple< Types >::m_data.

◆ clone()

template<typename... Types>
lightweight_tuple< Types... > tim::lightweight_tuple< Types >::clone ( bool  store,
scope::config  _scope = scope::get_default() 
)

Definition at line 125 of file lightweight_tuple.cpp.

126{
127 lightweight_tuple tmp(*this);
128 tmp.m_store(_store);
129 tmp.m_scope = _scope;
130 return tmp;
131}

◆ construct()

template<typename... Types>
template<typename... Args>
this_type & tim::lightweight_tuple< Types >::construct ( Args &&...  _args)
inline

construct the objects that have constructors with matching arguments

Definition at line 269 of file lightweight_tuple.hpp.

270 {
271 using construct_t = operation_t<operation::construct>;
272 apply_v::access<construct_t>(m_data, std::forward<Args>(_args)...);
273 return get_this_type();
274 }

References tim::_args, and tim::lightweight_tuple< Types >::m_data.

◆ data() [1/2]

template<typename... Types>
lightweight_tuple< Types... >::data_type & tim::lightweight_tuple< Types >::data

get tuple

Definition at line 434 of file lightweight_tuple.cpp.

435{
436 return m_data;
437}

Referenced by std::get().

◆ data() [2/2]

template<typename... Types>
const lightweight_tuple< Types... >::data_type & tim::lightweight_tuple< Types >::data

get tuple

Definition at line 443 of file lightweight_tuple.cpp.

444{
445 return m_data;
446}

◆ derive() [1/2]

template<typename... Types>
this_type & tim::lightweight_tuple< Types >::derive ( )
inline

provide conclusive info to the objects with matching arguments. This is typically used by components to extract data from another component it has been bundled alongside, e.g. the cpu_util component can extract data from tim::component::wall_clock and tim::component::cpu_clock

Definition at line 294 of file lightweight_tuple.hpp.

294{ invoke::derive(m_data, *this); }
void derive(TupleT< Tp... > &obj, Args &&... args)
Definition: functional.cpp:904

References tim::invoke::derive(), and tim::lightweight_tuple< Types >::m_data.

◆ derive() [2/2]

template<typename... Types>
template<typename... Args, size_t N = sizeof...(Args), enable_if_t< N !=0, int > = 0>
this_type & tim::lightweight_tuple< Types >::derive ( Args &&...  _args)
inline

Definition at line 297 of file lightweight_tuple.hpp.

298 {
299 invoke::derive(m_data, std::forward<Args>(_args)...);
300 return get_this_type();
301 }

References tim::_args, tim::invoke::derive(), and tim::lightweight_tuple< Types >::m_data.

◆ execute()

template<typename... Types>
template<typename FuncT , typename... Args>
decltype(auto) tim::lightweight_tuple< Types >::execute ( FuncT &&  func,
Args &&...  args 
)
inline

when chaining together operations, this function enables executing a function inside the chain

Definition at line 260 of file lightweight_tuple.hpp.

261 {
262 return mpl::execute(*this,
263 std::forward<FuncT>(func)(std::forward<Args>(args)...));
264 }
auto execute(BundleT &&_bundle, FuncT &&_func, Args &&... _args, enable_if_t< is_invocable< FuncT, Args... >::value &&!std::is_void< std::result_of_t< FuncT(Args...)> >::value, int >)

References tim::mpl::execute().

◆ get() [1/8]

template<typename... Types>
template<typename T , enable_if_t< is_one_of< T, data_type >::value, int > = 0>
T * tim::lightweight_tuple< Types >::get ( )
inline

get member functions taking either a type

Definition at line 391 of file lightweight_tuple.hpp.

392 {
393 return &(std::get<index_of<T, data_type>::value>(m_data));
394 }

References tim::lightweight_tuple< Types >::m_data.

Referenced by tim::lightweight_tuple< Types >::get().

◆ get() [2/8]

template<typename... Types>
template<typename T , enable_if_t< is_one_of< T, data_type >::value, int > = 0>
const T * tim::lightweight_tuple< Types >::get ( ) const
inline

Definition at line 397 of file lightweight_tuple.hpp.

398 {
399 return &(std::get<index_of<T, data_type>::value>(m_data));
400 }

References tim::lightweight_tuple< Types >::m_data.

◆ get() [3/8]

template<typename... Types>
template<typename T , enable_if_t<!is_one_of< T, data_type >::value, int > = 0>
T * tim::lightweight_tuple< Types >::get ( ) const
inline

Definition at line 403 of file lightweight_tuple.hpp.

404 {
405 void* ptr = nullptr;
406 get(ptr, typeid_hash<T>());
407 return static_cast<T*>(ptr);
408 }
T * get()
get member functions taking either a type

References tim::lightweight_tuple< Types >::get().

◆ get() [4/8]

template<typename... Types>
template<typename... Args>
auto tim::lightweight_tuple< Types >::get ( Args &&...  args) const

Definition at line 369 of file lightweight_tuple.cpp.

370{
371 return invoke::get(m_data, std::forward<Args>(args)...);
372}
auto get(TupleT< Tp... > &obj, Args &&... args)

References tim::invoke::get().

◆ get() [5/8]

template<typename... Types>
template<typename... Args>
auto tim::lightweight_tuple< Types >::get ( Args &&  ...) const

generic

◆ get() [6/8]

template<typename... Types>
template<typename T , typename FuncT >
decltype(auto) tim::lightweight_tuple< Types >::get ( FuncT &&  _func)

get member functions finding component and applying lambda

◆ get() [7/8]

template<typename... Types>
template<typename T , typename FuncT >
decltype(auto) tim::lightweight_tuple< Types >::get ( FuncT &&  _func) const

◆ get() [8/8]

template<typename... Types>
this_type & tim::lightweight_tuple< Types >::get ( void *&  ptr,
size_t  _hash 
) const
inline

Definition at line 410 of file lightweight_tuple.hpp.

411 {
412 using get_t = operation_t<operation::get>;
413 apply_v::access<get_t>(m_data, ptr, _hash);
414 return get_this_type();
415 }

References tim::lightweight_tuple< Types >::m_data.

◆ get_component()

template<typename... Types>
template<typename U , typename T = std::remove_pointer_t<decay_t<U>>, enable_if_t< trait::is_available< T >::value &&is_one_of< T, data_type >::value, int > = 0>
auto tim::lightweight_tuple< Types >::get_component ( )
inline

this is a simple alternative to get<T>() when used from SFINAE in operation namespace which has a struct get also templated. Usage there can cause error with older compilers

Definition at line 431 of file lightweight_tuple.hpp.

432 {
433 return get<T>();
434 }

◆ get_data() [1/2]

template<typename... Types>
data_type & tim::lightweight_tuple< Types >::get_data ( )

◆ get_data() [2/2]

template<typename... Types>
const data_type & tim::lightweight_tuple< Types >::get_data ( ) const

◆ get_initializer()

template<typename... Types>
static initializer_type & tim::lightweight_tuple< Types >::get_initializer ( )
inlinestatic

Definition at line 111 of file lightweight_tuple.hpp.

112 {
113 static initializer_type _instance = [](this_type&) {};
114 return _instance;
115 }
std::function< void(this_type &)> initializer_type
lightweight_tuple< Types... > this_type

◆ get_labeled() [1/2]

template<typename... Types>
template<typename... Args>
auto tim::lightweight_tuple< Types >::get_labeled ( Args &&...  args) const

Definition at line 380 of file lightweight_tuple.cpp.

381{
382 return invoke::get_labeled(m_data, std::forward<Args>(args)...);
383}
auto get_labeled(TupleT< Tp... > &obj, Args &&... args)

References tim::invoke::get_labeled().

◆ get_labeled() [2/2]

template<typename... Types>
template<typename... Args>
auto tim::lightweight_tuple< Types >::get_labeled ( Args &&  ...) const

generic

◆ get_prefix()

template<typename... Types>
auto tim::lightweight_tuple< Types >::get_prefix ( ) const
inline

Definition at line 645 of file lightweight_tuple.hpp.

645{ return bundle_type::get_prefix(); }

Referenced by tim::lightweight_tuple< Types >::print().

◆ hash()

template<typename... Types>
uint64_t tim::lightweight_tuple< Types >::hash ( ) const
inline

Definition at line 641 of file lightweight_tuple.hpp.

641{ return bundle_type::hash(); }

◆ init() [1/2]

template<typename... Types>
template<typename T , typename... Args, enable_if_t<!is_one_of< T, reference_type >::value &&has_user_bundle_v, int > = 0>
bool tim::lightweight_tuple< Types >::init ( Args &&  ...)
inline

Definition at line 441 of file lightweight_tuple.hpp.

442 {
443 using bundle_t = decltype(std::get<0>(std::declval<user_bundle_types>()));
444 this->init<bundle_t>();
445 this->get<bundle_t>()->insert(component::factory::get_opaque<T>(m_scope),
446 component::factory::get_typeids<T>());
447 return true;
448 }

◆ init() [2/2]

template<typename... Types>
template<typename T , typename... Args, enable_if_t<!is_one_of< T, reference_type >::value &&!has_user_bundle_v, int > = 0>
bool tim::lightweight_tuple< Types >::init ( Args &&  ...)
inline

Definition at line 455 of file lightweight_tuple.hpp.

456 {
457 return is_one_of<T, reference_type>::value;
458 }

◆ init_storage()

template<typename... Types>
void tim::lightweight_tuple< Types >::init_storage
static

requests the component initialize their storage

Definition at line 483 of file lightweight_tuple.cpp.

484{
485 static thread_local bool _once = []() {
486 apply_v::type_access<operation::init_storage, data_type>();
487 return true;
488 }();
489 consume_parameters(_once);
490}
void consume_parameters(ArgsT &&...)
Definition: types.hpp:285

References tim::consume_parameters().

◆ initialize()

template<typename... Types>
template<typename... T, typename... Args>
auto tim::lightweight_tuple< Types >::initialize ( Args &&...  args)
inline

variadic initialization

Definition at line 464 of file lightweight_tuple.hpp.

465 {
466 constexpr auto N = sizeof...(T);
467 return TIMEMORY_FOLD_EXPANSION(bool, N,
468 this->init<T>(std::forward<Args>(args)...));
469 }
#define TIMEMORY_FOLD_EXPANSION(TYPE, SIZE,...)
Definition: types.hpp:64

References TIMEMORY_FOLD_EXPANSION.

◆ invoke() [1/3]

template<typename... Types>
template<template< typename > class OpT, typename... Args>
this_type & tim::lightweight_tuple< Types >::invoke ( Args &&...  _args)
inline

apply a user-defined operation to all the components

Template Parameters
OpTOperation struct

Definition at line 360 of file lightweight_tuple.hpp.

361 {
362 invoke::invoke<OpT>(m_data, std::forward<Args>(_args)...);
363 return get_this_type();
364 }

References tim::_args, and tim::lightweight_tuple< Types >::m_data.

◆ invoke() [2/3]

template<typename... Types>
template<template< typename > class OpT, typename... Tp, typename... Args>
this_type & tim::lightweight_tuple< Types >::invoke ( mpl::piecewise_ignore< Tp... >  ,
Args &&...  _args 
)
inline

generic member function for invoking user-provided operations on a specific set of component types

Template Parameters
OpTOperation struct

Definition at line 381 of file lightweight_tuple.hpp.

382 {
383 invoke_piecewise<OpT>(
384 mpl::subtract_t<mpl::available_t<type_list_type>, type_list<Tp...>>{},
385 std::forward<Args>(_args)...);
386 return get_this_type();
387 }
typename impl::subtract< LhsT, RhsT >::type subtract_t
Definition: filters.hpp:426

References tim::_args.

◆ invoke() [3/3]

template<typename... Types>
template<template< typename > class OpT, typename... Tp, typename... Args>
this_type & tim::lightweight_tuple< Types >::invoke ( mpl::piecewise_select< Tp... >  ,
Args &&...  _args 
)
inline

generic member function for invoking user-provided operations on a specific set of component types

Template Parameters
OpTOperation struct

Definition at line 370 of file lightweight_tuple.hpp.

371 {
372 invoke_piecewise<OpT>(mpl::available_t<type_list<Tp...>>{},
373 std::forward<Args>(_args)...);
374 return get_this_type();
375 }
impl::filter_false< trait::is_available, T > available_t
Definition: available.hpp:324

References tim::_args.

◆ key()

template<typename... Types>
std::string tim::lightweight_tuple< Types >::key ( ) const
inline

Definition at line 640 of file lightweight_tuple.hpp.

640{ return bundle_type::key(); }

Referenced by tim::lightweight_tuple< Types >::print().

◆ laps()

template<typename... Types>
int64_t tim::lightweight_tuple< Types >::laps ( ) const
inline

Definition at line 639 of file lightweight_tuple.hpp.

639{ return bundle_type::laps(); }

◆ mark_begin()

template<typename... Types>
template<typename... Args>
this_type & tim::lightweight_tuple< Types >::mark_begin ( Args &&...  _args)
inline

mark a beginning position in the execution (typically used by asynchronous structures)

Definition at line 307 of file lightweight_tuple.hpp.

308 {
309 invoke::mark_begin(m_data, std::forward<Args>(_args)...);
310 return get_this_type();
311 }
void mark_begin(TupleT< Tp... > &obj, Args &&... args)
Definition: functional.cpp:492

References tim::_args, tim::lightweight_tuple< Types >::m_data, and tim::invoke::mark_begin().

◆ mark_end()

template<typename... Types>
template<typename... Args>
this_type & tim::lightweight_tuple< Types >::mark_end ( Args &&...  _args)
inline

mark a beginning position in the execution (typically used by asynchronous structures)

Definition at line 317 of file lightweight_tuple.hpp.

318 {
319 invoke::mark_end(m_data, std::forward<Args>(_args)...);
320 return get_this_type();
321 }
void mark_end(TupleT< Tp... > &obj, Args &&... args)
Definition: functional.cpp:528

References tim::_args, tim::lightweight_tuple< Types >::m_data, and tim::invoke::mark_end().

◆ measure() [1/2]

template<typename... Types>
template<typename... Args>
lightweight_tuple< Types... > & tim::lightweight_tuple< Types >::measure ( Args &&...  args)

Definition at line 235 of file lightweight_tuple.cpp.

236{
237 invoke::measure(m_data, std::forward<Args>(args)...);
238 return get_this_type();
239}
void measure(TupleT< Tp... > &obj, Args &&... args)
Definition: functional.cpp:669

References tim::invoke::measure().

◆ measure() [2/2]

template<typename... Types>
template<typename... Args>
this_type & tim::lightweight_tuple< Types >::measure ( Args &&  ...)

generic

◆ operator*=()

template<typename... Types>
template<typename Op >
this_type & tim::lightweight_tuple< Types >::operator*= ( Op &&  rhs)
inline

Definition at line 518 of file lightweight_tuple.hpp.

519 {
520 using multiply_t = operation_t<operation::multiply>;
521 apply_v::access<multiply_t>(m_data, std::forward<Op>(rhs));
522 return get_this_type();
523 }

References tim::lightweight_tuple< Types >::m_data.

◆ operator+=() [1/3]

template<typename... Types>
lightweight_tuple< Types... > & tim::lightweight_tuple< Types >::operator+= ( const this_type rhs)

Definition at line 412 of file lightweight_tuple.cpp.

413{
414 invoke::invoke_impl::invoke_data<operation::plus, TIMEMORY_API>(m_data, rhs.m_data);
415 m_laps += rhs.m_laps;
416 return get_this_type();
417}

References tim::lightweight_tuple< Types >::m_data.

◆ operator+=() [2/3]

template<typename... Types>
template<typename Op >
this_type & tim::lightweight_tuple< Types >::operator+= ( Op &&  rhs)
inline

Definition at line 510 of file lightweight_tuple.hpp.

511 {
512 using plus_t = operation_t<operation::plus>;
513 apply_v::access<plus_t>(m_data, std::forward<Op>(rhs));
514 return get_this_type();
515 }

References tim::lightweight_tuple< Types >::m_data.

◆ operator+=() [3/3]

template<typename... Types>
lightweight_tuple< Types... > & tim::lightweight_tuple< Types >::operator+= ( this_type rhs)

Definition at line 423 of file lightweight_tuple.cpp.

424{
425 invoke::invoke_impl::invoke_data<operation::plus, TIMEMORY_API>(m_data, rhs.m_data);
426 m_laps += rhs.m_laps;
427 return get_this_type();
428}

References tim::lightweight_tuple< Types >::m_data.

◆ operator-=() [1/3]

template<typename... Types>
lightweight_tuple< Types... > & tim::lightweight_tuple< Types >::operator-= ( const this_type rhs)

Definition at line 390 of file lightweight_tuple.cpp.

391{
392 invoke::invoke_impl::invoke_data<operation::minus, TIMEMORY_API>(m_data, rhs.m_data);
393 m_laps -= rhs.m_laps;
394 return get_this_type();
395}

References tim::lightweight_tuple< Types >::m_data.

◆ operator-=() [2/3]

template<typename... Types>
template<typename Op >
this_type & tim::lightweight_tuple< Types >::operator-= ( Op &&  rhs)
inline

Definition at line 502 of file lightweight_tuple.hpp.

503 {
504 using minus_t = operation_t<operation::minus>;
505 apply_v::access<minus_t>(m_data, std::forward<Op>(rhs));
506 return get_this_type();
507 }

References tim::lightweight_tuple< Types >::m_data.

◆ operator-=() [3/3]

template<typename... Types>
lightweight_tuple< Types... > & tim::lightweight_tuple< Types >::operator-= ( this_type rhs)

Definition at line 401 of file lightweight_tuple.cpp.

402{
403 invoke::invoke_impl::invoke_data<operation::minus, TIMEMORY_API>(m_data, rhs.m_data);
404 m_laps -= rhs.m_laps;
405 return get_this_type();
406}

References tim::lightweight_tuple< Types >::m_data.

◆ operator/=()

template<typename... Types>
template<typename Op >
this_type & tim::lightweight_tuple< Types >::operator/= ( Op &&  rhs)
inline

Definition at line 526 of file lightweight_tuple.hpp.

527 {
528 using divide_t = operation_t<operation::divide>;
529 apply_v::access<divide_t>(m_data, std::forward<Op>(rhs));
530 return get_this_type();
531 }

References tim::lightweight_tuple< Types >::m_data.

◆ operator=() [1/2]

template<typename... Types>
lightweight_tuple & tim::lightweight_tuple< Types >::operator= ( const lightweight_tuple< Types > &  rhs)
default

◆ operator=() [2/2]

template<typename... Types>
lightweight_tuple & tim::lightweight_tuple< Types >::operator= ( lightweight_tuple< Types > &&  )
default

◆ pop() [1/5]

template<typename... Types>
lightweight_tuple< Types... > & tim::lightweight_tuple< Types >::pop

generic pop out of storage

Definition at line 189 of file lightweight_tuple.cpp.

190{
191 if(m_is_pushed())
192 {
193 // set the current node to the parent node
195 // avoid pushing/popping when already pushed/popped
196 m_is_pushed(false);
197 }
198 return get_this_type();
199}
void pop(TupleT< Tp... > &obj, Args &&... args)
Definition: functional.cpp:739

References tim::invoke::pop().

◆ pop() [2/5]

template<typename... Types>
template<typename... Tp>
lightweight_tuple< Types... > & tim::lightweight_tuple< Types >::pop ( mpl::piecewise_ignore< Tp... >  )

Definition at line 220 of file lightweight_tuple.cpp.

222{
223 using pw_type = mpl::subtract_t<mpl::available_t<type_list_type>, type_list<Tp...>>;
224 // set the current node to the parent node
225 invoke_piecewise<operation::pop_node>(pw_type{});
226 return get_this_type();
227}
type_list
Definition: types.hpp:211

◆ pop() [3/5]

template<typename... Types>
template<typename... Tp>
this_type & tim::lightweight_tuple< Types >::pop ( mpl::piecewise_ignore< Tp... >  )

selective pop

◆ pop() [4/5]

template<typename... Types>
template<typename... Tp>
lightweight_tuple< Types... > & tim::lightweight_tuple< Types >::pop ( mpl::piecewise_select< Tp... >  )

Definition at line 206 of file lightweight_tuple.cpp.

208{
209 using pw_type = mpl::implemented_t<Tp...>;
210 // set the current node to the parent node
211 invoke_piecewise<operation::pop_node>(pw_type{});
212 return get_this_type();
213}
impl::filter_false_after_decay_t< trait::is_available, type_list< Types... > > implemented_t
filter out any types that are not available
Definition: available.hpp:318

◆ pop() [5/5]

template<typename... Types>
template<typename... Tp>
this_type & tim::lightweight_tuple< Types >::pop ( mpl::piecewise_select< Tp... >  )

selective pop

◆ prefix()

template<typename... Types>
auto tim::lightweight_tuple< Types >::prefix ( ) const
inline

Definition at line 644 of file lightweight_tuple.hpp.

644{ return bundle_type::prefix(); }

◆ print()

template<typename... Types>
template<bool PrintPrefix = true, bool PrintLaps = true>
this_type & tim::lightweight_tuple< Types >::print ( std::ostream &  os,
bool  skip_wo_hash = true 
) const
inline

Definition at line 565 of file lightweight_tuple.hpp.

566 {
567 using printer_t = typename bundle_type::print_type;
568 if(size() == 0)
569 return get_this_type();
570 if(m_hash == 0 && skip_wo_hash)
571 return get_this_type();
572 std::stringstream ss_data;
573 apply_v::access_with_indices<printer_t>(m_data, std::ref(ss_data), false);
574 IF_CONSTEXPR(PrintPrefix)
575 {
576 bundle_type::update_width();
577 auto _key = key();
578 if(_key.length() > 0)
579 {
580 std::stringstream ss_prefix;
581 std::stringstream ss_id;
582 ss_id << get_prefix() << " " << std::left << _key;
583 ss_prefix << std::setw(bundle_type::output_width()) << std::left
584 << ss_id.str() << " : ";
585 os << ss_prefix.str();
586 }
587 }
588 std::string _s = ss_data.str();
589 if(_s.empty())
590 return get_this_type();
591 while(_s.find_last_of(", ") == _s.length() - 1)
592 _s = _s.substr(0, _s.length() - 1);
593 if(_s.empty())
594 return get_this_type();
595 os << _s;
596 if(m_laps > 0 && PrintLaps)
597 os << " [laps: " << m_laps << "]";
598 return get_this_type();
599 }
static constexpr std::size_t size()
std::string key() const
tim::mpl::apply< std::string > string
Definition: macros.hpp:53
const std::string std::ostream * os

References tim::lightweight_tuple< Types >::get_prefix(), IF_CONSTEXPR, tim::lightweight_tuple< Types >::key(), tim::lightweight_tuple< Types >::m_data, tim::os, and tim::lightweight_tuple< Types >::size().

◆ push() [1/5]

template<typename... Types>
lightweight_tuple< Types... > & tim::lightweight_tuple< Types >::push

generic push into storage

Definition at line 138 of file lightweight_tuple.cpp.

139{
140 if(!m_is_pushed())
141 {
142 // reset the data
144 // avoid pushing/popping when already pushed/popped
145 m_is_pushed(true);
146 // insert node or find existing node
147 invoke::push(m_data, m_scope, m_hash);
148 }
149 return get_this_type();
150}
void push(TupleT< Tp... > &obj, Args &&... args)
Definition: functional.cpp:704
void reset(TupleT< Tp... > &obj, Args &&... args)
Definition: functional.cpp:599

References tim::invoke::push(), and tim::invoke::reset().

◆ push() [2/5]

template<typename... Types>
template<typename... Tp>
lightweight_tuple< Types... > & tim::lightweight_tuple< Types >::push ( mpl::piecewise_ignore< Tp... >  )

Definition at line 173 of file lightweight_tuple.cpp.

175{
176 using pw_type = mpl::subtract_t<mpl::available_t<type_list_type>, type_list<Tp...>>;
177 // reset the data
178 invoke_piecewise<operation::reset>(pw_type{});
179 // insert node or find existing node
180 invoke_piecewise<operation::push_node>(pw_type{}, m_scope, m_hash);
181 return get_this_type();
182}

◆ push() [3/5]

template<typename... Types>
template<typename... Tp>
this_type & tim::lightweight_tuple< Types >::push ( mpl::piecewise_ignore< Tp... >  )

selective push

◆ push() [4/5]

template<typename... Types>
template<typename... Tp>
lightweight_tuple< Types... > & tim::lightweight_tuple< Types >::push ( mpl::piecewise_select< Tp... >  )

Definition at line 157 of file lightweight_tuple.cpp.

159{
160 using pw_type = mpl::implemented_t<Tp...>;
161 // reset the data
162 invoke_piecewise<operation::reset>(pw_type{});
163 // insert node or find existing node
164 invoke_piecewise<operation::push_node>(pw_type{}, m_scope, m_hash);
165 return get_this_type();
166}

◆ push() [5/5]

template<typename... Types>
template<typename... Tp>
this_type & tim::lightweight_tuple< Types >::push ( mpl::piecewise_select< Tp... >  )

selective push

◆ record() [1/2]

template<typename... Types>
template<typename... Args>
lightweight_tuple< Types... > & tim::lightweight_tuple< Types >::record ( Args &&...  args)

Definition at line 343 of file lightweight_tuple.cpp.

344{
345 ++m_laps;
346 invoke::record(m_data, std::forward<Args>(args)...);
347 return get_this_type();
348}
void record(TupleT< Tp... > &obj, Args &&... args)
Definition: functional.cpp:634

References tim::invoke::record().

◆ record() [2/2]

template<typename... Types>
template<typename... Args>
this_type & tim::lightweight_tuple< Types >::record ( Args &&  ...)

generic

◆ rekey() [1/3]

template<typename... Types>
void tim::lightweight_tuple< Types >::rekey ( const captured_location_t _loc)

Definition at line 700 of file lightweight_tuple.hpp.

701{
702 m_hash = _loc.get_hash();
703 set_prefix(_loc.get_hash());
704}
void set_prefix(const string_t &) const

References tim::source_location::captured::get_hash(), and tim::invoke::set_prefix().

◆ rekey() [2/3]

template<typename... Types>
void tim::lightweight_tuple< Types >::rekey ( const string_t _key)

Definition at line 690 of file lightweight_tuple.hpp.

691{
692 m_hash = add_hash_id(_key);
693 set_prefix(_key);
694}
hash_value_t add_hash_id(hash_map_ptr_t &_hash_map, string_view_cref_t _prefix)
add an string to the given hash-map (if it doesn't already exist) and return the hash
Definition: types.hpp:190

References tim::invoke::set_prefix().

◆ rekey() [3/3]

template<typename... Types>
void tim::lightweight_tuple< Types >::rekey ( uint64_t  _hash)

Definition at line 710 of file lightweight_tuple.hpp.

711{
712 m_hash = _hash;
713 set_prefix(_hash);
714}

References tim::invoke::set_prefix().

◆ reset() [1/2]

template<typename... Types>
template<typename... Args>
lightweight_tuple< Types... > & tim::lightweight_tuple< Types >::reset ( Args &&...  args)

Definition at line 356 of file lightweight_tuple.cpp.

357{
358 invoke::reset(m_data, std::forward<Args>(args)...);
359 m_laps = 0;
360 return get_this_type();
361}

References tim::invoke::reset().

◆ reset() [2/2]

template<typename... Types>
template<typename... Args>
this_type & tim::lightweight_tuple< Types >::reset ( Args &&  ...)

generic

◆ sample() [1/2]

template<typename... Types>
template<typename... Args>
lightweight_tuple< Types... > & tim::lightweight_tuple< Types >::sample ( Args &&...  args)

Definition at line 247 of file lightweight_tuple.cpp.

248{
249 invoke::invoke<operation::sample, TIMEMORY_API>(m_data, std::forward<Args>(args)...);
250 return get_this_type();
251}

◆ sample() [2/2]

template<typename... Types>
template<typename... Args>
this_type & tim::lightweight_tuple< Types >::sample ( Args &&  ...)

generic

◆ serialize()

template<typename... Types>
template<typename Archive >
void tim::lightweight_tuple< Types >::serialize ( Archive &  ar,
const unsigned int   
)
inline

Definition at line 612 of file lightweight_tuple.hpp.

613 {
614 std::string _key = {};
615 auto keyitr = get_hash_ids()->find(m_hash);
616 if(keyitr != get_hash_ids()->end())
617 _key = keyitr->second;
618
619 ar(cereal::make_nvp("hash", m_hash), cereal::make_nvp("key", _key),
620 cereal::make_nvp("laps", m_laps));
621
622 if(keyitr == get_hash_ids()->end())
623 {
624 auto _hash = add_hash_id(_key);
625 if(_hash != m_hash)
626 {
627 PRINT_HERE("Warning! Hash for '%s' (%llu) != %llu", _key.c_str(),
628 (unsigned long long) _hash, (unsigned long long) m_hash);
629 }
630 }
631
632 ar.setNextName("data");
633 ar.startNode();
635 ar.finishNode();
636 }
return _hash_map end()
hash_map_ptr_t & get_hash_ids()
auto serialize(ArchiveT &ar, TupleT< Tp... > &obj)
#define PRINT_HERE(...)
Definition: macros.hpp:152

References tim::lightweight_tuple< Types >::m_data, PRINT_HERE, and tim::invoke::serialize().

◆ set_prefix() [1/2]

template<typename... Types>
void tim::lightweight_tuple< Types >::set_prefix ( const string_t _key) const
protected

Definition at line 452 of file lightweight_tuple.cpp.

453{
454 invoke::set_prefix(m_data, m_hash, _key);
455}
void set_prefix(TupleT< Tp... > &obj, Args &&... args)
Definition: functional.cpp:774

References tim::invoke::set_prefix().

◆ set_prefix() [2/2]

template<typename... Types>
void tim::lightweight_tuple< Types >::set_prefix ( size_t  _hash) const
protected

Definition at line 461 of file lightweight_tuple.cpp.

462{
463 auto itr = get_hash_ids()->find(_hash);
464 if(itr != get_hash_ids()->end())
465 invoke::set_prefix(m_data, _hash, itr->second);
466}

References tim::invoke::set_prefix().

◆ set_scope()

template<typename... Types>
lightweight_tuple< Types... > & tim::lightweight_tuple< Types >::set_scope ( scope::config  val)

set scope configuration

Definition at line 472 of file lightweight_tuple.cpp.

473{
474 m_scope = val;
475 invoke::set_scope(m_data, m_scope);
476 return get_this_type();
477}
void set_scope(TupleT< Tp... > &obj, Args &&... args)
Definition: functional.cpp:810

References tim::invoke::set_scope().

◆ size()

template<typename... Types>
static constexpr std::size_t tim::lightweight_tuple< Types >::size ( )
inlinestaticconstexpr

Definition at line 161 of file lightweight_tuple.hpp.

161{ return std::tuple_size<tuple_type>::value; }

Referenced by tim::lightweight_tuple< Types >::print().

◆ start() [1/6]

template<typename... Types>
template<typename... Args>
lightweight_tuple< Types... > & tim::lightweight_tuple< Types >::start ( Args &&...  args)

Definition at line 259 of file lightweight_tuple.cpp.

260{
261 invoke::start(m_data, std::forward<Args>(args)...);
262 m_is_active(true);
263 return get_this_type();
264}
void start(TupleT< Tp... > &obj, Args &&... args)
Definition: functional.cpp:316

References tim::invoke::start().

◆ start() [2/6]

template<typename... Types>
template<typename... Args>
this_type & tim::lightweight_tuple< Types >::start ( Args &&  ...)

start all applicable components

◆ start() [3/6]

template<typename... Types>
template<typename... Tp, typename... Args>
lightweight_tuple< Types... > & tim::lightweight_tuple< Types >::start ( mpl::piecewise_ignore< Tp... >  ,
Args &&...  args 
)

Definition at line 285 of file lightweight_tuple.cpp.

286{
287 using selected_t =
288 convert_t<mpl::subtract_t<mpl::available_t<type_list_type>, type_list<Tp...>>,
289 std::tuple<>>;
290 auto&& _data = mpl::get_reference_tuple<selected_t>(m_data);
291 invoke::start(_data, std::forward<Args>(args)...);
292 return get_this_type();
293}

References tim::invoke::start().

◆ start() [4/6]

template<typename... Types>
template<typename... Tp, typename... Args>
this_type & tim::lightweight_tuple< Types >::start ( mpl::piecewise_ignore< Tp... >  ,
Args &&  ... 
)

selective start

◆ start() [5/6]

template<typename... Types>
template<typename... Tp, typename... Args>
lightweight_tuple< Types... > & tim::lightweight_tuple< Types >::start ( mpl::piecewise_select< Tp... >  ,
Args &&...  args 
)

Definition at line 272 of file lightweight_tuple.cpp.

273{
274 auto&& _data = mpl::get_reference_tuple<mpl::available_t<std::tuple<Tp...>>>(m_data);
275 invoke::start(_data, std::forward<Args>(args)...);
276 return get_this_type();
277}
decltype(auto) get_reference_tuple(Tp &&_tuple)
Definition: types.hpp:1075

References tim::mpl::get_reference_tuple(), and tim::invoke::start().

◆ start() [6/6]

template<typename... Types>
template<typename... Tp, typename... Args>
this_type & tim::lightweight_tuple< Types >::start ( mpl::piecewise_select< Tp... >  ,
Args &&  ... 
)

selective start

◆ stop() [1/6]

template<typename... Types>
template<typename... Args>
lightweight_tuple< Types... > & tim::lightweight_tuple< Types >::stop ( Args &&...  args)

Definition at line 300 of file lightweight_tuple.cpp.

301{
302 invoke::stop(m_data, std::forward<Args>(args)...);
303 ++m_laps;
304 m_is_active(false);
305 return get_this_type();
306}
void stop(TupleT< Tp... > &obj, Args &&... args)
Definition: functional.cpp:386

References tim::invoke::stop().

◆ stop() [2/6]

template<typename... Types>
template<typename... Args>
this_type & tim::lightweight_tuple< Types >::stop ( Args &&  ...)

stop all applicable components

◆ stop() [3/6]

template<typename... Types>
template<typename... Tp, typename... Args>
lightweight_tuple< Types... > & tim::lightweight_tuple< Types >::stop ( mpl::piecewise_ignore< Tp... >  ,
Args &&...  args 
)

Definition at line 327 of file lightweight_tuple.cpp.

328{
329 using selected_t =
330 convert_t<mpl::subtract_t<mpl::available_t<type_list_type>, type_list<Tp...>>,
331 std::tuple<>>;
332 auto&& _data = mpl::get_reference_tuple<selected_t>(m_data);
333 invoke::stop(_data, std::forward<Args>(args)...);
334 return get_this_type();
335}

References tim::invoke::stop().

◆ stop() [4/6]

template<typename... Types>
template<typename... Tp, typename... Args>
this_type & tim::lightweight_tuple< Types >::stop ( mpl::piecewise_ignore< Tp... >  ,
Args &&  ... 
)

selection stop

◆ stop() [5/6]

template<typename... Types>
template<typename... Tp, typename... Args>
lightweight_tuple< Types... > & tim::lightweight_tuple< Types >::stop ( mpl::piecewise_select< Tp... >  ,
Args &&...  args 
)

Definition at line 314 of file lightweight_tuple.cpp.

315{
316 auto&& _data = mpl::get_reference_tuple<mpl::available_t<std::tuple<Tp...>>>(m_data);
317 invoke::stop(_data, std::forward<Args>(args)...);
318 return get_this_type();
319}

References tim::mpl::get_reference_tuple(), and tim::invoke::stop().

◆ stop() [6/6]

template<typename... Types>
template<typename... Tp, typename... Args>
this_type & tim::lightweight_tuple< Types >::stop ( mpl::piecewise_select< Tp... >  ,
Args &&  ... 
)

selective stop

◆ store() [1/3]

template<typename... Types>
bool & tim::lightweight_tuple< Types >::store ( )
inline

Definition at line 642 of file lightweight_tuple.hpp.

642{ return bundle_type::store(); }
void store(TupleT< Tp... > &obj, Args &&... args)
Definition: functional.cpp:564

References tim::invoke::store().

◆ store() [2/3]

template<typename... Types>
const bool & tim::lightweight_tuple< Types >::store ( ) const
inline

Definition at line 643 of file lightweight_tuple.hpp.

643{ return bundle_type::store(); }

References tim::invoke::store().

◆ store() [3/3]

template<typename... Types>
template<typename... Args>
this_type & tim::lightweight_tuple< Types >::store ( Args &&...  _args)
inline

store a value

Definition at line 325 of file lightweight_tuple.hpp.

326 {
327 invoke::store(m_data, std::forward<Args>(_args)...);
328 return get_this_type();
329 }

References tim::_args, tim::lightweight_tuple< Types >::m_data, and tim::invoke::store().

◆ type_apply() [1/2]

template<typename... Types>
template<typename T , typename Func , typename... Args, enable_if_t<!is_one_of< T, data_type >::value, int > = 0>
this_type & tim::lightweight_tuple< Types >::type_apply ( Func &&  ,
Args &&  ... 
)
inline

Definition at line 485 of file lightweight_tuple.hpp.

486 {
487 return get_this_type();
488 }

◆ type_apply() [2/2]

template<typename... Types>
template<typename T , typename Func , typename... Args, enable_if_t< is_one_of< T, data_type >::value, int > = 0>
this_type & tim::lightweight_tuple< Types >::type_apply ( Func &&  _func,
Args &&...  _args 
)
inline

apply a member function to a type that is in variadic list AND is available

Definition at line 476 of file lightweight_tuple.hpp.

477 {
478 auto&& _obj = get<T>();
479 ((_obj).*(_func))(std::forward<Args>(_args)...);
480 return get_this_type();
481 }

References tim::_args.

◆ update_statistics()

template<typename... Types>
template<typename... Args>
this_type & tim::lightweight_tuple< Types >::update_statistics ( Args &&...  _args)
inline

perform an add_secondary operation. This operation allows components to add additional entries to storage which are their direct descendant

Definition at line 352 of file lightweight_tuple.hpp.

353 {
354 return invoke<operation::add_statistics>(std::forward<Args>(_args)...);
355 }

References tim::_args.

Friends And Related Function Documentation

◆ impl::base_bundle

template<typename... Types>
template<typename... Tp>
friend class impl::base_bundle
friend

Definition at line 77 of file lightweight_tuple.hpp.

◆ operator*

template<typename... Types>
template<typename Op >
this_type operator* ( const this_type lhs,
Op &&  rhs 
)
friend

Definition at line 549 of file lightweight_tuple.hpp.

550 {
551 this_type tmp(lhs);
552 return tmp *= std::forward<Op>(rhs);
553 }

◆ operator+

template<typename... Types>
this_type operator+ ( const this_type lhs,
const this_type rhs 
)
friend

Definition at line 536 of file lightweight_tuple.hpp.

537 {
538 this_type tmp(lhs);
539 return tmp += rhs;
540 }

◆ operator-

template<typename... Types>
this_type operator- ( const this_type lhs,
const this_type rhs 
)
friend

Definition at line 542 of file lightweight_tuple.hpp.

543 {
544 this_type tmp(lhs);
545 return tmp -= rhs;
546 }

◆ operator/

template<typename... Types>
template<typename Op >
this_type operator/ ( const this_type lhs,
Op &&  rhs 
)
friend

Definition at line 556 of file lightweight_tuple.hpp.

557 {
558 this_type tmp(lhs);
559 return tmp /= std::forward<Op>(rhs);
560 }

◆ operator<<

template<typename... Types>
std::ostream & operator<< ( std::ostream &  os,
const this_type obj 
)
friend

Definition at line 603 of file lightweight_tuple.hpp.

604 {
605 obj.print<true, true>(os);
606 return os;
607 }

Member Data Documentation

◆ has_gotcha_v

template<typename... Types>
constexpr bool tim::lightweight_tuple< Types >::has_gotcha_v = bundle_type::has_gotcha_v
staticconstexpr

Definition at line 107 of file lightweight_tuple.hpp.

◆ has_user_bundle_v

template<typename... Types>
constexpr bool tim::lightweight_tuple< Types >::has_user_bundle_v = bundle_type::has_user_bundle_v
staticconstexpr

Definition at line 108 of file lightweight_tuple.hpp.

◆ m_data


The documentation for this class was generated from the following files: