Empirical
Public Types | Public Member Functions | Protected Attributes | List of all members
emp::Action< RETURN(ARGS...)> Class Template Reference

#include <Action.h>

Inheritance diagram for emp::Action< RETURN(ARGS...)>:
emp::ActionSize< sizeof...(ARGS)> emp::ActionBase

Public Types

using fun_t = RETURN(ARGS...)
 
using this_t = Action< fun_t >
 
using parent_t = ActionSize< sizeof...(ARGS)>
 

Public Member Functions

 Action (const std::function< RETURN(ARGS...)> &in_fun, const std::string &in_name="")
 
 Action (const this_t &)=default
 
 Action (this_t &&)=default
 
this_toperator= (const this_t &)=default
 
this_toperator= (this_t &&)=default
 
const std::function< fun_t > & GetFun () const
 
RETURN Call (ARGS &&...args)
 Call the function associated with this action. More...
 
this_tClone () const
 Build a copy of this Action. More...
 
size_t GetArgCount () const
 Get number of arguments this action takes. More...
 
const std::string & GetName () const
 Get the name of this action. More...
 

Protected Attributes

std::function< RETURN(ARGS...)> fun
 The specific function associated with this action. More...
 
std::string name
 A unique name for this action so it can be called at runtime. More...
 

Detailed Description

template<typename RETURN, typename... ARGS>
class emp::Action< RETURN(ARGS...)>

This Action class specialization takes a function with any non-void return tyime and builds it off of the action base classes.

Member Typedef Documentation

template<typename RETURN , typename... ARGS>
using emp::Action< RETURN(ARGS...)>::fun_t = RETURN(ARGS...)
template<typename RETURN , typename... ARGS>
using emp::Action< RETURN(ARGS...)>::parent_t = ActionSize<sizeof...(ARGS)>
template<typename RETURN , typename... ARGS>
using emp::Action< RETURN(ARGS...)>::this_t = Action<fun_t>

Constructor & Destructor Documentation

template<typename RETURN , typename... ARGS>
emp::Action< RETURN(ARGS...)>::Action ( const std::function< RETURN(ARGS...)> &  in_fun,
const std::string &  in_name = "" 
)
inline
template<typename RETURN , typename... ARGS>
emp::Action< RETURN(ARGS...)>::Action ( const this_t )
default
template<typename RETURN , typename... ARGS>
emp::Action< RETURN(ARGS...)>::Action ( this_t &&  )
default

Member Function Documentation

template<typename RETURN , typename... ARGS>
RETURN emp::Action< RETURN(ARGS...)>::Call ( ARGS &&...  args)
inline

Call the function associated with this action.

template<typename RETURN , typename... ARGS>
this_t* emp::Action< RETURN(ARGS...)>::Clone ( ) const
inlinevirtual

Build a copy of this Action.

Implements emp::ActionBase.

size_t emp::ActionSize< ARG_COUNT >::GetArgCount ( ) const
inlinevirtualinherited

Get number of arguments this action takes.

Implements emp::ActionBase.

template<typename RETURN , typename... ARGS>
const std::function<fun_t>& emp::Action< RETURN(ARGS...)>::GetFun ( ) const
inline
const std::string& emp::ActionBase::GetName ( ) const
inlineinherited

Get the name of this action.

template<typename RETURN , typename... ARGS>
this_t& emp::Action< RETURN(ARGS...)>::operator= ( const this_t )
default
template<typename RETURN , typename... ARGS>
this_t& emp::Action< RETURN(ARGS...)>::operator= ( this_t &&  )
default

Member Data Documentation

template<typename RETURN , typename... ARGS>
std::function<RETURN(ARGS...)> emp::Action< RETURN(ARGS...)>::fun
protected

The specific function associated with this action.

std::string emp::ActionBase::name
protectedinherited

A unique name for this action so it can be called at runtime.


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