Changeset 7301 for code/trunk
- Timestamp:
- Aug 31, 2010, 11:31:37 PM (14 years ago)
- Location:
- code/trunk/src
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/libraries/core/EventIncludes.h
r7284 r7301 53 53 XMLPortEventStateIntern(xmlportevent##function, classname, statename, xmlelement, mode) 54 54 55 /** 56 @brief Like XMLPortEventState but creates an event sink instead of an event state. 57 The most important destinction between an EventState and an EventSink is, that an EventState only processes events which change the state of the EventState, where as an EventSink is an EventState that processes any Event that reaches it. 58 */ 59 55 60 #define XMLPortEventSink(classname, subclassname, statename, function, xmlelement, mode) \ 56 61 orxonox::EventState* containername##function = this->getEventState(statename); \ … … 62 67 XMLPortEventStateIntern(xmlportevent##function, classname, statename, xmlelement, mode) 63 68 64 /** 65 @brief Like XMLPortEventState but creates an event sink instead of an event state. 66 The most important destinction between an EventState and an EventSink is, that an EventState only processes event which change the state of the EventState, where as an EventSink is an EventState that processes any Event that reaches it. 67 */ 69 68 70 #define XMLPortEventStateTemplate(classname, subclassname, statename, function, xmlelement, mode, ...) \ 69 71 orxonox::EventState* containername##function = this->getEventState(statename); \ -
code/trunk/src/modules/objects/triggers/DistanceMultiTrigger.cc
r7163 r7301 62 62 DistanceMultiTrigger::~DistanceMultiTrigger() 63 63 { 64 64 65 } 65 66 … … 81 82 82 83 In this implementation we iterate through all possible objects and check whether the fact that they are in range or not has changed and fire and hand a state ofer to the MultiTrigger if so. 84 @return 85 Returns a pointer to a queue of MultiTriggerState pointers, containing all the necessary information to decide whether these states should indeed become new states of the MultiTrigger. 83 86 */ 84 87 std::queue<MultiTriggerState*>* DistanceMultiTrigger::letTrigger(void) … … 92 95 WorldEntity* entity = it->second->get(); 93 96 WorldEntity* key = it->first; 97 it++; // Incrementing the iterator in advance, since we don't need the current anymore and we potentially are going to delete the current element thus invalidating the iterator. 98 // If the entity no longer exists. 94 99 if(entity == NULL) 95 100 { 96 ++it;97 101 this->removeFromRange(key); 98 102 continue; … … 103 107 if (distanceVec.length() > this->distance_) 104 108 { 109 // If for some reason the entity could not be removed. 105 110 if(!this->removeFromRange(key)) 106 {107 ++it;108 111 continue; 109 }110 112 111 113 // If no queue has been created, yet. … … 115 117 // Create a state and append it to the queue. 116 118 MultiTriggerState* state = new MultiTriggerState; 117 state->bTriggered = false; 119 state->bTriggered = false; // Because the entity went out of range. 118 120 state->originator = entity; 119 121 queue->push(state); 120 122 } 121 else122 ++it;123 123 } 124 124 125 ClassTreeMask& targetMask = this->getTargetMask();126 127 125 // Check for new objects that are in range 128 for(ClassTreeMaskObjectIterator it = t argetMask.begin(); it != targetMask.end(); ++it)126 for(ClassTreeMaskObjectIterator it = this->getTargetMask().begin(); it != this->getTargetMask().end(); ++it) 129 127 { 130 128 WorldEntity* entity = static_cast<WorldEntity*>(*it); 131 if (entity == NULL) //If the object is no WorldEntity or is already in range. 132 continue; 133 134 // If the DistanceMultiTrigger is in single-target-mode. 129 130 // If the DistanceMultiTrigger is in single-target mode. 135 131 if(this->singleTargetMode_) 136 132 { 137 133 // If the object that is a target is no DistanceTriggerBeacon, then the DistanceMultiTrigger can't be in single-target-mode. 138 if(!(*it)->isA(ClassIdentifier<DistanceTriggerBeacon>::getIdentifier())) 134 if(!entity->isA(ClassIdentifier<DistanceTriggerBeacon>::getIdentifier())) 135 { 139 136 this->singleTargetMode_ = false; 140 // If the target name and the name of the DistancTriggreBeacon don't match. 137 COUT(2) << "DistanceMultiTrigger " << this->getName() << " (&" << this << ")" << "is in single-target mode but the target is '" << entity->getIdentifier()->getName() << "' instead of DistanceTriggerBeacon. Setting single-target mode to false." << std::endl; 138 } 139 // If the target name and the name of the DistancTriggerBeacon don't match. 141 140 else if(entity->getName().compare(this->targetName_) != 0) 142 141 continue; … … 148 147 { 149 148 // Add the object to the objects that are in range. 149 // Objects that already are in range are not added twice, because in a map (this->range_) each key can only exist once and thus addToRange() will reject all attempts of duplicate entries. 150 150 if(!this->addToRange(entity)) 151 151 continue; … … 161 161 // Create a state and append it to the queue. 162 162 MultiTriggerState* state = new MultiTriggerState; 163 state->bTriggered = true; 163 state->bTriggered = true; // Because the entity came into range. 164 164 state->originator = entity; 165 165 queue->push(state); … … 170 170 } 171 171 172 /** 173 @brief 174 Set the target name of DistanceTriggerBeacons that triggers this DistanceMultiTrigger. 175 @param targetname 176 The name of the DistanceTriggerBeacon as a string. 177 */ 178 void DistanceMultiTrigger::setTargetName(const std::string& targetname) 179 { 180 // If the targetname is no blank string single-target mode is enabled. 181 if(targetname.compare(BLANKSTRING) != 0) 182 this->singleTargetMode_ = true; 183 else 184 this->singleTargetMode_ = false; 185 186 this->targetName_ = targetname; 187 } 188 189 /** 190 @brief 191 Add a given entity to the entities, that currently are in range of the DistanceMultiTrigger. 192 @param entity 193 A pointer to the entity. 194 @return 195 Returns true if successful, false if not. 196 */ 197 bool DistanceMultiTrigger::addToRange(WorldEntity* entity) 198 { 199 WeakPtr<WorldEntity>* weakptr = new WeakPtr<WorldEntity>(entity); 200 std::pair<std::map<WorldEntity*, WeakPtr<WorldEntity>* >::iterator, bool> pair = this->range_.insert(std::pair<WorldEntity*, WeakPtr<WorldEntity>* >(entity, weakptr)); 201 202 if(!pair.second) 203 { 204 delete weakptr; 205 return false; 206 } 207 208 return true; 209 } 210 211 /** 212 @brief 213 Remove a given entity from the set of entities, that currently are in range of the DistanceMultiTrigger. 214 @param entity 215 A pointer ot the entity. 216 @return 217 Returns true if successful. 218 */ 219 bool DistanceMultiTrigger::removeFromRange(WorldEntity* entity) 220 { 221 WeakPtr<WorldEntity>* weakptr = this->range_.find(entity)->second; 222 bool erased = this->range_.erase(entity) > 0; 223 if(erased) 224 delete weakptr; 225 return erased; 226 } 227 172 228 } -
code/trunk/src/modules/objects/triggers/DistanceMultiTrigger.h
r7163 r7301 48 48 /** 49 49 @brief 50 The DistanceMultiTrigger is a trigger that triggers whenever an object (that is of the specified target type) is in a specified range of the DistanceMultiTrigger. The object can be specified further by adding a DistanceTriggerBeacon (just attaching it) to the objects that can trigger this DistanceMultiTrigger and specify the name of the DistanceTriggerBeacon with the parameter targetname and only objects that hav a DistanceTriggerBeacon with that name attached will trigger the DistanceMultiTrigger. 50 The DistanceMultiTrigger is a trigger that triggers whenever an object (that is of the specified target type) is in a specified range of the DistanceMultiTrigger. The object can be specified further by adding a DistanceTriggerBeacon (just attaching it) to the objects that can trigger this DistanceMultiTrigger and specify the name of the DistanceTriggerBeacon with the parameter targetname and only objects that have a DistanceTriggerBeacon with that name attached will trigger the DistanceMultiTrigger. 51 Parameters are (additional to the ones of MultiTrigger): 52 'distance', which specifies the maximum distance at which the DistanceMultiTrigger still triggers. Default is 100. 53 'targetname', which, if not left blank, causes the DistancMultiTrigger to be in single-target mode, meaning, that it only reacts to objects that have a DistanceTriggerBeacon (therefore the target has to be set to DistanceTriggerBeacon for it to work), with the name specified by targetname, attached. 54 55 A simple DistanceMultiTrigger would look like this: 56 @code 57 <DistanceMultiTrigger position="0,0,0" switch="true" target="Pawn" distance="20" /> 58 @endcode 59 60 An implementation that only reacts to objects with a DistanceTriggerBeacon attached would look like this: 61 @code 62 <DistanceMultiTrigger position="0,0,0" target="DistanceMultiTrigger" targetname="beacon1" distance="30" /> 63 @endcode 64 This particular DistanceMultiTrigger would only react if an object was in range, that had a DistanceTriggerBeacon with the name 'beacon1' attached. 51 65 @see MultiTrigger.h 52 66 For more information on MultiTriggers. … … 59 73 public: 60 74 DistanceMultiTrigger(BaseObject* creator); //!< Default Constructor. Registers the object and initializes default values. 61 ~DistanceMultiTrigger(); //!< Destructor.75 virtual ~DistanceMultiTrigger(); //!< Destructor. 62 76 63 77 void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a DistanceMultiTrigger object through XML. 64 78 65 /** 66 @brief Set the target name of DistanceTriggerBeacons that triggers this DistanceMultiTrigger. 67 @param targename The name of the DistanceTriggerBeacon as a string. 68 */ 69 inline void setTargetName(const std::string& targetname) 70 { if(targetname.compare(BLANKSTRING) != 0) this->singleTargetMode_ = true; else this->singleTargetMode_ = false; this->targetName_ = targetname; } 79 void setTargetName(const std::string& targetname); //!< Set the target name of DistanceTriggerBeacons that triggers this DistanceMultiTrigger. 71 80 /** 72 81 @brief Get the target name of the DistanceTriggerbeacon, that triggers this DistanceMultiTrigger. … … 92 101 virtual std::queue<MultiTriggerState*>* letTrigger(void); //!< This method is called by the MultiTrigger to get information about new trigger events that need to be looked at. 93 102 94 /** 95 @brief Add a given entity to the entities, that currently are in range of the DistanceMultiTrigger. 96 @param entity A pointer to the entity. 97 @return Returns true if successful, false if not. 98 */ 99 inline bool addToRange(WorldEntity* entity) 100 { std::pair<std::map<WorldEntity*, WeakPtr<WorldEntity>* >::iterator, bool> pair = this->range_.insert(std::pair<WorldEntity*, WeakPtr<WorldEntity>* >(entity, new WeakPtr<WorldEntity>(entity))); return pair.second; } 101 /** 102 @brief Remove a given entity from the set of entities, that currently are in range of the DistanceMultiTrigger. 103 @param entity A pointer ot the entity. 104 @return Returns true if successful. 105 */ 106 inline bool removeFromRange(WorldEntity* entity) 107 { WeakPtr<WorldEntity>* weakptr = this->range_.find(entity)->second; bool erased = this->range_.erase(entity) > 0; if(erased) delete weakptr; return erased; } 103 bool addToRange(WorldEntity* entity); //!< Add a given entity to the entities, that currently are in range of the DistanceMultiTrigger. 104 bool removeFromRange(WorldEntity* entity); //!< Remove a given entity from the set of entities, that currently are in range of the DistanceMultiTrigger. 108 105 109 106 private: -
code/trunk/src/modules/objects/triggers/DistanceTrigger.cc
r7163 r7301 129 129 continue; 130 130 131 // If the DistanceTrigger is in single-target mode. 131 132 if(this->singleTargetMode_) 132 133 { 134 // If the object that is a target is no DistanceTriggerBeacon, then the DistanceTrigger can't be in single-target-mode. 133 135 if(!(*it)->isA(ClassIdentifier<DistanceTriggerBeacon>::getIdentifier())) 136 { 134 137 this->singleTargetMode_ = false; 138 COUT(2) << "DistanceTrigger " << this->getName() << " (&" << this << ")" << "is in single-target mode but the target is '" << entity->getIdentifier()->getName() << "' instead of DistanceTriggerBeacon. Setting single-target mode to false." << std::endl; 139 } 140 // If the target name and the name of the DistancTriggerBeacon don't match. 135 141 else if(entity->getName().compare(this->targetName_) != 0) 136 142 continue; … … 145 151 { 146 152 153 // Change the entity to the parent of the DistanceTriggerBeacon (if in single-target-mode), which is the entity to which the beacon is attached. 147 154 if(this->singleTargetMode_) 148 155 entity = entity->getParent(); -
code/trunk/src/modules/objects/triggers/DistanceTrigger.h
r6906 r7301 23 23 * Benjamin Knecht 24 24 * Co-authors: 25 * ...25 * Damian 'Mozork' Frick 26 26 * 27 27 */ -
code/trunk/src/modules/objects/triggers/DistanceTriggerBeacon.cc
r7163 r7301 27 27 */ 28 28 29 /** 30 @file DistanceTriggerBeacon.cc 31 @brief Implementation of the DistanceTriggerBeacon class. 32 */ 33 29 34 #include "DistanceTriggerBeacon.h" 30 35 … … 36 41 CreateFactory(DistanceTriggerBeacon); 37 42 43 /** 44 @brief 45 Constructor. Registers the object. 46 @param creator 47 The creator of this object. 48 */ 38 49 DistanceTriggerBeacon::DistanceTriggerBeacon(BaseObject* creator) : StaticEntity(creator) 39 50 { -
code/trunk/src/modules/objects/triggers/DistanceTriggerBeacon.h
r7163 r7301 27 27 */ 28 28 29 /** 30 @file DistanceTriggerBeacon.h 31 @brief Definition of the DistanceTriggerBeacon class. 32 */ 33 29 34 #ifndef _DistanceTriggerBeacon_H__ 30 35 #define _DistanceTriggerBeacon_H__ … … 37 42 { 38 43 44 /** 45 @brief 46 A DistanceTriggerBeacon can be used together with a DistanceTrigger or a DistanceMultiTrigger to make them only react to specific objects. 47 This can be done by attaching a DistanceTriggerBeacon to an object, giving it a unique name and setting the targetname in the DistanceTrigger (or DistanceMultiTrigger) to that name and the target to DistanceTriggerBeacon. 48 @author 49 Damian 'Mozork' Frick 50 */ 39 51 class _ObjectsExport DistanceTriggerBeacon : public StaticEntity 40 52 { 41 53 42 54 public: 43 44 DistanceTriggerBeacon(BaseObject* creator); 45 ~DistanceTriggerBeacon() {} 55 DistanceTriggerBeacon(BaseObject* creator); //!< Constructor. 56 virtual ~DistanceTriggerBeacon() {} //!< Destructor. 46 57 47 58 }; -
code/trunk/src/modules/objects/triggers/EventMultiTrigger.cc
r7163 r7301 37 37 #include "core/EventIncludes.h" 38 38 #include "core/XMLPort.h" 39 #include "MultiTriggerContainer.h" 39 40 40 41 namespace orxonox … … 43 44 CreateFactory(EventMultiTrigger); 44 45 46 /** 47 @brief 48 Constructor. Registers the object. 49 */ 45 50 EventMultiTrigger::EventMultiTrigger(BaseObject* creator) : MultiTrigger(creator) 46 51 { 47 52 RegisterObject(EventMultiTrigger); 48 49 this->bEventTriggered_ = false;50 53 } 51 54 55 /** 56 @brief 57 Destructor. 58 */ 52 59 EventMultiTrigger::~EventMultiTrigger() 53 60 { … … 55 62 } 56 63 64 /** 65 @brief 66 Method for creating an EventMultiTrigger object through XML. 67 */ 57 68 void EventMultiTrigger::XMLPort(Element& xmlelement, XMLPort::Mode mode) 58 69 { … … 62 73 } 63 74 75 /** 76 @brief 77 Creates an event port. 78 */ 64 79 void EventMultiTrigger::XMLEventPort(Element& xmlelement, XMLPort::Mode mode) 65 80 { … … 69 84 } 70 85 86 /** 87 @brief 88 Method that causes the EventMultiTrigger to trigger upon receiving an event. 89 @param bTriggered 90 Whether the event is a triggering or an un-triggering event. 91 @param originator 92 A pointer to the entity the event originates from. 93 */ 94 void EventMultiTrigger::trigger(bool bTriggered, BaseObject* originator) 95 { 96 // If the originator is a MultiTriggerContainer, the event originates from a MultiTrigger and thus the event only triggers the EventMultiTrigger for the originator that caused the MultiTrigger to trigger. 97 if(originator != NULL && originator->isA(ClassIdentifier<MultiTriggerContainer>::getIdentifier())) 98 { 99 MultiTriggerContainer* container = static_cast<MultiTriggerContainer*>(originator); 100 // If the entity that triggered the MultiTrigger is no target of this EventMultiTrigger we process it as it weren't an event caused by a MultiTrigger. 101 // But if it is the EventMultiTrigger only triggers for the entity tha caused the MultiTrigger to trigger. 102 if(this->isTarget(container->getData())) 103 { 104 if(this->isTriggered(container->getData()) ^ bTriggered) 105 this->changeTriggered(container->getData()); 106 107 return; 108 } 109 } 110 111 // If we don't know who exactly caused the event we just send a broadcast. 112 if(this->isTriggered() ^ bTriggered) 113 this->changeTriggered(); 114 } 115 71 116 } 72 117 -
code/trunk/src/modules/objects/triggers/EventMultiTrigger.h
r7163 r7301 42 42 { 43 43 44 /** 45 @brief 46 The EventMultiTrigger class is the equivalent of the EventTrigger class for MultiTriggers. 47 Consequentially what it does is it provides a way to have a MultiTrigger triggered by any kinds of events. 48 Events that are not caused by a MultiTrigger or by a MultiTrigger with an originator that is no target of this EventMultiTrigger are broadcasted to all entities that are the target of this EventMultitrigger. Events that are caused by MultiTriggers with an originator that is a target of this EventMultiTrigger just trigger the EventMultiTrigger for the originator that caused the MultiTrigger to trigger. Thus showing the equivalent behavior to the EventTrigger. 49 50 Example: 51 @code 52 <EventMultiTrigger invert="true"> 53 <events> 54 <trigger> 55 <MultiTrigger ... /> 56 <EventListener ... /> 57 </trigger> 58 </events> 59 </EventMultiTrigger> 60 @endcode 61 @see MultiTrigger.h 62 For more information on MultiTriggers. 63 @author 64 Damian 'Mozork' Frick 65 */ 44 66 class _ObjectsExport EventMultiTrigger : public MultiTrigger 45 67 { 46 68 47 69 public: 48 EventMultiTrigger(BaseObject* creator); 49 ~EventMultiTrigger();70 EventMultiTrigger(BaseObject* creator); //!< Constructor. Registers the object. 71 virtual ~EventMultiTrigger(); //!< Destructor. 50 72 51 73 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating an EventMultiTrigger object through XML. 52 74 virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode); 53 75 54 inline void trigger(bool bTriggered)55 { this->bEventTriggered_ = bTriggered; this->changeTriggered(); }76 private: 77 void trigger(bool bTriggered, BaseObject* originator); //!< Method that causes the EventMultiTrigger to trigger upon receiving an event. 56 78 57 private:58 bool bEventTriggered_;59 79 }; 60 80 -
code/trunk/src/modules/objects/triggers/MultiTrigger.cc
r7163 r7301 23 23 * Damian 'Mozork' Frick 24 24 * Co-authors: 25 * Benjamin Knecht25 * ... 26 26 * 27 27 */ … … 67 67 68 68 this->remainingActivations_ = INF_s; 69 this->maxNumSimultan iousTriggerers_ = INF_s;69 this->maxNumSimultaneousTriggerers_ = INF_s; 70 70 71 71 this->bInvertMode_ = false; … … 109 109 XMLPortParam(MultiTrigger, "stayactive", setStayActive, getStayActive, xmlelement, mode); 110 110 XMLPortParam(MultiTrigger, "activations", setActivations, getActivations, xmlelement, mode); 111 XMLPortParam(MultiTrigger, "simultan iousTriggerers", setSimultaniousTriggerers, getSimultaniousTriggerers, xmlelement, mode);111 XMLPortParam(MultiTrigger, "simultaneousTriggerers", setSimultaneousTriggerers, getSimultaneousTriggerers, xmlelement, mode); 112 112 XMLPortParam(MultiTrigger, "invert", setInvert, getInvert, xmlelement, mode); 113 113 XMLPortParamTemplate(MultiTrigger, "mode", setMode, getModeString, xmlelement, mode, const std::string&); … … 115 115 XMLPortParamLoadOnly(MultiTrigger, "target", addTargets, xmlelement, mode).defaultValues("Pawn"); //TODO: Remove load only 116 116 117 //TODO: Maybe nicer with explicit subgroup, e.g. triggers118 117 XMLPortObject(MultiTrigger, MultiTrigger, "", addTrigger, getTrigger, xmlelement, mode); 119 118 … … 131 130 { 132 131 // If this is the first tick. 133 //TODO: Determine need for this, else kick it out.134 132 if(this->bFirstTick_) 135 133 { 136 134 this->bFirstTick_ = false; 137 this->fire(false); 135 // Fire for all objects that are targets. 136 this->broadcast(false); 138 137 } 139 138 … … 154 153 if(state == NULL) 155 154 { 156 COUT(1) << "In MultiTrigger '" << this->getName() << "' (&" << this << "), Error: State of new states queue was NULL. " << std::endl;155 COUT(1) << "In MultiTrigger '" << this->getName() << "' (&" << this << "), Error: State of new states queue was NULL. State ignored." << std::endl; 157 156 queue->pop(); 158 157 continue; … … 162 161 bool bTriggered = (state->bTriggered & this->isModeTriggered(state->originator)) ^ this->bInvertMode_; 163 162 164 // If the 'triggered' state has changed a new state is added to the state queue. 165 //TODO: Do something against flooding, when there is delay. 166 if(this->delay_ != 0.0f || bTriggered ^ this->isTriggered(state->originator)) 163 // If the 'triggered' state has changed or the MultiTrigger has delay and thus we don't know whether this state will actually change the 'triggered' state, a new state is added to the state queue. 164 if(this->delay_ > 0.0f || bTriggered ^ this->isTriggered(state->originator)) 167 165 { 168 166 state->bTriggered = bTriggered; 169 167 this->addState(state); 170 168 } 169 // Else the change is irrelevant. 171 170 else 172 {173 COUT(1) << "BUH" << std::endl;174 171 delete state; 175 }176 172 177 173 queue->pop(); … … 181 177 182 178 // Go through the state queue and activate all pending states whose remaining time has expired. 183 if 179 if(this->stateQueue_.size() > 0) 184 180 { 185 181 MultiTriggerState* state; … … 195 191 if(timeRemaining <= dt) 196 192 { 197 // If the maximum number of objects simultan iously triggering this MultiTrigger is not exceeded.198 if(this->maxNumSimultan iousTriggerers_ == INF_s || this->triggered_.size() < (unsigned int)this->maxNumSimultaniousTriggerers_)193 // If the maximum number of objects simultaneously triggering this MultiTrigger is not exceeded. 194 if(this->maxNumSimultaneousTriggerers_ == INF_s || this->triggered_.size() < (unsigned int)this->maxNumSimultaneousTriggerers_) 199 195 { 200 196 bool bStateChanged = false; 201 // If the 'triggered' state is different f orm what it is now, change it.197 // If the 'triggered' state is different from what it is now, change it. 202 198 if(state->bTriggered ^ this->isTriggered(state->originator)) 203 199 { 204 200 // Add the originator to the objects triggering this MultiTrigger. 205 201 if(state->bTriggered == true) 206 {207 202 this->triggered_.insert(state->originator); 208 }209 203 // Remove the originator from the objects triggering this MultiTrigger. 210 204 else 211 {212 205 this->triggered_.erase(state->originator); 213 }214 206 215 207 bStateChanged = true; … … 218 210 // Get the activity of the new state. 219 211 bool bActive; 220 // If the MultiTrigger is in switch mode .212 // If the MultiTrigger is in switch mode the 'active'-state only changes of the state changed to triggered. 221 213 if(this->bSwitch_ && !state->bTriggered) 222 214 bActive = this->isActive(state->originator); … … 233 225 if(bActive == true) 234 226 { 235 if(this->remainingActivations_ != 0) 227 // If the MultiTrigger has not exceeded its remaining activations. 228 if(this->remainingActivations_ > 0) 236 229 { 237 230 this->active_.insert(state->originator); … … 240 233 } 241 234 else 242 {243 235 bFire = false; 244 }245 236 } 246 237 // Remove the originator from the objects activating this MultiTrigger. 247 238 else 248 239 { 249 if(!this->bStayActive_ || this->remainingActivations_ != 0)250 {240 // If the MultiTrigger doesn't stay active or hasn't' exceeded its remaining activations. 241 if(!this->bStayActive_ || this->remainingActivations_ > 0) 251 242 this->active_.erase(state->originator); 252 }253 243 else 254 {255 244 bFire = false; 256 }257 245 } 258 246 … … 260 248 if(bFire) 261 249 { 250 // If the MultiTrigger is set to broadcast and has no originator a boradcast is fired. 262 251 if(this->bBroadcast_ && state->originator == NULL) 263 {264 252 this->broadcast(bActive); 265 }253 // Else a normal event is fired. 266 254 else 267 255 this->fire(bActive, state->originator); … … 271 259 } 272 260 273 // Print some debug output if the state has changed.274 261 if(bStateChanged) 275 262 { 263 // Print some debug output if the state has changed. 276 264 if(state->originator != NULL) 277 265 COUT(4) << "MultiTrigger '" << this->getName() << "' (&" << this << ") changed state. originator: " << state->originator->getIdentifier()->getName() << " (&" << state->originator << "), active: " << bActive << ", triggered: " << state->bTriggered << "." << std::endl; 278 266 else 279 267 COUT(4) << "MultiTrigger '" << this->getName() << "' (&" << this << ") changed state. originator: NULL, active: " << bActive << ", triggered: " << state->bTriggered << "." << std::endl; 268 269 // If the MultiTrigger has a parent trigger it needs to call a method to notify him, that its activity has changed. 280 270 if(this->parentTrigger_ != NULL) 281 this->parentTrigger_->subTrigg gerActivityChanged(state->originator);271 this->parentTrigger_->subTriggerActivityChanged(state->originator); 282 272 } 283 273 284 // If the MultiTrigger has exceeded its amount of activations and it doesn't stay active, it has to be de stroyed,274 // If the MultiTrigger has exceeded its amount of activations and it doesn't stay active, it has to be deactivated. 285 275 if(this->remainingActivations_ == 0 && !bActive) 286 276 { … … 293 283 this->stateQueue_.pop_front(); 294 284 delete state; 295 size -= 1;296 285 } 297 // If the remaining time has not yet expired. Decrement the remainig time .286 // If the remaining time has not yet expired. Decrement the remainig time and put the state at the end of the queue. 298 287 else 299 288 { … … 308 297 @brief 309 298 Get whether the MultiTrigger is active for a given object. 310 @param triggerer s299 @param triggerer 311 300 A pointer to the object. 312 301 @return … … 335 324 else if (modeName == MultiTrigger::xor_s) 336 325 this->setMode(MultiTriggerMode::EventTriggerXOR); 326 else 327 COUT(2) << "Invalid mode '" << modeName << "' in MultiTrigger " << this->getName() << " &(" << this << "). Leaving mode at '" << this->getModeString() << "'." << std::endl; 337 328 } 338 329 … … 351 342 else if (this->mode_ == MultiTriggerMode::EventTriggerXOR) 352 343 return MultiTrigger::xor_s; 353 else 344 else // This can never happen, but the compiler needs it to feel secure. 354 345 return MultiTrigger::and_s; 355 346 } … … 365 356 Identifier* target = ClassByString(targetStr); 366 357 358 // If the target is not a valid class name display an error. 367 359 if (target == NULL) 368 360 { 369 COUT(1) << "Error: \"" << targetStr << "\" is not a valid class name to include in ClassTreeMask (in " << this->getName() << ", class " << this->getIdentifier()->getName() << ')'<< std::endl;361 COUT(1) << "Error: '" << targetStr << "' is not a valid class name to include in ClassTreeMask (in " << this->getName() << ", class " << this->getIdentifier()->getName() << ")" << std::endl; 370 362 return; 371 363 } … … 373 365 this->targetMask_.include(target); 374 366 375 // A MultiTrigger sshouldn't react to itself or other MultiTriggers.367 // A MultiTrigger shouldn't react to itself or other MultiTriggers. 376 368 this->targetMask_.exclude(Class(MultiTrigger), true); 377 369 378 370 // We only want WorldEntities 371 //TODO: Really? 379 372 ClassTreeMask WEMask; 380 373 WEMask.include(Class(WorldEntity)); 381 374 this->targetMask_ *= WEMask; 382 383 this->notifyMaskUpdate();384 375 } 385 376 … … 393 384 { 394 385 Identifier* target = ClassByString(targetStr); 386 387 // If the target is not a valid class name display an error. 388 if (target == NULL) 389 { 390 COUT(1) << "Error: '" << targetStr << "' is not a valid class name to include in ClassTreeMask (in " << this->getName() << ", class " << this->getIdentifier()->getName() << ")" << std::endl; 391 return; 392 } 393 395 394 this->targetMask_.exclude(target); 396 395 } … … 401 400 Beware: Loops are not prevented and potentially very bad, so just don't create any loops. 402 401 @param trigger 403 The trigger to be added.402 The MultiTrigger to be added. 404 403 */ 405 404 void MultiTrigger::addTrigger(MultiTrigger* trigger) … … 436 435 @brief 437 436 This method is called by the MultiTrigger to get information about new trigger events that need to be looked at. 438 This method is the device for the behavio ur (the conditions under which the MultiTrigger triggers) of any derived class fromMultiTrigger.439 @return 440 A pointer to a queue of MultiTriggerState pointers is returned, containing all the neccessary information to decide whether these states should indeed become new states of the MultiTrigger.441 Please be aware that both the queue and the states in the queue need to be deleted on e they have been used. This is already done in the tick() method of this class but would have to be done by any method calling this method.437 This method is the device for the behavior (the conditions under which the MultiTrigger triggers) of any derived class of MultiTrigger. 438 @return 439 Returns a pointer to a queue of MultiTriggerState pointers, containing all the necessary information to decide whether these states should indeed become new states of the MultiTrigger. 440 Please be aware that both the queue and the states in the queue need to be deleted once they have been used. This is already done in the tick() method of this class but would have to be done by any method calling this method. 442 441 */ 443 442 std::queue<MultiTriggerState*>* MultiTrigger::letTrigger(void) … … 464 463 /** 465 464 @brief 466 This method is called by any sub-trigger to advertise changes in it 's state to it's parent-trigger.465 This method is called by any sub-trigger to advertise changes in its state to its parent-trigger. 467 466 @param originator 468 467 The object that caused the change in activity. 469 468 */ 470 void MultiTrigger::subTrigg gerActivityChanged(BaseObject* originator)469 void MultiTrigger::subTriggerActivityChanged(BaseObject* originator) 471 470 { 472 471 MultiTriggerState* state = new MultiTriggerState; … … 479 478 @brief 480 479 Checks whether the sub-triggers are in such a way that, according to the mode of the MultiTrigger, the MultiTrigger is triggered (only considering the sub-triggers, not the state of MultiTrigger itself), for a given object. 481 To make an example: When the mode is 'and', then this would be true or a given object if all the sub-triggers were triggered ofr the given object.480 To make an example: When the mode is 'and', then this would be true or a given object if all the sub-triggers were triggered for the given object. 482 481 @param triggerer 483 482 The object. … … 487 486 bool MultiTrigger::isModeTriggered(BaseObject* triggerer) 488 487 { 489 if 488 if(this->subTriggers_.size() != 0) 490 489 { 491 490 bool returnVal = false; 492 491 493 switch 492 switch(this->mode_) 494 493 { 495 494 case MultiTriggerMode::EventTriggerAND: … … 502 501 returnVal = checkXor(triggerer); 503 502 break; 504 default: 503 default: // This will never happen. 505 504 returnVal = false; 506 505 break; … … 532 531 @brief 533 532 Helper method. Creates an Event for the given status and originator and fires it. 534 Or more precisely creates a MultiTriggerContainer to encompass all neccesary information andcreates an Event from that and sends it.533 Or more precisely creates a MultiTriggerContainer to encompass all neccesary information, creates an Event from that and sends it. 535 534 @param status 536 535 The status of the Event to be fired. This is equivalent to the activity of the MultiTrigger. … … 562 561 void MultiTrigger::broadcast(bool status) 563 562 { 564 ClassTreeMask& targetMask = this->getTargetMask(); 565 566 for(ClassTreeMaskObjectIterator it = targetMask.begin(); it != targetMask.end(); ++it) 567 { 568 BaseObject* object = static_cast<BaseObject*>(*it); 569 this->fire(status, object); 570 } 563 for(ClassTreeMaskObjectIterator it = this->getTargetMask().begin(); it != this->getTargetMask().end(); ++it) 564 this->fire(status, static_cast<BaseObject*>(*it)); 571 565 } 572 566 … … 576 570 @param state 577 571 The state to be added. 572 @return 573 Returns true if the state has been added, false if not. If the state has not been added this method destroys it. 578 574 */ 579 575 bool MultiTrigger::addState(MultiTriggerState* state) 580 576 { 581 assert(state); 577 assert(state); // The state really shouldn't be NULL. 582 578 583 579 // If the originator is no target of this MultiTrigger. 584 580 if(!this->isTarget(state->originator)) 581 { 582 delete state; 585 583 return false; 586 587 // Add it ot the state queue. 584 } 585 586 // Add it ot the state queue with the delay specified for the MultiTrigger. 588 587 this->stateQueue_.push_back(std::pair<float, MultiTriggerState*>(this->delay_, state)); 589 588 … … 597 596 The object. 598 597 @return 599 Returns true if they do.598 Returns true if all the sub-triggers are active. 600 599 */ 601 600 bool MultiTrigger::checkAnd(BaseObject* triggerer) 602 601 { 603 std::set<MultiTrigger*>::iterator it; 604 for(it = this->subTriggers_.begin(); it != this->subTriggers_.end(); ++it) 605 { 606 if (!(*it)->isActive(triggerer)) 602 for(std::set<MultiTrigger*>::iterator it = this->subTriggers_.begin(); it != this->subTriggers_.end(); ++it) 603 { 604 if(!(*it)->isActive(triggerer)) 607 605 return false; 608 606 } … … 616 614 The object. 617 615 @return 618 Returns true if they do.616 Returns true if at least one sub-trigger is active. 619 617 */ 620 618 bool MultiTrigger::checkOr(BaseObject* triggerer) 621 619 { 622 std::set<MultiTrigger*>::iterator it; 623 for(it = this->subTriggers_.begin(); it != this->subTriggers_.end(); ++it) 624 { 625 if ((*it)->isActive(triggerer)) 620 for(std::set<MultiTrigger*>::iterator it = this->subTriggers_.begin(); it != this->subTriggers_.end(); ++it) 621 { 622 if((*it)->isActive(triggerer)) 626 623 return true; 627 624 } … … 635 632 The object. 636 633 @return 637 Returns true if they do.634 Returns true if exactly one sub-trigger is active. 638 635 */ 639 636 bool MultiTrigger::checkXor(BaseObject* triggerer) 640 637 { 641 std::set<MultiTrigger*>::iterator it;642 638 bool test = false; 643 for( it = this->subTriggers_.begin(); it != this->subTriggers_.end(); ++it)644 { 645 if 639 for(std::set<MultiTrigger*>::iterator it = this->subTriggers_.begin(); it != this->subTriggers_.end(); ++it) 640 { 641 if(test && (*it)->isActive(triggerer)) 646 642 return false; 647 if ((*it)->isActive(triggerer)) 643 644 if((*it)->isActive(triggerer)) 648 645 test = true; 649 646 } -
code/trunk/src/modules/objects/triggers/MultiTrigger.h
r7271 r7301 23 23 * Damian 'Mozork' Frick 24 24 * Co-authors: 25 * Benjamin Knecht25 * ... 26 26 * 27 27 */ … … 70 70 @brief 71 71 The MultiTrigger class implements a trigger that has a distinct state for each object triggering it. 72 In more detail: A Trigger is an object that can either be active or inactive, w hith a specified behaviour how to switch between the two. A MultiTrigger generalizes that behaviour for multiple objects trigggering the trigger. A MultiTrigger can be active or inactive for any object triggering it, with the state for each object being completely independent of the state for other objects. Each time a switch occurs an Event is fired with as the originator a MultiTriggerContainer, containig a pointer to the pointer that caused the Event and a pointer to the object that caused the trigger to change it's activity.73 74 MultiTriggers also allow for additional complexity which can be added t rough the choice of the parameters explained (briefly) below:75 But first you must understand a small implementational detail. There is a distinction between the MultiTrigger being triggered (there is the state 'triggered' for that) and the MultiTrigger being active (for that is the state 'activity'). From the outside only the activity is visible. The state 'triggered' tells us whether the trigger is actually triggered, but it could pretend (for some reason, some of which we will see shortly) to be triggered (or to the outside, active), while it in fact isn't. The standard behavio ur is, that the cativity changes, when the MultiTrigger transits from being triggered to not being triggered or the other way around.72 In more detail: A Trigger is an object that can either be active or inactive, with a specified behavior how to switch between the two. A MultiTrigger generalizes that behavior for multiple objects triggering the trigger. A MultiTrigger can be active or inactive for any object triggering it, with the state for each object being completely independent of the state for other objects. Each time a switch occurs an Event is fired with as the originator a MultiTriggerContainer, containing a pointer to the MultiTrigger that caused the Event and a pointer to the object that caused the trigger to change it's activity. 73 74 MultiTriggers also allow for additional complexity which can be added through the choice of the parameters explained (briefly) below: 75 But first you must understand a small implementational detail. There is a distinction between the MultiTrigger being triggered (there is the state 'triggered' for that) and the MultiTrigger being active (for that is the state 'activity'). From the outside only the activity is visible. The state 'triggered' tells us whether the trigger is actually triggered, but it could pretend (for some reason, some of which we will see shortly) to be triggered (or to the outside, active), while it in fact isn't. The standard behavior is, that the activity changes, when the MultiTrigger transits from being triggered to not being triggered or the other way around. 76 76 The parameters are: 77 77 'delay': The delay is the time that the trigger waits until it reacts (i.e. changes it's state) to the triggering condition being fulfilled. 78 78 'switch': Switch is a bool, if true the MultiTrigger is in switch-mode, meaning, that the activity changes only when the trigger is triggered , this means, that now the activity only changes, when the trigger changes from not being triggered to being triggered but not the other way around. The default is false. 79 'stayactive': Stay active is also a bool, if true the MultiTrigger stays active after it has been activated as many times as specified by the parameter activations. The default is -1, which is infinity.79 'stayactive': Stay active is also a bool, if true the MultiTrigger stays active after it has been activated as many times as specified by the parameter activations. The default is false. 80 80 'activations': The number of activations until the trigger can't be triggered anymore. The default is -1, which is infinity. 81 'invert': Invert is a bool, if true the trigger is in invert-mode, meaning, that if the triggering condition is fulfilled the MultiTrigger will have the state not triggered and and if the condition is not fulfilled it will have the state triggered. In short it just inverts the behavio ur of the MultiTrigger. The default is false.82 'simultan iousTriggerers': The number of simultanious triggerers limits the number of object that are allowed to trigger the MultiTrigger at the same time. Or a little more precisely, the number of distinct objects the MultiTrigger has 'triggered' states for, at each point in time.83 'mode': The mode describes how the MultiTrigger acts in relation to all the MultiTriggers, that are appended to it. There are 3 modes: 'and', meaning that the MultiTrigger can only be triggered if all the appended MultiTriggers are active. 'or', meaning that the MultiTrigger can only triggered if at least one of the appende nd MultiTriggers is active. And 'xor', meaning that the MultiTrigger can only be triggered if one and only one appended MultiTrigger is active. Notice, that I wrote 'can only be active', that implies, that there is an addtitional condition to the activity of the MultiTrigger and that is the fulfillment of the triggering condition (the MultiTrigger itself doesn't have one, but all derived classes should). Also bear in mind, that the activity of a MultiTrigger is still coupled to the object that triggered it. The default is 'and'.84 'broadcast' Broadcast is a bool, if true the MutliTrigger is in broadcast-mode, mea ining, that all trigger events that are caused by no originator (originator is NULL) are broadcast as having come from every possible originator, or more precisely as having come from all objects that are specified targets of this MultiTrigger.81 'invert': Invert is a bool, if true the trigger is in invert-mode, meaning, that if the triggering condition is fulfilled the MultiTrigger will have the state not triggered and and if the condition is not fulfilled it will have the state triggered. In short it just inverts the behavior of the MultiTrigger. The default is false. 82 'simultaneousTriggerers': The number of simultaneous triggerers limits the number of objects that are allowed to trigger the MultiTrigger at the same time. Or more precisely, the number of distinct objects the MultiTrigger has 'triggered' states for, at each point in time. The default is -1, which denotes infinity. 83 'mode': The mode describes how the MultiTrigger acts in relation to all the MultiTriggers, that are appended to it. There are 3 modes: 'and', meaning that the MultiTrigger can only be triggered if all the appended MultiTriggers are active. 'or', meaning that the MultiTrigger can only triggered if at least one of the appended MultiTriggers is active. And 'xor', meaning that the MultiTrigger can only be triggered if one and only one appended MultiTrigger is active. Note, that I wrote 'can only be active', that implies, that there is an additional condition to the activity of the MultiTrigger and that is the fulfillment of the triggering condition (the MultiTrigger itself doesn't have one, but all derived classes should). Also bear in mind, that the activity of a MultiTrigger is still coupled to the object that triggered it. The default is 'and'. 84 'broadcast' Broadcast is a bool, if true the MutliTrigger is in broadcast-mode, meaning, that all trigger events that are caused by no originator (originator is NULL) are broadcast as having come from every possible originator, or more precisely as having come from all objects that are specified targets of this MultiTrigger. The default is false. 85 85 'target': The target describes the kind of objects that are allowed to trigger this MultiTrigger. The default is 'Pawn'. 86 Also there is the possibility of appending MultiTriggers to the MultiTrigger just by adding them as subobjects in the XML description of your MultiTrigger. 86 Also there is the possibility of appending MultiTriggers to the MultiTrigger just by adding them as sub-objects in the XML description of your MultiTrigger. 87 88 An example of a MultiTrigger created through XML would look like this: 89 @code 90 <MultiTrigger position="0,0,0" delay="1.3" switch="true" stayactive="true" activations="7" invert="true" simultaneousTriggerers="2" mode="xor" broadcast="false" target="Pawn"> 91 <MultiTrigger /> 92 ... 93 <MultiTrigger /> 94 </MultiTrigger> 95 @endcode 87 96 88 97 @author 89 98 Damian 'Mozork' Frick 99 Many concepts and loads of inspiration from the Trigger class by Benjamin Knecht. 90 100 */ 91 101 class _ObjectsExport MultiTrigger : public StaticEntity, public Tickable … … 93 103 public: 94 104 MultiTrigger(BaseObject* creator); //!< Constructor. Registers the objects and initializes default values. 95 ~MultiTrigger(); //!< Destructor.105 virtual ~MultiTrigger(); //!< Destructor. 96 106 97 107 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a MultiTrigger object through XML. … … 105 115 */ 106 116 inline void setDelay(float delay) 107 { if(delay > 0 ) this->delay_= delay; }117 { if(delay > 0.0f) this->delay_= delay; } 108 118 /** 109 119 @brief Get the delay of the MultiTrigger. … … 140 150 141 151 /** 142 @brief Set the number of activations the MultiTrigger can go through.143 @param activations The number of activations. -1 denotes infinitely many activations.144 */145 inline void setActivations(int activations)146 { if(activations >= 0 || activations == INF_s) this->remainingActivations_ = activations; }147 /**148 152 @brief Get the number of remaining activations of the MultiTrigger. 149 153 @return The number of activations. -1 denotes infinity. … … 153 157 154 158 /** 155 @brief Set the number of objects that are allowed to simultan iously trigger this MultiTrigger.159 @brief Set the number of objects that are allowed to simultaneously trigger this MultiTrigger. 156 160 @param triggerers The number of objects. -1 denotes infinitely many. 157 161 */ 158 inline void setSimultan iousTriggerers(int triggerers)159 { if(triggerers >= 0 || triggerers == INF_s) this->maxNumSimultan iousTriggerers_ = triggerers; }160 /** 161 @brief Get the number of objects that are allowed to simultan iously trigger this MultiTriggger.162 inline void setSimultaneousTriggerers(int triggerers) 163 { if(triggerers >= 0 || triggerers == INF_s) this->maxNumSimultaneousTriggerers_ = triggerers; } 164 /** 165 @brief Get the number of objects that are allowed to simultaneously trigger this MultiTriggger. 162 166 @return Returns the number of objects. -1 denotes infinity. 163 167 */ 164 inline int getSimultan iousTriggerers(void)165 { return this->maxNumSimultan iousTriggerers_; }168 inline int getSimultaneousTriggerers(void) 169 { return this->maxNumSimultaneousTriggerers_; } 166 170 167 171 /** … … 213 217 inline bool isTarget(BaseObject* target) 214 218 { if(target == NULL) return true; else return targetMask_.isIncluded(target->getIdentifier()); } 219 220 void addTrigger(MultiTrigger* trigger); //!< Adds a MultiTrigger as a sub-trigger to the trigger. 221 const MultiTrigger* getTrigger(unsigned int index) const; //!< Get the sub-trigger of this MultiTrigger at the given index. 222 223 protected: 224 virtual std::queue<MultiTriggerState*>* letTrigger(void); //!< This method is called by the MultiTrigger to get information about new trigger events that need to be looked at. 225 226 void changeTriggered(BaseObject* originator = NULL); //!< This method can be called by any class inheriting from MultiTrigger to change it's triggered status for a specified originator. 227 228 bool isModeTriggered(BaseObject* triggerer = NULL); //!< Checks whetherx the MultiTrigger is triggered concerning it's sub-triggers. 229 bool isTriggered(BaseObject* triggerer = NULL); //!< Get whether the MultiTrigger is triggered for a given object. 230 231 void fire(bool status, BaseObject* originator = NULL); //!< Helper method. Creates an Event for the given status and originator and fires it. 232 void broadcast(bool status); //!< Helper method. Broadcasts an Event for every object that is a target. 233 234 /** 235 @brief Set the number of activations the MultiTrigger can go through. 236 @param activations The number of activations. -1 denotes infinitely many activations. 237 */ 238 inline void setActivations(int activations) 239 { if(activations >= 0 || activations == INF_s) this->remainingActivations_ = activations; } 240 215 241 void addTargets(const std::string& targets); //!< Add some target to the MultiTrigger. 216 242 void removeTargets(const std::string& targets); //!< Remove some target from the MultiTrigger. 217 243 218 void addTrigger(MultiTrigger* trigger); //!< Adds a MultiTrigger as a sub-trigger to the trigger.219 const MultiTrigger* getTrigger(unsigned int index) const; //!< Get the sub-trigger of this MultiTrigger at the given index.220 221 protected:222 virtual std::queue<MultiTriggerState*>* letTrigger(void); //!< This method is called by the MultiTrigger to get information about new trigger events that need to be looked at.223 224 void changeTriggered(BaseObject* originator = NULL); //!< This method can be called by any class inheriting from MultiTrigger to change it's triggered status for a specified originator.225 226 bool isModeTriggered(BaseObject* triggerer = NULL); //!< Checks whetherx the MultiTrigger is triggered concerning it's sub-triggers.227 bool isTriggered(BaseObject* triggerer = NULL); //!< Get whether the MultiTrigger is triggered for a given object.228 229 void fire(bool status, BaseObject* originator = NULL); //!< Helper method. Creates an Event for the given status and originator and fires it.230 void broadcast(bool status); //!< Helper method. Broadcasts an Event for every object that is a target.231 232 244 /** 233 245 @brief Adds the parent of a MultiTrigger. … … 243 255 inline ClassTreeMask& getTargetMask(void) 244 256 { return this->targetMask_; } 245 /**246 @brief Is called, when the target mask changes.247 */248 //TODO: Check if something mus be done here.249 virtual void notifyMaskUpdate(void) {}250 257 251 258 private: … … 256 263 static const std::string xor_s; 257 264 258 void subTrigg gerActivityChanged(BaseObject* originator); //!< This method is called by any sub-trigger to advertise changes in it's state to it's parent-trigger.265 void subTriggerActivityChanged(BaseObject* originator); //!< This method is called by any sub-trigger to advertise changes in it's state to it's parent-trigger. 259 266 260 267 bool addState(MultiTriggerState* state); //!< Helper method. Adds a state to the state queue, where the state will wait to become active. … … 278 285 279 286 int remainingActivations_; //!< The remaining activations of this MultiTrigger. 280 int maxNumSimultan iousTriggerers_; //!< The maximum number of objects simultaniously trigggering this MultiTrigger.287 int maxNumSimultaneousTriggerers_; //!< The maximum number of objects simultaneously trigggering this MultiTrigger. 281 288 282 289 bool bInvertMode_; //!< Bool for the invert-mode, if true the MultiTrigger is inverted. … … 285 292 bool bBroadcast_; //!< Bool for the broadcast-mode, if true all triggers go to all possible targets. 286 293 287 MultiTrigger* parentTrigger_; 294 MultiTrigger* parentTrigger_; //!< The parent-trigger of theis MultiTrigger. 288 295 std::set<MultiTrigger*> subTriggers_; //!< The sub-triggers of this MultiTrigger. 289 296 -
code/trunk/src/modules/objects/triggers/MultiTriggerContainer.cc
r7163 r7301 21 21 * 22 22 * Author: 23 * ...23 * Damian 'Mozork' Frick 24 24 * Co-authors: 25 25 * ... … … 58 58 The creator. 59 59 @param originator 60 A pointer to the originator of the Event, i.e. the MultiTrigger that fired the Event. (or is about to )60 A pointer to the originator of the Event, i.e. the MultiTrigger that fired the Event. (or is about to fire) 61 61 @param data 62 62 A pointer to the data that should be sent with the container. -
code/trunk/src/modules/objects/triggers/MultiTriggerContainer.h
r7163 r7301 54 54 MultiTriggerContainer(BaseObject* creator); //!< Default constructor. Registers the object and creates an empty container. 55 55 MultiTriggerContainer(BaseObject* creator, MultiTrigger* originator, BaseObject* data); //!< Constructor. Registers the object and sets the input values. 56 ~MultiTriggerContainer(); //!< Destructor.56 virtual ~MultiTriggerContainer(); //!< Destructor. 57 57 58 58 /**
Note: See TracChangeset
for help on using the changeset viewer.