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::bundle< Tag, BundleT, TupleT > Class Template Reference

Example: bundle<Tag, component_bundle<Foo>, mixed_wrapper_types<concat<Bar, Baz>>> will use Tag + trait::is_available<Tag> or trait::runtime_available<Tag> to disable this bundle at compile-time or run-time, respectively. It will covert component_bundle<Foo> to component_bundle<Foo, Bar, Baz> for purposes of function signatures and it will instantiate std::tuple<...> depending on the compile-time availability of Bar and Baz. mixed_wrapper_types is a dummy type with the appropriate aliases to perform these conversions. Here is a theoretical implementation of mixed_wrapper_types (which supports allocating components on the stack and the heap): More...

#include "timemory/variadic/bundle.hpp"

+ Collaboration diagram for tim::bundle< Tag, BundleT, TupleT >:

Public Types

using captured_location_t = source_location::captured
 
using this_type = typename TupleT::template this_type< BundleT >
 
using type = typename TupleT::template type< BundleT >
 
using component_type = typename TupleT::template component_type< BundleT >
 
using data_type = typename TupleT::template data_type< Tag >
 
using type_list_type = typename TupleT::type_list_type
 
using value_type = data_type
 
using size_type = typename bundle_type::size_type
 
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, reference_type, U... >
 
using base_bundle_type = conditional_t< trait::is_available< Tag >::value, impl::base_bundle< Tag, remove_pointer_t< Types >... >, impl::base_bundle< Tag, std::tuple<> > >
 
using tuple_type = data_type
 
using impl_type = data_type
 

Public Member Functions

 bundle ()
 
template<typename... T>
 bundle (const string_t &_key, quirk::config< T... >, transient_func_t=get_initializer())
 
template<typename... T>
 bundle (hash_value_t _hash, quirk::config< T... >, transient_func_t=get_initializer())
 
template<typename... T>
 bundle (const captured_location_t &_loc, quirk::config< T... >, transient_func_t=get_initializer())
 
template<typename... T>
 bundle (const string_t &_key, bool _store, quirk::config< T... >, transient_func_t=get_initializer())
 
template<typename... T>
 bundle (const captured_location_t &_loc, bool _store, quirk::config< T... >, transient_func_t=get_initializer())
 
 bundle (hash_value_t _hash, bool _store=true, scope::config _scope=scope::get_default(), transient_func_t=get_initializer())
 
 bundle (const string_t &_key, bool _store=true, scope::config _scope=scope::get_default(), transient_func_t=get_initializer())
 
 bundle (const captured_location_t &_loc, bool _store=true, scope::config _scope=scope::get_default(), transient_func_t=get_initializer())
 
 bundle (hash_value_t _hash, scope::config _scope, transient_func_t=get_initializer())
 
 bundle (const string_t &_key, scope::config _scope, transient_func_t=get_initializer())
 
 bundle (const captured_location_t &_loc, scope::config _scope, transient_func_t=get_initializer())
 
 ~bundle ()
 
 bundle (const bundle &rhs)
 
 bundle (bundle &&)=default
 
bundleoperator= (const bundle &rhs)
 
bundleoperator= (bundle &&)=default
 
this_typeoperator-= (const this_type &rhs)
 
this_typeoperator+= (const this_type &rhs)
 
template<typename Op , enable_if_t<!is_this_type< Op >()> = 0>
this_typeoperator-= (Op &&rhs)
 
template<typename Op , enable_if_t<!is_this_type< Op >()> = 0>
this_typeoperator+= (Op &&rhs)
 
template<typename Op , enable_if_t<!is_this_type< Op >()> = 0>
this_typeoperator*= (Op &&rhs)
 
template<typename Op , enable_if_t<!is_this_type< Op >()> = 0>
this_typeoperator/= (Op &&rhs)
 
bundle clone (bool store, scope::config _scope=scope::get_default())
 
this_typepush ()
 tells each component to push itself into the call-stack hierarchy More...
 
this_typepop ()
 tells each component to pop itself off of the call-stack hierarchy 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_typepush (mpl::piecewise_select< Tp... >, scope::config)
 selective push with scope configuration More...
 
template<typename... Tp>
this_typepush (mpl::piecewise_ignore< Tp... >, scope::config)
 selective push with scope configuration 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_typemeasure (Args &&...)
 requests each component record a measurment More...
 
template<typename... Args>
this_typesample (Args &&...)
 requests each component take a sample (if supported) More...
 
template<typename... Args>
this_typestart (Args &&...)
 invokes start on all the components More...
 
template<typename... Args>
this_typestop (Args &&...)
 invokes stop on all the components More...
 
template<typename... Args>
this_typerecord (Args &&...)
 requests each component perform a measurement More...
 
template<typename... Args>
this_typereset (Args &&...)
 invokes reset member function on all the components More...
 
template<typename... Args>
this_typestart (mpl::lightweight, Args &&...)
 variant of start() which excludes push() More...
 
template<typename... Args>
this_typestop (mpl::lightweight, Args &&...)
 variant of stop() which excludes pop() More...
 
template<typename... Tp, typename... Args>
this_typestart (mpl::piecewise_select< Tp... >, Args &&...)
 variant of start() which only gets applied to Tp types More...
 
template<typename... Tp, typename... Args>
this_typestart (mpl::piecewise_ignore< Tp... >, Args &&...)
 variant of start() which gets applied to non-Tp types More...
 
template<typename... Tp, typename... Args>
this_typestop (mpl::piecewise_select< Tp... >, Args &&...)
 variant of stop() which only gets applied to Tp types More...
 
template<typename... Tp, typename... Args>
this_typestop (mpl::piecewise_ignore< Tp... >, Args &&...)
 variant of stop() which gets applied to non-Tp types More...
 
uint64_t count ()
 number of objects that will be performing measurements 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...
 
template<typename... Args>
this_typeassemble (Args &&... _args)
 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>
this_typederive (Args &&... _args)
 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>
this_typemark (Args &&... _args)
 mark an atomic event More...
 
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)
 generic member function for invoking user-provided operations 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 all types that are not listed More...
 
template<bool PrintPrefix = true, bool PrintLaps = true>
this_typeprint (std::ostream &os, bool _endl=false) const
 
template<typename... Args>
auto get (Args &&...) const
 returns a tuple of invoking get() on all the components More...
 
template<typename... Args>
auto get_labeled (Args &&...) const
 returns a tuple of the component label + invoking get() on all the components More...
 
data_typedata ()
 returns a reference to the underlying tuple of components More...
 
const data_typedata () const
 returns a const reference to the underlying tuple of components More...
 
template<typename U >
decltype(auto) get ()
 get a component from the bundle More...
 
template<typename U >
decltype(auto) get () const
 get a component from the bundle More...
 
template<typename U , typename FuncT >
decltype(auto) get (FuncT &&)
 get a component from the bundle and apply function if the pointer is valid More...
 
template<typename U , typename FuncT >
decltype(auto) get (FuncT &&) const
 get a component from the bundle More...
 
this_typeget (void *&ptr, hash_value_t _hash) const
 performs an opaque search. Opaque searches are generally provided by user_bundles with a functor such as this: More...
 
template<typename U >
auto get_component (enable_if_t< trait::is_available< remove_pointer_decay_t< U > >::value &&is_one_of< remove_pointer_decay_t< U >, data_type >::value, int >=0)
 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 U >
auto get_component (enable_if_t< trait::is_available< remove_pointer_decay_t< U > >::value &&is_one_of< remove_pointer_decay_t< U > *, data_type >::value, int >=0)
 
template<typename U >
auto & get_reference (enable_if_t< trait::is_available< remove_pointer_decay_t< U > >::value &&is_one_of< remove_pointer_decay_t< U >, data_type >::value, int >=0)
 returns a reference from a stack component instead of a pointer More...
 
template<typename U >
auto & get_reference (enable_if_t< trait::is_available< remove_pointer_decay_t< U > >::value &&is_one_of< remove_pointer_decay_t< U > *, data_type >::value, int >=0)
 returns a reference from a heap component instead of a pointer More...
 
template<typename U , typename T = remove_pointer_decay_t<U>, typename... Args>
enable_if_t< will_heap_init< T >() &&!will_opaque_init< T >(), bool > init (Args &&... _args, enable_if_t< is_constructible< T, Args... >(), int >=0)
 create an optional type that is in variadic list AND is available AND accepts arguments More...
 
template<typename U , typename T = remove_pointer_decay_t<U>, typename... Args>
enable_if_t< will_heap_init< T >() &&!will_opaque_init< T >(), bool > init (Args &&..., enable_if_t<!is_constructible< T, Args... >() &&is_default_constructible< T >(), long >=0)
 create an optional type that is in variadic list AND is available but is not constructible with provided arguments More...
 
template<typename U , typename T = remove_pointer_decay_t<U>, typename... Args>
bool init (Args &&... _args, enable_if_t< can_stack_init< T >(), int >=0)
 try to re-create a stack object with provided arguments More...
 
template<typename U , typename T = remove_pointer_decay_t<U>, typename... Args>
bool init (Args &&..., enable_if_t< will_opaque_init< T >(), long >=0)
 if a type is not in variadic list but a tim::component::user_bundle is available, add it in there More...
 
template<typename U , typename T = remove_pointer_decay_t<U>, typename... Args>
enable_if_t<!trait::is_available< T >::value||!(is_one_of< T *, data_type >::value||is_one_of< T, data_type >::value||bundle_type::has_user_bundle_v), bool > init (Args &&...)
 do nothing if type not available, not one of the variadic types, and there is no user bundle available More...
 
template<typename... T, typename... Args>
std::array< bool, sizeof...(T)> initialize (Args &&... args)
 variadic initialization More...
 
template<typename... Tail>
this_typedisable ()
 delete any optional types currently allocated 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 stack type that is in variadic list AND is available More...
 
template<typename T , typename Func , typename... Args, enable_if_t< trait::is_available< T >::value, int > = 0>
this_typetype_apply (Func &&_func, Args &&... _args)
 apply a member function to either a heap type or a type that is in a user_bundle More...
 
template<typename T , typename Func , typename... Args, enable_if_t<!trait::is_available< T >::value, int > = 0>
this_typetype_apply (Func &&, Args &&...)
 ignore applying a member function because the type is not present More...
 
void set_prefix (const string_t &) const
 
this_typeset_prefix (hash_value_t) const
 
this_typeset_prefix (captured_location_t) const
 
this_typeset_scope (scope::config)
 
void rekey (const string_t &_key)
 
void rekey (captured_location_t _loc)
 
void rekey (uint64_t _hash)
 
scope::transient_destructor get_scope_destructor ()
 returns a stack-object for calling stop More...
 
scope::transient_destructor get_scope_destructor (utility::transient_function< void(this_type &)>)
 returns a stack-object for calling some member functions when the scope is exited. More...
 
const data_typeget_data () const
 
template<typename Archive >
void serialize (Archive &ar, const unsigned int)
 
template<typename... Tp>
bundle< Tag, BundleT, TupleT >::this_typepush (mpl::piecewise_select< Tp... >)
 
template<typename... Tp>
bundle< Tag, BundleT, TupleT >::this_typepush (mpl::piecewise_ignore< Tp... >)
 
template<typename... Tp>
bundle< Tag, BundleT, TupleT >::this_typepush (mpl::piecewise_select< Tp... >, scope::config _scope)
 
template<typename... Tp>
bundle< Tag, BundleT, TupleT >::this_typepush (mpl::piecewise_ignore< Tp... >, scope::config _scope)
 
template<typename... Tp>
bundle< Tag, BundleT, TupleT >::this_typepop (mpl::piecewise_select< Tp... >)
 
template<typename... Tp>
bundle< Tag, BundleT, TupleT >::this_typepop (mpl::piecewise_ignore< Tp... >)
 
template<typename... Args>
bundle< Tag, BundleT, TupleT >::this_typemeasure (Args &&... args)
 
template<typename... Args>
bundle< Tag, BundleT, TupleT >::this_typesample (Args &&... args)
 
template<typename... Args>
bundle< Tag, BundleT, TupleT >::this_typestart (mpl::lightweight, Args &&... args)
 
template<typename... Args>
bundle< Tag, BundleT, TupleT >::this_typestop (mpl::lightweight, Args &&... args)
 
template<typename... Tp, typename... Args>
bundle< Tag, BundleT, TupleT >::this_typestart (mpl::piecewise_select< Tp... >, Args &&... args)
 
template<typename... Tp, typename... Args>
bundle< Tag, BundleT, TupleT >::this_typestart (mpl::piecewise_ignore< Tp... >, Args &&... args)
 
template<typename... Tp, typename... Args>
bundle< Tag, BundleT, TupleT >::this_typestop (mpl::piecewise_select< Tp... >, Args &&... args)
 
template<typename... Tp, typename... Args>
bundle< Tag, BundleT, TupleT >::this_typestop (mpl::piecewise_ignore< Tp... >, Args &&... args)
 
template<typename... Args>
bundle< Tag, BundleT, TupleT >::this_typestart (Args &&... args)
 
template<typename... Args>
bundle< Tag, BundleT, TupleT >::this_typestop (Args &&... args)
 
template<typename... Args>
bundle< Tag, BundleT, TupleT >::this_typerecord (Args &&... args)
 
template<typename... Args>
bundle< Tag, BundleT, TupleT >::this_typereset (Args &&... args)
 
template<typename... Args>
bundle< Tag, BundleT, TupleT >::this_typeconstruct (Args &&... _args)
 
template<typename... Args>
bundle< Tag, BundleT, TupleT >::this_typeassemble (Args &&... _args)
 
template<typename... Args>
bundle< Tag, BundleT, TupleT >::this_typederive (Args &&... _args)
 
template<typename... Args>
bundle< Tag, BundleT, TupleT >::this_typemark (Args &&... _args)
 
template<typename... Args>
bundle< Tag, BundleT, TupleT >::this_typemark_begin (Args &&... _args)
 
template<typename... Args>
bundle< Tag, BundleT, TupleT >::this_typemark_end (Args &&... _args)
 
template<typename... Args>
bundle< Tag, BundleT, TupleT >::this_typestore (Args &&... _args)
 
template<typename... Args>
bundle< Tag, BundleT, TupleT >::this_typeaudit (Args &&... _args)
 
template<typename... Args>
bundle< Tag, BundleT, TupleT >::this_typeadd_secondary (Args &&... _args)
 
template<typename... Args>
bundle< Tag, BundleT, TupleT >::this_typeupdate_statistics (Args &&... _args)
 
template<template< typename > class OpT, typename... Args>
bundle< Tag, BundleT, TupleT >::this_typeinvoke (Args &&... _args)
 
template<template< typename > class OpT, typename... Tp, typename... Args>
bundle< Tag, BundleT, TupleT >::this_typeinvoke (mpl::piecewise_select< Tp... >, Args &&... _args)
 
template<template< typename > class OpT, typename... Tp, typename... Args>
bundle< Tag, BundleT, TupleT >::this_typeinvoke (mpl::piecewise_ignore< Tp... >, Args &&... _args)
 
template<typename... Args>
auto get (Args &&... args) const
 
template<typename... Args>
auto get_labeled (Args &&... args) const
 
template<typename... Tail>
bundle< Tag, BundleT, TupleT >::this_typedisable ()
 
template<typename T , typename Func , typename... Args, enable_if_t< trait::is_available< T >::value, int > >
bundle< Tag, BundleT, TupleT >::this_typetype_apply (Func &&_func, Args &&... _args)
 
template<typename T , typename Func , typename... Args, enable_if_t<!trait::is_available< T >::value, int > >
bundle< Tag, BundleT, TupleT >::this_typetype_apply (Func &&, Args &&...)
 
template<bool PrintPrefix, bool PrintLaps>
bundle< Tag, BundleT, TupleT >::this_typeprint (std::ostream &os, bool _endl) const
 

Static Public Member Functions

static initializer_typeget_initializer ()
 
template<typename U >
static constexpr bool is_this_type ()
 Query whether type matches this_type. More...
 
static constexpr bool has_user_bundle ()
 Query at compile-time whether a user_bundle exists in the set of components. user_bundle are more restricted versions of component bundlers but allow runtime insertion of components. More...
 
template<typename U >
static constexpr bool can_stack_init ()
 Query at compile-time whether initialization can occur on the stack. More...
 
template<typename U >
static constexpr bool can_heap_init ()
 Query at compile-time whether initialization can occur on the heap. More...
 
template<typename U >
static constexpr bool can_placement_init ()
 Query at compile-time whether initialization can occur via a placement new. Placement new init allows for the combination of optional initialization without a heap allocation. Not currently available. More...
 
template<typename U >
static constexpr bool can_init ()
 Query at compile-time whether the specified type can be initialized. More...
 
template<typename U >
static constexpr bool will_heap_init ()
 Query at compile-time whether initialization will occur on the heap. can_heap_init<T>() && !will_heap_init<T>() will indicate that a stack-allocated instance of the same type exists. More...
 
template<typename U >
static constexpr bool will_opaque_init ()
 Query at compile-time whether initialization will happen with an opaque wrapper (i.e. via user bundle). In this situation, initialization arguments are ignored and the component will only be initialized with the tim::scope::config of the bundle. More...
 
template<typename U , typename... Args, typename T = remove_pointer_decay_t<U>, enable_if_t< trait::is_available< T >::value > = 0>
static constexpr bool is_constructible ()
 Query at compile-time whether type can be constructed with the given argument types. if type is not available, then it probably won't be defined, so this places the trait::is_available<T> check in the template parameters and the std::is_constructible<T, ...> in the body to avoid undefined behavior. More...
 
template<typename U , typename... Args, typename T = remove_pointer_decay_t<U>, enable_if_t<!trait::is_available< T >::value > = 0>
static constexpr bool is_constructible ()
 Return false if the type is not available. More...
 
template<typename U , typename T = remove_pointer_decay_t<U>, enable_if_t< trait::is_available< T >::value > = 0>
static constexpr bool is_default_constructible ()
 Query at compile-time whether type supports default construction. If type is not available, then it probably won't be defined, so this places the trait::is_available<T> check in the template parameters and the std::is_constructible<T, ...> in the body to avoid undefined behavior. More...
 
template<typename U , typename T = remove_pointer_decay_t<U>, enable_if_t<!trait::is_available< T >::value > = 0>
static constexpr bool is_default_constructible ()
 Return false if the type is not available. More...
 
static void init_storage ()
 requests the component initialize their storage More...
 
static constexpr uint64_t fixed_count ()
 query the number of (compile-time) fixed components More...
 
static constexpr uint64_t optional_count ()
 query the number of (run-time) optional components More...
 

Protected Types

using apply_v = mpl::apply< void >
 
using bundle_type = api_bundle< Tag, typename TupleT::available_type >
 
using string_t = typename bundle_type::string_t
 
using reference_type = typename TupleT::reference_type
 

Protected Member Functions

template<typename T >
void set_scope (T *obj, internal_tag) const
 
template<typename T >
void set_prefix (T *obj, internal_tag) const
 

Protected Attributes

data_type m_data {}
 

Friends

template<typename... Tp>
class impl::base_bundle
 
template<typename... Tp>
class auto_base_bundle
 
template<typename... Tp>
class auto_bundle
 
template<typename... Tp>
class auto_tuple
 
template<typename... Tp>
class auto_list
 
this_type operator+ (this_type lhs, const this_type &rhs)
 
this_type operator- (this_type lhs, const this_type &rhs)
 
template<typename Op >
enable_if_t<!std::is_arithmetic< Op >::value, this_typeoperator* (this_type lhs, const Op &rhs)
 
template<typename Op >
enable_if_t<!std::is_arithmetic< Op >::value, this_typeoperator/ (this_type lhs, const Op &rhs)
 
std::ostream & operator<< (std::ostream &os, const bundle &obj)
 

Detailed Description

template<typename Tag, typename BundleT, typename TupleT>
class tim::bundle< Tag, BundleT, TupleT >

Example: bundle<Tag, component_bundle<Foo>, mixed_wrapper_types<concat<Bar, Baz>>> will use Tag + trait::is_available<Tag> or trait::runtime_available<Tag> to disable this bundle at compile-time or run-time, respectively. It will covert component_bundle<Foo> to component_bundle<Foo, Bar, Baz> for purposes of function signatures and it will instantiate std::tuple<...> depending on the compile-time availability of Bar and Baz. mixed_wrapper_types is a dummy type with the appropriate aliases to perform these conversions. Here is a theoretical implementation of mixed_wrapper_types (which supports allocating components on the stack and the heap):

Template Parameters
TagAPI tag type, e.g. TIMEMORY_API
BundleTThe empty or empty + tag derived type.
TupleTThe set of components wrapped in a type which provides the appropriate aliases.
template <typename... T>
struct heap_wrapper_types
{
TIMEMORY_DELETED_OBJECT(heap_wrapper_types)
/// the set of types, unaltered, in a type_list
using type_list_type = type_list<T...>;
/// the set of types without any pointers
using reference_type = type_list<std::remove_pointer_t<T>...>;
/// type list of the available types
using available_type = type_list_t<reference_type>;
/// the original bundle type
template <typename BundleT>
using this_type = convert_t<type_list<T...>, BundleT>;
/// the type after available_t<concat<...>>
template <typename BundleT>
using type = convert_t<available_type, BundleT>;
/// conversion to equivalent wrapper requiring explicit start/stop
template <typename BundleT>
using component_type = convert_t<type_list<T...>, BundleT>;
/// conversion to equivalent wrapper which automatically starts/stops
template <typename BundleT>
using auto_type = concepts::auto_type_t<convert_t<type_list_type, BundleT>>;
/// the valid types to instantiate in a tuple
template <typename ApiT = TIMEMORY_API>
trait::is_available<ApiT>::value,
std::tuple<>>,
std::tuple<>>;
};
typename TupleT::template data_type< Tag > data_type
Definition: bundle.hpp:153
typename TupleT::template component_type< BundleT > component_type
Definition: bundle.hpp:152
typename TupleT::type_list_type type_list_type
Definition: bundle.hpp:154
typename TupleT::template type< BundleT > type
Definition: bundle.hpp:151
typename TupleT::template this_type< BundleT > this_type
Definition: bundle.hpp:150
typename TupleT::reference_type reference_type
Definition: bundle.hpp:146
impl::filter_true< concepts::is_quirk_type, T > non_quirk_t
Definition: available.hpp:310
impl::filter_true< concepts::is_placeholder, T > non_placeholder_t
Definition: available.hpp:313
typename impl::add_pointer_if_not< T >::type add_pointer_if_not_t
Definition: impl.hpp:63
convert_t< mpl::available_t< concat< T... > >, type_list<> > type_list_t
Definition: available.hpp:333
typename std::conditional< B, Lhs, Rhs >::type conditional_t
Definition: types.hpp:197
typename impl::convert< T, U >::type convert_t
Definition: types.hpp:855
#define TIMEMORY_DELETED_OBJECT(NAME)
Definition: types.hpp:96
type_list
Definition: types.hpp:211

Definition at line 111 of file bundle.hpp.

Member Typedef Documentation

◆ apply_v

template<typename Tag , typename BundleT , typename TupleT >
using tim::bundle< Tag, BundleT, TupleT >::apply_v = mpl::apply<void>
protected

Definition at line 143 of file bundle.hpp.

◆ base_bundle_type

using tim::api_bundle< Tag , Types >::base_bundle_type = conditional_t<trait::is_available<Tag >::value, impl::base_bundle<Tag , remove_pointer_t<Types>...>, impl::base_bundle<Tag , std::tuple<> >>
inherited

Definition at line 643 of file base_bundle.hpp.

◆ bundle_type

template<typename Tag , typename BundleT , typename TupleT >
using tim::bundle< Tag, BundleT, TupleT >::bundle_type = api_bundle<Tag, typename TupleT::available_type>
protected

Definition at line 144 of file bundle.hpp.

◆ captured_location_t

template<typename Tag , typename BundleT , typename TupleT >
using tim::bundle< Tag, BundleT, TupleT >::captured_location_t = source_location::captured

Definition at line 149 of file bundle.hpp.

◆ component_type

template<typename Tag , typename BundleT , typename TupleT >
using tim::bundle< Tag, BundleT, TupleT >::component_type = typename TupleT::template component_type<BundleT>

Definition at line 152 of file bundle.hpp.

◆ data_type

template<typename Tag , typename BundleT , typename TupleT >
using tim::bundle< Tag, BundleT, TupleT >::data_type = typename TupleT::template data_type<Tag>

Definition at line 153 of file bundle.hpp.

◆ impl_type

using tim::api_bundle< Tag , Types >::impl_type = data_type
inherited

Definition at line 652 of file base_bundle.hpp.

◆ initializer_type

template<typename Tag , typename BundleT , typename TupleT >
using tim::bundle< Tag, BundleT, TupleT >::initializer_type = std::function<void(this_type&)>

Definition at line 157 of file bundle.hpp.

◆ quirk_config

template<typename Tag , typename BundleT , typename TupleT >
template<typename T , typename... U>
using tim::bundle< Tag, BundleT, TupleT >::quirk_config = tim::variadic::impl::quirk_config<T, reference_type, U...>

Definition at line 164 of file bundle.hpp.

◆ reference_type

template<typename Tag , typename BundleT , typename TupleT >
using tim::bundle< Tag, BundleT, TupleT >::reference_type = typename TupleT::reference_type
protected

Definition at line 146 of file bundle.hpp.

◆ size_type

template<typename Tag , typename BundleT , typename TupleT >
using tim::bundle< Tag, BundleT, TupleT >::size_type = typename bundle_type::size_type

Definition at line 156 of file bundle.hpp.

◆ string_t

template<typename Tag , typename BundleT , typename TupleT >
using tim::bundle< Tag, BundleT, TupleT >::string_t = typename bundle_type::string_t
protected

Definition at line 145 of file bundle.hpp.

◆ this_type

template<typename Tag , typename BundleT , typename TupleT >
using tim::bundle< Tag, BundleT, TupleT >::this_type = typename TupleT::template this_type<BundleT>

Definition at line 150 of file bundle.hpp.

◆ transient_func_t

template<typename Tag , typename BundleT , typename TupleT >
using tim::bundle< Tag, BundleT, TupleT >::transient_func_t = utility::transient_function<void(this_type&)>

Definition at line 158 of file bundle.hpp.

◆ tuple_type

using tim::api_bundle< Tag , Types >::tuple_type = data_type
inherited

Definition at line 651 of file base_bundle.hpp.

◆ type

template<typename Tag , typename BundleT , typename TupleT >
using tim::bundle< Tag, BundleT, TupleT >::type = typename TupleT::template type<BundleT>

Definition at line 151 of file bundle.hpp.

◆ type_list_type

template<typename Tag , typename BundleT , typename TupleT >
using tim::bundle< Tag, BundleT, TupleT >::type_list_type = typename TupleT::type_list_type

Definition at line 154 of file bundle.hpp.

◆ value_type

template<typename Tag , typename BundleT , typename TupleT >
using tim::bundle< Tag, BundleT, TupleT >::value_type = data_type

Definition at line 155 of file bundle.hpp.

Constructor & Destructor Documentation

◆ bundle() [1/14]

template<typename Tag , typename BundleT , typename TupleT >
tim::bundle< Tag, BundleT, TupleT >::bundle

Definition at line 55 of file bundle.cpp.

56{
57 update_last_instance(&get_this_type(), get_last_instance(),
58 quirk_config<quirk::stop_last_bundle>::value);
59 IF_CONSTEXPR(optional_count() > 0) { apply_v::set_value(m_data, nullptr); }
61}
static constexpr uint64_t optional_count()
query the number of (run-time) optional components
Definition: bundle.hpp:897
static initializer_type & get_initializer()
Definition: bundle.cpp:46
#define IF_CONSTEXPR(...)
Definition: language.hpp:72
void init(Args &&... args)
Definition: types.hpp:111

References IF_CONSTEXPR, and tim::init().

◆ bundle() [2/14]

template<typename Tag , typename BundleT , typename TupleT >
template<typename... T>
tim::bundle< Tag, BundleT, TupleT >::bundle ( const string_t _key,
quirk::config< T... >  _config,
transient_func_t  _init_func = get_initializer() 
)
explicit

Definition at line 67 of file bundle.cpp.

69: bundle_type(bundle_type::handle(type_list_type{}, _key, true_type{}, _config))
70, m_data(invoke::construct<data_type, Tag>(_key, _config))
71{
72 update_last_instance(&get_this_type(), get_last_instance(),
73 quirk_config<quirk::stop_last_bundle, T...>::value);
74 IF_CONSTEXPR(optional_count() > 0) { apply_v::set_value(m_data, nullptr); }
75 bundle_type::init(type_list_type{}, get_this_type(), m_data, std::move(_init_func),
76 _config);
77}
api_bundle< Tag, typename TupleT::available_type > bundle_type
Definition: bundle.hpp:144

◆ bundle() [3/14]

template<typename Tag , typename BundleT , typename TupleT >
template<typename... T>
tim::bundle< Tag, BundleT, TupleT >::bundle ( hash_value_t  _hash,
quirk::config< T... >  _config,
transient_func_t  _init_func = get_initializer() 
)
explicit

Definition at line 83 of file bundle.cpp.

85: bundle_type(bundle_type::handle(type_list_type{}, _hash, true_type{}, _config))
86, m_data(invoke::construct<data_type, Tag>(_hash, _config))
87{
88 update_last_instance(&get_this_type(), get_last_instance(),
89 quirk_config<quirk::stop_last_bundle, T...>::value);
90 IF_CONSTEXPR(optional_count() > 0) { apply_v::set_value(m_data, nullptr); }
91 bundle_type::init(type_list_type{}, get_this_type(), m_data, std::move(_init_func),
92 _config);
93}

◆ bundle() [4/14]

template<typename Tag , typename BundleT , typename TupleT >
template<typename... T>
tim::bundle< Tag, BundleT, TupleT >::bundle ( const captured_location_t _loc,
quirk::config< T... >  _config,
transient_func_t  _init_func = get_initializer() 
)
explicit

Definition at line 99 of file bundle.cpp.

102: bundle_type(bundle_type::handle(type_list_type{}, _loc, true_type{}, _config))
103, m_data(invoke::construct<data_type, Tag>(_loc, _config))
104{
105 update_last_instance(&get_this_type(), get_last_instance(),
106 quirk_config<quirk::stop_last_bundle, T...>::value);
107 IF_CONSTEXPR(optional_count() > 0) { apply_v::set_value(m_data, nullptr); }
108 bundle_type::init(type_list_type{}, get_this_type(), m_data, std::move(_init_func),
109 _config);
110}

◆ bundle() [5/14]

template<typename Tag , typename BundleT , typename TupleT >
template<typename... T>
tim::bundle< Tag, BundleT, TupleT >::bundle ( const string_t _key,
bool  _store,
quirk::config< T... >  _config,
transient_func_t  _init_func = get_initializer() 
)
explicit

Definition at line 116 of file bundle.cpp.

119: bundle_type(bundle_type::handle(type_list_type{}, _key, _store, _config))
120, m_data(invoke::construct<data_type, Tag>(_key, _config))
121{
122 update_last_instance(&get_this_type(), get_last_instance(),
123 quirk_config<quirk::stop_last_bundle, T...>::value);
124 IF_CONSTEXPR(optional_count() > 0) { apply_v::set_value(m_data, nullptr); }
125 bundle_type::init(type_list_type{}, get_this_type(), m_data, std::move(_init_func),
126 _config);
127}

◆ bundle() [6/14]

template<typename Tag , typename BundleT , typename TupleT >
template<typename... T>
tim::bundle< Tag, BundleT, TupleT >::bundle ( const captured_location_t _loc,
bool  _store,
quirk::config< T... >  _config,
transient_func_t  _init_func = get_initializer() 
)
explicit

Definition at line 133 of file bundle.cpp.

136: bundle_type(bundle_type::handle(type_list_type{}, _loc, _store, _config))
137, m_data(invoke::construct<data_type, Tag>(_loc, _config))
138{
139 update_last_instance(&get_this_type(), get_last_instance(),
140 quirk_config<quirk::stop_last_bundle, T...>::value);
141 IF_CONSTEXPR(optional_count() > 0) { apply_v::set_value(m_data, nullptr); }
142 bundle_type::init(type_list_type{}, get_this_type(), m_data, std::move(_init_func),
143 _config);
144}

◆ bundle() [7/14]

template<typename Tag , typename BundleT , typename TupleT >
tim::bundle< Tag, BundleT, TupleT >::bundle ( hash_value_t  _hash,
bool  _store = true,
scope::config  _scope = scope::get_default(),
transient_func_t  _init_func = get_initializer() 
)
explicit

Definition at line 149 of file bundle.cpp.

151: bundle_type(bundle_type::handle(type_list_type{}, _hash, _store, _scope))
152, m_data(invoke::construct<data_type, Tag>(_hash, m_scope))
153{
154 update_last_instance(&get_this_type(), get_last_instance(),
155 quirk_config<quirk::stop_last_bundle>::value);
156 IF_CONSTEXPR(optional_count() > 0) { apply_v::set_value(m_data, nullptr); }
157 bundle_type::init(type_list_type{}, get_this_type(), m_data, std::move(_init_func));
158}

◆ bundle() [8/14]

template<typename Tag , typename BundleT , typename TupleT >
tim::bundle< Tag, BundleT, TupleT >::bundle ( const string_t _key,
bool  _store = true,
scope::config  _scope = scope::get_default(),
transient_func_t  _init_func = get_initializer() 
)
explicit

Definition at line 163 of file bundle.cpp.

165: bundle_type(bundle_type::handle(type_list_type{}, _key, _store, _scope))
166{
167 update_last_instance(&get_this_type(), get_last_instance(),
168 quirk_config<quirk::stop_last_bundle>::value);
169 IF_CONSTEXPR(optional_count() > 0) { apply_v::set_value(m_data, nullptr); }
170 bundle_type::init(type_list_type{}, get_this_type(), m_data, std::move(_init_func));
171}

References IF_CONSTEXPR, and tim::init().

◆ bundle() [9/14]

template<typename Tag , typename BundleT , typename TupleT >
tim::bundle< Tag, BundleT, TupleT >::bundle ( const captured_location_t _loc,
bool  _store = true,
scope::config  _scope = scope::get_default(),
transient_func_t  _init_func = get_initializer() 
)
explicit

Definition at line 176 of file bundle.cpp.

178: bundle_type(bundle_type::handle(type_list_type{}, _loc, _store, _scope))
179{
180 update_last_instance(&get_this_type(), get_last_instance(),
181 quirk_config<quirk::stop_last_bundle>::value);
182 IF_CONSTEXPR(optional_count() > 0) { apply_v::set_value(m_data, nullptr); }
183 bundle_type::init(type_list_type{}, get_this_type(), m_data, std::move(_init_func));
184}

References IF_CONSTEXPR, and tim::init().

◆ bundle() [10/14]

template<typename Tag , typename BundleT , typename TupleT >
tim::bundle< Tag, BundleT, TupleT >::bundle ( hash_value_t  _hash,
scope::config  _scope,
transient_func_t  _init_func = get_initializer() 
)
explicit

Definition at line 189 of file bundle.cpp.

191: bundle_type(bundle_type::handle(type_list_type{}, _hash, true_type{}, _scope))
192{
193 update_last_instance(&get_this_type(), get_last_instance(),
194 quirk_config<quirk::stop_last_bundle>::value);
195 IF_CONSTEXPR(optional_count() > 0) { apply_v::set_value(m_data, nullptr); }
196 bundle_type::init(type_list_type{}, get_this_type(), m_data, std::move(_init_func));
197}

References IF_CONSTEXPR, and tim::init().

◆ bundle() [11/14]

template<typename Tag , typename BundleT , typename TupleT >
tim::bundle< Tag, BundleT, TupleT >::bundle ( const string_t _key,
scope::config  _scope,
transient_func_t  _init_func = get_initializer() 
)
explicit

Definition at line 202 of file bundle.cpp.

204: bundle_type(bundle_type::handle(type_list_type{}, _key, true_type{}, _scope))
205{
206 update_last_instance(&get_this_type(), get_last_instance(),
207 quirk_config<quirk::stop_last_bundle>::value);
208 IF_CONSTEXPR(optional_count() > 0) { apply_v::set_value(m_data, nullptr); }
209 bundle_type::init(type_list_type{}, get_this_type(), m_data, std::move(_init_func));
210}

References IF_CONSTEXPR, and tim::init().

◆ bundle() [12/14]

template<typename Tag , typename BundleT , typename TupleT >
tim::bundle< Tag, BundleT, TupleT >::bundle ( const captured_location_t _loc,
scope::config  _scope,
transient_func_t  _init_func = get_initializer() 
)
explicit

Definition at line 215 of file bundle.cpp.

217: bundle_type(bundle_type::handle(type_list_type{}, _loc, true_type{}, _scope))
218{
219 update_last_instance(&get_this_type(), get_last_instance(),
220 quirk_config<quirk::stop_last_bundle>::value);
221 IF_CONSTEXPR(optional_count() > 0) { apply_v::set_value(m_data, nullptr); }
222 bundle_type::init(type_list_type{}, get_this_type(), m_data, std::move(_init_func));
223}

References IF_CONSTEXPR, and tim::init().

◆ ~bundle()

template<typename Tag , typename BundleT , typename TupleT >
tim::bundle< Tag, BundleT, TupleT >::~bundle

Definition at line 228 of file bundle.cpp.

229{
230 if(get_last_instance() == &get_this_type())
231 update_last_instance(nullptr, get_last_instance(), false);
232
233 IF_CONSTEXPR(!quirk_config<quirk::explicit_stop>::value)
234 {
235 if(m_is_active())
236 stop();
237 }
238
240 {
241#if defined(DEBUG) && !defined(NDEBUG)
243 {
244 PRINT_HERE("%s", "deleting components");
245 }
246#endif
247 invoke::destroy<Tag>(m_data);
248 }
249}
this_type & stop(Args &&...)
invokes stop on all the components
#define PRINT_HERE(...)
Definition: macros.hpp:152

References tim::debug, IF_CONSTEXPR, PRINT_HERE, tim::invoke::stop(), and tim::verbose.

◆ bundle() [13/14]

template<typename Tag , typename BundleT , typename TupleT >
tim::bundle< Tag, BundleT, TupleT >::bundle ( const bundle< Tag, BundleT, TupleT > &  rhs)

Definition at line 254 of file bundle.cpp.

255: bundle_type(rhs)
256{
257 using copy_oper_t = convert_each_t<operation::copy, remove_pointers_t<data_type>>;
258 IF_CONSTEXPR(optional_count() > 0) { apply_v::set_value(m_data, nullptr); }
259 apply_v::access2<copy_oper_t>(m_data, rhs.m_data);
260}

References IF_CONSTEXPR.

◆ bundle() [14/14]

template<typename Tag , typename BundleT , typename TupleT >
tim::bundle< Tag, BundleT, TupleT >::bundle ( bundle< Tag, BundleT, TupleT > &&  )
default

Member Function Documentation

◆ add_secondary() [1/2]

template<typename Tag , typename BundleT , typename TupleT >
template<typename... Args>
bundle< Tag, BundleT, TupleT >::this_type & tim::bundle< Tag, BundleT, TupleT >::add_secondary ( Args &&...  _args)

Definition at line 806 of file bundle.cpp.

807{
808 return invoke<operation::add_secondary>(std::forward<Args>(_args)...);
809}
std::array< char *, 4 > _args

References tim::_args.

◆ add_secondary() [2/2]

template<typename Tag , typename BundleT , typename TupleT >
template<typename... Args>
this_type & tim::bundle< Tag, BundleT, TupleT >::add_secondary ( Args &&...  _args)

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

◆ assemble() [1/2]

template<typename Tag , typename BundleT , typename TupleT >
template<typename... Args>
bundle< Tag, BundleT, TupleT >::this_type & tim::bundle< Tag, BundleT, TupleT >::assemble ( Args &&...  _args)

Definition at line 723 of file bundle.cpp.

724{
725 return invoke<operation::assemble>(std::forward<Args>(_args)...);
726}

References tim::_args.

◆ assemble() [2/2]

template<typename Tag , typename BundleT , typename TupleT >
template<typename... Args>
this_type & tim::bundle< Tag, BundleT, TupleT >::assemble ( Args &&...  _args)

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.

◆ audit() [1/2]

template<typename Tag , typename BundleT , typename TupleT >
template<typename... Args>
bundle< Tag, BundleT, TupleT >::this_type & tim::bundle< Tag, BundleT, TupleT >::audit ( Args &&...  _args)

Definition at line 795 of file bundle.cpp.

796{
797 return invoke<operation::audit>(std::forward<Args>(_args)...);
798}

References tim::_args.

◆ audit() [2/2]

template<typename Tag , typename BundleT , typename TupleT >
template<typename... Args>
this_type & tim::bundle< Tag, BundleT, TupleT >::audit ( Args &&...  _args)

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

◆ can_heap_init()

template<typename Tag , typename BundleT , typename TupleT >
template<typename U >
static constexpr bool tim::bundle< Tag, BundleT, TupleT >::can_heap_init ( )
inlinestaticconstexpr

Query at compile-time whether initialization can occur on the heap.

Definition at line 299 of file bundle.hpp.

300 {
301 using T = remove_pointer_decay_t<U>;
302 return trait::is_available<T>::value && is_one_of<T*, data_type>::value;
303 }

◆ can_init()

template<typename Tag , typename BundleT , typename TupleT >
template<typename U >
static constexpr bool tim::bundle< Tag, BundleT, TupleT >::can_init ( )
inlinestaticconstexpr

Query at compile-time whether the specified type can be initialized.

Definition at line 316 of file bundle.hpp.

317 {
318 using T = remove_pointer_decay_t<U>;
319 return can_stack_init<T>() || can_heap_init<T>() || can_placement_init<T>() ||
320 (trait::is_available<T>::value && has_user_bundle());
321 }
static constexpr bool has_user_bundle()
Query at compile-time whether a user_bundle exists in the set of components. user_bundle are more res...
Definition: bundle.hpp:287

◆ can_placement_init()

template<typename Tag , typename BundleT , typename TupleT >
template<typename U >
static constexpr bool tim::bundle< Tag, BundleT, TupleT >::can_placement_init ( )
inlinestaticconstexpr

Query at compile-time whether initialization can occur via a placement new. Placement new init allows for the combination of optional initialization without a heap allocation. Not currently available.

Definition at line 309 of file bundle.hpp.

310 {
311 return false;
312 }

◆ can_stack_init()

template<typename Tag , typename BundleT , typename TupleT >
template<typename U >
static constexpr bool tim::bundle< Tag, BundleT, TupleT >::can_stack_init ( )
inlinestaticconstexpr

Query at compile-time whether initialization can occur on the stack.

Definition at line 291 of file bundle.hpp.

292 {
293 using T = remove_pointer_decay_t<U>;
294 return trait::is_available<T>::value && is_one_of<T, data_type>::value;
295 }

◆ clone()

template<typename Tag , typename BundleT , typename TupleT >
bundle< Tag, BundleT, TupleT > tim::bundle< Tag, BundleT, TupleT >::clone ( bool  store,
scope::config  _scope = scope::get_default() 
)

Definition at line 305 of file bundle.cpp.

306{
307 bundle tmp(*this);
308 tmp.m_store(_store);
309 tmp.m_scope = _scope;
310 return tmp;
311}

◆ construct() [1/2]

template<typename Tag , typename BundleT , typename TupleT >
template<typename... Args>
bundle< Tag, BundleT, TupleT >::this_type & tim::bundle< Tag, BundleT, TupleT >::construct ( Args &&...  _args)

Definition at line 710 of file bundle.cpp.

711{
712 // using construct_t = operation_t<operation::construct>;
713 // apply_v::access<construct_t>(m_data, std::forward<Args>(_args)...);
714 return invoke<operation::construct>(std::forward<Args>(_args)...);
715}

◆ construct() [2/2]

template<typename Tag , typename BundleT , typename TupleT >
template<typename... Args>
this_type & tim::bundle< Tag, BundleT, TupleT >::construct ( Args &&...  _args)

construct the objects that have constructors with matching arguments

◆ count()

template<typename Tag , typename BundleT , typename TupleT >
uint64_t tim::bundle< Tag, BundleT, TupleT >::count

number of objects that will be performing measurements

Definition at line 697 of file bundle.cpp.

698{
699 uint64_t _count = 0;
700 invoke::invoke<operation::generic_counter>(m_data, std::ref(_count));
701 return _count;
702}

◆ data() [1/2]

template<typename Tag , typename BundleT , typename TupleT >
bundle< Tag, BundleT, TupleT >::data_type & tim::bundle< Tag, BundleT, TupleT >::data

returns a reference to the underlying tuple of components

Definition at line 906 of file bundle.cpp.

907{
908 return m_data;
909}

◆ data() [2/2]

template<typename Tag , typename BundleT , typename TupleT >
const bundle< Tag, BundleT, TupleT >::data_type & tim::bundle< Tag, BundleT, TupleT >::data

returns a const reference to the underlying tuple of components

Definition at line 915 of file bundle.cpp.

916{
917 return m_data;
918}

◆ derive() [1/2]

template<typename Tag , typename BundleT , typename TupleT >
template<typename... Args>
bundle< Tag, BundleT, TupleT >::this_type & tim::bundle< Tag, BundleT, TupleT >::derive ( Args &&...  _args)

Definition at line 734 of file bundle.cpp.

735{
736 return invoke<operation::derive>(std::forward<Args>(_args)...);
737}

References tim::_args.

◆ derive() [2/2]

template<typename Tag , typename BundleT , typename TupleT >
template<typename... Args>
this_type & tim::bundle< Tag, BundleT, TupleT >::derive ( Args &&...  _args)

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

◆ disable() [1/2]

template<typename Tag , typename BundleT , typename TupleT >
template<typename... Tail>
bundle< Tag, BundleT, TupleT >::this_type & tim::bundle< Tag, BundleT, TupleT >::disable ( )

Definition at line 940 of file bundle.cpp.

941{
942 TIMEMORY_FOLD_EXPRESSION(operation::generic_deleter<remove_pointer_t<Tail>>{
943 this->get_reference<Tail>() });
944 return get_this_type();
945}
#define TIMEMORY_FOLD_EXPRESSION(...)
Definition: types.hpp:56

References TIMEMORY_FOLD_EXPRESSION.

◆ disable() [2/2]

template<typename Tag , typename BundleT , typename TupleT >
template<typename... Tail>
this_type & tim::bundle< Tag, BundleT, TupleT >::disable ( )

delete any optional types currently allocated

◆ execute()

template<typename Tag , typename BundleT , typename TupleT >
template<typename FuncT , typename... Args>
decltype(auto) tim::bundle< Tag, BundleT, TupleT >::execute ( FuncT &&  func,
Args &&...  args 
)

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

◆ fixed_count()

template<typename Tag , typename BundleT , typename TupleT >
constexpr uint64_t tim::bundle< Tag, BundleT, TupleT >::fixed_count
staticconstexpr

query the number of (compile-time) fixed components

Definition at line 886 of file bundle.hpp.

887{
888 return (size() -
889 mpl::get_tuple_size<
891}
impl::filter_false< Predicate, std::tuple< Sequence... > > type
Definition: available.hpp:259

◆ get() [1/7]

template<typename Tag , typename BundleT , typename TupleT >
template<typename U >
decltype(auto) tim::bundle< Tag, BundleT, TupleT >::get ( )

get a component from the bundle

◆ get() [2/7]

template<typename Tag , typename BundleT , typename TupleT >
template<typename U >
decltype(auto) tim::bundle< Tag, BundleT, TupleT >::get ( ) const

get a component from the bundle

◆ get() [3/7]

template<typename Tag , typename BundleT , typename TupleT >
template<typename... Args>
auto tim::bundle< Tag, BundleT, TupleT >::get ( Args &&...  args) const

Definition at line 886 of file bundle.cpp.

887{
888 return invoke::get<Tag>(m_data, std::forward<Args>(args)...);
889}

◆ get() [4/7]

template<typename Tag , typename BundleT , typename TupleT >
template<typename... Args>
auto tim::bundle< Tag, BundleT, TupleT >::get ( Args &&  ...) const

returns a tuple of invoking get() on all the components

◆ get() [5/7]

template<typename Tag , typename BundleT , typename TupleT >
template<typename U , typename FuncT >
decltype(auto) tim::bundle< Tag, BundleT, TupleT >::get ( FuncT &&  )

get a component from the bundle and apply function if the pointer is valid

◆ get() [6/7]

template<typename Tag , typename BundleT , typename TupleT >
template<typename U , typename FuncT >
decltype(auto) tim::bundle< Tag, BundleT, TupleT >::get ( FuncT &&  ) const

get a component from the bundle

◆ get() [7/7]

template<typename Tag , typename BundleT , typename TupleT >
bundle< Tag, BundleT, TupleT >::this_type & tim::bundle< Tag, BundleT, TupleT >::get ( void *&  ptr,
hash_value_t  _hash 
) const

performs an opaque search. Opaque searches are generally provided by user_bundles with a functor such as this:

auto _get = [](void* v_this, void*& ptr, size_t _hash) {
{
if(!ptr && v_this && _hash == typeid_hash<Tp>())
{
Tp* _this = static_cast<Tp*>(v_this);
_this->get(ptr, _hash);
}
return ptr;
};

And the component provides this function:

template <typename Tp, typename Value>
void
base<Tp, Value>::get(void*& ptr, size_t _hash) const
{
if(!ptr && _hash == typeid_hash<Tp>())
ptr = reinterpret_cast<void*>(const_cast<base_type*>(this));
}
auto get(const auto_bundle< Tag, Types... > &_obj)

Definition at line 925 of file bundle.cpp.

926{
927 if(!m_enabled())
928 return get_this_type();
929
930 tim::variadic::impl::get<Tag>(m_data, ptr, _hash);
931 return get_this_type();
932}

◆ get_component() [1/2]

template<typename Tag , typename BundleT , typename TupleT >
template<typename U >
auto tim::bundle< Tag, BundleT, TupleT >::get_component ( enable_if_t< trait::is_available< remove_pointer_decay_t< U > >::value &&is_one_of< remove_pointer_decay_t< U > *, data_type >::value, int >  = 0)

Definition at line 996 of file bundle.hpp.

1000{
1001 return get<remove_pointer_decay_t<U>>();
1002}

◆ get_component() [2/2]

template<typename Tag , typename BundleT , typename TupleT >
template<typename U >
auto tim::bundle< Tag, BundleT, TupleT >::get_component ( enable_if_t< trait::is_available< remove_pointer_decay_t< U > >::value &&is_one_of< remove_pointer_decay_t< U >, data_type >::value, int >  = 0)

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 984 of file bundle.hpp.

988{
989 return get<remove_pointer_decay_t<U>>();
990}

◆ get_data()

template<typename Tag , typename BundleT , typename TupleT >
const data_type & tim::bundle< Tag, BundleT, TupleT >::get_data ( ) const
inline

Definition at line 829 of file bundle.hpp.

829{ return m_data; }

◆ get_initializer()

template<typename Tag , typename BundleT , typename TupleT >
bundle< Tag, BundleT, TupleT >::initializer_type & tim::bundle< Tag, BundleT, TupleT >::get_initializer
static

Definition at line 46 of file bundle.cpp.

47{
48 static initializer_type _instance = [](this_type&) {};
49 return _instance;
50}
std::function< void(this_type &)> initializer_type
Definition: bundle.hpp:157

◆ get_labeled() [1/2]

template<typename Tag , typename BundleT , typename TupleT >
template<typename... Args>
auto tim::bundle< Tag, BundleT, TupleT >::get_labeled ( Args &&...  args) const

Definition at line 897 of file bundle.cpp.

898{
899 return invoke::get_labeled<Tag>(m_data, std::forward<Args>(args)...);
900}

◆ get_labeled() [2/2]

template<typename Tag , typename BundleT , typename TupleT >
template<typename... Args>
auto tim::bundle< Tag, BundleT, TupleT >::get_labeled ( Args &&  ...) const

returns a tuple of the component label + invoking get() on all the components

◆ get_reference() [1/2]

template<typename Tag , typename BundleT , typename TupleT >
template<typename U >
auto & tim::bundle< Tag, BundleT, TupleT >::get_reference ( enable_if_t< trait::is_available< remove_pointer_decay_t< U > >::value &&is_one_of< remove_pointer_decay_t< U > *, data_type >::value, int >  = 0)

returns a reference from a heap component instead of a pointer

Definition at line 1020 of file bundle.hpp.

1024{
1025 return std::get<index_of<remove_pointer_decay_t<U>*, data_type>::value>(m_data);
1026}

◆ get_reference() [2/2]

template<typename Tag , typename BundleT , typename TupleT >
template<typename U >
auto & tim::bundle< Tag, BundleT, TupleT >::get_reference ( enable_if_t< trait::is_available< remove_pointer_decay_t< U > >::value &&is_one_of< remove_pointer_decay_t< U >, data_type >::value, int >  = 0)

returns a reference from a stack component instead of a pointer

Definition at line 1008 of file bundle.hpp.

1012{
1013 return std::get<index_of<remove_pointer_decay_t<U>, data_type>::value>(m_data);
1014}

◆ get_scope_destructor() [1/2]

template<typename Tag , typename BundleT , typename TupleT >
scope::transient_destructor tim::bundle< Tag, BundleT, TupleT >::get_scope_destructor

returns a stack-object for calling stop

Definition at line 1053 of file bundle.cpp.

1054{
1055 return scope::transient_destructor{ [&]() { this->stop(); } };
1056}

References tim::invoke::stop().

◆ get_scope_destructor() [2/2]

template<typename Tag , typename BundleT , typename TupleT >
scope::transient_destructor tim::bundle< Tag, BundleT, TupleT >::get_scope_destructor ( utility::transient_function< void(this_type &)>  _func)

returns a stack-object for calling some member functions when the scope is exited.

Definition at line 1062 of file bundle.cpp.

1064{
1065 return scope::transient_destructor{ [&, _func]() { _func(get_this_type()); } };
1066}

◆ has_user_bundle()

template<typename Tag , typename BundleT , typename TupleT >
static constexpr bool tim::bundle< Tag, BundleT, TupleT >::has_user_bundle ( )
inlinestaticconstexpr

Query at compile-time whether a user_bundle exists in the set of components. user_bundle are more restricted versions of component bundlers but allow runtime insertion of components.

Definition at line 287 of file bundle.hpp.

287{ return bundle_type::has_user_bundle_v; }

◆ init() [1/5]

template<typename Tag , typename BundleT , typename TupleT >
template<typename U , typename T = remove_pointer_decay_t<U>, typename... Args>
bool tim::bundle< Tag, BundleT, TupleT >::init ( Args &&...  _args,
enable_if_t< can_stack_init< T >(), int >  = 0 
)
inline

try to re-create a stack object with provided arguments

Definition at line 732 of file bundle.hpp.

733 {
734 IF_CONSTEXPR(can_heap_init<T>())
735 {
736 static std::atomic<int> _count(0);
737 if((settings::verbose() > 1 || settings::debug()) && _count++ == 0)
738 {
739 fprintf(stderr,
740 "[bundle::init]> type exists as a heap-allocated instance "
741 "and stack-allocated instance: \"%s\"...\n",
742 demangle<T>().c_str());
743 }
744 }
745 T& _obj = std::get<index_of<T, data_type>::value>(m_data);
746 operation::construct<T>{ _obj, std::forward<Args>(_args)... };
747 set_prefix(&_obj, internal_tag{});
748 set_scope(&_obj, internal_tag{});
749 return true;
750 }
this_type & set_scope(scope::config)
Definition: bundle.cpp:1039
void set_prefix(const string_t &) const
Definition: bundle.cpp:994

References tim::_args, tim::debug, IF_CONSTEXPR, tim::invoke::set_prefix(), tim::invoke::set_scope(), and tim::verbose.

◆ init() [2/5]

template<typename Tag , typename BundleT , typename TupleT >
template<typename U , typename T = remove_pointer_decay_t<U>, typename... Args>
enable_if_t< will_heap_init< T >() &&!will_opaque_init< T >(), bool > tim::bundle< Tag, BundleT, TupleT >::init ( Args &&...  _args,
enable_if_t< is_constructible< T, Args... >(), int >  = 0 
)
inline

create an optional type that is in variadic list AND is available AND accepts arguments

Definition at line 650 of file bundle.hpp.

652 {
653 T*& _obj = std::get<index_of<T*, data_type>::value>(m_data);
654 if(!_obj)
655 {
657 {
658 printf("[bundle::init]> initializing type '%s'...\n",
659 demangle<T>().c_str());
660 }
661 if(!bundle_type::init_buffer())
662 {
663 _obj = new T(std::forward<Args>(_args)...);
664 }
665 else
666 {
667 T in(std::forward<Args>(_args)...);
668 _obj = m_buffer->write(&in).second;
669 }
670 set_prefix(_obj, internal_tag{});
671 set_scope(_obj, internal_tag{});
672 return true;
673 }
674
675 static std::atomic<int> _count(0);
676 if((settings::verbose() > 1 || settings::debug()) && _count++ == 0)
677 {
678 std::string _id = demangle<T>();
679 fprintf(stderr,
680 "[bundle::init]> skipping re-initialization of type"
681 " \"%s\"...\n",
682 _id.c_str());
683 }
684
685 return false;
686 }
tim::mpl::apply< std::string > string
Definition: macros.hpp:53

References tim::_args, tim::debug, tim::invoke::set_prefix(), tim::invoke::set_scope(), and tim::verbose.

◆ init() [3/5]

template<typename Tag , typename BundleT , typename TupleT >
template<typename U , typename T = remove_pointer_decay_t<U>, typename... Args>
enable_if_t<!trait::is_available< T >::value|| !(is_one_of< T *, data_type >::value||is_one_of< T, data_type >::value|| bundle_type::has_user_bundle_v), bool > tim::bundle< Tag, BundleT, TupleT >::init ( Args &&  ...)
inline

do nothing if type not available, not one of the variadic types, and there is no user bundle available

Definition at line 778 of file bundle.hpp.

779 {
780 return false;
781 }

◆ init() [4/5]

template<typename Tag , typename BundleT , typename TupleT >
template<typename U , typename T = remove_pointer_decay_t<U>, typename... Args>
bool tim::bundle< Tag, BundleT, TupleT >::init ( Args &&  ...,
enable_if_t< will_opaque_init< T >(), long >  = 0 
)
inline

if a type is not in variadic list but a tim::component::user_bundle is available, add it in there

Definition at line 755 of file bundle.hpp.

756 {
757 using bundle_t = decay_t<decltype(
758 std::get<0>(std::declval<typename bundle_type::user_bundle_types>()))>;
759 static_assert(trait::is_user_bundle<bundle_t>::value, "Error! Not a user_bundle");
760 this->init<bundle_t>();
761 auto* _bundle = this->get<bundle_t>();
762 if(_bundle)
763 {
764 _bundle->insert(component::factory::get_opaque<T>(m_scope),
765 component::factory::get_typeids<T>());
766 return true;
767 }
768 return false;
769 }
typename std::decay< T >::type decay_t
Alias template for decay.
Definition: types.hpp:194

◆ init() [5/5]

template<typename Tag , typename BundleT , typename TupleT >
template<typename U , typename T = remove_pointer_decay_t<U>, typename... Args>
enable_if_t< will_heap_init< T >() &&!will_opaque_init< T >(), bool > tim::bundle< Tag, BundleT, TupleT >::init ( Args &&  ...,
enable_if_t<!is_constructible< T, Args... >() &&is_default_constructible< T >(), long >  = 0 
)
inline

create an optional type that is in variadic list AND is available but is not constructible with provided arguments

Definition at line 691 of file bundle.hpp.

695 {
696 T*& _obj = std::get<index_of<T*, data_type>::value>(m_data);
697 if(!_obj)
698 {
700 {
701 fprintf(stderr, "[bundle::init]> initializing type '%s'...\n",
702 demangle<T>().c_str());
703 }
704 if(!bundle_type::init_buffer())
705 {
706 _obj = new T{};
707 }
708 else
709 {
710 T in{};
711 _obj = m_buffer->write(&in).second;
712 }
713 set_prefix(_obj, internal_tag{});
714 set_scope(_obj, internal_tag{});
715 return true;
716 }
717
718 static std::atomic<int> _count(0);
719 if((settings::verbose() > 1 || settings::debug()) && _count++ == 0)
720 {
721 fprintf(stderr,
722 "[bundle::init]> skipping re-initialization of type "
723 "\"%s\"...\n",
724 demangle<T>().c_str());
725 }
726
727 return false;
728 }

References tim::debug, tim::invoke::set_prefix(), tim::invoke::set_scope(), and tim::verbose.

◆ init_storage()

template<typename Tag , typename BundleT , typename TupleT >
void tim::bundle< Tag, BundleT, TupleT >::init_storage
static

requests the component initialize their storage

Definition at line 317 of file bundle.cpp.

318{
319 static thread_local bool _once = []() {
320 apply_v::type_access<operation::init_storage, mpl::non_quirk_t<reference_type>>();
321 return true;
322 }();
323 consume_parameters(_once);
324}
void consume_parameters(ArgsT &&...)
Definition: types.hpp:285

References tim::consume_parameters().

◆ initialize()

template<typename Tag , typename BundleT , typename TupleT >
template<typename... T, typename... Args>
std::array< bool, sizeof...(T)> tim::bundle< Tag, BundleT, TupleT >::initialize ( Args &&...  args)

variadic initialization

Template Parameters
Tcomponents to initialize
Argsarguments to pass to the construction of the component

Definition at line 953 of file bundle.cpp.

954{
955 if(!m_enabled())
956 return std::array<bool, sizeof...(T)>{};
957
958 constexpr auto N = sizeof...(T);
959 return TIMEMORY_FOLD_EXPANSION(bool, N, init<T>(std::forward<Args>(args)...));
960}
#define TIMEMORY_FOLD_EXPANSION(TYPE, SIZE,...)
Definition: types.hpp:64

References TIMEMORY_FOLD_EXPANSION.

◆ invoke() [1/6]

template<typename Tag , typename BundleT , typename TupleT >
template<template< typename > class OpT, typename... Args>
bundle< Tag, BundleT, TupleT >::this_type & tim::bundle< Tag, BundleT, TupleT >::invoke ( Args &&...  _args)

Definition at line 828 of file bundle.cpp.

829{
830 if(!m_enabled())
831 return get_this_type();
832
833 invoke::invoke<OpT, Tag>(m_data, std::forward<Args>(_args)...);
834 return get_this_type();
835}

References tim::_args.

◆ invoke() [2/6]

template<typename Tag , typename BundleT , typename TupleT >
template<template< typename > class OpT, typename... Args>
this_type & tim::bundle< Tag, BundleT, TupleT >::invoke ( Args &&...  _args)

generic member function for invoking user-provided operations

Template Parameters
OpTOperation struct

◆ invoke() [3/6]

template<typename Tag , typename BundleT , typename TupleT >
template<template< typename > class OpT, typename... Tp, typename... Args>
bundle< Tag, BundleT, TupleT >::this_type & tim::bundle< Tag, BundleT, TupleT >::invoke ( mpl::piecewise_ignore< Tp... >  ,
Args &&...  _args 
)

Definition at line 858 of file bundle.cpp.

859{
860 if(!m_enabled())
861 return get_this_type();
862 invoke_piecewise<OpT>(
863 mpl::subtract_t<mpl::available_t<type_list_type>, type_list<Tp...>>{},
864 std::forward<Args>(_args)...);
865 return get_this_type();
866}
typename impl::subtract< LhsT, RhsT >::type subtract_t
Definition: filters.hpp:426

References tim::_args.

◆ invoke() [4/6]

template<typename Tag , typename BundleT , typename TupleT >
template<template< typename > class OpT, typename... Tp, typename... Args>
this_type & tim::bundle< Tag, BundleT, TupleT >::invoke ( mpl::piecewise_ignore< Tp... >  ,
Args &&...  _args 
)

generic member function for invoking user-provided operations on all types that are not listed

Template Parameters
OpTOperation struct

◆ invoke() [5/6]

template<typename Tag , typename BundleT , typename TupleT >
template<template< typename > class OpT, typename... Tp, typename... Args>
bundle< Tag, BundleT, TupleT >::this_type & tim::bundle< Tag, BundleT, TupleT >::invoke ( mpl::piecewise_select< Tp... >  ,
Args &&...  _args 
)

Definition at line 843 of file bundle.cpp.

844{
845 if(!m_enabled())
846 return get_this_type();
847 invoke_piecewise<OpT>(mpl::available_t<type_list<Tp...>>{},
848 std::forward<Args>(_args)...);
849 return get_this_type();
850}
impl::filter_false< trait::is_available, T > available_t
Definition: available.hpp:324

References tim::_args.

◆ invoke() [6/6]

template<typename Tag , typename BundleT , typename TupleT >
template<template< typename > class OpT, typename... Tp, typename... Args>
this_type & tim::bundle< Tag, BundleT, TupleT >::invoke ( mpl::piecewise_select< Tp... >  ,
Args &&...  _args 
)

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

Template Parameters
OpTOperation struct

◆ is_constructible() [1/2]

template<typename Tag , typename BundleT , typename TupleT >
template<typename U , typename... Args, typename T = remove_pointer_decay_t<U>, enable_if_t< trait::is_available< T >::value > = 0>
static constexpr bool tim::bundle< Tag, BundleT, TupleT >::is_constructible ( )
inlinestaticconstexpr

Query at compile-time whether type can be constructed with the given argument types. if type is not available, then it probably won't be defined, so this places the trait::is_available<T> check in the template parameters and the std::is_constructible<T, ...> in the body to avoid undefined behavior.

Definition at line 351 of file bundle.hpp.

352 {
353 return std::is_constructible<T, Args...>::value;
354 }

◆ is_constructible() [2/2]

template<typename Tag , typename BundleT , typename TupleT >
template<typename U , typename... Args, typename T = remove_pointer_decay_t<U>, enable_if_t<!trait::is_available< T >::value > = 0>
static constexpr bool tim::bundle< Tag, BundleT, TupleT >::is_constructible ( )
inlinestaticconstexpr

Return false if the type is not available.

Definition at line 359 of file bundle.hpp.

360 {
361 return false;
362 }

◆ is_default_constructible() [1/2]

template<typename Tag , typename BundleT , typename TupleT >
template<typename U , typename T = remove_pointer_decay_t<U>, enable_if_t< trait::is_available< T >::value > = 0>
static constexpr bool tim::bundle< Tag, BundleT, TupleT >::is_default_constructible ( )
inlinestaticconstexpr

Query at compile-time whether type supports default construction. If type is not available, then it probably won't be defined, so this places the trait::is_available<T> check in the template parameters and the std::is_constructible<T, ...> in the body to avoid undefined behavior.

Definition at line 370 of file bundle.hpp.

371 {
372 return std::is_default_constructible<T>::value;
373 }

◆ is_default_constructible() [2/2]

template<typename Tag , typename BundleT , typename TupleT >
template<typename U , typename T = remove_pointer_decay_t<U>, enable_if_t<!trait::is_available< T >::value > = 0>
static constexpr bool tim::bundle< Tag, BundleT, TupleT >::is_default_constructible ( )
inlinestaticconstexpr

Return false if the type is not available.

Definition at line 378 of file bundle.hpp.

379 {
380 return false;
381 }

◆ is_this_type()

template<typename Tag , typename BundleT , typename TupleT >
template<typename U >
static constexpr bool tim::bundle< Tag, BundleT, TupleT >::is_this_type ( )
inlinestaticconstexpr

Query whether type matches this_type.

Definition at line 168 of file bundle.hpp.

169 {
170 return std::is_same<decay_t<U>, this_type>::value;
171 }

◆ mark() [1/2]

template<typename Tag , typename BundleT , typename TupleT >
template<typename... Args>
bundle< Tag, BundleT, TupleT >::this_type & tim::bundle< Tag, BundleT, TupleT >::mark ( Args &&...  _args)

Definition at line 745 of file bundle.cpp.

746{
747 return invoke<operation::mark>(std::forward<Args>(_args)...);
748}

References tim::_args.

◆ mark() [2/2]

template<typename Tag , typename BundleT , typename TupleT >
template<typename... Args>
this_type & tim::bundle< Tag, BundleT, TupleT >::mark ( Args &&...  _args)

mark an atomic event

◆ mark_begin() [1/2]

template<typename Tag , typename BundleT , typename TupleT >
template<typename... Args>
bundle< Tag, BundleT, TupleT >::this_type & tim::bundle< Tag, BundleT, TupleT >::mark_begin ( Args &&...  _args)

Definition at line 756 of file bundle.cpp.

757{
758 return invoke<operation::mark_begin>(std::forward<Args>(_args)...);
759}

References tim::_args.

◆ mark_begin() [2/2]

template<typename Tag , typename BundleT , typename TupleT >
template<typename... Args>
this_type & tim::bundle< Tag, BundleT, TupleT >::mark_begin ( Args &&...  _args)

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

◆ mark_end() [1/2]

template<typename Tag , typename BundleT , typename TupleT >
template<typename... Args>
bundle< Tag, BundleT, TupleT >::this_type & tim::bundle< Tag, BundleT, TupleT >::mark_end ( Args &&...  _args)

Definition at line 767 of file bundle.cpp.

768{
769 return invoke<operation::mark_end>(std::forward<Args>(_args)...);
770}

References tim::_args.

◆ mark_end() [2/2]

template<typename Tag , typename BundleT , typename TupleT >
template<typename... Args>
this_type & tim::bundle< Tag, BundleT, TupleT >::mark_end ( Args &&...  _args)

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

◆ measure() [1/2]

template<typename Tag , typename BundleT , typename TupleT >
template<typename... Args>
bundle< Tag, BundleT, TupleT >::this_type & tim::bundle< Tag, BundleT, TupleT >::measure ( Args &&...  args)

Definition at line 484 of file bundle.cpp.

485{
486 return invoke<operation::measure>(std::forward<Args>(args)...);
487}

◆ measure() [2/2]

template<typename Tag , typename BundleT , typename TupleT >
template<typename... Args>
this_type & tim::bundle< Tag, BundleT, TupleT >::measure ( Args &&  ...)

requests each component record a measurment

◆ operator*=()

template<typename Tag , typename BundleT , typename TupleT >
template<typename Op , enable_if_t<!is_this_type< Op >()> = 0>
this_type & tim::bundle< Tag, BundleT, TupleT >::operator*= ( Op &&  rhs)
inline

Definition at line 244 of file bundle.hpp.

245 {
246 invoke::invoke<operation::multiply, Tag>(m_data, std::forward<Op>(rhs));
247 return get_this_type();
248 }

◆ operator+=() [1/2]

template<typename Tag , typename BundleT , typename TupleT >
bundle< Tag, BundleT, TupleT >::this_type & tim::bundle< Tag, BundleT, TupleT >::operator+= ( const this_type rhs)

Definition at line 294 of file bundle.cpp.

295{
296 bundle_type::operator+=(static_cast<const bundle_type&>(rhs));
297 invoke::invoke_impl::invoke_data<operation::plus, Tag>(m_data, rhs.m_data);
298 return get_this_type();
299}
::tim::statistics< tuple<> > & operator+=(::tim::statistics< tuple<> > &_lhs, const Tp &)
Definition: statistics.hpp:338

References std::operator+=().

◆ operator+=() [2/2]

template<typename Tag , typename BundleT , typename TupleT >
template<typename Op , enable_if_t<!is_this_type< Op >()> = 0>
this_type & tim::bundle< Tag, BundleT, TupleT >::operator+= ( Op &&  rhs)
inline

Definition at line 237 of file bundle.hpp.

238 {
239 invoke::invoke<operation::plus, Tag>(m_data, std::forward<Op>(rhs));
240 return get_this_type();
241 }

◆ operator-=() [1/2]

template<typename Tag , typename BundleT , typename TupleT >
bundle< Tag, BundleT, TupleT >::this_type & tim::bundle< Tag, BundleT, TupleT >::operator-= ( const this_type rhs)

Definition at line 283 of file bundle.cpp.

284{
285 bundle_type::operator-=(static_cast<const bundle_type&>(rhs));
286 invoke::invoke_impl::invoke_data<operation::minus, Tag>(m_data, rhs.m_data);
287 return get_this_type();
288}
std::array< Tp, N > & operator-=(std::array< Tp, N > &, const std::array< Tp, N > &)
Definition: stl.hpp:96

◆ operator-=() [2/2]

template<typename Tag , typename BundleT , typename TupleT >
template<typename Op , enable_if_t<!is_this_type< Op >()> = 0>
this_type & tim::bundle< Tag, BundleT, TupleT >::operator-= ( Op &&  rhs)
inline

Definition at line 230 of file bundle.hpp.

231 {
232 invoke::invoke<operation::minus, Tag>(m_data, std::forward<Op>(rhs));
233 return get_this_type();
234 }

◆ operator/=()

template<typename Tag , typename BundleT , typename TupleT >
template<typename Op , enable_if_t<!is_this_type< Op >()> = 0>
this_type & tim::bundle< Tag, BundleT, TupleT >::operator/= ( Op &&  rhs)
inline

Definition at line 251 of file bundle.hpp.

252 {
253 invoke::invoke<operation::divide, Tag>(m_data, std::forward<Op>(rhs));
254 return get_this_type();
255 }

◆ operator=() [1/2]

template<typename Tag , typename BundleT , typename TupleT >
bundle & tim::bundle< Tag, BundleT, TupleT >::operator= ( bundle< Tag, BundleT, TupleT > &&  )
default

◆ operator=() [2/2]

template<typename Tag , typename BundleT , typename TupleT >
bundle< Tag, BundleT, TupleT > & tim::bundle< Tag, BundleT, TupleT >::operator= ( const bundle< Tag, BundleT, TupleT > &  rhs)

Definition at line 266 of file bundle.cpp.

267{
268 if(this != &rhs)
269 {
270 bundle_type::operator=(rhs);
271 invoke::destroy<Tag>(m_data);
272 invoke::invoke_impl::invoke_data<operation::copy, Tag>(m_data, rhs.m_data);
273 // apply_v::access<operation_t<operation::copy>>(m_data);
274 }
275 return get_this_type();
276}

◆ optional_count()

template<typename Tag , typename BundleT , typename TupleT >
constexpr uint64_t tim::bundle< Tag, BundleT, TupleT >::optional_count
staticconstexpr

query the number of (run-time) optional components

Definition at line 897 of file bundle.hpp.

898{
899 return mpl::get_tuple_size<
901}

◆ pop() [1/5]

template<typename Tag , typename BundleT , typename TupleT >
bundle< Tag, BundleT, TupleT >::this_type & tim::bundle< Tag, BundleT, TupleT >::pop

tells each component to pop itself off of the call-stack hierarchy

Definition at line 429 of file bundle.cpp.

430{
431 if(!m_enabled())
432 return get_this_type();
433
434 if(m_is_pushed())
435 {
436 // set the current node to the parent node
437 invoke::pop<Tag>(m_data);
438 // avoid pushing/popping when already pushed/popped
439 m_is_pushed(false);
440 }
441 return get_this_type();
442}

◆ pop() [2/5]

template<typename Tag , typename BundleT , typename TupleT >
template<typename... Tp>
bundle< Tag, BundleT, TupleT >::this_type & tim::bundle< Tag, BundleT, TupleT >::pop ( mpl::piecewise_ignore< Tp... >  )

Definition at line 466 of file bundle.cpp.

468{
469 if(!m_enabled())
470 return get_this_type();
471
472 using pw_type = mpl::subtract_t<mpl::available_t<type_list_type>, type_list<Tp...>>;
473 // set the current node to the parent node
474 invoke_piecewise<operation::pop_node>(pw_type{});
475 return get_this_type();
476}

◆ pop() [3/5]

template<typename Tag , typename BundleT , typename TupleT >
template<typename... Tp>
this_type & tim::bundle< Tag, BundleT, TupleT >::pop ( mpl::piecewise_ignore< Tp... >  )

selective pop

◆ pop() [4/5]

template<typename Tag , typename BundleT , typename TupleT >
template<typename... Tp>
bundle< Tag, BundleT, TupleT >::this_type & tim::bundle< Tag, BundleT, TupleT >::pop ( mpl::piecewise_select< Tp... >  )

Definition at line 449 of file bundle.cpp.

451{
452 if(!m_enabled())
453 return get_this_type();
454
455 using pw_type = convert_t<mpl::implemented_t<Tp...>, mpl::piecewise_select<>>;
456 // set the current node to the parent node
457 invoke::invoke<operation::pop_node, Tag>(pw_type{}, m_data);
458 return get_this_type();
459}
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 Tag , typename BundleT , typename TupleT >
template<typename... Tp>
this_type & tim::bundle< Tag, BundleT, TupleT >::pop ( mpl::piecewise_select< Tp... >  )

selective pop

◆ print() [1/2]

template<typename Tag , typename BundleT , typename TupleT >
template<bool PrintPrefix, bool PrintLaps>
bundle< Tag, BundleT, TupleT >::this_type & tim::bundle< Tag, BundleT, TupleT >::print ( std::ostream &  os,
bool  _endl 
) const

Definition at line 1103 of file bundle.cpp.

1104{
1105 using printer_t = typename bundle_type::print_type;
1106 if(size() == 0 || m_hash == 0)
1107 return get_this_type();
1108 std::stringstream ss_data;
1109 apply_v::access_with_indices<printer_t>(m_data, std::ref(ss_data), false);
1110 if(PrintPrefix)
1111 {
1112 bundle_type::update_width();
1113 std::stringstream ss_prefix;
1114 std::stringstream ss_id;
1115 ss_id << get_prefix() << " " << std::left << key();
1116 ss_prefix << std::setw(bundle_type::output_width()) << std::left << ss_id.str()
1117 << " : ";
1118 os << ss_prefix.str();
1119 }
1120 std::string _s = ss_data.str();
1121 if(_s.empty())
1122 return get_this_type();
1123 while(_s.find_last_of(", ") == _s.length() - 1)
1124 _s = _s.substr(0, _s.length() - 1);
1125 if(_s.empty())
1126 return get_this_type();
1127 os << _s;
1128 if(m_laps > 0 && PrintLaps)
1129 os << " [laps: " << m_laps << "]";
1130 if(_endl)
1131 os << '\n';
1132 return get_this_type();
1133}
const std::string std::ostream * os

References tim::os.

◆ print() [2/2]

template<typename Tag , typename BundleT , typename TupleT >
template<bool PrintPrefix = true, bool PrintLaps = true>
this_type & tim::bundle< Tag, BundleT, TupleT >::print ( std::ostream &  os,
bool  _endl = false 
) const

◆ push() [1/9]

template<typename Tag , typename BundleT , typename TupleT >
bundle< Tag, BundleT, TupleT >::this_type & tim::bundle< Tag, BundleT, TupleT >::push

tells each component to push itself into the call-stack hierarchy

Definition at line 331 of file bundle.cpp.

332{
333 if(!m_enabled())
334 return get_this_type();
335
336 if(!m_is_pushed())
337 {
338 // reset the data
339 invoke::reset<Tag>(m_data);
340 // avoid pushing/popping when already pushed/popped
341 m_is_pushed(true);
342 // insert node or find existing node
343 invoke::push<Tag>(m_data, m_scope, m_hash);
344 }
345 return get_this_type();
346}

◆ push() [2/9]

template<typename Tag , typename BundleT , typename TupleT >
template<typename... Tp>
bundle< Tag, BundleT, TupleT >::this_type & tim::bundle< Tag, BundleT, TupleT >::push ( mpl::piecewise_ignore< Tp... >  )

Definition at line 372 of file bundle.cpp.

374{
375 if(!m_enabled())
376 return get_this_type();
377
378 using pw_type = mpl::subtract_t<mpl::available_t<type_list_type>, type_list<Tp...>>;
379 // reset the data
380 invoke_piecewise<operation::reset>(pw_type{});
381 // insert node or find existing node
382 invoke_piecewise<operation::push_node>(pw_type{}, m_scope, m_hash);
383 return get_this_type();
384}

◆ push() [3/9]

template<typename Tag , typename BundleT , typename TupleT >
template<typename... Tp>
this_type & tim::bundle< Tag, BundleT, TupleT >::push ( mpl::piecewise_ignore< Tp... >  )

selective push

◆ push() [4/9]

template<typename Tag , typename BundleT , typename TupleT >
template<typename... Tp>
bundle< Tag, BundleT, TupleT >::this_type & tim::bundle< Tag, BundleT, TupleT >::push ( mpl::piecewise_ignore< Tp... >  ,
scope::config  _scope 
)

Definition at line 411 of file bundle.cpp.

412{
413 if(!m_enabled())
414 return get_this_type();
415
416 using pw_type = mpl::subtract_t<mpl::available_t<type_list_type>, type_list<Tp...>>;
417 // reset the data
418 invoke_piecewise<operation::reset>(pw_type{});
419 // insert node or find existing node
420 invoke_piecewise<operation::push_node>(pw_type{}, _scope, m_hash);
421 return get_this_type();
422}

◆ push() [5/9]

template<typename Tag , typename BundleT , typename TupleT >
template<typename... Tp>
this_type & tim::bundle< Tag, BundleT, TupleT >::push ( mpl::piecewise_ignore< Tp... >  ,
scope::config   
)

selective push with scope configuration

◆ push() [6/9]

template<typename Tag , typename BundleT , typename TupleT >
template<typename... Tp>
bundle< Tag, BundleT, TupleT >::this_type & tim::bundle< Tag, BundleT, TupleT >::push ( mpl::piecewise_select< Tp... >  )

Definition at line 353 of file bundle.cpp.

355{
356 if(!m_enabled())
357 return get_this_type();
358
359 using pw_type = convert_t<mpl::implemented_t<Tp...>, mpl::piecewise_select<>>;
360 // reset the data
361 invoke::invoke<operation::reset, Tag>(pw_type{}, m_data);
362 // insert node or find existing node
363 invoke::invoke<operation::push_node, Tag>(pw_type{}, m_data, m_scope, m_hash);
364 return get_this_type();
365}

◆ push() [7/9]

template<typename Tag , typename BundleT , typename TupleT >
template<typename... Tp>
this_type & tim::bundle< Tag, BundleT, TupleT >::push ( mpl::piecewise_select< Tp... >  )

selective push

◆ push() [8/9]

template<typename Tag , typename BundleT , typename TupleT >
template<typename... Tp>
bundle< Tag, BundleT, TupleT >::this_type & tim::bundle< Tag, BundleT, TupleT >::push ( mpl::piecewise_select< Tp... >  ,
scope::config  _scope 
)

Definition at line 392 of file bundle.cpp.

393{
394 if(!m_enabled())
395 return get_this_type();
396
397 using pw_type = convert_t<mpl::implemented_t<Tp...>, mpl::piecewise_select<>>;
398 // reset the data
399 invoke::invoke<operation::reset, Tag>(pw_type{}, m_data);
400 // insert node or find existing node
401 invoke::invoke<operation::push_node, Tag>(pw_type{}, m_data, _scope, m_hash);
402 return get_this_type();
403}

◆ push() [9/9]

template<typename Tag , typename BundleT , typename TupleT >
template<typename... Tp>
this_type & tim::bundle< Tag, BundleT, TupleT >::push ( mpl::piecewise_select< Tp... >  ,
scope::config   
)

selective push with scope configuration

◆ record() [1/2]

template<typename Tag , typename BundleT , typename TupleT >
template<typename... Args>
bundle< Tag, BundleT, TupleT >::this_type & tim::bundle< Tag, BundleT, TupleT >::record ( Args &&...  args)

Definition at line 671 of file bundle.cpp.

672{
673 if(!m_enabled())
674 return get_this_type();
675
676 ++m_laps;
677 return invoke<operation::record>(std::forward<Args>(args)...);
678}

◆ record() [2/2]

template<typename Tag , typename BundleT , typename TupleT >
template<typename... Args>
this_type & tim::bundle< Tag, BundleT, TupleT >::record ( Args &&  ...)

requests each component perform a measurement

◆ rekey() [1/3]

template<typename Tag , typename BundleT , typename TupleT >
void tim::bundle< Tag, BundleT, TupleT >::rekey ( captured_location_t  _loc)

Definition at line 1042 of file bundle.hpp.

1043{
1044 m_hash = _loc.get_hash();
1045 set_prefix(_loc);
1046}

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

◆ rekey() [2/3]

template<typename Tag , typename BundleT , typename TupleT >
void tim::bundle< Tag, BundleT, TupleT >::rekey ( const string_t _key)

Definition at line 1032 of file bundle.hpp.

1033{
1034 m_hash = add_hash_id(_key);
1035 set_prefix(_key);
1036}
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 Tag , typename BundleT , typename TupleT >
void tim::bundle< Tag, BundleT, TupleT >::rekey ( uint64_t  _hash)

Definition at line 1052 of file bundle.hpp.

1053{
1054 m_hash = _hash;
1055 set_prefix(_hash);
1056}

References tim::invoke::set_prefix().

◆ reset() [1/2]

template<typename Tag , typename BundleT , typename TupleT >
template<typename... Args>
bundle< Tag, BundleT, TupleT >::this_type & tim::bundle< Tag, BundleT, TupleT >::reset ( Args &&...  args)

Definition at line 686 of file bundle.cpp.

687{
688 m_laps = 0;
689 return invoke<operation::reset>(std::forward<Args>(args)...);
690}

◆ reset() [2/2]

template<typename Tag , typename BundleT , typename TupleT >
template<typename... Args>
this_type & tim::bundle< Tag, BundleT, TupleT >::reset ( Args &&  ...)

invokes reset member function on all the components

◆ sample() [1/2]

template<typename Tag , typename BundleT , typename TupleT >
template<typename... Args>
bundle< Tag, BundleT, TupleT >::this_type & tim::bundle< Tag, BundleT, TupleT >::sample ( Args &&...  args)

Definition at line 495 of file bundle.cpp.

496{
497 return invoke<operation::sample>(std::forward<Args>(args)...);
498}

◆ sample() [2/2]

template<typename Tag , typename BundleT , typename TupleT >
template<typename... Args>
this_type & tim::bundle< Tag, BundleT, TupleT >::sample ( Args &&  ...)

requests each component take a sample (if supported)

◆ serialize()

template<typename Tag , typename BundleT , typename TupleT >
template<typename Archive >
void tim::bundle< Tag, BundleT, TupleT >::serialize ( Archive &  ar,
const unsigned int   
)

Definition at line 1140 of file bundle.cpp.

1141{
1142 std::string _key = {};
1143 auto keyitr = get_hash_ids()->find(m_hash);
1144 if(keyitr != get_hash_ids()->end())
1145 _key = keyitr->second;
1146
1147 ar(cereal::make_nvp("hash", m_hash), cereal::make_nvp("key", _key),
1148 cereal::make_nvp("laps", m_laps));
1149
1150 if(keyitr == get_hash_ids()->end())
1151 {
1152 auto _hash = add_hash_id(_key);
1153 if(_hash != m_hash)
1154 {
1155 PRINT_HERE("Warning! Hash for '%s' (%llu) != %llu", _key.c_str(),
1156 (unsigned long long) _hash, (unsigned long long) m_hash);
1157 }
1158 }
1159
1160 ar.setNextName("data");
1161 ar.startNode();
1163 ar.finishNode();
1164 // ar(cereal::make_nvp("data", m_data));
1165}
return _hash_map end()
hash_map_ptr_t & get_hash_ids()
auto serialize(ArchiveT &ar, TupleT< Tp... > &obj)

References PRINT_HERE, and tim::invoke::serialize().

◆ set_prefix() [1/4]

template<typename Tag , typename BundleT , typename TupleT >
bundle< Tag, BundleT, TupleT >::this_type & tim::bundle< Tag, BundleT, TupleT >::set_prefix ( captured_location_t  _loc) const

Definition at line 1030 of file bundle.cpp.

1031{
1032 return set_prefix(_loc.get_hash());
1033}

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

◆ set_prefix() [2/4]

template<typename Tag , typename BundleT , typename TupleT >
void tim::bundle< Tag, BundleT, TupleT >::set_prefix ( const string_t _key) const

Definition at line 994 of file bundle.cpp.

995{
996 if(!m_enabled())
997 return;
998
999 invoke::set_prefix<Tag>(m_data, m_hash, _key);
1000}

◆ set_prefix() [3/4]

template<typename Tag , typename BundleT , typename TupleT >
bundle< Tag, BundleT, TupleT >::this_type & tim::bundle< Tag, BundleT, TupleT >::set_prefix ( hash_value_t  _hash) const

Definition at line 1006 of file bundle.cpp.

1007{
1008 if(!m_enabled())
1009 return get_this_type();
1010
1011 const auto& _hash_ids = hash::get_hash_ids();
1012 auto itr = hash::find_hash_identifier(_hash_ids, hash::get_hash_aliases(), _hash);
1013 if(itr != _hash_ids->end())
1014 {
1015 invoke::set_prefix<Tag>(m_data, _hash, itr->second);
1016 }
1017 else
1018 {
1019 const char* _prefix = nullptr;
1021 invoke::set_prefix<Tag>(m_data, _hash, _prefix);
1022 }
1023 return get_this_type();
1024}
hash_alias_ptr_t & get_hash_aliases()
bool get_hash_identifier(const hash_map_ptr_t &_hash_map, const hash_alias_ptr_t &_hash_alias, hash_value_t _hash_id, std::string *&_ret)
hash_map_t::const_iterator find_hash_identifier(const hash_map_ptr_t &_hash_map, const hash_alias_ptr_t &_hash_alias, hash_value_t _hash_id)
char const std::string & _prefix
Definition: config.cpp:55

References tim::_prefix, tim::hash::find_hash_identifier(), tim::hash::get_hash_aliases(), tim::hash::get_hash_identifier(), and tim::hash::get_hash_ids().

◆ set_prefix() [4/4]

template<typename Tag , typename BundleT , typename TupleT >
template<typename T >
void tim::bundle< Tag, BundleT, TupleT >::set_prefix ( T *  obj,
internal_tag   
) const
protected

Definition at line 1073 of file bundle.cpp.

1074{
1075 if(!m_enabled())
1076 return;
1077
1078 using PrefixOpT = operation::generic_operator<T, operation::set_prefix<T>, Tag>;
1079 std::string* _key = nullptr;
1080 if(get_hash_identifier_fast(m_hash, _key))
1081 PrefixOpT{ obj, m_hash, *_key };
1082}
string_view_t get_hash_identifier_fast(hash_value_t _hash)
this does not check other threads or aliases. Only call this function when you know that the hash exi...
Definition: types.hpp:252

◆ set_scope() [1/2]

template<typename Tag , typename BundleT , typename TupleT >
bundle< Tag, BundleT, TupleT >::this_type & tim::bundle< Tag, BundleT, TupleT >::set_scope ( scope::config  val)

Definition at line 1039 of file bundle.cpp.

1040{
1041 if(!m_enabled())
1042 return get_this_type();
1043
1044 m_scope = val;
1045 invoke::set_scope<Tag>(m_data, m_scope);
1046 return get_this_type();
1047}

◆ set_scope() [2/2]

template<typename Tag , typename BundleT , typename TupleT >
template<typename T >
void tim::bundle< Tag, BundleT, TupleT >::set_scope ( T *  obj,
internal_tag   
) const
protected

Definition at line 1089 of file bundle.cpp.

1090{
1091 if(!m_enabled())
1092 return;
1093
1094 using PrefixOpT = operation::generic_operator<T, operation::set_scope<T>, Tag>;
1095 PrefixOpT(obj, m_scope);
1096}

◆ start() [1/8]

template<typename Tag , typename BundleT , typename TupleT >
template<typename... Args>
bundle< Tag, BundleT, TupleT >::this_type & tim::bundle< Tag, BundleT, TupleT >::start ( Args &&...  args)

Definition at line 624 of file bundle.cpp.

625{
626 if(!m_enabled())
627 return get_this_type();
628
629 // push components into the call-stack
630 IF_CONSTEXPR(!quirk_config<quirk::explicit_push>::value &&
631 !quirk_config<quirk::no_store>::value)
632 {
633 if(m_store() && !bundle_type::m_explicit_push())
634 push();
635 }
636
637 // start components
638 start(mpl::lightweight{}, std::forward<Args>(args)...);
639 return get_this_type();
640}
this_type & start(Args &&...)
invokes start on all the components
this_type & push()
tells each component to push itself into the call-stack hierarchy
Definition: bundle.cpp:331

References IF_CONSTEXPR, tim::invoke::push(), and tim::invoke::start().

◆ start() [2/8]

template<typename Tag , typename BundleT , typename TupleT >
template<typename... Args>
this_type & tim::bundle< Tag, BundleT, TupleT >::start ( Args &&  ...)

invokes start on all the components

◆ start() [3/8]

template<typename Tag , typename BundleT , typename TupleT >
template<typename... Args>
bundle< Tag, BundleT, TupleT >::this_type & tim::bundle< Tag, BundleT, TupleT >::start ( mpl::lightweight  ,
Args &&...  args 
)

Definition at line 506 of file bundle.cpp.

507{
508 if(!m_enabled())
509 return get_this_type();
510
511 assemble(*this);
512 invoke::start<Tag>(m_data, std::forward<Args>(args)...);
513 m_is_active(true);
514 return get_this_type();
515}
this_type & assemble(Args &&... _args)
provide preliminary info to the objects with matching arguments. This is typically used to notify a c...

References tim::invoke::assemble().

◆ start() [4/8]

template<typename Tag , typename BundleT , typename TupleT >
template<typename... Args>
this_type & tim::bundle< Tag, BundleT, TupleT >::start ( mpl::lightweight  ,
Args &&  ... 
)

variant of start() which excludes push()

◆ start() [5/8]

template<typename Tag , typename BundleT , typename TupleT >
template<typename... Tp, typename... Args>
bundle< Tag, BundleT, TupleT >::this_type & tim::bundle< Tag, BundleT, TupleT >::start ( mpl::piecewise_ignore< Tp... >  ,
Args &&...  args 
)

Definition at line 570 of file bundle.cpp.

571{
572 using selected_t =
573 mpl::subtract_t<mpl::available_t<type_list_type>, type_list<Tp...>>;
574 return start(convert_t<selected_t, mpl::piecewise_select<>>{},
575 std::forward<Args>(args)...);
576}

References tim::invoke::start().

◆ start() [6/8]

template<typename Tag , typename BundleT , typename TupleT >
template<typename... Tp, typename... Args>
this_type & tim::bundle< Tag, BundleT, TupleT >::start ( mpl::piecewise_ignore< Tp... >  ,
Args &&  ... 
)

variant of start() which gets applied to non-Tp types

◆ start() [7/8]

template<typename Tag , typename BundleT , typename TupleT >
template<typename... Tp, typename... Args>
bundle< Tag, BundleT, TupleT >::this_type & tim::bundle< Tag, BundleT, TupleT >::start ( mpl::piecewise_select< Tp... >  ,
Args &&...  args 
)

Definition at line 541 of file bundle.cpp.

542{
543 if(!m_enabled())
544 return get_this_type();
545
546 using select_tuple_t = mpl::sort<trait::start_priority, std::tuple<Tp...>>;
547
548 invoke_piecewise<operation::reset>(type_list<Tp...>{});
549 IF_CONSTEXPR(!quirk_config<quirk::explicit_push>::value &&
550 !quirk_config<quirk::no_store>::value)
551 {
552 if(m_store() && !bundle_type::m_explicit_push())
553 {
554 invoke_piecewise<operation::push_node>(type_list<Tp...>{}, m_scope, m_hash);
555 }
556 }
557
558 // start components
559 auto&& _data = mpl::get_reference_tuple<select_tuple_t>(m_data);
560 invoke::invoke<operation::standard_start, Tag>(_data, std::forward<Args>(args)...);
561 return get_this_type();
562}
convert_t< typename ::tim::mpl::impl::sortT< PrioT, convert_t< Tuple, type_list<> >, convert_t< BegT, type_list<> >, convert_t< EndT, type_list<> > >::type, std::tuple<> > sort
Definition: filters.hpp:478

References IF_CONSTEXPR.

◆ start() [8/8]

template<typename Tag , typename BundleT , typename TupleT >
template<typename... Tp, typename... Args>
this_type & tim::bundle< Tag, BundleT, TupleT >::start ( mpl::piecewise_select< Tp... >  ,
Args &&  ... 
)

variant of start() which only gets applied to Tp types

◆ stop() [1/8]

template<typename Tag , typename BundleT , typename TupleT >
template<typename... Args>
bundle< Tag, BundleT, TupleT >::this_type & tim::bundle< Tag, BundleT, TupleT >::stop ( Args &&...  args)

Definition at line 647 of file bundle.cpp.

648{
649 if(!m_enabled())
650 return get_this_type();
651
652 // stop components
653 stop(mpl::lightweight{}, std::forward<Args>(args)...);
654
655 // pop components off of the call-stack stack
656 IF_CONSTEXPR(!quirk_config<quirk::explicit_pop>::value &&
657 !quirk_config<quirk::no_store>::value)
658 {
659 if(m_store() && !bundle_type::m_explicit_pop())
660 pop();
661 }
662 return get_this_type();
663}
this_type & pop()
tells each component to pop itself off of the call-stack hierarchy
Definition: bundle.cpp:429

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

◆ stop() [2/8]

template<typename Tag , typename BundleT , typename TupleT >
template<typename... Args>
this_type & tim::bundle< Tag, BundleT, TupleT >::stop ( Args &&  ...)

invokes stop on all the components

◆ stop() [3/8]

template<typename Tag , typename BundleT , typename TupleT >
template<typename... Args>
bundle< Tag, BundleT, TupleT >::this_type & tim::bundle< Tag, BundleT, TupleT >::stop ( mpl::lightweight  ,
Args &&...  args 
)

Definition at line 522 of file bundle.cpp.

523{
524 if(!m_enabled())
525 return get_this_type();
526
527 invoke::stop<Tag>(m_data, std::forward<Args>(args)...);
528 if(m_is_active())
529 ++m_laps;
530 derive(*this);
531 m_is_active(false);
532 return get_this_type();
533}
this_type & derive(Args &&... _args)
provide conclusive info to the objects with matching arguments. This is typically used by components ...

References tim::invoke::derive().

◆ stop() [4/8]

template<typename Tag , typename BundleT , typename TupleT >
template<typename... Args>
this_type & tim::bundle< Tag, BundleT, TupleT >::stop ( mpl::lightweight  ,
Args &&  ... 
)

variant of stop() which excludes pop()

◆ stop() [5/8]

template<typename Tag , typename BundleT , typename TupleT >
template<typename... Tp, typename... Args>
bundle< Tag, BundleT, TupleT >::this_type & tim::bundle< Tag, BundleT, TupleT >::stop ( mpl::piecewise_ignore< Tp... >  ,
Args &&...  args 
)

Definition at line 610 of file bundle.cpp.

611{
612 using selected_t =
613 mpl::subtract_t<mpl::available_t<type_list_type>, type_list<Tp...>>;
614 return stop(convert_t<selected_t, mpl::piecewise_select<>>{},
615 std::forward<Args>(args)...);
616}

References tim::invoke::stop().

◆ stop() [6/8]

template<typename Tag , typename BundleT , typename TupleT >
template<typename... Tp, typename... Args>
this_type & tim::bundle< Tag, BundleT, TupleT >::stop ( mpl::piecewise_ignore< Tp... >  ,
Args &&  ... 
)

variant of stop() which gets applied to non-Tp types

◆ stop() [7/8]

template<typename Tag , typename BundleT , typename TupleT >
template<typename... Tp, typename... Args>
bundle< Tag, BundleT, TupleT >::this_type & tim::bundle< Tag, BundleT, TupleT >::stop ( mpl::piecewise_select< Tp... >  ,
Args &&...  args 
)

Definition at line 583 of file bundle.cpp.

584{
585 if(!m_enabled())
586 return get_this_type();
587
588 using select_tuple_t = mpl::sort<trait::stop_priority, std::tuple<Tp...>>;
589
590 // stop components
591 auto&& _data = mpl::get_reference_tuple<select_tuple_t>(m_data);
592 invoke::invoke<operation::standard_stop, Tag>(_data, std::forward<Args>(args)...);
593
594 IF_CONSTEXPR(!quirk_config<quirk::explicit_pop>::value &&
595 !quirk_config<quirk::no_store>::value)
596 {
597 if(m_store() && !bundle_type::m_explicit_pop())
598 {
599 invoke_piecewise<operation::pop_node>(type_list<Tp...>{});
600 }
601 }
602 return get_this_type();
603}

References IF_CONSTEXPR.

◆ stop() [8/8]

template<typename Tag , typename BundleT , typename TupleT >
template<typename... Tp, typename... Args>
this_type & tim::bundle< Tag, BundleT, TupleT >::stop ( mpl::piecewise_select< Tp... >  ,
Args &&  ... 
)

variant of stop() which only gets applied to Tp types

◆ store() [1/2]

template<typename Tag , typename BundleT , typename TupleT >
template<typename... Args>
bundle< Tag, BundleT, TupleT >::this_type & tim::bundle< Tag, BundleT, TupleT >::store ( Args &&...  _args)

Definition at line 778 of file bundle.cpp.

779{
780 if(!m_enabled())
781 return get_this_type();
782
783 m_is_active(true);
784 invoke<operation::store>(std::forward<Args>(_args)...);
785 m_is_active(false);
786 return get_this_type();
787}

References tim::_args.

◆ store() [2/2]

template<typename Tag , typename BundleT , typename TupleT >
template<typename... Args>
this_type & tim::bundle< Tag, BundleT, TupleT >::store ( Args &&...  _args)

store a value

◆ type_apply() [1/5]

template<typename Tag , typename BundleT , typename TupleT >
template<typename T , typename Func , typename... Args, enable_if_t<!trait::is_available< T >::value, int > >
bundle< Tag, BundleT, TupleT >::this_type & tim::bundle< Tag, BundleT, TupleT >::type_apply ( Func &&  ,
Args &&  ... 
)

Definition at line 985 of file bundle.cpp.

986{
987 return get_this_type();
988}

◆ type_apply() [2/5]

template<typename Tag , typename BundleT , typename TupleT >
template<typename T , typename Func , typename... Args, enable_if_t<!trait::is_available< T >::value, int > = 0>
this_type & tim::bundle< Tag, BundleT, TupleT >::type_apply ( Func &&  ,
Args &&  ... 
)

ignore applying a member function because the type is not present

◆ type_apply() [3/5]

template<typename Tag , typename BundleT , typename TupleT >
template<typename T , typename Func , typename... Args, enable_if_t< trait::is_available< T >::value, int > >
bundle< Tag, BundleT, TupleT >::this_type & tim::bundle< Tag, BundleT, TupleT >::type_apply ( Func &&  _func,
Args &&...  _args 
)

Definition at line 968 of file bundle.cpp.

969{
970 if(!m_enabled())
971 return get_this_type();
972
973 auto* _obj = get<T>();
974 if(_obj)
975 ((*_obj).*(_func))(std::forward<Args>(_args)...);
976 return get_this_type();
977}

References tim::_args.

◆ type_apply() [4/5]

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

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

Definition at line 796 of file bundle.hpp.

797 {
798 auto* _obj = get<T>();
799 ((*_obj).*(_func))(std::forward<Args>(_args)...);
800 return get_this_type();
801 }

References tim::_args.

◆ type_apply() [5/5]

template<typename Tag , typename BundleT , typename TupleT >
template<typename T , typename Func , typename... Args, enable_if_t< trait::is_available< T >::value, int > = 0>
this_type & tim::bundle< Tag, BundleT, TupleT >::type_apply ( Func &&  _func,
Args &&...  _args 
)

apply a member function to either a heap type or a type that is in a user_bundle

◆ update_statistics() [1/2]

template<typename Tag , typename BundleT , typename TupleT >
template<typename... Args>
bundle< Tag, BundleT, TupleT >::this_type & tim::bundle< Tag, BundleT, TupleT >::update_statistics ( Args &&...  _args)

Definition at line 817 of file bundle.cpp.

818{
819 return invoke<operation::add_statistics>(std::forward<Args>(_args)...);
820}

References tim::_args.

◆ update_statistics() [2/2]

template<typename Tag , typename BundleT , typename TupleT >
template<typename... Args>
this_type & tim::bundle< Tag, BundleT, TupleT >::update_statistics ( Args &&...  _args)

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

◆ will_heap_init()

template<typename Tag , typename BundleT , typename TupleT >
template<typename U >
static constexpr bool tim::bundle< Tag, BundleT, TupleT >::will_heap_init ( )
inlinestaticconstexpr

Query at compile-time whether initialization will occur on the heap. can_heap_init<T>() && !will_heap_init<T>() will indicate that a stack-allocated instance of the same type exists.

Definition at line 327 of file bundle.hpp.

328 {
329 using T = remove_pointer_decay_t<U>;
330 return can_init<T>() && !can_stack_init<T>();
331 }

◆ will_opaque_init()

template<typename Tag , typename BundleT , typename TupleT >
template<typename U >
static constexpr bool tim::bundle< Tag, BundleT, TupleT >::will_opaque_init ( )
inlinestaticconstexpr

Query at compile-time whether initialization will happen with an opaque wrapper (i.e. via user bundle). In this situation, initialization arguments are ignored and the component will only be initialized with the tim::scope::config of the bundle.

Definition at line 338 of file bundle.hpp.

339 {
340 using T = remove_pointer_decay_t<U>;
341 return !can_stack_init<T>() && !can_heap_init<T>() &&
342 (trait::is_available<T>::value && has_user_bundle());
343 }

Friends And Related Function Documentation

◆ auto_base_bundle

template<typename Tag , typename BundleT , typename TupleT >
template<typename... Tp>
friend class auto_base_bundle
friend

Definition at line 121 of file bundle.hpp.

◆ auto_bundle

template<typename Tag , typename BundleT , typename TupleT >
template<typename... Tp>
friend class auto_bundle
friend

Definition at line 124 of file bundle.hpp.

◆ auto_list

template<typename Tag , typename BundleT , typename TupleT >
template<typename... Tp>
friend class auto_list
friend

Definition at line 130 of file bundle.hpp.

◆ auto_tuple

template<typename Tag , typename BundleT , typename TupleT >
template<typename... Tp>
friend class auto_tuple
friend

Definition at line 127 of file bundle.hpp.

◆ impl::base_bundle

template<typename Tag , typename BundleT , typename TupleT >
template<typename... Tp>
friend class impl::base_bundle
friend

Definition at line 118 of file bundle.hpp.

◆ operator*

template<typename Tag , typename BundleT , typename TupleT >
template<typename Op >
enable_if_t<!std::is_arithmetic< Op >::value, this_type > operator* ( this_type  lhs,
const Op &  rhs 
)
friend

Definition at line 262 of file bundle.hpp.

264 {
265 return lhs *= rhs;
266 }

◆ operator+

template<typename Tag , typename BundleT , typename TupleT >
this_type operator+ ( this_type  lhs,
const this_type rhs 
)
friend

Definition at line 258 of file bundle.hpp.

258{ return lhs += rhs; }

◆ operator-

template<typename Tag , typename BundleT , typename TupleT >
this_type operator- ( this_type  lhs,
const this_type rhs 
)
friend

Definition at line 259 of file bundle.hpp.

259{ return lhs -= rhs; }

◆ operator/

template<typename Tag , typename BundleT , typename TupleT >
template<typename Op >
enable_if_t<!std::is_arithmetic< Op >::value, this_type > operator/ ( this_type  lhs,
const Op &  rhs 
)
friend

Definition at line 269 of file bundle.hpp.

271 {
272 return lhs /= rhs;
273 }

◆ operator<<

template<typename Tag , typename BundleT , typename TupleT >
std::ostream & operator<< ( std::ostream &  os,
const bundle< Tag, BundleT, TupleT > &  obj 
)
friend

Definition at line 275 of file bundle.hpp.

276 {
277 obj.print<true, true>(os);
278 return os;
279 }

Member Data Documentation

◆ m_data

template<typename Tag , typename BundleT , typename TupleT >
data_type tim::bundle< Tag, BundleT, TupleT >::m_data {}
mutableprotected

Definition at line 849 of file bundle.hpp.


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