10 #include <Atoms/Globals.h>
11 #include <Atoms/Agent.h>
35 std::vector<Agent*>
reserve(
unsigned int numAgents,
const std::string& affinity =
"");
67 void setNumAgentsOffset(
unsigned int offset);
69 unsigned int numAgentsOffset()
const;
88 std::unordered_map<int, Agent*> m_agents;
91 std::map<std::string, std::vector<Agent*>> m_agentCache;
97 unsigned int m_nextFreeId;
99 unsigned int m_numAgentsOffset;
Agent.
Definition: Agent.h:44
Agents pool.
Definition: AgentsPool.h:24
void clear()
Clears all the agents.
void reset()
Reset the map and move the agents to the cache.
void deleteAgents(const std::vector< unsigned int > &ids)
Delete agents.
AtomsPtr< Agent > createEmptyAgent() const
Create and agent without saving it inside the pool.
size_t numAgents() const
Gets the number of agents.
std::vector< int > agentIds()
Gets all agent global ids.
static AgentsPool & instance()
Singleton access.
void deleteAgent(unsigned int id)
Delete an agent.
Agent * agent(unsigned int id)
Gets an agent by its global id.
void clearCache()
Delete the cache.
std::vector< Agent * > reserve(unsigned int numAgents, const std::string &affinity="")
Creates the given number of agents and returns them.
Atoms namespace.
Definition: Agent.h:29