![]() |
Atoms Crowd
7.0.0
|
Agents pool. More...
#include <AgentsPool.h>
Public Member Functions | |
| std::vector< Agent * > | reserve (unsigned int numAgents, const std::string &affinity="") |
| Creates the given number of agents and returns them. More... | |
| void | clear () |
| Clears all the agents. | |
| void | reset () |
| Reset the map and move the agents to the cache. | |
| void | clearCache () |
| Delete the cache. | |
| Agent * | agent (unsigned int id) |
| Gets an agent by its global id. More... | |
| std::vector< int > | agentIds () |
| Gets all agent global ids. | |
| void | deleteAgent (unsigned int id) |
| Delete an agent. | |
| void | deleteAgents (const std::vector< unsigned int > &ids) |
| Delete agents. | |
| size_t | numAgents () const |
| Gets the number of agents. | |
| AtomsPtr< Agent > | createEmptyAgent () const |
| Create and agent without saving it inside the pool. | |
| void | setNumAgentsOffset (unsigned int offset) |
| unsigned int | numAgentsOffset () const |
Static Public Member Functions | |
| static AgentsPool & | instance () |
| Singleton access. | |
Agents pool.
This is the container of all the agents of your simulation. Every agent is generated by this class and a pointer to the new agents is returned. The agents must be created and destroyed by this class only! Every agent created has a unique id stored in the "id" metadata.
| Agent* Atoms::AgentsPool::agent | ( | unsigned int | id | ) |
Gets an agent by its global id.
| id | Agent global id |
| std::vector<Agent*> Atoms::AgentsPool::reserve | ( | unsigned int | numAgents, |
| const std::string & | affinity = "" |
||
| ) |
Creates the given number of agents and returns them.
| numAgents | Number of agents to create |