Orxonox  0.0.5 Codename: Arcturus
Event.h
Go to the documentation of this file.
1 /*
2  * ORXONOX - the hottest 3D action shooter ever to exist
3  * > www.orxonox.net <
4  *
5  *
6  * License notice:
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21  *
22  * Author:
23  * Fabian 'x3n' Landau
24  * Co-authors:
25  * ...
26  *
27  */
28 
40 #ifndef _Event_H__
41 #define _Event_H__
42 
43 #include "CorePrereqs.h"
44 #include <string>
45 
46 namespace orxonox
47 {
52  {
53  Event(bool activate, BaseObject* originator, const std::string& name) : activate_(activate), originator_(originator), name_(name) {}
54 
55  bool activate_;
59 
60  };
61 
78  {
79  public:
80  EventState(const FunctorPtr& statefunction, Identifier* subclass, bool bSink = false) : bProcessingEvent_(false), activeEvents_(0), statefunction_(statefunction), subclass_(subclass), bSink_(bSink) {}
81 
82  void process(const Event& event, BaseObject* object);
83 
84  const FunctorPtr& getFunctor() const
85  { return this->statefunction_; }
86 
87  private:
92  bool bSink_;
93  };
94 }
95 
96 #endif /* _Event_H__ */
The BaseObject is the parent of all classes representing an instance in the game. ...
Definition: BaseObject.h:63
std::shared_ptr< Functor > FunctorPtr
Definition: FunctorPtr.h:57
The EventState contains information about an event state.
Definition: Event.h:77
bool activate_
True if this is an activating event (the event source was inactive before and just triggered the even...
Definition: Event.h:55
Shared library macros, enums, constants and forward declarations for the core library ...
::std::string string
Definition: gtest-port.h:756
Structure to describe a single event.
Definition: ScriptController.h:42
BaseObject * originator_
The object which triggered this event.
Definition: Event.h:57
bool bSink_
Determines whether the EventState acts as an EventSink forwarding any Event (even if the state didn&#39;t...
Definition: Event.h:92
EventState(const FunctorPtr &statefunction, Identifier *subclass, bool bSink=false)
Definition: Event.h:80
std::string statename_
The name of the state this event affects.
Definition: Event.h:56
The Event struct contains information about a fired Event.
Definition: Event.h:51
Event(bool activate, BaseObject *originator, const std::string &name)
Definition: Event.h:53
Die Wagnis Klasse hat die folgenden Aufgaben:
Definition: ApplicationPaths.cc:66
#define _CoreExport
Definition: CorePrereqs.h:61
std::string name_
The name of this event.
Definition: Event.h:58
The Identifier is used to identify the class of an object and to store information about the class...
Definition: Identifier.h:109
FunctorPtr statefunction_
A functor to set the state.
Definition: Event.h:90
const FunctorPtr & getFunctor() const
Definition: Event.h:84
Identifier * subclass_
Originators must be an instance of this class (usually BaseObject, but some statefunctions allow a se...
Definition: Event.h:91
bool bProcessingEvent_
This becomes true while the container processes an event (used to prevent loops)
Definition: Event.h:88
int activeEvents_
The number of events which affect this state and are currently active.
Definition: Event.h:89
internal::String name_
Definition: gtest.cc:2289