Orxonox  0.0.5 Codename: Arcturus
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
orxonox::MultiTrigger Class Reference

The MultiTrigger class implements a trigger that has a distinct state for each object triggering it. More...

#include </home/jenkins/workspace/orxonox_doxygen_trunk/src/modules/objects/triggers/MultiTrigger.h>

Inheritance diagram for orxonox::MultiTrigger:
orxonox::TriggerBase orxonox::StaticEntity orxonox::Tickable orxonox::WorldEntity orxonox::OrxonoxInterface orxonox::BaseObject orxonox::Synchronisable orxonox::Configurable orxonox::Destroyable orxonox::OrxonoxClass orxonox::OrxonoxInterface orxonox::Listable orxonox::Configurable orxonox::Destroyable orxonox::Configurable orxonox::Destroyable orxonox::Identifiable orxonox::Listable orxonox::Listable orxonox::Identifiable orxonox::Identifiable orxonox::DistanceMultiTrigger orxonox::EventMultiTrigger orxonox::RaceCheckPoint

Public Member Functions

 MultiTrigger (Context *context)
 Constructor. Registers the objects and initializes default values. More...
 
virtual ~MultiTrigger ()
 Destructor. More...
 
void addTarget (const std::string &targets)
 Add some target to the MultiTrigger. More...
 
bool getBroadcast (void)
 Get the broadcast-mode of the MultiTrigger. More...
 
int getSimultaneousTriggerers (void)
 Get the number of objects that are allowed to simultaneously trigger this MultiTriggger. More...
 
bool isActive (void) const
 Check whether the MultiTrigger is active. More...
 
bool isActive (BaseObject *triggerer=nullptr) const
 Check whether the MultiTrigger is active for a given object. More...
 
bool isTarget (BaseObject *target)
 Get whether the input object is a target of the MultiTrigger. More...
 
void setBroadcast (bool bBroadcast)
 Set the broadcast-mode of the MultiTrigger. More...
 
void setSimultaneousTriggerers (int triggerers)
 Set the number of objects that are allowed to simultaneously trigger this MultiTrigger. More...
 
virtual void tick (float dt)
 A method that is executed each tick. More...
 
virtual void XMLPort (Element &xmlelement, XMLPort::Mode mode)
 Method for creating a MultiTrigger object through XML. More...
 
- Public Member Functions inherited from orxonox::TriggerBase
 TriggerBase (Context *context)
 Constructor. More...
 
virtual ~TriggerBase ()
 Destructor. More...
 
void addTrigger (TriggerBase *trigger)
 Adds a trigger as a child to the trigger. More...
 
virtual void delayChanged (void)
 
int getActivations (void) const
 Get the number of remaining activations of the trigger. More...
 
float getDelay (void) const
 Get the delay of the trigger. More...
 
bool getInvert (void) const
 Get the invert-mode of the trigger. More...
 
TriggerMode getMode (void) const
 Get the mode of the trigger. More...
 
const std::string & getModeString (void) const
 Get the mode of the MultiTrigger. More...
 
bool getStayActive (void) const
 Get the stay-active-mode of the trigger. More...
 
bool getSwitch (void) const
 Get the switch-mode of the trigger. More...
 
const TriggerBasegetTrigger (unsigned int index) const
 Get the child of this trigger at the given index. More...
 
bool hasRemainingActivations (void) const
 Check whether the trigger has still at least one remaining activation. More...
 
bool isMultiTrigger (void)
 Check whether this trigger is a MultiTrigger. More...
 
void setDelay (float delay)
 Set the delay of the trigger. More...
 
void setInvert (bool bInvert)
 Set the invert-mode of triggerhe trigger. More...
 
void setMode (const std::string &modeName)
 Set the mode of the trigger. More...
 
void setMode (TriggerMode mode)
 Set the mode of the trigger. More...
 
void setStayActive (bool bStayActive)
 Set the stay-active-mode of the trigger. More...
 
void setSwitch (bool bSwitch)
 Set switch-mode of the trigger. More...
 
- Public Member Functions inherited from orxonox::StaticEntity
 StaticEntity (Context *context)
 
virtual ~StaticEntity ()
 
virtual void setOrientation (const Quaternion &orientation) override
 
virtual void setPosition (const Vector3 &position) override
 
- Public Member Functions inherited from orxonox::WorldEntity
 WorldEntity (Context *context)
 Creates a new WorldEntity that may immediately be used. More...
 
virtual ~WorldEntity ()
 Destroys the WorldEntity AND ALL its children with it. More...
 
void activatePhysics ()
 Activates physics if the CollisionType is not None. More...
 
bool addedToPhysicalWorld () const
 Tells whether the object has already been added to the Bullet physics World. More...
 
void attach (WorldEntity *object)
 Attaches a child WorldEntity to this object. More...
 
void attachCollisionShape (CollisionShape *shape)
 Attaches a collision Shape to this object (delegated to the internal CompoundCollisionShape) More...
 
void attachNode (Ogre::SceneNode *node)
 Attaches an Ogre::SceneNode to this WorldEntity. More...
 
void attachOgreObject (Ogre::MovableObject *object)
 Attaches an Ogre::MovableObject to this WorldEntity. More...
 
void attachOgreObject (Ogre::BillboardSet *object)
 
void attachOgreObject (Ogre::Camera *object)
 
void attachOgreObject (Ogre::Entity *object)
 
void attachOgreObject (Ogre::ParticleSystem *object)
 
void attachToNode (Ogre::SceneNode *node)
 Attaches this object to a parent SceneNode. More...
 
void attachToParent (WorldEntity *parent)
 
 BT_DECLARE_ALIGNED_ALLOCATOR ()
 
virtual void changedActivity (void) override
 When the activity is changed, it is changed for all attached objects as well. More...
 
virtual void changedScale ()
 
virtual void changedVisibility (void) override
 When the visibility is changed, it is changed for all attached objects as well. More...
 
virtual bool collidesAgainst (WorldEntity *otherObject, const btCollisionShape *ownCollisionShape, btManifoldPoint &contactPoint)
 Virtual function that gets called when this object collides with another. More...
 
void deactivatePhysics ()
 Deactivates physics but the CollisionType does not change. More...
 
void detach (WorldEntity *object)
 Detaches a child WorldEntity from this instance. More...
 
void detachCollisionShape (CollisionShape *shape)
 Detaches a collision Shape from this object (delegated to the internal CompoundCollisionShape) More...
 
void detachFromNode (Ogre::SceneNode *node)
 Detaches this object from a parent SceneNode. More...
 
void detachFromParent ()
 
void detachNode (Ogre::SceneNode *node)
 Detaches an Ogre::SceneNode from this WorldEntity. More...
 
void detachOgreObject (Ogre::MovableObject *object)
 Detaches an Ogre::MovableObject from this WorldEntity. More...
 
void detachOgreObject (Ogre::BillboardSet *object)
 
void detachOgreObject (Ogre::Camera *object)
 
void detachOgreObject (Ogre::Entity *object)
 
void detachOgreObject (Ogre::ParticleSystem *object)
 
Ogre::MovableObject * detachOgreObject (const Ogre::String &name)
 Detaches an Ogre::MovableObject (by string) from this WorldEntity. More...
 
void disableCollisionCallback ()
 Disables the collidesAgainst(.) function. More...
 
void enableCollisionCallback ()
 Enables the collidesAgainst(.) function. The object doesn't respond to collision otherwise! More...
 
float getAngularDamping () const
 Returns the angular damping. More...
 
float getAngularFactor () const
 Returns the angular factor. More...
 
CollisionShapegetAttachedCollisionShape (unsigned int index)
 Returns an attached collision Shape of this object (delegated to the internal CompoundCollisionShape) More...
 
WorldEntitygetAttachedObject (unsigned int index)
 Returns an attached object (merely for XMLPort). More...
 
const std::set< WorldEntity * > & getAttachedObjects () const
 
float getCcdMotionThreshold () const
 Returns the currently used motion threshold for CCD (0 means CCD is deactivated). More...
 
float getCcdSweptSphereRadius () const
 Returns the currently used radius of the sphere for CCD. More...
 
CollisionType getCollisionType () const
 Returns the CollisionType. More...
 
std::string getCollisionTypeStr () const
 Gets the CollisionType by string (used for the XMLPort) More...
 
bool getDeleteWithParent () const
 
float getFriction () const
 Returns the amount of friction applied to the object. More...
 
std::string getID (void)
 
float getLinearDamping () const
 Returns the linear damping. More...
 
const btVector3 & getLocalInertia () const
 Returns the diagonal elements of the inertia tensor when calculated in local coordinates. More...
 
float getMass () const
 Returns the mass of this object without its children. More...
 
const Ogre::SceneNode * getNode () const
 
const Quaternion & getOrientation () const
 
WorldEntitygetParent () const
 
const Vector3 & getPosition () const
 
float getRestitution () const
 Returns the restitution parameter. More...
 
float getScale () const
 
const Vector3 & getScale3D () const
 
float getTotalMass () const
 Returns the total mass of this object with all its attached children. More...
 
virtual const Vector3 & getVelocity () const
 
const Quaternion & getWorldOrientation () const
 Returns the orientation relative to the root space. More...
 
const Vector3 & getWorldPosition () const
 Returns the position relative to the root space. More...
 
float getWorldScale () const
 Returns the scaling applied relative to the root space in 3 coordinates. More...
 
const Vector3 & getWorldScale3D () const
 Returns the scaling applied relative to the root space in 3 coordinates. More...
 
bool hasCollisionResponse ()
 Tells whether there could be a collision response. More...
 
bool hasPhysics () const
 Tells whether the object has any connection to the Bullet physics engine. If hasPhysics() is false, the object may still have a velocity. More...
 
bool isCollisionCallbackActive () const
 Tells whether there could be a collision callback via collidesAgainst(.) More...
 
bool isDynamic () const
 
bool isKinematic () const
 
bool isPhysicsActive () const
 Tells whether physics has been activated (you can temporarily deactivate it) More...
 
bool isStatic () const
 
void lookAt (const Vector3 &target, TransformSpace relativeTo=TransformSpace::Parent, const Vector3 &localDirectionVector=Vector3::NEGATIVE_UNIT_Z)
 Makes this WorldEntity look at a specific target location. More...
 
void notifyChildMassChanged ()
 Recalculates the accumulated child mass and calls recalculateMassProps() and notifies the parent of the change. More...
 
void notifyChildPropsChanged ()
 
void notifyCollisionShapeChanged ()
 Undertakes the necessary steps to change the collision shape in Bullet, even at runtime. More...
 
void pitch (const Degree &angle, TransformSpace relativeTo=TransformSpace::Local)
 
void roll (const Degree &angle, TransformSpace relativeTo=TransformSpace::Local)
 
void rotate (const Quaternion &rotation, TransformSpace relativeTo=TransformSpace::Local)
 Rotates this WorldEntity by a quaternion. More...
 
void rotate (const Vector3 &axis, const Degree &angle, TransformSpace relativeTo=TransformSpace::Local)
 
void scale (float scale)
 
void scale3D (const Vector3 &scale)
 
void scale3D (float x, float y, float z)
 
void setAngularDamping (float angularDamping)
 Applies a tensor independent rotation damping. Angular velocities will simply diminish exponentially. More...
 
void setAngularFactor (float angularFactor)
 Sets an artificial parameter that tells how much torque is applied when you apply a non-central force. More...
 
void setCcdMotionThreshold (float ccdMotionThreshold)
 Sets the motion threshold for continuous collision detection (CCD). More...
 
void setCcdSweptSphereRadius (float ccdSweptSphereRadius)
 Sets the radius of the sphere which is used for continuous collision detection (CCD). More...
 
void setCollisionResponse (bool value)
 Enables or disables collision response (default is of course on) More...
 
void setCollisionType (CollisionType type)
 Sets the CollisionType. More...
 
void setCollisionTypeStr (const std::string &type)
 Sets the CollisionType by string (used for the XMLPort) More...
 
void setDeleteWithParent (bool value)
 
void setDirection (const Vector3 &direction, TransformSpace relativeTo=TransformSpace::Local, const Vector3 &localDirectionVector=Vector3::NEGATIVE_UNIT_Z)
 Makes this WorldEntity look in specific direction. More...
 
void setDirection (float x, float y, float z, TransformSpace relativeTo=TransformSpace::Local, const Vector3 &localDirectionVector=Vector3::NEGATIVE_UNIT_Z)
 
void setFriction (float friction)
 Applies friction to the object. Friction occurs when two objects collide. More...
 
void setID (std::string id)
 
void setLinearDamping (float linearDamping)
 Applies a mass independent damping. Velocities will simply diminish exponentially. More...
 
void setMass (float mass)
 Sets the mass of this object. Note that the total mass may be influenced by attached objects! More...
 
void setOrientation (float w, float x, float y, float z)
 
void setOrientation (const Vector3 &axis, const Radian &angle)
 
void setOrientation (const Vector3 &axis, const Degree &angle)
 
void setPosition (float x, float y, float z)
 
void setRestitution (float restitution)
 Sets how much reaction is applied in a collision. More...
 
void setScale (float scale)
 
virtual void setScale3D (const Vector3 &scale)
 Sets the three dimensional scaling of this object. More...
 
void setScale3D (float x, float y, float z)
 
void translate (const Vector3 &distance, TransformSpace relativeTo=TransformSpace::Parent)
 Translates this WorldEntity by a vector. More...
 
void translate (float x, float y, float z, TransformSpace relativeTo=TransformSpace::Parent)
 
void yaw (const Degree &angle, TransformSpace relativeTo=TransformSpace::Local)
 
- Public Member Functions inherited from orxonox::BaseObject
 BaseObject (Context *context)
 Constructor: Registers the object in the BaseObject-list. More...
 
virtual ~BaseObject ()
 Destructor. More...
 
void addEventListener (BaseObject *listener)
 Adds an object which listens to the events of this object. More...
 
void addEventSource (BaseObject *source, const std::string &state)
 Adds a new event source for a specific state. More...
 
void addTemplate (const std::string &name)
 Adds a Template to the object. More...
 
void addTemplate (Template *temp)
 Adds a Template to the object. More...
 
virtual void changedMainStateName ()
 This function gets called if the main state name of the object changes. More...
 
virtual void changedName ()
 This function gets called if the name of the object changes. More...
 
void fireEvent (const std::string &name="")
 Fires an event (without a state). More...
 
void fireEvent (bool activate, const std::string &name="")
 Fires an event which activates or deactivates a state. More...
 
void fireEvent (bool activate, BaseObject *originator, const std::string &name="")
 Fires an event which activates or deactivates a state with agiven originator (the object which triggered the event). More...
 
void fireEvent (Event &event)
 Fires an event, using the Event struct. More...
 
BaseObjectgetCreator () const
 
BaseObjectgetEventListener (unsigned int index) const
 Returns an event listener with a given index. More...
 
BaseObjectgetEventSource (unsigned int index, const std::string &state) const
 Returns an eventsource with a given index. More...
 
const XMLFilegetFile () const
 Returns a pointer to the XMLFile that loaded this object. More...
 
const std::string & getFilename () const
 Returns the levelfile that loaded this object. More...
 
GametypegetGametype () const
 
LevelgetLevel () const
 
const std::string & getLoaderIndentation () const
 Returns the indentation of the debug output in the Loader. More...
 
const std::string & getMainStateName () const
 Returns the name of the main state. More...
 
const std::string & getName () const
 Returns the name of the object. More...
 
NamespacegetNamespace () const
 
const std::string & getOldName () const
 Returns the old name of the object. More...
 
ScenegetScene () const
 
virtual uint32_t getSceneID () const
 
const std::set< Template * > & getTemplates () const
 Returns the set of all aplied templates. More...
 
const mboolisActive () const
 Returns the state of the objects activity. More...
 
bool isInitialized () const
 Returns if the object was initialized (passed the object registration). More...
 
const mboolisVisible () const
 Returns the state of the objects visibility. More...
 
virtual void processEvent (Event &event)
 Processing an event by calling the right main state. More...
 
void removeEventSource (BaseObject *source)
 Removes an eventsource (but doesn't unregister itself at the source). More...
 
void setActive (bool bActive)
 Sets the state of the objects activity. More...
 
void setCreator (BaseObject *creator)
 
void setFile (const XMLFile *file)
 Sets a pointer to the xml file that loaded this object. More...
 
void setGametype (const StrongOrWeakPtr< Gametype > &gametype)
 
void setLevel (const StrongOrWeakPtr< Level > &level)
 
void setLoaderIndentation (const std::string &indentation)
 Sets the indentation of the debug output in the Loader. More...
 
void setMainState (bool state)
 Sets the main state of the object to a given boolean value. More...
 
void setMainStateName (const std::string &name)
 Sets the name of the main state (used for event reactions). More...
 
void setName (const std::string &name)
 Sets the name of the object. More...
 
void setNamespace (const StrongOrWeakPtr< Namespace > &ns)
 
void setScene (const StrongOrWeakPtr< Scene > &scene, uint32_t sceneID)
 
void setVisible (bool bVisible)
 Sets the state of the objects visibility. More...
 
virtual void XMLEventPort (Element &xmlelement, XMLPort::Mode mode)
 Defines the possible event states of this object and parses eventsources from an XML file. More...
 
- Public Member Functions inherited from orxonox::OrxonoxClass
 OrxonoxClass ()
 
OrxonoxClassoperator= (const OrxonoxClass &)=default
 
- Public Member Functions inherited from orxonox::Configurable
 Configurable ()
 
void setConfigValues ()
 Function to collect the SetConfigValue-macro calls. More...
 
- Public Member Functions inherited from orxonox::Listable
 Listable ()
 Constructor: Allocates space in the element list. More...
 
 Listable (Context *context)
 Constructor: Allocates space in the element list and assigns the context. More...
 
virtual ~Listable ()
 Destructor: Removes the object from the object-lists. More...
 
ContextgetContext () const
 
void setContext (Context *context)
 Changes the context. More...
 
void unregisterObject ()
 Removes this object from the object-lists. More...
 
- Public Member Functions inherited from orxonox::Identifiable
 Identifiable ()
 Constructor: Sets the default values. More...
 
virtual ~Identifiable ()
 
ORX_FORCEINLINE voidgetDerivedPointer (unsigned int classID)
 Returns a valid pointer of any derived type that is registered in the class hierarchy. More...
 
template<class T >
ORX_FORCEINLINE T * getDerivedPointer (unsigned int classID)
 Version of getDerivedPointer with template. More...
 
template<class T >
ORX_FORCEINLINE const T * getDerivedPointer (unsigned int classID) const
 Const version of getDerivedPointer with template. More...
 
IdentifiergetIdentifier () const
 Returns the Identifier of the object. More...
 
bool isA (const Identifier *identifier)
 Returns true if the object's class is of the given type or a derivative. More...
 
template<class B >
bool isA (const SubclassIdentifier< B > *identifier)
 Returns true if the object's class is of the given type or a derivative. More...
 
bool isA (const Identifiable *object)
 Returns true if the object's class is of the given type or a derivative. More...
 
bool isChildOf (const Identifier *identifier)
 Returns true if the object's class is a child of the given type. More...
 
template<class B >
bool isChildOf (const SubclassIdentifier< B > *identifier)
 Returns true if the object's class is a child of the given type. More...
 
bool isChildOf (const Identifiable *object)
 Returns true if the object's class is a child of the given type. More...
 
bool isDirectChildOf (const Identifier *identifier)
 Returns true if the object's class is a direct child of the given type. More...
 
template<class B >
bool isDirectChildOf (const SubclassIdentifier< B > *identifier)
 Returns true if the object's class is a direct child of the given type. More...
 
bool isDirectChildOf (const Identifiable *object)
 Returns true if the object's class is a direct child of the given type. More...
 
bool isDirectParentOf (const Identifier *identifier)
 Returns true if the object's class is a direct parent of the given type. More...
 
template<class B >
bool isDirectParentOf (const SubclassIdentifier< B > *identifier)
 Returns true if the object's class is a direct parent of the given type. More...
 
bool isDirectParentOf (const Identifiable *object)
 Returns true if the object's class is a direct child of the given type. More...
 
bool isExactlyA (const Identifier *identifier)
 Returns true if the object's class is exactly of the given type. More...
 
template<class B >
bool isExactlyA (const SubclassIdentifier< B > *identifier)
 Returns true if the object's class is exactly of the given type. More...
 
bool isExactlyA (const Identifiable *object)
 Returns true if the object's class is exactly of the given type. More...
 
bool isParentOf (const Identifier *identifier)
 Returns true if the object's class is a parent of the given type. More...
 
template<class B >
bool isParentOf (const SubclassIdentifier< B > *identifier)
 Returns true if the object's class is a parent of the given type. More...
 
bool isParentOf (const Identifiable *object)
 Returns true if the object's class is a parent of the given type. More...
 
- Public Member Functions inherited from orxonox::Destroyable
 Destroyable ()
 Constructor: Sets the default values. More...
 
virtual ~Destroyable ()
 Destructor: Notifies all DestructionListener (for example weak pointers) that this object is being deleted. More...
 
void destroy ()
 Deletes the object if no strong pointers point to this object. More...
 
void destroyLater ()
 Works like destroy() but doesn't destroy the object until the current tick has ended. More...
 
unsigned int getReferenceCount () const
 Returns the number of strong pointers that point to this object. More...
 
- Public Member Functions inherited from orxonox::Synchronisable
virtual ~Synchronisable ()
 Destructor: Delete all callback objects and remove objectID_ from the objectMap_. More...
 
uint32_t getClassID () const
 
unsigned int getContextID () const
 
uint32_t getNrOfVariables ()
 
uint32_t getObjectID () const
 
unsigned int getPriority () const
 
uint8_t getSyncMode () const
 
uint32_t getVarSize (VariableID ID)
 
template<>
_NetworkExport void registerVariable (std::string &variable, uint8_t mode, NetworkCallbackBase *cb, bool bidirectional)
 
template<>
void registerVariable (std::string &variable, uint8_t mode, NetworkCallbackBase *cb, bool bidirectional)
 
void setSyncMode (uint8_t mode)
 This function sets the synchronisation mode of the object If set to 0x0 variables will not be synchronised at all If set to 0x1 variables will only be synchronised to the client If set to 0x2 variables will only be synchronised to the server If set to 0x3 variables will be synchronised bidirectionally (only if set so in registerVar) More...
 
template<>
_NetworkExport void unregisterVariable (std::string &variable)
 
template<>
void unregisterVariable (std::string &variable)
 
- Public Member Functions inherited from orxonox::OrxonoxInterface
 OrxonoxInterface ()
 

Protected Member Functions

void broadcast (bool status)
 Helper method. Broadcasts an Event for every object that is a target. More...
 
void changeTriggered (BaseObject *originator=nullptr)
 This method can be called by any class inheriting from MultiTrigger to change it's triggered status for a specified originator. More...
 
virtual void fire (bool status, BaseObject *originator=nullptr)
 Helper method. Creates an Event for the given status and originator and fires it. More...
 
ClassTreeMaskgetTargetMask (void)
 Get the target mask used to identify the targets of this MultiTrigger. More...
 
bool isModeTriggered (BaseObject *triggerer=nullptr)
 Checks whether the MultiTrigger is triggered concerning it's children. More...
 
bool isTriggered (BaseObject *triggerer=nullptr)
 Get whether the MultiTrigger is triggered for a given object. More...
 
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. More...
 
void removeTarget (const std::string &target)
 Remove some target from the MultiTrigger. More...
 
- Protected Member Functions inherited from orxonox::TriggerBase
void addParentTrigger (TriggerBase *parent)
 Adds the parent of a MultiTrigger. More...
 
bool hasRemainingActivations (void)
 
void setActivations (int activations)
 Set the number of activations the trigger can go through. More...
 
- Protected Member Functions inherited from orxonox::WorldEntity
virtual void parentChanged ()
 
- Protected Member Functions inherited from orxonox::BaseObject
void addEventState (const std::string &name, EventState *container)
 Adds a new event-state to the object. More...
 
EventStategetEventState (const std::string &name) const
 Returns the event-state with the given name. More...
 
- Protected Member Functions inherited from orxonox::Destroyable
virtual void preDestroy ()
 This virtual function is called if destroy() is called and no StrongPtr points to this object. More...
 
- Protected Member Functions inherited from orxonox::Synchronisable
 Synchronisable (Context *context)
 Constructor: Initializes all Variables and sets the right objectID_. More...
 
uint32_t findContextID (Context *context)
 Returns the id of the context. More...
 
template<class T >
void registerVariable (T &variable, uint8_t mode=0x1, NetworkCallbackBase *cb=nullptr, bool bidirectional=false)
 
template<class T >
void registerVariable (std::set< T > &variable, uint8_t mode=0x1, NetworkCallbackBase *cb=nullptr, bool bidirectional=false)
 
void setPriority (unsigned int freq)
 
template<class T >
void unregisterVariable (T &var)
 
- Protected Member Functions inherited from orxonox::Tickable
 Tickable ()
 Constructor: Registers the object in the Tickable-list. More...
 

Private Member Functions

bool addState (MultiTriggerState *state)
 Helper method. Adds a state to the state queue, where the state will wait to become active. More...
 
bool checkAnd (BaseObject *triggerer)
 Checks whether the children amount to true for the and mode for a given object. More...
 
bool checkOr (BaseObject *triggerer)
 Checks whether the children amount to true for the or mode for a given object. More...
 
bool checkXor (BaseObject *triggerer)
 Checks whether the children amount to true for the xor mode for a given object. More...
 
void childActivityChanged (BaseObject *originator)
 This method is called by any child to advertise changes in it's state to it's parent. More...
 
std::set< BaseObject * > & getActive (void)
 Get the objects for which this MultiTrigger is active. More...
 

Private Attributes

std::set< BaseObject * > active_
 The set of all objects the MultiTrigger is active for. More...
 
bool bBroadcast_
 Bool for the broadcast-mode, if true all triggers go to all possible targets. More...
 
int maxNumSimultaneousTriggerers_
 The maximum number of objects simultaneously trigggering this MultiTrigger. More...
 
std::deque< std::pair< float, MultiTriggerState * > > stateQueue_
 The queue of states waiting to become active. More...
 
ClassTreeMask targetMask_
 The target mask, masking all objects that can trigger this MultiTrigger. More...
 
std::set< BaseObject * > triggered_
 The set of all objects the MultiTrigger is triggered for. More...
 

Additional Inherited Members

- Public Types inherited from orxonox::WorldEntity
enum  CollisionType { CollisionType::Dynamic, CollisionType::Kinematic, CollisionType::Static, CollisionType::None }
 Denotes the possible types of physical objects in a Scene. More...
 
enum  TransformSpace { TransformSpace::Local, TransformSpace::Parent, TransformSpace::World }
 Enumeration denoting the spaces which a transform can be relative to. More...
 
- Static Public Member Functions inherited from orxonox::BaseObject
static void loadAllEventStates (Element &xmlelement, XMLPort::Mode mode, BaseObject *object, Identifier *identifier)
 Manually loads all event states, even if the class doesn't officially support them. More...
 
- Static Public Member Functions inherited from orxonox::Synchronisable
static bool deleteObject (uint32_t objectID_)
 Finds and deletes the Synchronisable with the appropriate objectID_. More...
 
static Synchronisablefabricate (uint8_t *&mem, uint8_t mode=0x0)
 This function fabricated a new synchrnisable (and children of it), sets calls updateData and create After calling this function the mem pointer will be increased by the size of the needed data. More...
 
static unsigned int getNumberOfDeletedObject ()
 
static SynchronisablegetSynchronisable (uint32_t objectID_)
 This function looks up the objectID_ in the objectMap_ and returns a pointer to the right Synchronisable. More...
 
static uint32_t popDeletedObject ()
 
static void setClient (bool b)
 This function sets the internal mode for synchronisation. More...
 
- Static Public Attributes inherited from orxonox::WorldEntity
static const Vector3 BACK = Vector3::UNIT_Z
 
static const Vector3 DOWN = Vector3::NEGATIVE_UNIT_Y
 
static const Vector3 FRONT = Vector3::NEGATIVE_UNIT_Z
 
static const Vector3 LEFT = Vector3::NEGATIVE_UNIT_X
 
static const Vector3 RIGHT = Vector3::UNIT_X
 
static const Vector3 UP = Vector3::UNIT_Y
 
- Protected Attributes inherited from orxonox::TriggerBase
bool bFirstTick_
 Bool to check whether this is the first tick. More...
 
bool bInvertMode_
 Bool for the invert-mode, if true the trigger is inverted. More...
 
bool bMultiTrigger_
 Specifies whether this trigger is a MultiTrigger. More...
 
bool bStayActive_
 Bool for the stay-active-mode, if true the trigger stays active after its last activation.;. More...
 
bool bSwitch_
 Bool for the switch-mode, if true the trigger behaves like a switch. More...
 
std::set< TriggerBase * > children_
 The children of this trigger. More...
 
float delay_
 The delay that is imposed on all new trigger events. More...
 
TriggerMode mode_
 The mode of the trigger. More...
 
TriggerBaseparent_
 The parent of this trigger. More...
 
int remainingActivations_
 The remaining activations of this trigger. More...
 
- Protected Attributes inherited from orxonox::WorldEntity
std::string id_
 Used by the ScriptableController to identify objects. More...
 
Ogre::SceneNode * node_
 
btRigidBody * physicalBody_
 Bullet rigid body. Everything physical is applied to this instance. More...
 
- Protected Attributes inherited from orxonox::BaseObject
mbool bActive_
 True = the object is active. More...
 
mbool bVisible_
 True = the object is visible. More...
 
FunctorPtr mainStateFunctor_
 
std::string mainStateName_
 
std::string name_
 The name of the object. More...
 
std::set< std::string > networkTemplateNames_
 
std::string oldName_
 The old name of the object. More...
 
- Static Protected Attributes inherited from orxonox::TriggerBase
static const std::string and_s = "and"
 Magic strings for the mode. More...
 
static const int INF_s = -1
 Magic number for infinity. More...
 
static const std::string or_s = "or"
 
static const std::string xor_s = "xor"
 

Detailed Description

The MultiTrigger class implements a trigger that has a distinct state for each object triggering it.

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.

MultiTriggers also allow for additional complexity which can be added through the choice of the parameters explained (briefly) below: But first you must understand a small implementation 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 active, while it in fact isn't. The standard behavior is, that the activity changes, when the MultiTrigger transits from being triggered to being not triggered or the other way around. The parameters are:

An example of a MultiTrigger created through XML would look like this:

<MultiTrigger position="0,0,0" delay="1.3" switch="true" stayactive="true" activations="7" invert="true" simultaneousTriggerers="2" mode="xor" broadcast="false" target="Pawn">
...
Author
Damian 'Mozork' Frick

Many concepts and loads of inspiration from the Trigger class by Benjamin Knecht.

Constructor & Destructor Documentation

orxonox::MultiTrigger::MultiTrigger ( Context context)

Constructor. Registers the objects and initializes default values.

Constructor.

Registers the objects and initializes default values.

orxonox::MultiTrigger::~MultiTrigger ( )
virtual

Destructor.

Cleans up the state queue.

Member Function Documentation

bool orxonox::MultiTrigger::addState ( MultiTriggerState state)
private

Helper method. Adds a state to the state queue, where the state will wait to become active.

Helper method.

Adds a state to the state queue, where the state will wait to become active.

Parameters
stateThe state to be added.
Returns
Returns true if the state has been added, false if not. If the state has not been added this method destroys it.
void orxonox::MultiTrigger::addTarget ( const std::string &  targetStr)

Add some target to the MultiTrigger.

Parameters
targetStrThe target class name as a string.
void orxonox::MultiTrigger::broadcast ( bool  status)
protected

Helper method. Broadcasts an Event for every object that is a target.

Helper method.

Broadcasts an Event for every object that is a target.

Parameters
statusThe status of the Events to be fired. This is equivalent to the activity of the MultiTrigger.
void orxonox::MultiTrigger::changeTriggered ( BaseObject originator = nullptr)
protected

This method can be called by any class inheriting from MultiTrigger to change it's triggered status for a specified originator.

Compared to the letTrigger mode, which just polls and lets the pollee send it's state changed back, the changeTriggered method lets the trigger advertise its state changes just as they happen so it's much like the interrupt version of letTrigger.

Parameters
originatorThe originator which triggered the state change.
bool orxonox::MultiTrigger::checkAnd ( BaseObject triggerer)
private

Checks whether the children amount to true for the and mode for a given object.

Parameters
triggererThe object.
Returns
Returns true if all the sub-triggers are active.
bool orxonox::MultiTrigger::checkOr ( BaseObject triggerer)
private

Checks whether the children amount to true for the or mode for a given object.

Parameters
triggererThe object.
Returns
Returns true if at least one sub-trigger is active.
bool orxonox::MultiTrigger::checkXor ( BaseObject triggerer)
private

Checks whether the children amount to true for the xor mode for a given object.

Parameters
triggererThe object.
Returns
Returns true if exactly one sub-trigger is active.
void orxonox::MultiTrigger::childActivityChanged ( BaseObject originator)
private

This method is called by any child to advertise changes in it's state to it's parent.

This method is called by any child to advertise changes in its state to its parent.

Parameters
originatorThe object that caused the change in activity.
void orxonox::MultiTrigger::fire ( bool  status,
BaseObject originator = nullptr 
)
protectedvirtual

Helper method. Creates an Event for the given status and originator and fires it.

Helper method.

Creates an Event for the given status and originator and fires it. Or more precisely creates a MultiTriggerContainer to encompass all neccesary information, creates an Event from that and sends it.

Parameters
statusThe status of the Event to be fired. This is equivalent to the activity of the MultiTrigger.
originatorThe object that triggered the MultiTrigger to fire this Event.

Reimplemented in orxonox::RaceCheckPoint.

std::set<BaseObject*>& orxonox::MultiTrigger::getActive ( void  )
inlineprivate

Get the objects for which this MultiTrigger is active.

Returns
Returns a set with all the object this MultiTrigger is active for.
bool orxonox::MultiTrigger::getBroadcast ( void  )
inline

Get the broadcast-mode of the MultiTrigger.

Returns
Returns true if the MultiTrigger is set to broadcast.
int orxonox::MultiTrigger::getSimultaneousTriggerers ( void  )
inline

Get the number of objects that are allowed to simultaneously trigger this MultiTriggger.

Returns
Returns the number of objects. -1 denotes infinity.
ClassTreeMask& orxonox::MultiTrigger::getTargetMask ( void  )
inlineprotected

Get the target mask used to identify the targets of this MultiTrigger.

Returns
Returns the target mask.
bool orxonox::MultiTrigger::isActive ( void  ) const
inlinevirtual

Check whether the MultiTrigger is active.

Returns
Returns if the MultiTrigger is active.

Reimplemented from orxonox::TriggerBase.

bool orxonox::MultiTrigger::isActive ( BaseObject triggerer = nullptr) const

Check whether the MultiTrigger is active for a given object.

Parameters
triggererA pointer to the object.
Returns
Returns true if the MultiTrigger is active, false if not.
bool orxonox::MultiTrigger::isModeTriggered ( BaseObject triggerer = nullptr)
protected

Checks whether the MultiTrigger is triggered concerning it's children.

Checks whether the children are in such a way that, according to the mode of the MultiTrigger, the MultiTrigger is triggered (only considering the children, not the state of MultiTrigger itself), for a given object.

To make an example: When the mode is and, then this would be true or a given object if all the children were triggered for the given object.

Parameters
triggererThe object.
Returns
Returns true if the MultiTrigger is triggered concerning it's children.
bool orxonox::MultiTrigger::isTarget ( BaseObject target)
inline

Get whether the input object is a target of the MultiTrigger.

Parameters
targetA pointer to the object.
Returns
Returns true if the input object is a target, false if not.
bool orxonox::MultiTrigger::isTriggered ( BaseObject triggerer = nullptr)
protected

Get whether the MultiTrigger is triggered for a given object.

Parameters
triggererThe object.
Returns
Returns true if the MultiTrigger is triggered for the given object.
std::queue< MultiTriggerState * > * orxonox::MultiTrigger::letTrigger ( void  )
protectedvirtual

This method is called by the MultiTrigger to get information about new trigger events that need to be looked at.

This method is the device for the behavior (the conditions under which the MultiTrigger triggers) of any derived class of MultiTrigger.

Returns
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. 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.

Reimplemented in orxonox::DistanceMultiTrigger.

void orxonox::MultiTrigger::removeTarget ( const std::string &  targetStr)
protected

Remove some target from the MultiTrigger.

Parameters
targetStrThe target to be removed as a string.
void orxonox::MultiTrigger::setBroadcast ( bool  bBroadcast)
inline

Set the broadcast-mode of the MultiTrigger.

Parameters
bBroadcastIf true the MultiTrigger is set to broadcast;
void orxonox::MultiTrigger::setSimultaneousTriggerers ( int  triggerers)
inline

Set the number of objects that are allowed to simultaneously trigger this MultiTrigger.

Parameters
triggerersThe number of objects. -1 denotes infinitely many.
void orxonox::MultiTrigger::tick ( float  dt)
virtual

A method that is executed each tick.

Most of the magic of MultiTriggers happens here.

Parameters
dtThe duration of the last tick.

Reimplemented from orxonox::Tickable.

void orxonox::MultiTrigger::XMLPort ( Element &  xmlelement,
XMLPort::Mode  mode 
)
virtual

Method for creating a MultiTrigger object through XML.

For a detailed description of the parameters please see the class description in the header file.

Reimplemented from orxonox::TriggerBase.

Reimplemented in orxonox::DistanceMultiTrigger, orxonox::EventMultiTrigger, and orxonox::RaceCheckPoint.

Member Data Documentation

std::set<BaseObject*> orxonox::MultiTrigger::active_
private

The set of all objects the MultiTrigger is active for.

bool orxonox::MultiTrigger::bBroadcast_
private

Bool for the broadcast-mode, if true all triggers go to all possible targets.

int orxonox::MultiTrigger::maxNumSimultaneousTriggerers_
private

The maximum number of objects simultaneously trigggering this MultiTrigger.

std::deque<std::pair<float, MultiTriggerState*> > orxonox::MultiTrigger::stateQueue_
private

The queue of states waiting to become active.

ClassTreeMask orxonox::MultiTrigger::targetMask_
private

The target mask, masking all objects that can trigger this MultiTrigger.

std::set<BaseObject*> orxonox::MultiTrigger::triggered_
private

The set of all objects the MultiTrigger is triggered for.


The documentation for this class was generated from the following files: