cppyabm  1.0.17
An agent-based library to integrate C++ and Python
Public Member Functions | Public Attributes | List of all members
Agent< ENV, AGENT, PATCH > Struct Template Reference

Base class for Agent. More...

#include <bases.h>

Public Member Functions

 Agent (shared_ptr< ENV > env, string class_name)
 
virtual ~Agent ()
 
virtual void step ()
 
virtual void inherit (shared_ptr< AGENT > father)
 To define agent behavior. More...
 
virtual void update ()
 To define inheritage. More...
 
void move (shared_ptr< PATCH > dest, bool quiet=false)
 Moves the agent to the given destination patch. More...
 
void order_hatch (shared_ptr< PATCH > patch=nullptr, bool inherit=false, bool quiet=false, bool reset=false)
 Orders agent to hatch. This will execute during Env::update. More...
 
void order_move (shared_ptr< PATCH > patch=nullptr, bool quiet=false, bool reset=false)
 Orders agent to move. This will execute during Env::update. More...
 
void order_switch (string to)
 
void reset_hatch ()
 Orders agent to switch to another agent. This will execute during Env::update. More...
 
void reset_move ()
 
void reset_switch ()
 
 Agent (shared_ptr< ENV > env, string class_name)
 
virtual ~Agent ()
 
virtual void step ()
 
virtual void inherit (shared_ptr< AGENT > father)
 To define agent behavior. More...
 
virtual void update ()
 To define inheritage. More...
 
void move (shared_ptr< PATCH > dest, bool quiet=false)
 Moves the agent to the given destination patch. More...
 
void order_hatch (shared_ptr< PATCH > patch=nullptr, bool inherit=false, bool quiet=false, bool reset=false)
 Orders agent to hatch. This will execute during Env::update. More...
 
void order_move (shared_ptr< PATCH > patch=nullptr, bool quiet=false, bool reset=false)
 Orders agent to move. This will execute during Env::update. More...
 
void order_switch (string to)
 
void reset_hatch ()
 Orders agent to switch to another agent. This will execute during Env::update. More...
 
void reset_move ()
 
void reset_switch ()
 

Public Attributes

std::pair< bool, std::string > switch_info = std::make_pair(false,"")
 
HATCH_CONFIG< ENV, AGENT, PATCH > _hatch = HATCH_CONFIG<ENV,AGENT,PATCH>()
 
MOVE_CONFIG< ENV, AGENT, PATCH > _move = MOVE_CONFIG<ENV,AGENT,PATCH>()
 
SWITCH_CONFIG _switch = SWITCH_CONFIG()
 
std::shared_ptr< PATCH > patch
 Pointer to the residing patch. More...
 
std::shared_ptr< ENV > env
 Pointer to the simulation world. More...
 
bool disappear = false
 if set to true, the agent will be removed from the simulation. This will execute during Env::update More...
 
string class_name
 Unique ID of this class. More...
 
bool has_patch = false
 Indicates if an agent residing on a patch. More...
 

Detailed Description

template<class ENV, class AGENT, class PATCH>
struct Agent< ENV, AGENT, PATCH >

Base class for Agent.

Agent class simulates movable objects

Definition at line 103 of file bases.h.

Constructor & Destructor Documentation

◆ Agent() [1/2]

template<class ENV , class AGENT , class PATCH >
Agent< ENV, AGENT, PATCH >::Agent ( shared_ptr< ENV >  env,
string  class_name 
)
inline

Definition at line 104 of file bases.h.

◆ ~Agent() [1/2]

template<class ENV , class AGENT , class PATCH >
virtual Agent< ENV, AGENT, PATCH >::~Agent ( )
inlinevirtual

Definition at line 108 of file bases.h.

◆ Agent() [2/2]

template<class ENV , class AGENT , class PATCH >
Agent< ENV, AGENT, PATCH >::Agent ( shared_ptr< ENV >  env,
string  class_name 
)
inline

Definition at line 104 of file bases.h.

◆ ~Agent() [2/2]

template<class ENV , class AGENT , class PATCH >
virtual Agent< ENV, AGENT, PATCH >::~Agent ( )
inlinevirtual

Definition at line 108 of file bases.h.

Member Function Documentation

◆ inherit() [1/2]

template<class ENV , class AGENT , class PATCH >
virtual void Agent< ENV, AGENT, PATCH >::inherit ( shared_ptr< AGENT >  father)
inlinevirtual

To define agent behavior.

Definition at line 113 of file bases.h.

◆ inherit() [2/2]

template<class ENV , class AGENT , class PATCH >
virtual void Agent< ENV, AGENT, PATCH >::inherit ( shared_ptr< AGENT >  father)
inlinevirtual

To define agent behavior.

Definition at line 113 of file bases.h.

◆ move() [1/2]

template<class ENV , class AGENT , class PATCH >
void Agent< ENV, AGENT, PATCH >::move ( shared_ptr< PATCH >  dest,
bool  quiet = false 
)

Moves the agent to the given destination patch.

◆ move() [2/2]

template<class ENV , class AGENT , class PATCH >
void Agent< ENV, AGENT, PATCH >::move ( shared_ptr< PATCH >  dest,
bool  quiet = false 
)

Moves the agent to the given destination patch.

◆ order_hatch() [1/2]

template<class ENV , class AGENT , class PATCH >
void Agent< ENV, AGENT, PATCH >::order_hatch ( shared_ptr< PATCH >  patch = nullptr,
bool  inherit = false,
bool  quiet = false,
bool  reset = false 
)

Orders agent to hatch. This will execute during Env::update.

◆ order_hatch() [2/2]

template<class ENV , class AGENT , class PATCH >
void Agent< ENV, AGENT, PATCH >::order_hatch ( shared_ptr< PATCH >  patch = nullptr,
bool  inherit = false,
bool  quiet = false,
bool  reset = false 
)

Orders agent to hatch. This will execute during Env::update.

◆ order_move() [1/2]

template<class ENV , class AGENT , class PATCH >
void Agent< ENV, AGENT, PATCH >::order_move ( shared_ptr< PATCH >  patch = nullptr,
bool  quiet = false,
bool  reset = false 
)

Orders agent to move. This will execute during Env::update.

◆ order_move() [2/2]

template<class ENV , class AGENT , class PATCH >
void Agent< ENV, AGENT, PATCH >::order_move ( shared_ptr< PATCH >  patch = nullptr,
bool  quiet = false,
bool  reset = false 
)

Orders agent to move. This will execute during Env::update.

◆ order_switch() [1/2]

template<class ENV , class AGENT , class PATCH >
void Agent< ENV, AGENT, PATCH >::order_switch ( string  to)
inline

Definition at line 122 of file bases.h.

◆ order_switch() [2/2]

template<class ENV , class AGENT , class PATCH >
void Agent< ENV, AGENT, PATCH >::order_switch ( string  to)
inline

Definition at line 122 of file bases.h.

◆ reset_hatch() [1/2]

template<class ENV , class AGENT , class PATCH >
void Agent< ENV, AGENT, PATCH >::reset_hatch ( )
inline

Orders agent to switch to another agent. This will execute during Env::update.

Definition at line 126 of file bases.h.

◆ reset_hatch() [2/2]

template<class ENV , class AGENT , class PATCH >
void Agent< ENV, AGENT, PATCH >::reset_hatch ( )
inline

Orders agent to switch to another agent. This will execute during Env::update.

Definition at line 126 of file bases.h.

◆ reset_move() [1/2]

template<class ENV , class AGENT , class PATCH >
void Agent< ENV, AGENT, PATCH >::reset_move ( )
inline

Definition at line 127 of file bases.h.

◆ reset_move() [2/2]

template<class ENV , class AGENT , class PATCH >
void Agent< ENV, AGENT, PATCH >::reset_move ( )
inline

Definition at line 127 of file bases.h.

◆ reset_switch() [1/2]

template<class ENV , class AGENT , class PATCH >
void Agent< ENV, AGENT, PATCH >::reset_switch ( )
inline

Definition at line 128 of file bases.h.

◆ reset_switch() [2/2]

template<class ENV , class AGENT , class PATCH >
void Agent< ENV, AGENT, PATCH >::reset_switch ( )
inline

Definition at line 128 of file bases.h.

◆ step() [1/2]

template<class ENV , class AGENT , class PATCH >
virtual void Agent< ENV, AGENT, PATCH >::step ( )
inlinevirtual

Reimplemented in Cell, and Cell.

Definition at line 110 of file bases.h.

◆ step() [2/2]

template<class ENV , class AGENT , class PATCH >
virtual void Agent< ENV, AGENT, PATCH >::step ( )
inlinevirtual

Reimplemented in Cell, and Cell.

Definition at line 110 of file bases.h.

◆ update() [1/2]

template<class ENV , class AGENT , class PATCH >
virtual void Agent< ENV, AGENT, PATCH >::update ( )
inlinevirtual

To define inheritage.

Reimplemented in Cell, and Cell.

Definition at line 116 of file bases.h.

◆ update() [2/2]

template<class ENV , class AGENT , class PATCH >
virtual void Agent< ENV, AGENT, PATCH >::update ( )
inlinevirtual

To define inheritage.

Reimplemented in Cell, and Cell.

Definition at line 116 of file bases.h.

Member Data Documentation

◆ _hatch

template<class ENV , class AGENT , class PATCH >
HATCH_CONFIG< ENV, AGENT, PATCH > Agent< ENV, AGENT, PATCH >::_hatch = HATCH_CONFIG<ENV,AGENT,PATCH>()

Definition at line 130 of file bases.h.

◆ _move

template<class ENV , class AGENT , class PATCH >
MOVE_CONFIG< ENV, AGENT, PATCH > Agent< ENV, AGENT, PATCH >::_move = MOVE_CONFIG<ENV,AGENT,PATCH>()

Definition at line 131 of file bases.h.

◆ _switch

template<class ENV , class AGENT , class PATCH >
SWITCH_CONFIG Agent< ENV, AGENT, PATCH >::_switch = SWITCH_CONFIG()

Definition at line 132 of file bases.h.

◆ class_name

template<class ENV , class AGENT , class PATCH >
string Agent< ENV, AGENT, PATCH >::class_name

Unique ID of this class.

Definition at line 136 of file bases.h.

◆ disappear

template<class ENV , class AGENT , class PATCH >
bool Agent< ENV, AGENT, PATCH >::disappear = false

if set to true, the agent will be removed from the simulation. This will execute during Env::update

Definition at line 135 of file bases.h.

◆ env

template<class ENV , class AGENT , class PATCH >
std::shared_ptr< ENV > Agent< ENV, AGENT, PATCH >::env

Pointer to the simulation world.

Definition at line 134 of file bases.h.

◆ has_patch

template<class ENV , class AGENT , class PATCH >
bool Agent< ENV, AGENT, PATCH >::has_patch = false

Indicates if an agent residing on a patch.

Definition at line 137 of file bases.h.

◆ patch

template<class ENV , class AGENT , class PATCH >
std::shared_ptr< PATCH > Agent< ENV, AGENT, PATCH >::patch

Pointer to the residing patch.

Definition at line 133 of file bases.h.

◆ switch_info

template<class ENV , class AGENT , class PATCH >
std::pair< bool, std::string > Agent< ENV, AGENT, PATCH >::switch_info = std::make_pair(false,"")

Definition at line 129 of file bases.h.


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