42 #ifndef _BaseObject_H__ 43 #define _BaseObject_H__ 60 class ScriptableController;
76 inline T*
get()
const;
105 if (this->bActive_ != bActive)
107 this->bActive_ = bActive;
108 this->changedActivity();
119 if (this->bVisible_ != bVisible)
121 this->bVisible_ = bVisible;
122 this->changedVisibility();
130 void setMainState(
bool state);
135 if (this->mainStateName_ != name)
137 this->mainStateName_ = name;
138 this->changedMainStateName();
144 virtual void changedMainStateName();
156 {
return this->templates_; }
166 virtual inline uint32_t
getSceneID()
const {
return this->sceneID_; }
179 BaseObject* getEventListener(
unsigned int index)
const;
182 void fireEvent(
bool activate,
const std::string& name =
"");
186 virtual void processEvent(
Event& event);
210 void registerEventListener(
BaseObject*
object);
213 { this->eventListeners_.erase(
object); }
217 Template* getTemplate(
unsigned int index)
const;
218 void registerEventStates();
The BaseObject is the parent of all classes representing an instance in the game. ...
Definition: BaseObject.h:63
std::set< BaseObject * > eventListenersXML_
List of objects which listen to the events of this object through the "eventlisteners" subsection in ...
Definition: BaseObject.h:235
std::shared_ptr< Functor > FunctorPtr
Definition: FunctorPtr.h:57
virtual uint32_t getSceneID() const
Definition: BaseObject.h:166
void source(const std::string &filename)
Reads the content of a file and executes the commands in it line by line.
Definition: ConsoleCommandCompilation.cc:167
StrongOrWeakPtr< Namespace > namespace_
Definition: BaseObject.h:225
const std::string & getOldName() const
Returns the old name of the object.
Definition: BaseObject.h:98
bool bRegisteredEventStates_
Becomes true after the object registered its event states (with XMLEventPort)
Definition: BaseObject.h:237
Definition: Template.h:50
std::set< std::string > networkTemplateNames_
Definition: BaseObject.h:206
The EventState contains information about an event state.
Definition: Event.h:77
T * get() const
Definition: BaseObject.h:262
StrongOrWeakPtr()
Definition: BaseObject.h:247
std::string oldName_
The old name of the object.
Definition: BaseObject.h:201
Scene * getScene() const
Definition: BaseObject.h:165
This is the class from which all objects of the game-logic (not the engine) are derived from...
Definition: OrxonoxClass.h:53
const std::set< Template * > & getTemplates() const
Returns the set of all aplied templates.
Definition: BaseObject.h:155
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
void setCreator(BaseObject *creator)
Definition: BaseObject.h:161
A strong pointer which wraps a pointer to an object and keeps this object alive as long as the strong...
Definition: CorePrereqs.h:227
void setVisible(bool bVisible)
Sets the state of the objects visibility.
Definition: BaseObject.h:117
bool isInitialized() const
Returns if the object was initialized (passed the object registration).
Definition: BaseObject.h:91
BaseObject * creator_
Definition: BaseObject.h:226
std::string mainStateName_
Definition: BaseObject.h:204
void setNamespace(const StrongOrWeakPtr< Namespace > &ns)
Definition: BaseObject.h:158
std::map< BaseObject *, std::string > eventSources_
List of objects which send events to this object, mapped to the state which they affect.
Definition: BaseObject.h:233
std::set< Template * > templates_
Definition: BaseObject.h:231
WeakPtr wraps a pointer to an object, which becomes nullptr if the object is deleted.
Definition: CorePrereqs.h:236
void setFile(const XMLFile *file)
Sets a pointer to the xml file that loaded this object.
Definition: BaseObject.h:147
StrongPtr< T > createStrongPtr() const
Definition: BaseObject.h:273
BaseObject * getCreator() const
Definition: BaseObject.h:162
Definition: BaseObject.h:69
void setScene(const StrongOrWeakPtr< Scene > &scene, uint32_t sceneID)
Definition: BaseObject.h:164
SUPER_FUNCTION(0, BaseObject, XMLPort, false)
std::string loaderIndentation_
Indentation of the debug output in the Loader.
Definition: BaseObject.h:224
void setMainStateName(const std::string &name)
Sets the name of the main state (used for event reactions).
Definition: BaseObject.h:133
xmlelement
Definition: Super.h:519
void setName(const std::string &name)
Sets the name of the object.
Definition: BaseObject.h:94
FunctorPtr mainStateFunctor_
Definition: BaseObject.h:205
mbool bVisible_
True = the object is visible.
Definition: BaseObject.h:203
Gametype * getGametype() const
Definition: BaseObject.h:169
StrongOrWeakPtr< Gametype > gametype_
Definition: BaseObject.h:229
Definition: Namespace.h:46
const std::string & getName() const
Returns the name of the object.
Definition: BaseObject.h:96
mbool is a small helper class that acts like a bool, but keeps track of the number of its state chang...
Definition: mbool.h:58
StrongOrWeakPtr< Level > level_
Definition: BaseObject.h:230
The Event struct contains information about a fired Event.
Definition: Event.h:51
const mbool & isVisible() const
Returns the state of the objects visibility.
Definition: BaseObject.h:126
std::map< std::string, std::string > xmlAttributes_
Lowercase XML attributes.
Definition: BaseObject.h:223
std::string name_
The name of the object.
Definition: BaseObject.h:200
const std::string & getMainStateName() const
Returns the name of the main state.
Definition: BaseObject.h:142
WeakPtr< T > weakPtr_
Definition: BaseObject.h:81
const mbool & isActive() const
Returns the state of the objects activity.
Definition: BaseObject.h:112
Die Wagnis Klasse hat die folgenden Aufgaben:
Definition: ApplicationPaths.cc:66
void setLoaderIndentation(const std::string &indentation)
Sets the indentation of the debug output in the Loader.
Definition: BaseObject.h:189
void setGametype(const StrongOrWeakPtr< Gametype > &gametype)
Definition: BaseObject.h:168
#define _CoreExport
Definition: CorePrereqs.h:61
Mode
Definition: CorePrereqs.h:102
Level * getLevel() const
Definition: BaseObject.h:172
Definition: Gametype.h:63
The Identifier is used to identify the class of an object and to store information about the class...
Definition: Identifier.h:109
Declaration and implementation of the orxonox::mbool class.
Definition: InputPrereqs.h:78
void setActive(bool bActive)
Sets the state of the objects activity.
Definition: BaseObject.h:103
std::set< BaseObject * > eventListeners_
List of objects which listen to the events of this object.
Definition: BaseObject.h:234
virtual void changedName()
This function gets called if the name of the object changes.
Definition: BaseObject.h:100
std::map< std::string, EventState * > eventStates_
Maps the name of the event states to their helper objects.
Definition: BaseObject.h:236
void unregisterEventListener(BaseObject *object)
Removes an event listener from this object.
Definition: BaseObject.h:212
virtual void changedActivity()
This function gets called if the activity of the object changes.
Definition: BaseObject.h:114
uint32_t sceneID_
Definition: BaseObject.h:228
Definition of StrongPtr<T>, wraps a pointer to an object and keeps it alive.
void setLevel(const StrongOrWeakPtr< Level > &level)
Definition: BaseObject.h:171
Namespace * getNamespace() const
Definition: BaseObject.h:159
bool bInitialized_
True if the object was initialized (passed the object registration)
Definition: BaseObject.h:220
const XMLFile * getFile() const
Returns a pointer to the XMLFile that loaded this object.
Definition: BaseObject.h:149
Definition: CorePrereqs.h:243
StrongPtr< T > strongPtr_
Definition: BaseObject.h:80
const std::string & getLoaderIndentation() const
Returns the indentation of the debug output in the Loader.
Definition: BaseObject.h:191
Definition of all super-function related macros, used to call functions of the base class...
mbool bActive_
True = the object is active.
Definition: BaseObject.h:202
internal::String name_
Definition: gtest.cc:2289
Element * lastLoadedXMLElement_
Non nullptr if the TinyXML attributes have already been copied to our own lowercase map...
Definition: BaseObject.h:222
virtual void changedVisibility()
This function gets called if the visibility of the object changes.
Definition: BaseObject.h:128
StrongOrWeakPtr< Scene > scene_
Definition: BaseObject.h:227
Declaration of OrxonoxClass, the base class of all objects in Orxonox.
const XMLFile * file_
The XMLFile that loaded this object.
Definition: BaseObject.h:221