Empirical
Public Types | Public Member Functions | Protected Attributes | List of all members
emp::Trait< TARGET_T, VALUE_T > Class Template Reference

#include <Trait.h>

Inheritance diagram for emp::Trait< TARGET_T, VALUE_T >:
emp::BaseTrait< TARGET_T >

Public Types

using this_t = Trait< TARGET_T, VALUE_T >
 
using target_t = TARGET_T
 
using value_t = VALUE_T
 
using fun_t = std::function< value_t(target_t &)>
 
using range_t = emp::Range< value_t >
 

Public Member Functions

 Trait (const std::string &_n, const fun_t &_f)
 
 Trait (const std::string &_n, const fun_t &_f, value_t min, value_t max)
 
 Trait (const std::string &_n, const fun_t &_f, const range_t &_r)
 
 Trait (const Trait &)=default
 
 Trait (Trait &&)=default
 
Traitoperator= (const Trait &)=default
 
Traitoperator= (Trait &&)=default
 
const std::string & GetName () const
 
const std::string & GetDesc () const
 
const fun_tGetFun () const
 
const range_tGetRange () const
 
void SetName (const std::string &_in)
 
void SetDesc (const std::string &_in)
 
void SetFun (const fun_t &_in)
 
void SetRange (const range_t &_in)
 
void SetRange (value_t min, value_t max)
 
void SetMin (value_t min)
 
void SetMax (value_t max)
 
value_t Eval (target_t &target) const
 
value_t EvalLimit (target_t &target) const
 
std::string EvalString (target_t &target) const
 
double EvalValue (target_t &target) const
 
size_t EvalBin (target_t &target, size_t num_bins) const
 
Ptr< BaseTrait< TARGET_T > > Clone () const
 
template<typename VALUE_T >
bool IsType ()
 

Protected Attributes

std::string name
 Unique name for this trait. More...
 
std::string desc
 Full description explaining this trait. More...
 
fun_t fun
 Function to retrieve trait value from target. More...
 
range_t range
 Limits on legal values (defaults to extremes) More...
 

Member Typedef Documentation

template<typename TARGET_T , typename VALUE_T = double>
using emp::Trait< TARGET_T, VALUE_T >::fun_t = std::function<value_t(target_t &)>
template<typename TARGET_T , typename VALUE_T = double>
using emp::Trait< TARGET_T, VALUE_T >::range_t = emp::Range<value_t>
template<typename TARGET_T , typename VALUE_T = double>
using emp::Trait< TARGET_T, VALUE_T >::target_t = TARGET_T
template<typename TARGET_T , typename VALUE_T = double>
using emp::Trait< TARGET_T, VALUE_T >::this_t = Trait<TARGET_T, VALUE_T>
template<typename TARGET_T , typename VALUE_T = double>
using emp::Trait< TARGET_T, VALUE_T >::value_t = VALUE_T

Constructor & Destructor Documentation

template<typename TARGET_T , typename VALUE_T = double>
emp::Trait< TARGET_T, VALUE_T >::Trait ( const std::string &  _n,
const fun_t _f 
)
inline
template<typename TARGET_T , typename VALUE_T = double>
emp::Trait< TARGET_T, VALUE_T >::Trait ( const std::string &  _n,
const fun_t _f,
value_t  min,
value_t  max 
)
inline
template<typename TARGET_T , typename VALUE_T = double>
emp::Trait< TARGET_T, VALUE_T >::Trait ( const std::string &  _n,
const fun_t _f,
const range_t _r 
)
inline
template<typename TARGET_T , typename VALUE_T = double>
emp::Trait< TARGET_T, VALUE_T >::Trait ( const Trait< TARGET_T, VALUE_T > &  )
default
template<typename TARGET_T , typename VALUE_T = double>
emp::Trait< TARGET_T, VALUE_T >::Trait ( Trait< TARGET_T, VALUE_T > &&  )
default

Member Function Documentation

template<typename TARGET_T , typename VALUE_T = double>
Ptr<BaseTrait<TARGET_T> > emp::Trait< TARGET_T, VALUE_T >::Clone ( ) const
inlinevirtual
template<typename TARGET_T , typename VALUE_T = double>
value_t emp::Trait< TARGET_T, VALUE_T >::Eval ( target_t target) const
inline
template<typename TARGET_T , typename VALUE_T = double>
size_t emp::Trait< TARGET_T, VALUE_T >::EvalBin ( target_t target,
size_t  num_bins 
) const
inlinevirtual
template<typename TARGET_T , typename VALUE_T = double>
value_t emp::Trait< TARGET_T, VALUE_T >::EvalLimit ( target_t target) const
inline
template<typename TARGET_T , typename VALUE_T = double>
std::string emp::Trait< TARGET_T, VALUE_T >::EvalString ( target_t target) const
inlinevirtual
template<typename TARGET_T , typename VALUE_T = double>
double emp::Trait< TARGET_T, VALUE_T >::EvalValue ( target_t target) const
inlinevirtual
template<typename TARGET_T , typename VALUE_T = double>
const std::string& emp::Trait< TARGET_T, VALUE_T >::GetDesc ( ) const
inline
template<typename TARGET_T , typename VALUE_T = double>
const fun_t& emp::Trait< TARGET_T, VALUE_T >::GetFun ( ) const
inline
template<typename TARGET_T , typename VALUE_T = double>
const std::string& emp::Trait< TARGET_T, VALUE_T >::GetName ( ) const
inline
template<typename TARGET_T , typename VALUE_T = double>
const range_t& emp::Trait< TARGET_T, VALUE_T >::GetRange ( ) const
inline
template<typename TARGET_T >
template<typename VALUE_T >
bool emp::BaseTrait< TARGET_T >::IsType ( )
inlineinherited
template<typename TARGET_T , typename VALUE_T = double>
Trait& emp::Trait< TARGET_T, VALUE_T >::operator= ( const Trait< TARGET_T, VALUE_T > &  )
default
template<typename TARGET_T , typename VALUE_T = double>
Trait& emp::Trait< TARGET_T, VALUE_T >::operator= ( Trait< TARGET_T, VALUE_T > &&  )
default
template<typename TARGET_T , typename VALUE_T = double>
void emp::Trait< TARGET_T, VALUE_T >::SetDesc ( const std::string &  _in)
inline
template<typename TARGET_T , typename VALUE_T = double>
void emp::Trait< TARGET_T, VALUE_T >::SetFun ( const fun_t _in)
inline
template<typename TARGET_T , typename VALUE_T = double>
void emp::Trait< TARGET_T, VALUE_T >::SetMax ( value_t  max)
inline
template<typename TARGET_T , typename VALUE_T = double>
void emp::Trait< TARGET_T, VALUE_T >::SetMin ( value_t  min)
inline
template<typename TARGET_T , typename VALUE_T = double>
void emp::Trait< TARGET_T, VALUE_T >::SetName ( const std::string &  _in)
inline
template<typename TARGET_T , typename VALUE_T = double>
void emp::Trait< TARGET_T, VALUE_T >::SetRange ( const range_t _in)
inline
template<typename TARGET_T , typename VALUE_T = double>
void emp::Trait< TARGET_T, VALUE_T >::SetRange ( value_t  min,
value_t  max 
)
inline

Member Data Documentation

template<typename TARGET_T , typename VALUE_T = double>
std::string emp::Trait< TARGET_T, VALUE_T >::desc
protected

Full description explaining this trait.

template<typename TARGET_T , typename VALUE_T = double>
fun_t emp::Trait< TARGET_T, VALUE_T >::fun
protected

Function to retrieve trait value from target.

template<typename TARGET_T , typename VALUE_T = double>
std::string emp::Trait< TARGET_T, VALUE_T >::name
protected

Unique name for this trait.

template<typename TARGET_T , typename VALUE_T = double>
range_t emp::Trait< TARGET_T, VALUE_T >::range
protected

Limits on legal values (defaults to extremes)


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