Empirical
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Friends | List of all members
emp::SignalBase Class Referenceabstract

Base class for all signals. More...

#include <Signal.h>

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

Public Member Functions

 SignalBase ()=delete
 
 SignalBase (const SignalBase &)=delete
 
 SignalBase (SignalBase &&)=delete
 
SignalBaseoperator= (const SignalBase &)=delete
 
SignalBaseoperator= (SignalBase &&)=delete
 
virtual ~SignalBase ()
 
virtual SignalBaseClone () const =0
 
const std::string & GetName () const
 
virtual size_t GetNumArgs () const =0
 
virtual size_t GetNumActions () const =0
 
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...
 
virtual SignalKey AddAction (ActionBase &)=0
 Add an action using an Action object. More...
 
virtual void Remove (SignalKey key)=0
 Remove an action specified by its key. 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 ()
 
 SignalBase (const std::string &n, internal::SignalManager_Base *manager=nullptr)
 

Protected Attributes

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...
 

Friends

class SignalManager
 

Detailed Description

Base class for all signals.

Member Typedef Documentation

Constructor & Destructor Documentation

emp::SignalBase::SignalBase ( const std::string &  n,
internal::SignalManager_Base manager = nullptr 
)
inlineprotected
emp::SignalBase::SignalBase ( )
delete
emp::SignalBase::SignalBase ( const SignalBase )
delete
emp::SignalBase::SignalBase ( SignalBase &&  )
delete
virtual emp::SignalBase::~SignalBase ( )
inlinevirtual

Member Function Documentation

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

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

virtual SignalKey emp::SignalBase::AddAction ( ActionBase )
pure virtual

Add an action using an Action object.

Implemented in emp::Signal< RETURN(ARGS...)>, and emp::Signal< void(ARGS...)>.

template<typename... ARGS>
void emp::SignalBase::BaseTrigger ( ARGS...  args)
inline
void emp::SignalBase::Clear ( )
inline

Remove all actions from this signal.

virtual SignalBase* emp::SignalBase::Clone ( ) const
pure virtual
const std::string& emp::SignalBase::GetName ( ) const
inline
virtual size_t emp::SignalBase::GetNumActions ( ) const
pure virtual
virtual size_t emp::SignalBase::GetNumArgs ( ) const
pure virtual
bool emp::SignalBase::Has ( SignalKey  key) const
inline
SignalKey emp::SignalBase::NextSignalKey ( )
inlineprotected
SignalBase& emp::SignalBase::operator= ( const SignalBase )
delete
SignalBase& emp::SignalBase::operator= ( SignalBase &&  )
delete
virtual void emp::SignalBase::Remove ( SignalKey  key)
pure virtual

Remove an action specified by its key.

Implemented in emp::Signal< RETURN(ARGS...)>, and emp::Signal< void(ARGS...)>.

Friends And Related Function Documentation

friend class SignalManager
friend

Member Data Documentation

std::map<SignalKey, size_t> emp::SignalBase::link_key_map
protected

Map unique link keys to link index for actions.

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

What manager is handling this signal?

std::string emp::SignalBase::name
protected

What is the unique name of this signal?

uint32_t emp::SignalBase::next_link_id
protected

What ID shouild the next link have?

man_t* emp::SignalBase::prime_manager
protected

Which manager leads deletion? (nullptr for self)

uint32_t emp::SignalBase::signal_id
protected

What is the unique ID of this signal?


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