Atoms Crowd  7.0.0
ScriptModule.h
1 #pragma once
2 // ===========================================================================
3 // Copyright (c) 2015-2024 Toolchefs Ltd. All rights reserved.
4 //
5 // Use of this software is subject to the terms of the Toolchefs license
6 // agreement provided at the time of installation or download, or which
7 // otherwise accompanies this software in either electronic or hard copy form.
8 // ===========================================================================
9 #include <Atoms/BehaviourModule.h>
10 
11 namespace AtomsModules
12 {
14  {
15  public:
16 
17  ScriptModule();
18 
19  ~ScriptModule();
20 
21  void initSimulation(Atoms::AgentGroup* agentGroup = nullptr);
22 
23  void agentsCreated(const std::vector<Atoms::Agent*>& agents, Atoms::AgentGroup* agentGroup = nullptr) override;
24 
25  void agentsKilled(const std::vector<Atoms::Agent*>& agents, Atoms::AgentGroup* agentGroup = nullptr) override;
26 
27  void initFrame(const std::vector<Atoms::Agent*>& agents, Atoms::AgentGroup* agentGroup = nullptr) override;
28 
29  void endFrame(const std::vector<Atoms::Agent*>& agents, Atoms::AgentGroup* agentGroup = nullptr) override;
30 
31  static Atoms::BehaviourModule* creator(const std::string& parameter);
32 
33  std::function<void(const AtomsScriptUtils::AgentWrapper&, const AtomsScriptUtils::AgentGroupWrapper&)> compile(Atoms::AgentGroup* agentGroup, const std::string& eventName);
34 
35  private:
36 
37  std::function<void(const AtomsScriptUtils::AgentWrapper&, const AtomsScriptUtils::AgentGroupWrapper&)> m_agentsCreated;
38  std::function<void(const AtomsScriptUtils::AgentWrapper&, const AtomsScriptUtils::AgentGroupWrapper&)> m_agentsKilled;
39  std::function<void(const AtomsScriptUtils::AgentWrapper&, const AtomsScriptUtils::AgentGroupWrapper&)> m_initFrame;
40  std::function<void(const AtomsScriptUtils::AgentWrapper&, const AtomsScriptUtils::AgentGroupWrapper&)> m_endFrame;
41  };
42 }
43 
Agent group.
Definition: AgentGroup.h:36
Behaviour module.
Definition: BehaviourModule.h:32
Definition: ScriptModule.h:14
void initSimulation(Atoms::AgentGroup *agentGroup=nullptr)
Init simulation.
void initFrame(const std::vector< Atoms::Agent * > &agents, Atoms::AgentGroup *agentGroup=nullptr) override
Init frame.
void agentsKilled(const std::vector< Atoms::Agent * > &agents, Atoms::AgentGroup *agentGroup=nullptr) override
Post frame.
void endFrame(const std::vector< Atoms::Agent * > &agents, Atoms::AgentGroup *agentGroup=nullptr) override
End frame.
void agentsCreated(const std::vector< Atoms::Agent * > &agents, Atoms::AgentGroup *agentGroup=nullptr) override
Agents Created.
Definition: AtomsScriptUtils.h:260
Definition: AtomsScriptUtils.h:125