Menge
Modular Pedestrian Simulation Framework for Research and Development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
StateMemberTarget.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 
44 #ifndef __STATE_MEMBER_TARGET_H__
45 #define __STATE_MEMBER_TARGET_H__
46 
47 #include "AgentEventTarget.h"
48 
49 namespace Menge {
50  // forward declaration
51  class NamedStateMemberTargetFactory;
52 
53  namespace BFSM {
54  class State;
55  }
56 
57 
59 
64  class MENGE_API NamedStateMemberTarget : public AgentEventTarget {
65  public:
70 
77  virtual void finalize();
78 
86  virtual void update();
87 
88  friend class NamedStateMemberTargetFactory;
89 
90  protected:
94  std::string _stateName;
95 
100 
105  bool _inState;
106  };
107 
109 
114  public:
119 
128  virtual const char * name() const { return "named_state_member"; }
129 
137  virtual const char * description() const {
138  return "Defines an agent as a target based on its membership relationship to a single state.";
139  };
140 
141  protected:
152  EventTarget * instance() const { return new NamedStateMemberTarget(); }
153 
172  virtual bool setFromXML( EventTarget * target, TiXmlElement * node, const std::string & behaveFldr ) const;
173 
177  size_t _stateID;
178 
182  size_t _isMemberID;
183  };
184 
185  // TODO: Future state-based targets
186  // Set of named states
187  // membership based on state properties
188  // final/not final
189  // transitions to state X
190  // etc.
191 
192 } // namespace Menge
193 #endif // __STATE_MEMBER_TARGET_H__
The basic state of the behavior finite state machine.
Definition: State.h:123
std::string _stateName
The name of the state to operate on.
Definition: StateMemberTarget.h:94
The core namespace. All elements of Menge are contained in this namespace.
Definition: AgentGenerator.cpp:43
The factory to generate NamedStateMemberTarget instances.
Definition: StateMemberTarget.h:113
The base class for all event targets.
Definition: EventTarget.h:66
Factory for the AgentEventTarget.
Definition: AgentEventTarget.h:84
virtual const char * name() const
The name of the target.
Definition: StateMemberTarget.h:128
The definition of the event target for agents.
EventTarget * instance() const
Create an instance of this class's target.
Definition: StateMemberTarget.h:152
Defines the target of an event effect based on membership relationship to a single named state...
Definition: StateMemberTarget.h:64
The base class for all event targets which target agents.
Definition: AgentEventTarget.h:59
BFSM::State * _state
The state to operate on.
Definition: StateMemberTarget.h:99
The namespace contains the Behavior Finite State Machine (BFSM) definition.
NamedStateMemberTarget()
Default constructor.
Definition: StateMemberTarget.h:69
bool _inState
Deterimines if membership in the specified state (true) or non-membership (false) makes an agent a ta...
Definition: StateMemberTarget.h:105
size_t _stateID
The identifier for the "state" string attribute.
Definition: StateMemberTarget.h:177
virtual const char * description() const
A description of the target.
Definition: StateMemberTarget.h:137
size_t _isMemberID
The identifier for the "is_member" bool attribute.
Definition: StateMemberTarget.h:182