AgentsSource.h 1.81 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12
/*
 * AgentSource.h
 *
 *  Created on: 14.04.2015
 *      Author: piccolo
 */

#ifndef AGENTSOURCE_H_
#define AGENTSOURCE_H_

#include <string>
#include <vector>
13
#include <memory>
14 15 16

class Pedestrian;
class OutputHandler;
17
class StartDistribution;
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63

// external variables
extern OutputHandler* Log;


class AgentsSource
{
public:
     /**
      * Constructor
      */
     AgentsSource(int id,std::string caption,int max_agents,int group_id,int frequency);

     /**
      * Destructor
      */
     virtual ~AgentsSource();

     /**
      * Add a new agent to this source
      * @param ped
      */
     void Add(Pedestrian* ped);

     /**
      * Generate a number of agents, based on the frequency given in the constructor.
      * No agents are generated if the the maximum (_maxAgents) is reached.
      * @see _maxAgents
      * @param ped
      */
     void GenerateByFrequency(std::vector<Pedestrian*>& ped);

     /**
      * @return the number of agents remaining
      */
     int GetPoolSize() const;

     /**
      * Print relevant information
      */
     void Dump() const;

     int GetGroupID() const;
     int GetAgentsGenerated() const;
     void SetAgentsGenerated(int agentsGenerated);
     const double* GetBoundaries() const;
64
     void Setboundaries(double * bounds);
65 66 67 68 69
     const std::string& GetCaption() const;
     int GetFrequency() const;
     int GetGroupId() const;
     int GetId() const;
     int GetMaxAgents() const;
70
     void SetStartDistribution(std::shared_ptr<StartDistribution>);
71 72 73 74 75 76 77 78 79 80 81


private:
     int _id=-1;
     int _frequency=0;
     int _maxAgents=0;
     int _agentsGenerated=0;
     int _groupID=-1;
     double _boundaries [4] = {0,0,0,0};
     std::string _caption="no caption";
     std::vector<Pedestrian*> _agents;
82
     std::shared_ptr<StartDistribution> _startDistribution;
83 84 85 86 87

};

#endif /* AGENTSOURCE_H_ */