AgentsSourcesManager.h 1.57 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
/*
 * AgentsSourcesManager.h
 *
 *  Created on: 14.04.2015
 *      Author: piccolo
 */

#ifndef AGENTSSOURCESMANAGER_H_
#define AGENTSSOURCESMANAGER_H_

#include <vector>
#include <memory>

//Forward declarations
class AgentsSource;
16
class Building;
17
class Pedestrian;
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

class AgentsSourcesManager
{
public:
     /**
      * Constructor
      */
     AgentsSourcesManager();

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

     /**
      * Make the class "runnable" by overloading the operator
      * @param value
      */
     void operator()(int value);

     /**
      *  Add a new agent source
      */
     void AddSource(std::shared_ptr<AgentsSource> src);

     /**
      * @return all sources
      */
     const std::vector<std::shared_ptr<AgentsSource> >& GetSources() const;

48 49 50 51 52
     /**
      * Set the building object
      */
     void SetBuilding(Building* building);

53
     //void operator()();
54 55 56 57 58
     /**
      * @return true if all agents have been generated
      * and the class is ready to leave
      */
     bool IsCompleted() const;
59 60 61

private:
     /// contain the sources
62 63 64
     std::vector<std::shared_ptr<AgentsSource> > _sources;
     ///to control the trigger of the events
     long int _lastUpdateTime = 0;
65
     /// building object
66
     Building* _building=nullptr;
67 68
     /// whether all agents have been dispatched
     bool _isCompleted=true;
69 70

private:
71 72
     void ComputeBestPositionVoronoi(AgentsSource* src, Pedestrian* agent);
     void ComputeBestPositionRandom(AgentsSource* src, std::vector<Pedestrian*>& peds);
73 74 75
};

#endif /* AGENTSSOURCESMANAGER_H_ */