Menge
Modular Pedestrian Simulation Framework for Research and Development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ExplicitAgentGenerator.h
Go to the documentation of this file.
1 /*
2 
3 License
4 
5 Menge
6 Copyright © and trademark ™ 2012-14 University of North Carolina at Chapel Hill.
7 All rights reserved.
8 
9 Permission to use, copy, modify, and distribute this software and its documentation
10 for educational, research, and non-profit purposes, without fee, and without a
11 written agreement is hereby granted, provided that the above copyright notice,
12 this paragraph, and the following four paragraphs appear in all copies.
13 
14 This software program and documentation are copyrighted by the University of North
15 Carolina at Chapel Hill. The software program and documentation are supplied "as is,"
16 without any accompanying services from the University of North Carolina at Chapel
17 Hill or the authors. The University of North Carolina at Chapel Hill and the
18 authors do not warrant that the operation of the program will be uninterrupted
19 or error-free. The end-user understands that the program was developed for research
20 purposes and is advised not to rely exclusively on the program for any reason.
21 
22 IN NO EVENT SHALL THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL OR THE AUTHORS
23 BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
24 DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS
25 DOCUMENTATION, EVEN IF THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL OR THE
26 AUTHORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL AND THE AUTHORS SPECIFICALLY
29 DISCLAIM ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
30 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE AND ANY STATUTORY WARRANTY
31 OF NON-INFRINGEMENT. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND
32 THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL AND THE AUTHORS HAVE NO OBLIGATIONS
33 TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
34 
35 Any questions or comments should be sent to the authors {menge,geom}@cs.unc.edu
36 
37 */
38 
45 #ifndef __EXPLICIT_AGENT_GENERATOR_H__
46 #define __EXPLICIT_AGENT_GENERATOR_H__
47 
48 #include "mengeCommon.h"
51 #include <vector>
52 
53 namespace Menge {
54 
55  namespace Agents {
60  class MENGE_API ExplicitGenerator : public AgentGenerator {
61  public:
66 
72  virtual size_t agentCount() { return _positions.size(); }
73 
81  virtual Vector2 agentPos( size_t i );
82 
88  void addPosition( const Vector2 & p );
89 
90  protected:
94  std::vector< Vector2 > _positions;
95  };
96 
98 
103  public:
112  virtual const char * name() const { return "explicit"; }
113 
121  virtual const char * description() const {
122  return "Agent generation is done via an explicit list of agent positions, given in the XML specification.";
123  };
124 
125  protected:
136  AgentGenerator * instance() const { return new ExplicitGenerator(); }
137 
156  virtual bool setFromXML( AgentGenerator * gen, TiXmlElement * node, const std::string & specFldr ) const;
157 
165  Vector2 parseAgent( TiXmlElement * node ) const;
166  };
167  } // namespace Agents
168 } // namespace Menge
169 #endif // __EXPLICIT_AGENT_GENERATOR_H__
std::vector< Vector2 > _positions
The agent positions parsed from the file.
Definition: ExplicitAgentGenerator.h:94
The factory for parsing xml data and instantiating agent generator implementations.
The core namespace. All elements of Menge are contained in this namespace.
Definition: AgentGenerator.cpp:43
Definition of agent generator class which produces agents based on explicit enumeration of agent posi...
Definition: ExplicitAgentGenerator.h:60
virtual const char * name() const
The name of the generator type.
Definition: ExplicitAgentGenerator.h:112
The base class inital agent generation.
Definition: AgentGenerator.h:104
virtual size_t agentCount()
Reports the number of agents created.
Definition: ExplicitAgentGenerator.h:72
A class for parsing the xml description of an agent generator and instantiating particular instances...
Definition: AgentGeneratorFactory.h:59
The definition of the agent generator element. Defines the intial numbers and positions of agents in ...
The namespace that contains the basic simulation mechanisms.
Factory for ExplicitGenerator.
Definition: ExplicitAgentGenerator.h:102
virtual const char * description() const
A description of the agent generator.
Definition: ExplicitAgentGenerator.h:121
AgentGenerator * instance() const
Create an instance of this class's agent generator implementation.
Definition: ExplicitAgentGenerator.h:136