Add dummy c'stor and d'stor to the starter example

This commit is contained in:
James P. Howard, II
2022-08-04 10:07:44 -04:00
parent c91caf723e
commit cc7cf670bb
2 changed files with 21 additions and 1 deletions

View File

@@ -53,6 +53,14 @@ struct fmt::formatter<kami::AgentID> : fmt::formatter<std::string> {
} }
}; };
StarterAgent::StarterAgent() {
console->debug("StarterAgent with ID {} constructed", this->get_agent_id());
}
StarterAgent::~StarterAgent() {
console->debug("StarterAgent with ID {} deconstructed", this->get_agent_id());
}
kami::AgentID StarterAgent::step(std::shared_ptr<kami::Model> model) { kami::AgentID StarterAgent::step(std::shared_ptr<kami::Model> model) {
this->_step_counter++; this->_step_counter++;
return this->get_agent_id(); return this->get_agent_id();

View File

@@ -32,20 +32,32 @@
#include <kami/agent.h> #include <kami/agent.h>
#include <kami/kami.h> #include <kami/kami.h>
#include <kami/multigrid1d.h>
#include <kami/random.h> #include <kami/random.h>
/** /**
* A starter agent for a starter model * A starter agent for a starter model
*/ */
class StarterAgent : public kami::Agent { class StarterAgent : public kami::Agent {
private:
int _step_counter = 0; int _step_counter = 0;
public: public:
/**
* Constructor
*/
StarterAgent();
/**
* Deconstructor
*/
~StarterAgent();
/** /**
* Execute a single time-step for the agent * Execute a single time-step for the agent
*/ */
kami::AgentID step(std::shared_ptr<kami::Model> model) override; kami::AgentID step(std::shared_ptr<kami::Model> model) override;
}; };
/** /**