BioDynaMo  v1.05.119-a4ff3934
Public Member Functions | Private Member Functions | Private Attributes | List of all members
bdm::Behavior Class Referenceabstract

#include <behavior.h>

Inheritance diagram for bdm::Behavior:
[legend]

Public Member Functions

 Behavior ()
 
virtual ~Behavior ()=default
 
virtual BehaviorNew () const =0
 Create a new instance of this object using the default constructor. More...
 
virtual BehaviorNewCopy () const =0
 Create a new copy of this behavior. More...
 
virtual void Initialize (const NewAgentEvent &event)
 
virtual void Update (const NewAgentEvent &event)
 
virtual void Run (Agent *agent)=0
 
void AlwaysCopyToNew ()
 Always copy this behavior to new agents. More...
 
void NeverCopyToNew ()
 Never copy this behavior to new agents. More...
 
void CopyToNewIf (const std::initializer_list< NewAgentEventUid > &uids)
 
void AlwaysRemoveFromExisting ()
 
void NeverRemoveFromExisting ()
 
void RemoveFromExistingIf (const std::initializer_list< NewAgentEventUid > &uids)
 
bool WillBeCopied (NewAgentEventUid event) const
 
bool WillBeRemoved (NewAgentEventUid event) const
 
void * operator new (size_t size)
 
void operator delete (void *p)
 

Private Member Functions

 BDM_CLASS_DEF (Behavior, 2)
 

Private Attributes

NewAgentEventUid copy_mask_ = 0
 
NewAgentEventUid remove_mask_ = 0
 

Detailed Description

Behavior encapsulates logic to decide for which NewAgentEventUids a behavior should be copied to the new agent and/or removed from existing one. The default behavior is never copy to new agents, and never remove from existing agents.

Definition at line 29 of file behavior.h.

Constructor & Destructor Documentation

◆ Behavior()

bdm::Behavior::Behavior ( )
inline

Definition at line 31 of file behavior.h.

◆ ~Behavior()

virtual bdm::Behavior::~Behavior ( )
virtualdefault

Member Function Documentation

◆ AlwaysCopyToNew()

void bdm::Behavior::AlwaysCopyToNew ( )
inline

Always copy this behavior to new agents.

Definition at line 63 of file behavior.h.

◆ AlwaysRemoveFromExisting()

void bdm::Behavior::AlwaysRemoveFromExisting ( )
inline

Always remove this behavior from the existing agent if a new agent is created.

Definition at line 78 of file behavior.h.

◆ BDM_CLASS_DEF()

bdm::Behavior::BDM_CLASS_DEF ( Behavior  ,
 
)
private

◆ CopyToNewIf()

void bdm::Behavior::CopyToNewIf ( const std::initializer_list< NewAgentEventUid > &  uids)
inline

If a new agent will be created with one of these NewAgentEventUids, this behavior will be copied to the new agent.

Definition at line 70 of file behavior.h.

◆ Initialize()

virtual void bdm::Behavior::Initialize ( const NewAgentEvent event)
inlinevirtual

This method is called to initialize new behaviors that are created during a NewAgentEvent. Override this method to initialize attributes of your own Behavior subclasses. NB: Don't forget to call the implementation of the base class first. Base::Initialize(event); Failing to do so will result in errors.

Reimplemented in bdm::StatelessBehavior, bdm::Secretion, bdm::GeneRegulation, bdm::Chemotaxis, and bdm::GrowthDivision.

Definition at line 47 of file behavior.h.

◆ NeverCopyToNew()

void bdm::Behavior::NeverCopyToNew ( )
inline

Never copy this behavior to new agents.

Definition at line 67 of file behavior.h.

◆ NeverRemoveFromExisting()

void bdm::Behavior::NeverRemoveFromExisting ( )
inline

Never remove this behavior from the existing agent if a new agent is created.

Definition at line 83 of file behavior.h.

◆ New()

virtual Behavior* bdm::Behavior::New ( ) const
pure virtual

Create a new instance of this object using the default constructor.

◆ NewCopy()

virtual Behavior* bdm::Behavior::NewCopy ( ) const
pure virtual

Create a new copy of this behavior.

◆ operator delete()

void bdm::Behavior::operator delete ( void *  p)
inline

Definition at line 114 of file behavior.h.

◆ operator new()

void* bdm::Behavior::operator new ( size_t  size)
inline

Definition at line 105 of file behavior.h.

◆ RemoveFromExistingIf()

void bdm::Behavior::RemoveFromExistingIf ( const std::initializer_list< NewAgentEventUid > &  uids)
inline

If a new agent will be created with one of these NewAgentEventUids, this behavior will be removed from the existing agent.

Definition at line 86 of file behavior.h.

◆ Run()

virtual void bdm::Behavior::Run ( Agent agent)
pure virtual

◆ Update()

virtual void bdm::Behavior::Update ( const NewAgentEvent event)
inlinevirtual

This method is called to update the existing behavior at the end of a NewAgentEvent. Override this method to update attributes of your own Behavior subclasses. NB: Don't forget to call the implementation of the base class first. Base::Update(event); Failing to do so will result in errors.

Definition at line 58 of file behavior.h.

◆ WillBeCopied()

bool bdm::Behavior::WillBeCopied ( NewAgentEventUid  event) const
inline

Function returns whether the behavior will be copied for the given event.

Definition at line 95 of file behavior.h.

◆ WillBeRemoved()

bool bdm::Behavior::WillBeRemoved ( NewAgentEventUid  event) const
inline

Function returns whether the behavior will be removed for the given event.

Definition at line 101 of file behavior.h.

Member Data Documentation

◆ copy_mask_

NewAgentEventUid bdm::Behavior::copy_mask_ = 0
private

Definition at line 124 of file behavior.h.

◆ remove_mask_

NewAgentEventUid bdm::Behavior::remove_mask_ = 0
private

Definition at line 125 of file behavior.h.


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