Empirical
|
#include <TypeTracker.h>
Public Types | |
using | this_t = TypeTracker< TYPES... > |
template<typename REAL_T > | |
using | wrap_t = TypeTracker_Class< REAL_T, get_type_index< REAL_T, TYPES... >() > |
Public Member Functions | |
TypeTracker () | |
TypeTracker (const TypeTracker &)=default | |
TypeTracker (TypeTracker &&)=default | |
TypeTracker & | operator= (const TypeTracker &)=default |
TypeTracker & | operator= (TypeTracker &&)=default |
~TypeTracker () | |
template<typename REAL_T > | |
wrap_t< REAL_T > | Wrap (REAL_T &&val) |
Convert an input value into a TypeTracker_Class maintaining the value (universal version) More... | |
template<typename REAL_T > | |
wrap_t< REAL_T > * | New (REAL_T &val) |
Create an input value in a TypeTracker_Class maintaining the value (reference version) More... | |
template<typename REAL_T > | |
wrap_t< REAL_T > * | New (REAL_T &&val) |
Create an input value in a TypeTracker_Class maintaining the value (move version) More... | |
template<typename TEST_T > | |
bool | IsType (TrackedType &tt) |
Test if the tracked type is TEST_T. More... | |
template<typename TEST_T > | |
bool | IsType (TrackedType *tt) |
Test if the tracked type points to TEST_T. More... | |
template<typename REAL_T > | |
REAL_T | ToType (TrackedType &tt) |
Convert the tracked type back to REAL_T. Assert that this is type safe! More... | |
template<typename REAL_T > | |
REAL_T | ToType (TrackedType *tt) |
Convert the tracked type pointer back to REAL_T. Assert that this is type safe! More... | |
template<typename OUT_T > | |
OUT_T | Cast (TrackedType &tt) |
Cast the tracked type to OUT_T. Try to do so even if NOT original type! More... | |
template<typename OUT_T > | |
OUT_T | Cast (TrackedType *tt) |
Cast the tracked type pointer to OUT_T. Try to do so even if NOT original type! More... | |
template<typename... Ts> | |
this_t & | AddFunction (std::function< void(Ts...)> fun) |
template<typename... Ts> | |
this_t & | AddFunction (void(*fun)(Ts...)) |
template<typename... Ts> | |
void | RunFunction (Ts...args) |
Run the appropriate function based on the argument types received. More... | |
template<typename... Ts> | |
void | operator() (Ts...args) |
Call TypeTracker as a function (refers call to RunFunction) More... | |
Static Public Member Functions | |
static constexpr size_t | GetNumTypes () |
How many types are we working with? More... | |
static constexpr size_t | GetNumCombos (size_t vals=2) |
How many combinations of V types are there? More... | |
static constexpr size_t | GetCumCombos (size_t vals=2) |
How many combinations are the of the given number of types OR FEWER? More... | |
template<typename T > | |
static constexpr size_t | GetID () |
Each type should have a unique ID. More... | |
template<typename T1 , typename T2 , typename... Ts> | |
static constexpr size_t | GetID () |
Each set of types should have an ID unique within that number of types. More... | |
template<typename... Ts> | |
static constexpr size_t | GetComboID () |
A ComboID should be unique across all size combinations. More... | |
static size_t | GetTrackedID (const TrackedType &tt) |
A Tracked ID is simply the unique ID of the type being tracked. More... | |
template<typename... Ts> | |
static size_t | GetTrackedID (const TrackedType &tt1, const TrackedType &tt2, const Ts &...ARGS) |
Or set of types being tracked... More... | |
static size_t | GetTrackedID (TrackedType *tt) |
We should also about able to use a pointer to access tracked IDs. More... | |
template<typename... Ts> | |
static size_t | GetTrackedID (TrackedType *tt1, TrackedType *tt2, Ts *...ARGS) |
A set of pointers to access tracked IDs. More... | |
template<typename... Ts> | |
static constexpr size_t | GetTrackedComboID (Ts...ARGS) |
Public Attributes | |
std::unordered_map< size_t, emp::GenericFunction * > | fun_map |
fun_map is a hash table that maps a set of inputs to the appropriate function. More... | |
Dynamic functions that are indexed by parameter types; calls lookup the correct function to forward arguments into.
using emp::TypeTracker< TYPES >::this_t = TypeTracker<TYPES...> |
using emp::TypeTracker< TYPES >::wrap_t = TypeTracker_Class< REAL_T, get_type_index<REAL_T,TYPES...>() > |
|
inline |
|
default |
|
default |
|
inline |
|
inline |
Add a new std::function that this TypeTracker should call if the appropriate types are passed in.
|
inline |
Add a new function pointer that this TypeTracker should call if the appropriate types are passed in.
|
inline |
Cast the tracked type to OUT_T. Try to do so even if NOT original type!
|
inline |
Cast the tracked type pointer to OUT_T. Try to do so even if NOT original type!
|
inlinestatic |
A ComboID should be unique across all size combinations.
|
inlinestatic |
How many combinations are the of the given number of types OR FEWER?
|
inlinestatic |
Each type should have a unique ID.
|
inlinestatic |
Each set of types should have an ID unique within that number of types.
|
inlinestatic |
How many combinations of V types are there?
|
inlinestatic |
How many types are we working with?
|
inlinestatic |
A tracked COMBO ID, is an ID for this combination of types, unique among all possible type combinations. Consistent with GetComboID with the same underlying types.
|
inlinestatic |
A Tracked ID is simply the unique ID of the type being tracked.
|
inlinestatic |
Or set of types being tracked...
|
inlinestatic |
We should also about able to use a pointer to access tracked IDs.
|
inlinestatic |
A set of pointers to access tracked IDs.
|
inline |
Test if the tracked type is TEST_T.
|
inline |
Test if the tracked type points to TEST_T.
|
inline |
Create an input value in a TypeTracker_Class maintaining the value (reference version)
|
inline |
Create an input value in a TypeTracker_Class maintaining the value (move version)
|
inline |
Call TypeTracker as a function (refers call to RunFunction)
|
default |
|
default |
|
inline |
Run the appropriate function based on the argument types received.
|
inline |
Convert the tracked type back to REAL_T. Assert that this is type safe!
|
inline |
Convert the tracked type pointer back to REAL_T. Assert that this is type safe!
|
inline |
Convert an input value into a TypeTracker_Class maintaining the value (universal version)
std::unordered_map<size_t, emp::GenericFunction *> emp::TypeTracker< TYPES >::fun_map |
fun_map is a hash table that maps a set of inputs to the appropriate function.