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

#include <Signal.h>

Inheritance diagram for emp::Signal< RETURN(ARGS...)>:
emp::SignalBase

Public Types

using fun_t = RETURN(ARGS...)
 
using this_t = Signal< fun_t >
 

Public Member Functions

 Signal (const std::string &name="", internal::SignalManager_Base *manager=nullptr)
 
 Signal (const std::string &name, internal::SignalControl_Base &control)
 
virtual this_tClone () const
 
size_t GetNumArgs () const
 
size_t GetNumActions () const
 
const emp::vector< RETURN > & Trigger (ARGS...args)
 
SignalKey AddAction (const std::function< fun_t > &in_fun)
 
SignalKey AddAction (ActionBase &in_action)
 Add an action using an Action object. More...
 
template<typename... FUN_ARGS, typename... EXTRA_ARGS>
SignalKey AddAction (const std::function< RETURN(FUN_ARGS...)> &in_fun, TypePack< EXTRA_ARGS... >)
 
template<typename... FUN_ARGS>
SignalKey AddAction (const std::function< RETURN(FUN_ARGS...)> &in_fun)
 
template<typename... FUN_ARGS>
SignalKey AddAction (RETURN in_fun(FUN_ARGS...))
 
void Remove (SignalKey key)
 Remove an action specified by its key. More...
 
size_t GetPriority (SignalKey key)
 
const std::string & GetName () const
 
template<typename... ARGS>
void BaseTrigger (ARGS...args)
 
template<typename... ARGS>
SignalKey AddAction (const std::function< void(ARGS...)> &in_fun)
 Actions without arguments or a return type can be associated with any signal. More...
 
void Clear ()
 Remove all actions from this signal. More...
 
bool Has (SignalKey key) const
 

Protected Types

using man_t = internal::SignalManager_Base
 

Protected Member Functions

SignalKey NextSignalKey ()
 

Protected Attributes

FunctionSet< RETURN(ARGS...)> actions
 
std::string name
 What is the unique name of this signal? More...
 
uint32_t signal_id
 What is the unique ID of this signal? More...
 
uint32_t next_link_id
 What ID shouild the next link have? More...
 
std::map< SignalKey, size_t > link_key_map
 Map unique link keys to link index for actions. More...
 
emp::vector< man_t * > managers
 What manager is handling this signal? More...
 
man_tprime_manager
 Which manager leads deletion? (nullptr for self) More...
 

Member Typedef Documentation

template<typename RETURN , typename... ARGS>
using emp::Signal< RETURN(ARGS...)>::fun_t = RETURN(ARGS...)
template<typename RETURN , typename... ARGS>
using emp::Signal< RETURN(ARGS...)>::this_t = Signal<fun_t>

Constructor & Destructor Documentation

template<typename RETURN , typename... ARGS>
emp::Signal< RETURN(ARGS...)>::Signal ( const std::string &  name = "",
internal::SignalManager_Base manager = nullptr 
)
inline
template<typename RETURN , typename... ARGS>
emp::Signal< RETURN(ARGS...)>::Signal ( const std::string &  name,
internal::SignalControl_Base control 
)
inline

Member Function Documentation

template<typename... ARGS>
SignalKey emp::SignalBase::AddAction ( const std::function< void(ARGS...)> &  in_fun)
inlineinherited

Actions without arguments or a return type can be associated with any signal.

template<typename RETURN , typename... ARGS>
SignalKey emp::Signal< RETURN(ARGS...)>::AddAction ( const std::function< fun_t > &  in_fun)
inline
template<typename RETURN , typename... ARGS>
SignalKey emp::Signal< RETURN(ARGS...)>::AddAction ( ActionBase )
inlinevirtual

Add an action using an Action object.

Implements emp::SignalBase.

template<typename RETURN , typename... ARGS>
template<typename... FUN_ARGS, typename... EXTRA_ARGS>
SignalKey emp::Signal< RETURN(ARGS...)>::AddAction ( const std::function< RETURN(FUN_ARGS...)> &  in_fun,
TypePack< EXTRA_ARGS... >   
)
inline
template<typename RETURN , typename... ARGS>
template<typename... FUN_ARGS>
SignalKey emp::Signal< RETURN(ARGS...)>::AddAction ( const std::function< RETURN(FUN_ARGS...)> &  in_fun)
inline
template<typename RETURN , typename... ARGS>
template<typename... FUN_ARGS>
SignalKey emp::Signal< RETURN(ARGS...)>::AddAction ( RETURN   in_funFUN_ARGS...)
inline
template<typename... ARGS>
void emp::SignalBase::BaseTrigger ( ARGS...  args)
inlineinherited
void emp::SignalBase::Clear ( )
inlineinherited

Remove all actions from this signal.

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

Implements emp::SignalBase.

const std::string& emp::SignalBase::GetName ( ) const
inlineinherited
template<typename RETURN , typename... ARGS>
size_t emp::Signal< RETURN(ARGS...)>::GetNumActions ( ) const
inlinevirtual

Implements emp::SignalBase.

template<typename RETURN , typename... ARGS>
size_t emp::Signal< RETURN(ARGS...)>::GetNumArgs ( ) const
inlinevirtual

Implements emp::SignalBase.

template<typename RETURN , typename... ARGS>
size_t emp::Signal< RETURN(ARGS...)>::GetPriority ( SignalKey  key)
inline
bool emp::SignalBase::Has ( SignalKey  key) const
inlineinherited
SignalKey emp::SignalBase::NextSignalKey ( )
inlineprotectedinherited
template<typename RETURN , typename... ARGS>
void emp::Signal< RETURN(ARGS...)>::Remove ( SignalKey  key)
inlinevirtual

Remove an action specified by its key.

Implements emp::SignalBase.

template<typename RETURN , typename... ARGS>
const emp::vector<RETURN>& emp::Signal< RETURN(ARGS...)>::Trigger ( ARGS...  args)
inline

Member Data Documentation

template<typename RETURN , typename... ARGS>
FunctionSet<RETURN(ARGS...)> emp::Signal< RETURN(ARGS...)>::actions
protected
std::map<SignalKey, size_t> emp::SignalBase::link_key_map
protectedinherited

Map unique link keys to link index for actions.

emp::vector<man_t *> emp::SignalBase::managers
protectedinherited

What manager is handling this signal?

std::string emp::SignalBase::name
protectedinherited

What is the unique name of this signal?

uint32_t emp::SignalBase::next_link_id
protectedinherited

What ID shouild the next link have?

man_t* emp::SignalBase::prime_manager
protectedinherited

Which manager leads deletion? (nullptr for self)

uint32_t emp::SignalBase::signal_id
protectedinherited

What is the unique ID of this signal?


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