[Orxonox-commit 4894] r9563 - in code/branches/core6/src: libraries/core libraries/core/class libraries/core/command libraries/core/config libraries/core/input libraries/core/object libraries/network libraries/network/synchronisable libraries/tools libraries/tools/interfaces modules/designtools modules/notifications modules/pickup modules/questsystem modules/weapons/projectiles orxonox orxonox/chat orxonox/controllers orxonox/gamestates orxonox/gametypes orxonox/infos orxonox/interfaces orxonox/overlays orxonox/sound orxonox/weaponsystem orxonox/worldentities
landauf at orxonox.net
landauf at orxonox.net
Sun Mar 24 17:33:43 CET 2013
Author: landauf
Date: 2013-03-24 17:33:43 +0100 (Sun, 24 Mar 2013)
New Revision: 9563
Added:
code/branches/core6/src/libraries/core/class/
code/branches/core6/src/libraries/core/class/CMakeLists.txt
code/branches/core6/src/libraries/core/class/Identifier.cc
code/branches/core6/src/libraries/core/class/Identifier.h
code/branches/core6/src/libraries/core/class/OrxonoxClass.cc
code/branches/core6/src/libraries/core/class/OrxonoxClass.h
code/branches/core6/src/libraries/core/class/SubclassIdentifier.h
code/branches/core6/src/libraries/core/class/Super.h
Removed:
code/branches/core6/src/libraries/core/Identifier.cc
code/branches/core6/src/libraries/core/Identifier.h
code/branches/core6/src/libraries/core/OrxonoxClass.cc
code/branches/core6/src/libraries/core/OrxonoxClass.h
code/branches/core6/src/libraries/core/SubclassIdentifier.h
code/branches/core6/src/libraries/core/Super.h
Modified:
code/branches/core6/src/libraries/core/BaseObject.h
code/branches/core6/src/libraries/core/CMakeLists.txt
code/branches/core6/src/libraries/core/ClassTreeMask.cc
code/branches/core6/src/libraries/core/Core.cc
code/branches/core6/src/libraries/core/Core.h
code/branches/core6/src/libraries/core/CoreIncludes.h
code/branches/core6/src/libraries/core/Event.cc
code/branches/core6/src/libraries/core/GUIManager.h
code/branches/core6/src/libraries/core/Game.h
code/branches/core6/src/libraries/core/GraphicsManager.h
code/branches/core6/src/libraries/core/ViewportEventListener.h
code/branches/core6/src/libraries/core/WindowEventListener.h
code/branches/core6/src/libraries/core/XMLNameListener.h
code/branches/core6/src/libraries/core/XMLPort.h
code/branches/core6/src/libraries/core/command/ArgumentCompletionFunctions.cc
code/branches/core6/src/libraries/core/command/Functor.h
code/branches/core6/src/libraries/core/command/Shell.h
code/branches/core6/src/libraries/core/config/ConfigValueContainer.h
code/branches/core6/src/libraries/core/config/ConfigValueIncludes.h
code/branches/core6/src/libraries/core/input/InputBuffer.h
code/branches/core6/src/libraries/core/input/JoyStickQuantityListener.h
code/branches/core6/src/libraries/core/input/KeyBinderManager.h
code/branches/core6/src/libraries/core/object/ClassFactory.h
code/branches/core6/src/libraries/core/object/ContextObject.h
code/branches/core6/src/libraries/core/object/Iterator.h
code/branches/core6/src/libraries/core/object/MetaObjectList.cc
code/branches/core6/src/libraries/core/object/ObjectListIterator.h
code/branches/core6/src/libraries/core/object/SmartPtr.h
code/branches/core6/src/libraries/core/object/WeakPtr.h
code/branches/core6/src/libraries/network/ClientConnectionListener.h
code/branches/core6/src/libraries/network/NetworkChatListener.h
code/branches/core6/src/libraries/network/NetworkFunction.h
code/branches/core6/src/libraries/network/WANDiscoverable.h
code/branches/core6/src/libraries/network/WANDiscovery.h
code/branches/core6/src/libraries/network/synchronisable/Synchronisable.h
code/branches/core6/src/libraries/tools/Timer.h
code/branches/core6/src/libraries/tools/interfaces/Tickable.h
code/branches/core6/src/libraries/tools/interfaces/TimeFactorListener.h
code/branches/core6/src/modules/designtools/ScreenshotManager.h
code/branches/core6/src/modules/designtools/SkyboxGenerator.h
code/branches/core6/src/modules/notifications/NotificationManager.h
code/branches/core6/src/modules/pickup/PickupManager.cc
code/branches/core6/src/modules/questsystem/QuestManager.h
code/branches/core6/src/modules/weapons/projectiles/BasicProjectile.h
code/branches/core6/src/orxonox/CameraManager.h
code/branches/core6/src/orxonox/LevelInfo.h
code/branches/core6/src/orxonox/LevelManager.h
code/branches/core6/src/orxonox/MoodManager.h
code/branches/core6/src/orxonox/chat/ChatListener.h
code/branches/core6/src/orxonox/controllers/FormationController.h
code/branches/core6/src/orxonox/gamestates/GSLevel.h
code/branches/core6/src/orxonox/gamestates/GSMainMenu.h
code/branches/core6/src/orxonox/gametypes/Gametype.h
code/branches/core6/src/orxonox/infos/PlayerInfo.h
code/branches/core6/src/orxonox/interfaces/GametypeMessageListener.h
code/branches/core6/src/orxonox/interfaces/NotificationListener.h
code/branches/core6/src/orxonox/interfaces/PickupCarrier.cc
code/branches/core6/src/orxonox/interfaces/PickupCarrier.h
code/branches/core6/src/orxonox/interfaces/PickupListener.h
code/branches/core6/src/orxonox/interfaces/Pickupable.cc
code/branches/core6/src/orxonox/interfaces/Pickupable.h
code/branches/core6/src/orxonox/interfaces/PlayerTrigger.h
code/branches/core6/src/orxonox/interfaces/RadarListener.h
code/branches/core6/src/orxonox/interfaces/RadarViewable.h
code/branches/core6/src/orxonox/interfaces/Rewardable.h
code/branches/core6/src/orxonox/interfaces/TeamColourable.h
code/branches/core6/src/orxonox/overlays/OrxonoxOverlay.h
code/branches/core6/src/orxonox/sound/BaseSound.h
code/branches/core6/src/orxonox/sound/SoundManager.h
code/branches/core6/src/orxonox/weaponsystem/WeaponMode.h
code/branches/core6/src/orxonox/weaponsystem/WeaponSystem.cc
code/branches/core6/src/orxonox/worldentities/SpawnPoint.h
Log:
moved files used for class management to core/class/
Modified: code/branches/core6/src/libraries/core/BaseObject.h
===================================================================
--- code/branches/core6/src/libraries/core/BaseObject.h 2013-03-24 15:16:01 UTC (rev 9562)
+++ code/branches/core6/src/libraries/core/BaseObject.h 2013-03-24 16:33:43 UTC (rev 9563)
@@ -48,8 +48,8 @@
#include <list>
#include "util/mbool.h"
-#include "OrxonoxClass.h"
-#include "Super.h"
+#include "class/OrxonoxClass.h"
+#include "class/Super.h"
#include "object/SmartPtr.h"
namespace orxonox
Modified: code/branches/core6/src/libraries/core/CMakeLists.txt
===================================================================
--- code/branches/core6/src/libraries/core/CMakeLists.txt 2013-03-24 15:16:01 UTC (rev 9562)
+++ code/branches/core6/src/libraries/core/CMakeLists.txt 2013-03-24 16:33:43 UTC (rev 9563)
@@ -27,13 +27,11 @@
Game.cc
GameMode.cc
GameState.cc
- Identifier.cc
Language.cc
Loader.cc
LuaState.cc
Namespace.cc
NamespaceNode.cc
- OrxonoxClass.cc
Template.cc
ViewportEventListener.cc
WindowEventListener.cc
@@ -63,6 +61,7 @@
END_BUILD_UNIT
)
+ADD_SUBDIRECTORY(class)
ADD_SUBDIRECTORY(command)
ADD_SUBDIRECTORY(config)
ADD_SUBDIRECTORY(input)
Modified: code/branches/core6/src/libraries/core/ClassTreeMask.cc
===================================================================
--- code/branches/core6/src/libraries/core/ClassTreeMask.cc 2013-03-24 15:16:01 UTC (rev 9562)
+++ code/branches/core6/src/libraries/core/ClassTreeMask.cc 2013-03-24 16:33:43 UTC (rev 9563)
@@ -32,7 +32,7 @@
*/
#include "ClassTreeMask.h"
-#include "Identifier.h"
+#include "class/Identifier.h"
namespace orxonox
{
Modified: code/branches/core6/src/libraries/core/Core.cc
===================================================================
--- code/branches/core6/src/libraries/core/Core.cc 2013-03-24 15:16:01 UTC (rev 9562)
+++ code/branches/core6/src/libraries/core/Core.cc 2013-03-24 16:33:43 UTC (rev 9563)
@@ -67,7 +67,7 @@
#include "GameMode.h"
#include "GraphicsManager.h"
#include "GUIManager.h"
-#include "Identifier.h"
+#include "class/Identifier.h"
#include "Language.h"
#include "LuaState.h"
#include "command/ConsoleCommand.h"
Modified: code/branches/core6/src/libraries/core/Core.h
===================================================================
--- code/branches/core6/src/libraries/core/Core.h 2013-03-24 15:16:01 UTC (rev 9562)
+++ code/branches/core6/src/libraries/core/Core.h 2013-03-24 16:33:43 UTC (rev 9563)
@@ -46,7 +46,7 @@
#include <string>
#include "util/DestructionHelper.h"
#include "util/Singleton.h"
-#include "OrxonoxClass.h"
+#include "class/OrxonoxClass.h"
namespace orxonox
{
Modified: code/branches/core6/src/libraries/core/CoreIncludes.h
===================================================================
--- code/branches/core6/src/libraries/core/CoreIncludes.h 2013-03-24 15:16:01 UTC (rev 9562)
+++ code/branches/core6/src/libraries/core/CoreIncludes.h 2013-03-24 16:33:43 UTC (rev 9563)
@@ -78,7 +78,7 @@
#include "CorePrereqs.h"
#include "util/Output.h"
-#include "Identifier.h"
+#include "class/Identifier.h"
#include "object/ClassFactory.h"
#include "object/ObjectList.h"
Modified: code/branches/core6/src/libraries/core/Event.cc
===================================================================
--- code/branches/core6/src/libraries/core/Event.cc 2013-03-24 15:16:01 UTC (rev 9562)
+++ code/branches/core6/src/libraries/core/Event.cc 2013-03-24 16:33:43 UTC (rev 9563)
@@ -34,7 +34,7 @@
#include "Event.h"
#include "BaseObject.h"
-#include "Identifier.h"
+#include "class/Identifier.h"
namespace orxonox
{
Modified: code/branches/core6/src/libraries/core/GUIManager.h
===================================================================
--- code/branches/core6/src/libraries/core/GUIManager.h 2013-03-24 15:16:01 UTC (rev 9562)
+++ code/branches/core6/src/libraries/core/GUIManager.h 2013-03-24 16:33:43 UTC (rev 9563)
@@ -48,7 +48,7 @@
#include "util/tribool.h"
#include "util/Singleton.h"
#include "input/InputHandler.h"
-#include "OrxonoxClass.h"
+#include "class/OrxonoxClass.h"
#include "WindowEventListener.h"
#if CEGUI_VERSION_MAJOR < 1 && CEGUI_VERSION_MINOR < 7
Modified: code/branches/core6/src/libraries/core/Game.h
===================================================================
--- code/branches/core6/src/libraries/core/Game.h 2013-03-24 15:16:01 UTC (rev 9562)
+++ code/branches/core6/src/libraries/core/Game.h 2013-03-24 16:33:43 UTC (rev 9563)
@@ -49,7 +49,7 @@
#include "util/Output.h"
#include "util/DestructionHelper.h"
#include "util/Singleton.h"
-#include "OrxonoxClass.h"
+#include "class/OrxonoxClass.h"
/**
@brief
Modified: code/branches/core6/src/libraries/core/GraphicsManager.h
===================================================================
--- code/branches/core6/src/libraries/core/GraphicsManager.h 2013-03-24 15:16:01 UTC (rev 9562)
+++ code/branches/core6/src/libraries/core/GraphicsManager.h 2013-03-24 16:33:43 UTC (rev 9563)
@@ -51,7 +51,7 @@
#include "util/DestructionHelper.h"
#include "util/Singleton.h"
-#include "OrxonoxClass.h"
+#include "class/OrxonoxClass.h"
// tolua_begin
namespace orxonox
Deleted: code/branches/core6/src/libraries/core/Identifier.cc
===================================================================
--- code/branches/core6/src/libraries/core/Identifier.cc 2013-03-24 15:16:01 UTC (rev 9562)
+++ code/branches/core6/src/libraries/core/Identifier.cc 2013-03-24 16:33:43 UTC (rev 9563)
@@ -1,507 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-/**
- @file
- @brief Implementation of the Identifier class.
-*/
-
-#include "Identifier.h"
-
-#include <ostream>
-
-#include "util/StringUtils.h"
-#include "config/ConfigValueContainer.h"
-#include "XMLPort.h"
-#include "object/ClassFactory.h"
-
-namespace orxonox
-{
- // ###############################
- // ### Identifier ###
- // ###############################
- int Identifier::hierarchyCreatingCounter_s = 0;
- unsigned int Identifier::classIDCounter_s = 0;
-
- /**
- @brief Constructor: No factory, no object created, new ObjectList and a unique networkID.
- */
- Identifier::Identifier()
- : classID_(classIDCounter_s++)
- {
- this->objects_ = new ObjectListBase(this);
-
- this->bCreatedOneObject_ = false;
- this->bSetName_ = false;
- this->factory_ = 0;
- this->bLoadable_ = false;
-
- this->bHasConfigValues_ = false;
-
- // Default network ID is the class ID
- this->networkID_ = this->classID_;
- }
-
- /**
- @brief Destructor: Deletes the list containing the children.
- */
- Identifier::~Identifier()
- {
- delete this->objects_;
-
- if (this->factory_)
- delete this->factory_;
-
- for (std::map<std::string, ConfigValueContainer*>::iterator it = this->configValues_.begin(); it != this->configValues_.end(); ++it)
- delete (it->second);
- for (std::map<std::string, XMLPortParamContainer*>::iterator it = this->xmlportParamContainers_.begin(); it != this->xmlportParamContainers_.end(); ++it)
- delete (it->second);
- for (std::map<std::string, XMLPortObjectContainer*>::iterator it = this->xmlportObjectContainers_.begin(); it != this->xmlportObjectContainers_.end(); ++it)
- delete (it->second);
- }
-
- /**
- @brief Returns the identifier map with the names as received by typeid(). This is only used internally.
- */
- std::map<std::string, Identifier*>& Identifier::getTypeIDIdentifierMap()
- {
- static std::map<std::string, Identifier*> identifiers; //!< The map to store all Identifiers.
- return identifiers;
- }
-
- /**
- @brief Returns an identifier by name and adds it if not available
- @param name The name of the identifier as typeid().name() suggests
- @param proposal A pointer to a newly created identifier for the case of non existence in the map
- @return The identifier (unique instance)
- */
- Identifier* Identifier::getIdentifierSingleton(const std::string& name, Identifier* proposal)
- {
- std::map<std::string, Identifier*>::const_iterator it = getTypeIDIdentifierMap().find(name);
-
- if (it != getTypeIDIdentifierMap().end())
- {
- // There is already an entry: return it and delete the proposal
- delete proposal;
- return it->second;
- }
- else
- {
- // There is no entry: put the proposal into the map and return it
- getTypeIDIdentifierMap()[name] = proposal;
- return proposal;
- }
- }
-
- /**
- @brief Registers a class, which means that the name and the parents get stored.
- @param parents A list, containing the Identifiers of all parents of the class
- @param bRootClass True if the class is either an Interface or the BaseObject itself
- */
- void Identifier::initializeClassHierarchy(std::set<const Identifier*>* parents, bool bRootClass)
- {
- // Check if at least one object of the given type was created
- if (!this->bCreatedOneObject_ && Identifier::isCreatingHierarchy())
- {
- // If no: We have to store the information and initialize the Identifier
- orxout(verbose, context::identifier) << "Register Class in ClassIdentifier<" << this->getName() << ">-Singleton -> Initialize Singleton." << endl;
- if (bRootClass)
- this->initialize(0); // If a class is derived from two interfaces, the second interface might think it's derived from the first because of the order of constructor-calls. Thats why we set parents to zero in that case.
- else
- this->initialize(parents);
- }
- }
-
- /**
- @brief Initializes the Identifier with a list containing all parents of the class the Identifier belongs to.
- @param parents A list containing all parents
- */
- void Identifier::initialize(std::set<const Identifier*>* parents)
- {
- orxout(verbose, context::identifier) << "Initialize ClassIdentifier<" << this->name_ << ">-Singleton." << endl;
- this->bCreatedOneObject_ = true;
-
- if (parents)
- {
- this->parents_ = (*parents);
- this->directParents_ = (*parents);
-
- // Iterate through all parents
- for (std::set<const Identifier*>::iterator it = parents->begin(); it != parents->end(); ++it)
- {
- // Tell the parent we're one of it's children
- (*it)->children_.insert((*it)->children_.end(), this);
-
- // Erase all parents of our parent from our direct-parent-list
- for (std::set<const Identifier*>::const_iterator it1 = (*it)->getParents().begin(); it1 != (*it)->getParents().end(); ++it1)
- {
- // Search for the parent's parent in our direct-parent-list
- for (std::set<const Identifier*>::iterator it2 = this->directParents_.begin(); it2 != this->directParents_.end(); ++it2)
- {
- if ((*it1) == (*it2))
- {
- // We've found a non-direct parent in our list: Erase it
- this->directParents_.erase(it2);
- break;
- }
- }
- }
- }
-
- // Now iterate through all direct parents
- for (std::set<const Identifier*>::iterator it = this->directParents_.begin(); it != this->directParents_.end(); ++it)
- {
- // Tell the parent we're one of it's direct children
- (*it)->directChildren_.insert((*it)->directChildren_.end(), this);
-
- // Create the super-function dependencies
- (*it)->createSuperFunctionCaller();
- }
- }
- }
-
- /**
- @brief Creates the class-hierarchy by creating and destroying one object of each type.
- */
- void Identifier::createClassHierarchy()
- {
- orxout(internal_status) << "Create class-hierarchy" << endl;
- Identifier::startCreatingHierarchy();
- for (std::map<std::string, Identifier*>::const_iterator it = Identifier::getStringIdentifierMap().begin(); it != Identifier::getStringIdentifierMap().end(); ++it)
- {
- // To create the new branch of the class-hierarchy, we create a new object and delete it afterwards.
- if (it->second->hasFactory())
- {
- OrxonoxClass* temp = it->second->fabricate(0);
- temp->destroy();
- }
- }
- Identifier::stopCreatingHierarchy();
- orxout(internal_status) << "Finished class-hierarchy creation" << endl;
- }
-
- /**
- @brief Destroys all Identifiers. Called when exiting the program.
- */
- void Identifier::destroyAllIdentifiers()
- {
- for (std::map<std::string, Identifier*>::iterator it = Identifier::getTypeIDIdentifierMap().begin(); it != Identifier::getTypeIDIdentifierMap().end(); ++it)
- delete (it->second);
- }
-
- /**
- @brief Sets the name of the class.
- */
- void Identifier::setName(const std::string& name)
- {
- if (!this->bSetName_)
- {
- this->name_ = name;
- this->bSetName_ = true;
- Identifier::getStringIdentifierMapIntern()[name] = this;
- Identifier::getLowercaseStringIdentifierMapIntern()[getLowercase(name)] = this;
- Identifier::getIDIdentifierMapIntern()[this->networkID_] = this;
- }
- }
-
- /**
- @brief Creates an object of the type the Identifier belongs to.
- @return The new object
- */
- OrxonoxClass* Identifier::fabricate(BaseObject* creator)
- {
- if (this->factory_)
- {
- return this->factory_->fabricate(creator);
- }
- else
- {
- orxout(user_error) << "An error occurred in Identifier.cc:" << endl;
- orxout(user_error) << "Cannot fabricate an object of type '" << this->name_ << "'. Class has no factory." << endl;
- orxout(user_error) << "Aborting..." << endl;
- abort();
- return 0;
- }
- }
-
- /**
- @brief Sets the network ID to a new value and changes the entry in the ID-Identifier-map.
- */
- void Identifier::setNetworkID(uint32_t id)
- {
-// Identifier::getIDIdentifierMapIntern().erase(this->networkID_);
- Identifier::getIDIdentifierMapIntern()[id] = this;
- this->networkID_ = id;
- }
-
- /**
- @brief Returns true, if the Identifier is at least of the given type.
- @param identifier The identifier to compare with
- */
- bool Identifier::isA(const Identifier* identifier) const
- {
- return (identifier == this || (this->parents_.find(identifier) != this->parents_.end()));
- }
-
- /**
- @brief Returns true, if the Identifier is exactly of the given type.
- @param identifier The identifier to compare with
- */
- bool Identifier::isExactlyA(const Identifier* identifier) const
- {
- return (identifier == this);
- }
-
- /**
- @brief Returns true, if the assigned identifier is a child of the given identifier.
- @param identifier The identifier to compare with
- */
- bool Identifier::isChildOf(const Identifier* identifier) const
- {
- return (this->parents_.find(identifier) != this->parents_.end());
- }
-
- /**
- @brief Returns true, if the assigned identifier is a direct child of the given identifier.
- @param identifier The identifier to compare with
- */
- bool Identifier::isDirectChildOf(const Identifier* identifier) const
- {
- return (this->directParents_.find(identifier) != this->directParents_.end());
- }
-
- /**
- @brief Returns true, if the assigned identifier is a parent of the given identifier.
- @param identifier The identifier to compare with
- */
- bool Identifier::isParentOf(const Identifier* identifier) const
- {
- return (this->children_.find(identifier) != this->children_.end());
- }
-
- /**
- @brief Returns true, if the assigned identifier is a direct parent of the given identifier.
- @param identifier The identifier to compare with
- */
- bool Identifier::isDirectParentOf(const Identifier* identifier) const
- {
- return (this->directChildren_.find(identifier) != this->directChildren_.end());
- }
-
- /**
- @brief Returns the map that stores all Identifiers with their names.
- @return The map
- */
- std::map<std::string, Identifier*>& Identifier::getStringIdentifierMapIntern()
- {
- static std::map<std::string, Identifier*> identifierMap;
- return identifierMap;
- }
-
- /**
- @brief Returns the map that stores all Identifiers with their names in lowercase.
- @return The map
- */
- std::map<std::string, Identifier*>& Identifier::getLowercaseStringIdentifierMapIntern()
- {
- static std::map<std::string, Identifier*> lowercaseIdentifierMap;
- return lowercaseIdentifierMap;
- }
-
- /**
- @brief Returns the map that stores all Identifiers with their network IDs.
- @return The map
- */
- std::map<uint32_t, Identifier*>& Identifier::getIDIdentifierMapIntern()
- {
- static std::map<uint32_t, Identifier*> identifierMap;
- return identifierMap;
- }
-
- /**
- @brief Returns the Identifier with a given name.
- @param name The name of the wanted Identifier
- @return The Identifier
- */
- Identifier* Identifier::getIdentifierByString(const std::string& name)
- {
- std::map<std::string, Identifier*>::const_iterator it = Identifier::getStringIdentifierMapIntern().find(name);
- if (it != Identifier::getStringIdentifierMapIntern().end())
- return it->second;
- else
- return 0;
- }
-
- /**
- @brief Returns the Identifier with a given name in lowercase.
- @param name The name of the wanted Identifier
- @return The Identifier
- */
- Identifier* Identifier::getIdentifierByLowercaseString(const std::string& name)
- {
- std::map<std::string, Identifier*>::const_iterator it = Identifier::getLowercaseStringIdentifierMapIntern().find(name);
- if (it != Identifier::getLowercaseStringIdentifierMapIntern().end())
- return it->second;
- else
- return 0;
- }
-
- /**
- @brief Returns the Identifier with a given network ID.
- @param id The network ID of the wanted Identifier
- @return The Identifier
- */
- Identifier* Identifier::getIdentifierByID(const uint32_t id)
- {
- std::map<uint32_t, Identifier*>::const_iterator it = Identifier::getIDIdentifierMapIntern().find(id);
- if (it != Identifier::getIDIdentifierMapIntern().end())
- return it->second;
- else
- return 0;
- }
-
- /**
- @brief Cleans the NetworkID map (needed on clients for correct initialization)
- */
- void Identifier::clearNetworkIDs()
- {
- Identifier::getIDIdentifierMapIntern().clear();
- }
-
- /**
- @brief Adds the ConfigValueContainer of a variable, given by the string of its name.
- @param varname The name of the variablee
- @param container The container
- */
- void Identifier::addConfigValueContainer(const std::string& varname, ConfigValueContainer* container)
- {
- std::map<std::string, ConfigValueContainer*>::const_iterator it = this->configValues_.find(varname);
- if (it != this->configValues_.end())
- {
- orxout(internal_warning) << "Overwriting config-value with name " << varname << " in class " << this->getName() << '.' << endl;
- delete (it->second);
- }
-
- this->bHasConfigValues_ = true;
- this->configValues_[varname] = container;
- }
-
- /**
- @brief Returns the ConfigValueContainer of a variable, given by the string of its name.
- @param varname The name of the variable
- @return The ConfigValueContainer
- */
- ConfigValueContainer* Identifier::getConfigValueContainer(const std::string& varname)
- {
- std::map<std::string, ConfigValueContainer*>::const_iterator it = configValues_.find(varname);
- if (it != configValues_.end())
- return it->second;
- else
- return 0;
- }
-
- /**
- @brief Returns a XMLPortParamContainer that loads a parameter of this class.
- @param paramname The name of the parameter
- @return The container
- */
- XMLPortParamContainer* Identifier::getXMLPortParamContainer(const std::string& paramname)
- {
- std::map<std::string, XMLPortParamContainer*>::const_iterator it = this->xmlportParamContainers_.find(paramname);
- if (it != this->xmlportParamContainers_.end())
- return it->second;
- else
- return 0;
- }
-
- /**
- @brief Adds a new XMLPortParamContainer that loads a parameter of this class.
- @param paramname The name of the parameter
- @param container The container
- */
- void Identifier::addXMLPortParamContainer(const std::string& paramname, XMLPortParamContainer* container)
- {
- std::map<std::string, XMLPortParamContainer*>::const_iterator it = this->xmlportParamContainers_.find(paramname);
- if (it != this->xmlportParamContainers_.end())
- {
- orxout(internal_warning) << "Overwriting XMLPortParamContainer in class " << this->getName() << '.' << endl;
- delete (it->second);
- }
-
- this->xmlportParamContainers_[paramname] = container;
- }
-
- /**
- @brief Returns a XMLPortObjectContainer that attaches an object to this class.
- @param sectionname The name of the section that contains the attachable objects
- @return The container
- */
- XMLPortObjectContainer* Identifier::getXMLPortObjectContainer(const std::string& sectionname)
- {
- std::map<std::string, XMLPortObjectContainer*>::const_iterator it = this->xmlportObjectContainers_.find(sectionname);
- if (it != this->xmlportObjectContainers_.end())
- return it->second;
- else
- return 0;
- }
-
- /**
- @brief Adds a new XMLPortObjectContainer that attaches an object to this class.
- @param sectionname The name of the section that contains the attachable objects
- @param container The container
- */
- void Identifier::addXMLPortObjectContainer(const std::string& sectionname, XMLPortObjectContainer* container)
- {
- std::map<std::string, XMLPortObjectContainer*>::const_iterator it = this->xmlportObjectContainers_.find(sectionname);
- if (it != this->xmlportObjectContainers_.end())
- {
- orxout(internal_warning) << "Overwriting XMLPortObjectContainer in class " << this->getName() << '.' << endl;
- delete (it->second);
- }
-
- this->xmlportObjectContainers_[sectionname] = container;
- }
-
- /**
- @brief Lists the names of all Identifiers in a std::set<const Identifier*>.
- @param out The outstream
- @param list The list (or set) of Identifiers
- @return The outstream
- */
- std::ostream& operator<<(std::ostream& out, const std::set<const Identifier*>& list)
- {
- for (std::set<const Identifier*>::const_iterator it = list.begin(); it != list.end(); ++it)
- {
- if (it != list.begin())
- out << ' ';
- out << (*it)->getName();
- }
-
- return out;
- }
-}
Deleted: code/branches/core6/src/libraries/core/Identifier.h
===================================================================
--- code/branches/core6/src/libraries/core/Identifier.h 2013-03-24 15:16:01 UTC (rev 9562)
+++ code/branches/core6/src/libraries/core/Identifier.h 2013-03-24 16:33:43 UTC (rev 9563)
@@ -1,502 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-/**
- @defgroup Identifier Identifier
- @ingroup Class
-*/
-
-/**
- @file
- @ingroup Class Identifier
- @brief Declaration of Identifier, definition of ClassIdentifier<T>; used to identify the class of an object.
-
- @anchor IdentifierExample
-
- An Identifier "identifies" the class of an object. It contains different information about
- the class: Its name and ID, a list of all instances of this class, a factory to create new
- instances of this class, and more.
-
- It also contains information about the inheritance of this class: It stores a list of the
- Identifiers of all parent-classes as well as a list of all child-classes. These relationships
- can be tested using functions like @c isA(), @c isChildOf(), @c isParentOf(), and more.
-
- Every Identifier is in fact a ClassIdentifier<T> (where T is the class that is identified
- by the Identifier), Identifier is just the common base-class.
-
- Example:
- @code
- MyClass* object = new MyClass(); // create an instance of MyClass
-
- object->getIdentifier()->getName(); // returns "MyClass"
-
- OrxonoxClass* other = object->getIdentifier()->fabricate(0); // fabricates a new instance of MyClass
-
-
- // iterate through all objects of type MyClass:
- ObjectListBase* objects = object->getIdentifier()->getObjects(); // get a pointer to the object-list
- int count;
- for (Iterator<MyClass> it = objects.begin(); it != objects.end(); ++it) // iterate through the objects
- ++count;
- orxout() << count << endl; // prints "2" because we created 2 instances of MyClass so far
-
-
- // test the class hierarchy
- object->getIdentifier()->isA(Class(MyClass)); // returns true
- object->isA(Class(MyClass)); // returns true (short version)
-
- object->isA(Class(BaseClass)); // returns true if MyClass is a child of BaseClass
-
- Class(ChildClass)->isChildOf(object->getIdentifier()); // returns true if ChildClass is a child of MyClass
- @endcode
-*/
-
-#ifndef _Identifier_H__
-#define _Identifier_H__
-
-#include "CorePrereqs.h"
-
-#include <cassert>
-#include <map>
-#include <set>
-#include <string>
-#include <typeinfo>
-#include <loki/TypeTraits.h>
-
-#include "util/Output.h"
-#include "object/MetaObjectList.h"
-#include "object/ObjectList.h"
-#include "object/ObjectListBase.h"
-#include "Super.h"
-
-namespace orxonox
-{
- // ###############################
- // ### Identifier ###
- // ###############################
- /**
- @brief The Identifier is used to identify the class of an object and to store information about the class.
-
- Each Identifier stores information about one class. The Identifier can then be used to identify
- this class. On the other hand it's also possible to get the corresponding Identifier of a class,
- for example by using the macro Class().
-
- @see See @ref IdentifierExample "Identifier.h" for more information and some examples.
-
- @note You can't directly create an Identifier, it's just the base-class of ClassIdentifier<T>.
- */
- class _CoreExport Identifier
- {
- public:
- /// Returns the name of the class the Identifier belongs to.
- inline const std::string& getName() const { return this->name_; }
- void setName(const std::string& name);
-
- /// Returns the network ID to identify a class through the network.
- inline uint32_t getNetworkID() const { return this->networkID_; }
- void setNetworkID(uint32_t id);
-
- /// Returns the unique ID of the class.
- ORX_FORCEINLINE unsigned int getClassID() const { return this->classID_; }
-
- /// Returns the list of all existing objects of this class.
- inline ObjectListBase* getObjects() const { return this->objects_; }
-
- /// Sets the Factory.
- inline void addFactory(Factory* factory) { this->factory_ = factory; }
- /// Returns true if the Identifier has a Factory.
- inline bool hasFactory() const { return (this->factory_ != 0); }
-
- OrxonoxClass* fabricate(BaseObject* creator);
-
- /// Returns true if the class can be loaded through XML.
- inline bool isLoadable() const { return this->bLoadable_; }
- /// Set the class to be loadable through XML or not.
- inline void setLoadable(bool bLoadable) { this->bLoadable_ = bLoadable; }
-
- bool isA(const Identifier* identifier) const;
- bool isExactlyA(const Identifier* identifier) const;
- bool isChildOf(const Identifier* identifier) const;
- bool isDirectChildOf(const Identifier* identifier) const;
- bool isParentOf(const Identifier* identifier) const;
- bool isDirectParentOf(const Identifier* identifier) const;
-
-
- /////////////////////////////
- ////// Class Hierarchy //////
- /////////////////////////////
- static void createClassHierarchy();
-
- /// Returns true, if a branch of the class-hierarchy is being created, causing all new objects to store their parents.
- inline static bool isCreatingHierarchy() { return (hierarchyCreatingCounter_s > 0); }
-
- /// Returns the parents of the class the Identifier belongs to.
- inline const std::set<const Identifier*>& getParents() const { return this->parents_; }
- /// Returns the begin-iterator of the parents-list.
- inline std::set<const Identifier*>::const_iterator getParentsBegin() const { return this->parents_.begin(); }
- /// Returns the end-iterator of the parents-list.
- inline std::set<const Identifier*>::const_iterator getParentsEnd() const { return this->parents_.end(); }
-
- /// Returns the children of the class the Identifier belongs to.
- inline const std::set<const Identifier*>& getChildren() const { return this->children_; }
- /// Returns the begin-iterator of the children-list.
- inline std::set<const Identifier*>::const_iterator getChildrenBegin() const { return this->children_.begin(); }
- /// Returns the end-iterator of the children-list.
- inline std::set<const Identifier*>::const_iterator getChildrenEnd() const { return this->children_.end(); }
-
- /// Returns the direct parents of the class the Identifier belongs to.
- inline const std::set<const Identifier*>& getDirectParents() const { return this->directParents_; }
- /// Returns the begin-iterator of the direct-parents-list.
- inline std::set<const Identifier*>::const_iterator getDirectParentsBegin() const { return this->directParents_.begin(); }
- /// Returns the end-iterator of the direct-parents-list.
- inline std::set<const Identifier*>::const_iterator getDirectParentsEnd() const { return this->directParents_.end(); }
-
- /// Returns the direct children the class the Identifier belongs to.
- inline const std::set<const Identifier*>& getDirectChildren() const { return this->directChildren_; }
- /// Returns the begin-iterator of the direct-children-list.
- inline std::set<const Identifier*>::const_iterator getDirectChildrenBegin() const { return this->directChildren_.begin(); }
- /// Returns the end-iterator of the direct-children-list.
- inline std::set<const Identifier*>::const_iterator getDirectChildrenEnd() const { return this->directChildren_.end(); }
-
-
- //////////////////////////
- ///// Identifier Map /////
- //////////////////////////
- static void destroyAllIdentifiers();
-
- static Identifier* getIdentifierByString(const std::string& name);
- static Identifier* getIdentifierByLowercaseString(const std::string& name);
- static Identifier* getIdentifierByID(uint32_t id);
-
- static void clearNetworkIDs();
-
- /// Returns the map that stores all Identifiers with their names.
- static inline const std::map<std::string, Identifier*>& getStringIdentifierMap() { return Identifier::getStringIdentifierMapIntern(); }
- /// Returns a const_iterator to the beginning of the map that stores all Identifiers with their names.
- static inline std::map<std::string, Identifier*>::const_iterator getStringIdentifierMapBegin() { return Identifier::getStringIdentifierMap().begin(); }
- /// Returns a const_iterator to the end of the map that stores all Identifiers with their names.
- static inline std::map<std::string, Identifier*>::const_iterator getStringIdentifierMapEnd() { return Identifier::getStringIdentifierMap().end(); }
-
- /// Returns the map that stores all Identifiers with their names in lowercase.
- static inline const std::map<std::string, Identifier*>& getLowercaseStringIdentifierMap() { return Identifier::getLowercaseStringIdentifierMapIntern(); }
- /// Returns a const_iterator to the beginning of the map that stores all Identifiers with their names in lowercase.
- static inline std::map<std::string, Identifier*>::const_iterator getLowercaseStringIdentifierMapBegin() { return Identifier::getLowercaseStringIdentifierMap().begin(); }
- /// Returns a const_iterator to the end of the map that stores all Identifiers with their names in lowercase.
- static inline std::map<std::string, Identifier*>::const_iterator getLowercaseStringIdentifierMapEnd() { return Identifier::getLowercaseStringIdentifierMap().end(); }
-
- /// Returns the map that stores all Identifiers with their IDs.
- static inline const std::map<uint32_t, Identifier*>& getIDIdentifierMap() { return Identifier::getIDIdentifierMapIntern(); }
- /// Returns a const_iterator to the beginning of the map that stores all Identifiers with their IDs.
- static inline std::map<uint32_t, Identifier*>::const_iterator getIDIdentifierMapBegin() { return Identifier::getIDIdentifierMap().begin(); }
- /// Returns a const_iterator to the end of the map that stores all Identifiers with their IDs.
- static inline std::map<uint32_t, Identifier*>::const_iterator getIDIdentifierMapEnd() { return Identifier::getIDIdentifierMap().end(); }
-
-
- /////////////////////////
- ///// Config Values /////
- /////////////////////////
- virtual void updateConfigValues(bool updateChildren = true) const = 0;
-
- /// Returns true if this class has at least one config value.
- inline bool hasConfigValues() const { return this->bHasConfigValues_; }
-
- void addConfigValueContainer(const std::string& varname, ConfigValueContainer* container);
- ConfigValueContainer* getConfigValueContainer(const std::string& varname);
-
-
- ///////////////////
- ///// XMLPort /////
- ///////////////////
- /// Returns the map that stores all XMLPort params.
- inline const std::map<std::string, XMLPortParamContainer*>& getXMLPortParamMap() const { return this->xmlportParamContainers_; }
- /// Returns a const_iterator to the beginning of the map that stores all XMLPort params.
- inline std::map<std::string, XMLPortParamContainer*>::const_iterator getXMLPortParamMapBegin() const { return this->xmlportParamContainers_.begin(); }
- /// Returns a const_iterator to the end of the map that stores all XMLPort params.
- inline std::map<std::string, XMLPortParamContainer*>::const_iterator getXMLPortParamMapEnd() const { return this->xmlportParamContainers_.end(); }
-
- /// Returns the map that stores all XMLPort objects.
- inline const std::map<std::string, XMLPortObjectContainer*>& getXMLPortObjectMap() const { return this->xmlportObjectContainers_; }
- /// Returns a const_iterator to the beginning of the map that stores all XMLPort objects.
- inline std::map<std::string, XMLPortObjectContainer*>::const_iterator getXMLPortObjectMapBegin() const { return this->xmlportObjectContainers_.begin(); }
- /// Returns a const_iterator to the end of the map that stores all XMLPort objects.
- inline std::map<std::string, XMLPortObjectContainer*>::const_iterator getXMLPortObjectMapEnd() const { return this->xmlportObjectContainers_.end(); }
-
- void addXMLPortParamContainer(const std::string& paramname, XMLPortParamContainer* container);
- XMLPortParamContainer* getXMLPortParamContainer(const std::string& paramname);
-
- void addXMLPortObjectContainer(const std::string& sectionname, XMLPortObjectContainer* container);
- XMLPortObjectContainer* getXMLPortObjectContainer(const std::string& sectionname);
-
-
- protected:
- Identifier();
- Identifier(const Identifier& identifier); // don't copy
- virtual ~Identifier();
-
- static Identifier* getIdentifierSingleton(const std::string& name, Identifier* proposal);
- virtual void createSuperFunctionCaller() const = 0;
-
- void initializeClassHierarchy(std::set<const Identifier*>* parents, bool bRootClass);
-
- /// Returns the map that stores all Identifiers with their names.
- static std::map<std::string, Identifier*>& getStringIdentifierMapIntern();
- /// Returns the map that stores all Identifiers with their names in lowercase.
- static std::map<std::string, Identifier*>& getLowercaseStringIdentifierMapIntern();
- /// Returns the map that stores all Identifiers with their network IDs.
- static std::map<uint32_t, Identifier*>& getIDIdentifierMapIntern();
-
- /// Returns the children of the class the Identifier belongs to.
- inline std::set<const Identifier*>& getChildrenIntern() const { return this->children_; }
- /// Returns the direct children of the class the Identifier belongs to.
- inline std::set<const Identifier*>& getDirectChildrenIntern() const { return this->directChildren_; }
-
- ObjectListBase* objects_; //!< The list of all objects of this class
-
- private:
- /// Increases the hierarchyCreatingCounter_s variable, causing all new objects to store their parents.
- inline static void startCreatingHierarchy() { hierarchyCreatingCounter_s++; }
- /// Decreases the hierarchyCreatingCounter_s variable, causing the objects to stop storing their parents.
- inline static void stopCreatingHierarchy() { hierarchyCreatingCounter_s--; }
-
- static std::map<std::string, Identifier*>& getTypeIDIdentifierMap();
-
- void initialize(std::set<const Identifier*>* parents);
-
- std::set<const Identifier*> parents_; //!< The parents of the class the Identifier belongs to
- mutable std::set<const Identifier*> children_; //!< The children of the class the Identifier belongs to
-
- std::set<const Identifier*> directParents_; //!< The direct parents of the class the Identifier belongs to
- mutable std::set<const Identifier*> directChildren_; //!< The direct children of the class the Identifier belongs to
-
- bool bCreatedOneObject_; //!< True if at least one object of the given type was created (used to determine the need of storing the parents)
- bool bSetName_; //!< True if the name is set
- bool bLoadable_; //!< False = it's not permitted to load the object through XML
- std::string name_; //!< The name of the class the Identifier belongs to
- Factory* factory_; //!< The Factory, able to create new objects of the given class (if available)
- static int hierarchyCreatingCounter_s; //!< Bigger than zero if at least one Identifier stores its parents (its an int instead of a bool to avoid conflicts with multithreading)
- uint32_t networkID_; //!< The network ID to identify a class through the network
- const unsigned int classID_; //!< Uniquely identifies a class (might not be the same as the networkID_)
- static unsigned int classIDCounter_s; //!< Static counter for the unique classIDs
-
- bool bHasConfigValues_; //!< True if this class has at least one assigned config value
- std::map<std::string, ConfigValueContainer*> configValues_; //!< A map to link the string of configurable variables with their ConfigValueContainer
-
- std::map<std::string, XMLPortParamContainer*> xmlportParamContainers_; //!< All loadable parameters
- std::map<std::string, XMLPortObjectContainer*> xmlportObjectContainers_; //!< All attachable objects
- };
-
- _CoreExport std::ostream& operator<<(std::ostream& out, const std::set<const Identifier*>& list);
-
-
- // ###############################
- // ### ClassIdentifier ###
- // ###############################
- /**
- @brief The ClassIdentifier is derived from Identifier and holds all class-specific functions and variables the Identifier cannot have.
-
- ClassIdentifier is a Singleton, which means that only one ClassIdentifier for a given type T exists.
- This makes it possible to store information about a class, sharing them with all
- objects of that class without defining static variables in every class.
-
- To be really sure that not more than exactly one object exists (even with libraries),
- ClassIdentifiers are stored in a static map in Identifier.
- */
- template <class T>
- class ClassIdentifier : public Identifier
- {
- #ifndef DOXYGEN_SHOULD_SKIP_THIS
- #define SUPER_INTRUSIVE_DECLARATION_INCLUDE
- #include "Super.h"
- #endif
-
- public:
- static ClassIdentifier<T>* getIdentifier();
- static ClassIdentifier<T>* getIdentifier(const std::string& name);
-
- bool initialiseObject(T* object, const std::string& className, bool bRootClass);
-
- void updateConfigValues(bool updateChildren = true) const;
-
- private:
- static void initialiseIdentifier();
- ClassIdentifier(const ClassIdentifier<T>& identifier) {} // don't copy
- ClassIdentifier()
- {
- SuperFunctionInitialization<0, T>::initialize(this);
- }
- ~ClassIdentifier()
- {
- SuperFunctionDestruction<0, T>::destroy(this);
- }
-
- static ClassIdentifier<T>* classIdentifier_s;
- };
-
- template <class T>
- ClassIdentifier<T>* ClassIdentifier<T>::classIdentifier_s = 0;
-
- /**
- @brief Returns the only instance of this class.
- @return The unique Identifier
- */
- template <class T>
- inline ClassIdentifier<T>* ClassIdentifier<T>::getIdentifier()
- {
- // check if the Identifier already exists
- if (!ClassIdentifier<T>::classIdentifier_s)
- ClassIdentifier<T>::initialiseIdentifier();
-
- return ClassIdentifier<T>::classIdentifier_s;
- }
-
- /**
- @brief Does the same as getIdentifier() but sets the name if this wasn't done yet.
- @param name The name of this Identifier
- @return The Identifier
- */
- template <class T>
- inline ClassIdentifier<T>* ClassIdentifier<T>::getIdentifier(const std::string& name)
- {
- ClassIdentifier<T>* identifier = ClassIdentifier<T>::getIdentifier();
- identifier->setName(name);
- return identifier;
- }
-
- /**
- @brief Assigns the static field for the identifier singleton.
- */
- template <class T>
- void ClassIdentifier<T>::initialiseIdentifier()
- {
- // Get the name of the class
- std::string name = typeid(T).name();
-
- // create a new identifier anyway. Will be deleted in Identifier::getIdentifier if not used.
- ClassIdentifier<T>* proposal = new ClassIdentifier<T>();
-
- // Get the entry from the map
- ClassIdentifier<T>::classIdentifier_s = (ClassIdentifier<T>*)Identifier::getIdentifierSingleton(name, proposal);
-
- if (ClassIdentifier<T>::classIdentifier_s == proposal)
- {
- orxout(verbose, context::identifier) << "Requested Identifier for " << name << " was not yet existing and got created." << endl;
- }
- else
- {
- orxout(verbose, context::identifier) << "Requested Identifier for " << name << " was already existing and got assigned." << endl;
- }
- }
-
- /**
- @brief Adds an object of the given type to the ObjectList.
- @param object The object to add
- @param className The name of the class T
- @param bRootClass True if this is a root class (i.e. it inherits directly from OrxonoxClass)
- */
- template <class T>
- bool ClassIdentifier<T>::initialiseObject(T* object, const std::string& className, bool bRootClass)
- {
- if (bRootClass)
- orxout(verbose, context::object_list) << "Register Root-Object: " << className << endl;
- else
- orxout(verbose, context::object_list) << "Register Object: " << className << endl;
-
- object->identifier_ = this;
- if (Identifier::isCreatingHierarchy())
- {
- if (bRootClass && !object->parents_)
- object->parents_ = new std::set<const Identifier*>();
-
- if (object->parents_)
- {
- this->initializeClassHierarchy(object->parents_, bRootClass);
- object->parents_->insert(object->parents_->end(), this);
- }
-
- object->setConfigValues();
- return true;
- }
- else
- {
- orxout(verbose, context::object_list) << "Added object to " << this->getName() << "-list." << endl;
- object->metaList_->add(this->objects_, this->objects_->add(new ObjectListElement<T>(object)));
-
- // Add pointer of type T to the map in the OrxonoxClass instance that enables "dynamic_casts"
- object->objectPointers_.push_back(std::make_pair(this->getClassID(), static_cast<void*>(object)));
- return false;
- }
- }
-
- /**
- @brief Updates the config-values of all existing objects of this class by calling their setConfigValues() function.
- */
- template <class T>
- void ClassIdentifier<T>::updateConfigValues(bool updateChildren) const
- {
- if (!this->hasConfigValues())
- return;
-
- for (ObjectListIterator<T> it = ObjectList<T>::begin(); it; ++it)
- it->setConfigValues();
-
- if (updateChildren)
- for (std::set<const Identifier*>::const_iterator it = this->getChildrenBegin(); it != this->getChildrenEnd(); ++it)
- (*it)->updateConfigValues(false);
- }
-
-
- // ###############################
- // ### orxonox_cast ###
- // ###############################
- /**
- @brief
- Casts on object of type OrxonoxClass to any derived type that is
- registered in the class hierarchy.
- @return
- Returns NULL if the cast is not possible
- @note
- In case of NULL return (and using MSVC), a dynamic_cast might still be possible if
- a class forgot to register its objects.
- Also note that the function is implemented differently for GCC/MSVC.
- */
- template <class T, class U>
- ORX_FORCEINLINE T orxonox_cast(U* source)
- {
-#ifdef ORXONOX_COMPILER_MSVC
- typedef Loki::TypeTraits<typename Loki::TypeTraits<T>::PointeeType>::NonConstType ClassType;
- if (source != NULL)
- return source->template getDerivedPointer<ClassType>(ClassIdentifier<ClassType>::getIdentifier()->getClassID());
- else
- return NULL;
-#else
- return dynamic_cast<T>(source);
-#endif
- }
-}
-
-#endif /* _Identifier_H__ */
Deleted: code/branches/core6/src/libraries/core/OrxonoxClass.cc
===================================================================
--- code/branches/core6/src/libraries/core/OrxonoxClass.cc 2013-03-24 15:16:01 UTC (rev 9562)
+++ code/branches/core6/src/libraries/core/OrxonoxClass.cc 2013-03-24 16:33:43 UTC (rev 9563)
@@ -1,141 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-/**
- @file
- @brief Implementation of OrxonoxClass.
-*/
-
-#include "OrxonoxClass.h"
-
-#include <cassert>
-#include "object/MetaObjectList.h"
-#include "object/Context.h"
-#include "Identifier.h"
-
-namespace orxonox
-{
- /**
- @brief Constructor: Sets the default values.
- */
- OrxonoxClass::OrxonoxClass()
- {
- this->identifier_ = 0;
- this->parents_ = 0;
- this->metaList_ = new MetaObjectList();
- this->referenceCount_ = 0;
- this->requestedDestruction_ = false;
- // Optimisation
- this->objectPointers_.reserve(6);
- }
-
- /**
- @brief Destructor: Removes the object from the object-lists, notifies all DestructionListener (for example @ref WeakPtr "weak pointers") that this object is being deleted.
- */
- OrxonoxClass::~OrxonoxClass()
- {
-// if (!this->requestedDestruction_)
-// orxout(internal_warning) << "Destroyed object without destroy() (" << this->getIdentifier()->getName() << ')' << endl;
-
- assert(this->referenceCount_ <= 0);
-
- this->unregisterObject();
-
- // parents_ exists only if isCreatingHierarchy() of the associated Identifier returned true while creating the class
- if (this->parents_)
- delete this->parents_;
-
- // notify all destruction listeners
- for (std::set<DestructionListener*>::iterator it = this->destructionListeners_.begin(); it != this->destructionListeners_.end(); )
- (*(it++))->objectDeleted();
- }
-
- /**
- @brief Deletes the object if no @ref orxonox::SmartPtr "smart pointers" point to this object. Otherwise schedules the object to be deleted as soon as possible.
- */
- void OrxonoxClass::destroy()
- {
- assert(this); // Just in case someone tries to delete a NULL pointer
- this->requestedDestruction_ = true;
- if (this->referenceCount_ == 0)
- {
- this->preDestroy();
- if (this->referenceCount_ == 0)
- delete this;
- }
- }
-
- /**
- @brief Removes this object from the object-lists.
- */
- void OrxonoxClass::unregisterObject()
- {
- if (this->metaList_)
- delete this->metaList_;
- this->metaList_ = 0;
- }
-
- /// Returns true if the object's class is of the given type or a derivative.
- bool OrxonoxClass::isA(const Identifier* identifier)
- { return this->getIdentifier()->isA(identifier); }
- /// Returns true if the object's class is exactly of the given type.
- bool OrxonoxClass::isExactlyA(const Identifier* identifier)
- { return this->getIdentifier()->isExactlyA(identifier); }
- /// Returns true if the object's class is a child of the given type.
- bool OrxonoxClass::isChildOf(const Identifier* identifier)
- { return this->getIdentifier()->isChildOf(identifier); }
- /// Returns true if the object's class is a direct child of the given type.
- bool OrxonoxClass::isDirectChildOf(const Identifier* identifier)
- { return this->getIdentifier()->isDirectChildOf(identifier); }
- /// Returns true if the object's class is a parent of the given type.
- bool OrxonoxClass::isParentOf(const Identifier* identifier)
- { return this->getIdentifier()->isParentOf(identifier); }
- /// Returns true if the object's class is a direct parent of the given type.
- bool OrxonoxClass::isDirectParentOf(const Identifier* identifier)
- { return this->getIdentifier()->isDirectParentOf(identifier); }
-
-
- /// Returns true if the object's class is of the given type or a derivative.
- bool OrxonoxClass::isA(const OrxonoxClass* object)
- { return this->getIdentifier()->isA(object->getIdentifier()); }
- /// Returns true if the object's class is exactly of the given type.
- bool OrxonoxClass::isExactlyA(const OrxonoxClass* object)
- { return this->getIdentifier()->isExactlyA(object->getIdentifier()); }
- /// Returns true if the object's class is a child of the given type.
- bool OrxonoxClass::isChildOf(const OrxonoxClass* object)
- { return this->getIdentifier()->isChildOf(object->getIdentifier()); }
- /// Returns true if the object's class is a direct child of the given type.
- bool OrxonoxClass::isDirectChildOf(const OrxonoxClass* object)
- { return this->getIdentifier()->isDirectChildOf(object->getIdentifier()); }
- /// Returns true if the object's class is a parent of the given type.
- bool OrxonoxClass::isParentOf(const OrxonoxClass* object)
- { return this->getIdentifier()->isParentOf(object->getIdentifier()); }
- /// Returns true if the object's class is a direct child of the given type.
- bool OrxonoxClass::isDirectParentOf(const OrxonoxClass* object)
- { return this->getIdentifier()->isDirectParentOf(object->getIdentifier()); }
-}
Deleted: code/branches/core6/src/libraries/core/OrxonoxClass.h
===================================================================
--- code/branches/core6/src/libraries/core/OrxonoxClass.h 2013-03-24 15:16:01 UTC (rev 9562)
+++ code/branches/core6/src/libraries/core/OrxonoxClass.h 2013-03-24 16:33:43 UTC (rev 9563)
@@ -1,199 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-/**
- @defgroup OrxonoxClass OrxonoxClass
- @ingroup Class
-*/
-
-/**
- @file
- @ingroup Class OrxonoxClass
- @brief Declaration of OrxonoxClass, the base class of all objects and interfaces in Orxonox.
-
- All objects and interfaces of the game-logic (not the engine) are derived from OrxonoxClass.
- It stores the Identifier and the MetaObjectList and has all needed functions to create and use the class-hierarchy.
-*/
-
-#ifndef _OrxonoxClass_H__
-#define _OrxonoxClass_H__
-
-#include "CorePrereqs.h"
-
-#include <set>
-#include <vector>
-#include "Super.h"
-
-namespace orxonox
-{
- /**
- @brief The class all objects and interfaces of the game-logic (not the engine) are derived from.
-
- The BaseObject and Interfaces are derived with @c virtual @c public @c OrxonoxClass from OrxonoxClass.
- OrxonoxClass is needed to create the class-hierarchy at startup and to store the Identifier and the
- MetaObjectList, as well as to provide an interface for SmartPtr and WeakPtr.
- */
- class _CoreExport OrxonoxClass
- {
- template <class T>
- friend class ClassIdentifier;
-
- template <class T>
- friend class SmartPtr;
-
- friend class DestructionListener;
-
- public:
- OrxonoxClass();
- virtual ~OrxonoxClass();
-
- void destroy();
- void unregisterObject();
-
- /// Function to collect the SetConfigValue-macro calls.
- void setConfigValues() {};
-
- /// Returns the Identifier of the object.
- inline Identifier* getIdentifier() const { return this->identifier_; }
-
- bool isA(const Identifier* identifier);
- bool isExactlyA(const Identifier* identifier);
- bool isChildOf(const Identifier* identifier);
- bool isDirectChildOf(const Identifier* identifier);
- bool isParentOf(const Identifier* identifier);
- bool isDirectParentOf(const Identifier* identifier);
-
- /// Returns true if the object's class is of the given type or a derivative.
- template <class B> inline bool isA(const SubclassIdentifier<B>* identifier)
- { return this->isA(*identifier); }
- /// Returns true if the object's class is exactly of the given type.
- template <class B> inline bool isExactlyA(const SubclassIdentifier<B>* identifier)
- { return this->isExactlyA(*identifier); }
- /// Returns true if the object's class is a child of the given type.
- template <class B> inline bool isChildOf(const SubclassIdentifier<B>* identifier)
- { return this->isChildOf(*identifier); }
- /// Returns true if the object's class is a direct child of the given type.
- template <class B> inline bool isDirectChildOf(const SubclassIdentifier<B>* identifier)
- { return this->isDirectChildOf(*identifier); }
- /// Returns true if the object's class is a parent of the given type.
- template <class B> inline bool isParentOf(const SubclassIdentifier<B>* identifier)
- { return this->isParentOf(*identifier); }
- /// Returns true if the object's class is a direct parent of the given type.
- template <class B> inline bool isDirectParentOf(const SubclassIdentifier<B>* identifier)
- { return this->isDirectParentOf(*identifier); }
-
- bool isA(const OrxonoxClass* object);
- bool isExactlyA(const OrxonoxClass* object);
- bool isChildOf(const OrxonoxClass* object);
- bool isDirectChildOf(const OrxonoxClass* object);
- bool isParentOf(const OrxonoxClass* object);
- bool isDirectParentOf(const OrxonoxClass* object);
-
- /// Returns the number of @ref orxonox::SmartPtr "smart pointers" that point to this object.
- inline unsigned int getReferenceCount() const
- { return this->referenceCount_; }
-
- /**
- @brief
- Returns a valid pointer of any derived type that is
- registered in the class hierarchy.
- @return
- Returns NULL if the no pointer was found.
- */
- ORX_FORCEINLINE void* getDerivedPointer(unsigned int classID)
- {
- for (int i = this->objectPointers_.size() - 1; i >= 0; --i)
- {
- if (this->objectPointers_[i].first == classID)
- return this->objectPointers_[i].second;
- }
- return NULL;
- }
-
- /// Version of getDerivedPointer with template
- template <class T> ORX_FORCEINLINE T* getDerivedPointer(unsigned int classID)
- { return static_cast<T*>(this->getDerivedPointer(classID)); }
- /// Const version of getDerivedPointer with template
- template <class T> ORX_FORCEINLINE const T* getDerivedPointer(unsigned int classID) const
- { return const_cast<OrxonoxClass*>(this)->getDerivedPointer<T>(classID); }
-
- protected:
- /// This virtual function is called if destroy() is called and no SmartPtr points to this object. Used in some cases to create a new SmartPtr to prevent destruction.
- virtual void preDestroy() {}
-
- private:
- /// Increments the reference counter (for smart pointers).
- inline void incrementReferenceCount()
- { ++this->referenceCount_; }
- /// Decrements the reference counter (for smart pointers).
- inline void decrementReferenceCount()
- {
- --this->referenceCount_;
- if (this->referenceCount_ == 0 && this->requestedDestruction_)
- this->destroy();
- }
-
- /// Register a destruction listener (for example a weak pointer which points to this object).
- inline void registerDestructionListener(DestructionListener* pointer)
- { this->destructionListeners_.insert(pointer); }
- /// Unegister a destruction listener (for example a weak pointer which pointed to this object before).
- inline void unregisterDestructionListener(DestructionListener* pointer)
- { this->destructionListeners_.erase(pointer); }
-
- Identifier* identifier_; //!< The Identifier of the object
- std::set<const Identifier*>* parents_; //!< List of all parents of the object
- MetaObjectList* metaList_; //!< MetaObjectList, containing all ObjectLists and ObjectListElements the object is registered in
- int referenceCount_; //!< Counts the references from smart pointers to this object
- bool requestedDestruction_; //!< Becomes true after someone called delete on this object
- std::set<DestructionListener*> destructionListeners_; //!< All destruction listeners (for example weak pointers which point to this object and like to get notified if it dies)
-
- /// 'Fast map' that holds this-pointers of all derived types
- std::vector<std::pair<unsigned int, void*> > objectPointers_;
- };
-
- /**
- @brief This listener is used to inform weak pointers if an object of type OrxonoxClass gets destroyed.
- */
- class _CoreExport DestructionListener
- {
- friend class OrxonoxClass;
-
- protected:
- virtual ~DestructionListener() {}
-
- inline void registerAsDestructionListener(OrxonoxClass* object)
- { if (object) { object->registerDestructionListener(this); } }
- inline void unregisterAsDestructionListener(OrxonoxClass* object)
- { if (object) { object->unregisterDestructionListener(this); } }
-
- virtual void objectDeleted() = 0;
- };
-
-}
-
-#endif /* _OrxonoxClass_H__ */
Deleted: code/branches/core6/src/libraries/core/SubclassIdentifier.h
===================================================================
--- code/branches/core6/src/libraries/core/SubclassIdentifier.h 2013-03-24 15:16:01 UTC (rev 9562)
+++ code/branches/core6/src/libraries/core/SubclassIdentifier.h 2013-03-24 16:33:43 UTC (rev 9563)
@@ -1,204 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-/**
- @file
- @ingroup Class Identifier
- @brief Definition of SubclassIdentifier.
-
- @anchor SubclassIdentifierExample
-
- SubclassIdentifier is a separated class, acting like an Identifier, but has a given class.
- You can only assign Identifiers of exactly the given class or of a derivative to a SubclassIdentifier.
-
- Example:
-
- You can assign an Identifier either through the constructor or by using the assignment @c operator=:
- @code
- SubclassIdentifier<BaseClass> identifier = Class(SubClass);
- @endcode
-
- The @c operator-> is overloaded an returns the assigned Identifier. That way you can just call
- functions of the assigned Identifier by using @c ->function():
- @code
- SubclassIdentifier<BaseClass> identifier = Class(SubClass);
- identifier->getName(); // returns "SubClass"
- @endcode
-
- There are two possibilities to create an object out of a SubclassIdentifier: Either you just use
- the @c fabricate() function of the assigned Identifier through the overloaded @c operator->, which
- returns a @c OrxonoxClass* pointer, or you use the function of SubclassIdentifier, this time by using
- @c operator., which returns a @c BaseClass* pointer (@a BaseClass is the baseclass specified by the
- template argument):
- @code
- identifier->fabricate(); // calls Identifier::fabricate(), creates a SubClass, returns a OrxonoxClass* pointer
-
- identifier.fabricate(); // calls SubclassIdentifier::fabricate(), creates a SubClass, returns a BaseClass* pointer
- @endcode
-*/
-
-#ifndef _SubclassIdentifier_H__
-#define _SubclassIdentifier_H__
-
-#include "CorePrereqs.h"
-
-#include <cstdlib>
-#include "util/Output.h"
-#include "Identifier.h"
-
-namespace orxonox
-{
- // ###############################
- // ### SubclassIdentifier ###
- // ###############################
- /**
- @brief The SubclassIdentifier acts almost like an Identifier, but has some prerequisites.
-
- You can only assign an Identifier that belongs to a class T (or derived) to a SubclassIdentifier<T>.
- If you assign something else, the program prints an error.
-
- Because we know the base-type, a @c dynamic_cast is done, which makes it easier to create a new object.
-
- @see See @ref SubclassIdentifierExample "SubclassIdentifier.h" for some examples.
- */
- template <class T>
- class SubclassIdentifier
- {
- public:
- /// Constructor: Automaticaly assigns the Identifier of the given class.
- SubclassIdentifier()
- {
- this->identifier_ = ClassIdentifier<T>::getIdentifier();
- }
-
- /// Constructor: Assigns the given Identifier.
- SubclassIdentifier(Identifier* identifier)
- {
- this->operator=(identifier);
- }
-
- /// Copyconstructor: Assigns the identifier of another SubclassIdentifier.
- template <class O>
- SubclassIdentifier(const SubclassIdentifier<O>& identifier)
- {
- this->operator=(identifier.getIdentifier());
- }
-
- /**
- @brief Overloading of the = operator: assigns the identifier and checks its type.
- @param identifier The Identifier to assign
- @return The SubclassIdentifier itself
- */
- SubclassIdentifier<T>& operator=(Identifier* identifier)
- {
- if (!identifier || !identifier->isA(ClassIdentifier<T>::getIdentifier()))
- {
- orxout(internal_error) << "An error occurred in SubclassIdentifier (Identifier.h):" << endl;
- if (identifier)
- {
- orxout(internal_error) << "Class " << identifier->getName() << " is not a " << ClassIdentifier<T>::getIdentifier()->getName() << '!' << endl;
- orxout(internal_error) << "SubclassIdentifier<" << ClassIdentifier<T>::getIdentifier()->getName() << "> = Class(" << identifier->getName() << ") is forbidden." << endl;
- }
- else
- {
- orxout(internal_error) << "Can't assign NULL identifier" << endl;
- }
- }
- else
- {
- this->identifier_ = identifier;
- }
- return *this;
- }
-
- /// Overloading of the = operator: assigns the identifier of another SubclassIdentifier.
- template <class O>
- SubclassIdentifier<T>& operator=(const SubclassIdentifier<O>& identifier)
- {
- return this->operator=(identifier.getIdentifier());
- }
-
- /// Overloading of the * operator: returns the assigned identifier.
- inline Identifier* operator*() const
- {
- return this->identifier_;
- }
-
- /// Overloading of the -> operator: returns the assigned identifier.
- inline Identifier* operator->() const
- {
- return this->identifier_;
- }
-
- /// Returns the assigned identifier. This allows you to assign a SubclassIdentifier to a normal Identifier*.
- inline operator Identifier*() const
- {
- return this->identifier_;
- }
-
- /// Creates a new object of the type of the assigned Identifier and dynamic_casts it to the minimal type given by T.
- T* fabricate(BaseObject* creator) const
- {
- OrxonoxClass* newObject = this->identifier_->fabricate(creator);
-
- // Check if the creation was successful
- if (newObject)
- {
- return orxonox_cast<T*>(newObject);
- }
- else
- {
- // Something went terribly wrong
- if (this->identifier_)
- {
- orxout(user_error) << "An error occurred in SubclassIdentifier (Identifier.h):" << endl;
- orxout(user_error) << "Class " << this->identifier_->getName() << " is not a " << ClassIdentifier<T>::getIdentifier()->getName() << '!' << endl;
- orxout(user_error) << "Couldn't fabricate a new Object." << endl;
- }
- else
- {
- orxout(user_error) << "An error occurred in SubclassIdentifier (Identifier.h):" << endl;
- orxout(user_error) << "Couldn't fabricate a new Object - Identifier is undefined." << endl;
- }
-
- orxout(user_error) << "Aborting..." << endl;
- abort();
- return 0;
- }
- }
-
- /// Returns the assigned identifier.
- inline Identifier* getIdentifier() const
- { return this->identifier_; }
-
- private:
- Identifier* identifier_; //!< The assigned identifier
- };
-}
-
-#endif /* _SubclassIdentifier_H__ */
Deleted: code/branches/core6/src/libraries/core/Super.h
===================================================================
--- code/branches/core6/src/libraries/core/Super.h 2013-03-24 15:16:01 UTC (rev 9562)
+++ code/branches/core6/src/libraries/core/Super.h 2013-03-24 16:33:43 UTC (rev 9563)
@@ -1,634 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-/**
- @defgroup Super Super
- @ingroup Class
-*/
-
-/**
- @file
- @ingroup Class Super
- @brief Definition of all super-function related macros, used to call functions of the base class.
-
- This file defines all macros needed to add a new "super-function". If you add
- a super-function, you can call <tt>SUPER(myclass, functionname, arguments)</tt>
- inside your code and the function of the parent-class gets called. This is comparable
- to <tt>super.functionname(arguments)</tt> in Java or other languages.
-
- This works only with virtual functions that return nothing (@c void) and belong to
- classes that have an @ref orxonox::Identifier "Identifier". Arguments however are
- supported, there's no limitation for their number and type, except that the type has
- to be known in Super.h.
-
- To add a new super-function, you have to process 4 steps:
-
- -# Add a new @c SUPER macro <br />
- This allows you to call the super-function in your code. <br />
- Location: This file (Super.h), marked with "--> HERE <--" comments (1/3)
- -# Call the @c SUPER_FUNCTION_GLOBAL_DECLARATION_PART1/2 macros. <br />
- This defines some global classes and templates, needed to create and call the super-functions. <br />
- Location: This file (Super.h), marked with "--> HERE <--" comments (2/3)
- -# Call the @c SUPER_INTRUSIVE_DECLARATION macro. <br />
- This will be included into the declaration of @c ClassIdentifier<T>. <br />
- Location: This file (Super.h), marked with "--> HERE <--" comments (3/3)
- -# Call the @c SUPER_FUNCTION macro. <br />
- This defines a partially specialized template that will decide if a class is "super" to another class.
- If the check returns true, a @c SuperFunctionCaller gets created, which will be used by the @c SUPER macro.
- You have to add this into the header-file of the baseclass of the super-function (the class that first
- implements the function), below the class declaration. You can't call it directly in this file, because
- otherwise you had to include the headerfile right here, which would cause some ugly back-dependencies,
- include loops and slower compilation. <br />
- Dont forget to include Super.h in the header-file. <br />
- Location: The header-file of the baseclass (Baseclass.h), below the class declaration
-*/
-
-#ifndef _Super_H__
-#define _Super_H__
-
-#include "CorePrereqs.h"
-#include "util/Output.h"
-
-///////////////////////
-// Macro definitions //
-///////////////////////
-
-//// Common macros ////
-
- /**
- @brief Declares a new super-function by creating a specialized template. Add this below the class declaration of the baseclass.
- @param functionnumber Each super-function needs a unique number, starting with zero, increasing by one
- @param baseclass The baseclass of the super-function (~the root)
- @param functionname The name of the super-function
- @param purevirtualbase "true" if the function is pure virtual in the baseclass, "false" if the function is implemented (without "")
- */
- #define SUPER_FUNCTION(functionnumber, baseclass, functionname, purevirtualbase) \
- template <class T, int templatehack2> \
- struct SuperFunctionCondition<functionnumber, T, 0, templatehack2> \
- { \
- static void superCheck() \
- { \
- SuperFunctionCondition<functionnumber, T, 0, templatehack2>::apply(static_cast<T*>(0)); \
- SuperFunctionCondition<functionnumber + 1, T, 0, templatehack2>::superCheck(); \
- } \
- \
- static void apply(void*) {} \
- \
- static void apply(baseclass*) \
- { \
- ClassIdentifier<T>* identifier = ClassIdentifier<T>::getIdentifier(); \
- for (std::set<const Identifier*>::iterator it = identifier->getDirectChildrenIntern().begin(); it != identifier->getDirectChildrenIntern().end(); ++it) \
- { \
- if (((ClassIdentifier<T>*)(*it))->bSuperFunctionCaller_##functionname##_isFallback_ && ((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_) \
- { \
- delete ((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_; \
- ((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_ = 0; \
- ((ClassIdentifier<T>*)(*it))->bSuperFunctionCaller_##functionname##_isFallback_ = false; \
- } \
- \
- if (!((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_) \
- { \
- orxout(verbose, context::super) << "Added SuperFunctionCaller for " << #functionname << ": " << ClassIdentifier<T>::getIdentifier()->getName() << " <- " << ((ClassIdentifier<T>*)(*it))->getName() << endl; \
- ((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_ = new SuperFunctionClassCaller_##functionname <T>; \
- } \
- else if (((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_->getParentIdentifier() != ClassIdentifier<T>::getIdentifier()) \
- orxout(internal_warning, context::super) << "SuperFunctionCaller for " << #functionname << " in " << ((ClassIdentifier<T>*)(*it))->getName() << " calls function of " << ((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_->getParentIdentifier()->getName() << " but " << ClassIdentifier<T>::getIdentifier()->getName() << " is also possible (do you use multiple inheritance?)" << endl; \
- } \
- } \
- }; \
- \
- SUPER_FUNCTION_PUREVIRTUAL_WORKAROUND##purevirtualbase(functionnumber, baseclass)
-
- #define SUPER_FUNCTION_PUREVIRTUAL_WORKAROUND0(functionnumber, baseclass) SUPER_FUNCTION_PUREVIRTUAL_WORKAROUNDfalse(functionnumber, baseclass)
- #define SUPER_FUNCTION_PUREVIRTUAL_WORKAROUND1(functionnumber, baseclass) SUPER_FUNCTION_PUREVIRTUAL_WORKAROUNDtrue(functionnumber, baseclass)
- #define SUPER_FUNCTION_PUREVIRTUAL_WORKAROUNDfalse(functionnumber, baseclass)
- #define SUPER_FUNCTION_PUREVIRTUAL_WORKAROUNDtrue(functionnumber, baseclass) \
- template <int templatehack2> \
- struct SuperFunctionCondition<functionnumber, baseclass, 0, templatehack2> \
- { \
- static void superCheck() \
- { \
- SuperFunctionCondition<functionnumber + 1, baseclass, 0, templatehack2>::superCheck(); \
- } \
- };
-
-
- /*
- //// Comments about the macro ////
-
- // Partially specialized template (templatehack is now specialized too).
- //
- // This ensures the compiler takes THIS template if the header-file of the super-function
- // is included. In any other case, the compiler just uses the fallback template which is
- // defined in this file.
- template <class T, templatehack2>
- struct SuperFunctionCondition<functionnumber, T, 0, templatehack2>
- {
- static void superCheck()
- {
- // This call to the apply-function is the whole check. By calling the function with
- // a T* pointer, the right function get's called.
- SuperFunctionCondition<functionnumber, T, 0, templatehack2>::apply(static_cast<T*>(0));
-
- // Go go the superCheck for of next super-function (functionnumber + 1)
- SuperFunctionCondition<functionnumber + 1, T, 0, templatehack2>::superCheck();
- }
-
- // This function gets called if T is not a child of the baseclass.
- // The function does nothing.
- static void apply(void* temp) {}
-
- // This function gets called if T is a child of the baseclass and can therefore be converted.
- // The function adds a SuperFunctionCaller to the Identifier of all subclasses of T.
- static void apply(baseclass* temp)
- {
- ClassIdentifier<T>* identifier = ClassIdentifier<T>::getIdentifier();
-
- // Iterate through all children
- for (std::set<const Identifier*>::iterator it = identifier->getDirectChildrenIntern().begin(); it != identifier->getDirectChildrenIntern().end(); ++it)
- {
- // Check if the caller is a fallback-caller
- if (((ClassIdentifier<T>*)(*it))->bSuperFunctionCaller_##functionname##_isFallback_ && ((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_)
- {
- // Delete the fallback caller an prepare to get a real caller
- delete ((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_;
- ((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_ = 0;
- ((ClassIdentifier<T>*)(*it))->bSuperFunctionCaller_##functionname##_isFallback_ = false;
- }
-
- // Check if there's not already a caller
- if (!((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_)
- {
- // Add the SuperFunctionCaller
- orxout(verbose, context::super) << "adding functionpointer to " << ((ClassIdentifier<T>*)(*it))->getName() << endl;
- ((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_ = new SuperFunctionClassCaller_##functionname <T>;
- }
-
- // If there is already a caller, but for another parent, print a warning
- else if (((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_->getParentIdentifier() != ClassIdentifier<T>::getIdentifier())
- orxout(internal_warning, context::super) << "SuperFunctionCaller for " << #functionname << " in " << ((ClassIdentifier<T>*)(*it))->getName() << " calls function of " << ((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_->getParentIdentifier()->getName() << " but " << ClassIdentifier<T>::getIdentifier()->getName() << " is also possible (do you use multiple inheritance?)" << endl;
- }
- }
- };
- SUPER_FUNCTION_PUREVIRTUAL_WORKAROUND##purevirtualbase
-
-
- // The following piece of code is only added if purevirtualbase = true
-
- // Explicit specialization of the Condition template for the baseclass to avoid
- // errors if the function is pure virtual in the baseclass.
- template <int templatehack2> \
- struct SuperFunctionCondition<functionnumber, baseclass, 0, templatehack2> \
- { \
- // The superCheck function acts like the fallback - it advances to the check for the next super-function (functionnumber + 1)
- static void superCheck() \
- { \
- SuperFunctionCondition<functionnumber + 1, baseclass, 0, templatehack2>::superCheck(); \
- } \
- };
- */
-
- /// SUPER-macro: Calls Parent::functionname(...) where Parent is the direct parent of @a classname
- #ifdef ORXONOX_COMPILER_MSVC
- #define SUPER(classname, functionname, ...) \
- __super::functionname(__VA_ARGS__)
- #else
- #define SUPER(classname, functionname, ...) \
- SUPER_##functionname(classname, functionname, __VA_ARGS__)
- #endif
-
- // helper macro: for functions without arguments
- #define SUPER_NOARGS(classname, functionname) \
- (*ClassIdentifier<classname>::getIdentifier()->superFunctionCaller_##functionname##_)(this)
-
- // helper macro: for functions with arguments
- #define SUPER_ARGS(classname, functionname, ...) \
- (*ClassIdentifier<classname>::getIdentifier()->superFunctionCaller_##functionname##_)(this, __VA_ARGS__)
-
-
-//// Function-specific macros ////
-
- /*
- Add a macro for each super-function
-
- Example (no arguments):
- #define SUPER_myfunction(classname, functionname, ...) \
- SUPER_NOARGS(classname, functionname)
-
- Example (with arguments):
- #define SUPER_myfunction(classname, functionname, ...) \
- SUPER_ARGS(classname, functionname, __VA_ARGS__)
- */
-
- // (1/3) --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <--
- #define SUPER_XMLPort(classname, functionname, ...) \
- SUPER_ARGS(classname, functionname, __VA_ARGS__)
-
- #define SUPER_tick(classname, functionname, ...) \
- SUPER_ARGS(classname, functionname, __VA_ARGS__)
-
- #define SUPER_changedActivity(classname, functionname, ...) \
- SUPER_NOARGS(classname, functionname)
-
- #define SUPER_changedVisibility(classname, functionname, ...) \
- SUPER_NOARGS(classname, functionname)
-
- #define SUPER_XMLEventPort(classname, functionname, ...) \
- SUPER_ARGS(classname, functionname, __VA_ARGS__)
-
- #define SUPER_changedScale(classname, functionname, ...) \
- SUPER_NOARGS(classname, functionname)
-
- #define SUPER_changedOwner(classname, functionname, ...) \
- SUPER_NOARGS(classname, functionname)
-
- #define SUPER_changedOverlayGroup(classname, functionname, ...) \
- SUPER_NOARGS(classname, functionname)
-
- #define SUPER_changedName(classname, functionname, ...) \
- SUPER_NOARGS(classname, functionname)
-
- #define SUPER_changedGametype(classname, functionname, ...) \
- SUPER_NOARGS(classname, functionname)
-
- #define SUPER_changedUsed(classname, functionname, ...) \
- SUPER_NOARGS(classname, functionname)
-
- #define SUPER_changedCarrier(classname, functionname, ...) \
- SUPER_NOARGS(classname, functionname)
-
- #define SUPER_changedPickedUp(classname, functionname, ...) \
- SUPER_NOARGS(classname, functionname)
-
- // (1/3) --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <--
-
-
-namespace orxonox
-{
- /////////////////////////////////////////////////////////////////////////////////////////////////////
- // This code gets included by Identifier.h and every other header file that needs a super-function //
- /////////////////////////////////////////////////////////////////////////////////////////////////////
-
- //// Common code ////
-
- // Base templates
- /**
- @brief Creates the SuperFunctionCaller if T is a child of the super-functions baseclass.
- */
- template <int functionnumber, class T, int templatehack1, int templatehack2>
- struct SuperFunctionCondition
- {
- static void superCheck() {}
- };
-
- /**
- @brief Initializes the SuperFunctionCaller-pointer with zero.
- */
- template <int functionnumber, class T>
- struct SuperFunctionInitialization
- {
- static void initialize(ClassIdentifier<T>*) {}
- };
-
- /**
- @brief Deletes the SuperFunctionCaller.
- */
- template <int functionnumber, class T>
- struct SuperFunctionDestruction
- {
- static void destroy(ClassIdentifier<T>*) {}
- };
-
-
- //// Function-specific code ////
-
- /**
- @brief Creates the needed objects and templates to call a super-function.
- @param functionnumber Each super-function needs a unique number, starting with zero, increasing by one
- @param functionname The name of the super-function
- @param hasarguments "false" if the function doesn't take any arguments, "true" if it does (without "")
- @param ... Variadic: If the function takes arguments, add them here with type and name. Example: int myvalue, float myothervalue
- */
- #define SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(functionnumber, functionname, hasarguments, ...) \
- template <class T, int templatehack1, int templatehack2> \
- struct SuperFunctionCondition<functionnumber, T, templatehack1, templatehack2> \
- { \
- static void superCheck() \
- { \
- SuperFunctionCondition<functionnumber + 1, T, templatehack1, templatehack2>::superCheck(); \
- } \
- }; \
- \
- class _CoreExport SuperFunctionCaller_##functionname \
- { \
- public: \
- virtual void operator()( SUPER_CALL_ARGUMENTS##hasarguments(__VA_ARGS__) ) = 0; \
- virtual ~SuperFunctionCaller_##functionname () {} \
- virtual Identifier* getParentIdentifier() const = 0; \
- }; \
- \
- template <class T> \
- class SuperFunctionClassCaller_purevirtualfallback_##functionname : public SuperFunctionCaller_##functionname \
- { \
- public: \
- inline void operator()( SUPER_CALL_ARGUMENTS##hasarguments(__VA_ARGS__) ) \
- { \
- } \
- \
- Identifier* getParentIdentifier() const \
- { \
- return ClassIdentifier<T>::getIdentifier(); \
- } \
- }; \
- \
- template <class T> \
- struct SuperFunctionInitialization<functionnumber, T> \
- { \
- static void initialize(ClassIdentifier<T>* identifier) \
- { \
- identifier->superFunctionCaller_##functionname##_ = new SuperFunctionClassCaller_purevirtualfallback_##functionname <T>; \
- identifier->bSuperFunctionCaller_##functionname##_isFallback_ = true; \
- SuperFunctionInitialization<functionnumber + 1, T>::initialize(identifier); \
- } \
- }; \
- \
- template <class T> \
- struct SuperFunctionDestruction<functionnumber, T> \
- { \
- static void destroy(ClassIdentifier<T>* identifier) \
- { \
- if (identifier->superFunctionCaller_##functionname##_) \
- delete identifier->superFunctionCaller_##functionname##_; \
- SuperFunctionDestruction<functionnumber + 1, T>::destroy(identifier); \
- } \
- }; \
- \
- template <class T> \
- class SuperFunctionClassCaller_##functionname : public SuperFunctionCaller_##functionname \
- { \
- public: \
- inline void operator()( SUPER_CALL_ARGUMENTS##hasarguments(__VA_ARGS__) ) \
- { \
- (orxonox_cast<T*>(object))->T:: functionname
-
- /*
- JUST ADD THE FUNCTION ARGUMENTS BETWEEN BOTH MACROS, ENCLOSED BY BRACKETS
- EXAMPLE:
-
- SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(0, myfunction, true, int myvalue, float myothervalue) <-- !!! DONT ADD A SEMICOLON HERE !!!
- (myvalue, myothervalue)
- SUPER_FUNCTION_GLOBAL_DECLARATION_PART2
- */
-
- #define SUPER_FUNCTION_GLOBAL_DECLARATION_PART2 \
- ; \
- } \
- \
- Identifier* getParentIdentifier() const \
- { \
- return ClassIdentifier<T>::getIdentifier(); \
- } \
- };
-
- #define SUPER_CALL_ARGUMENTSfalse(...) OrxonoxClass* object
- #define SUPER_CALL_ARGUMENTS0(...) OrxonoxClass* object
- #define SUPER_CALL_ARGUMENTStrue(...) OrxonoxClass* object, __VA_ARGS__
- #define SUPER_CALL_ARGUMENTS1(...) OrxonoxClass* object, __VA_ARGS__
-
-
- /*
- //// COMMENTS ABOUT THE MACRO ////
-
- // Partially specialized template (templatehack not yet specialized, this
- // will be done by the real condition in the header-file of the super-function)
- // Only used as fallback
- template <class T, int templatehack1, int templatehack2>
- struct SuperFunctionCondition<functionnumber, T, templatehack1, templatehack2>
- {
- // If this function gets called, the header-file of the super function is not
- // included, so this fallback template (templatehack not specialized) is used
- static void superCheck()
- {
- // Calls the condition-check of the next super-function (functionnumber + 1)
- SuperFunctionCondition<functionnumber + 1, T, templatehack1, templatehack2>::superCheck();
- }
- };
-
- // Baseclass of the super-function caller. The real call will be done by a
- // templatized subclass through the virtual () operator.
- class _CoreExport SuperFunctionCaller_##functionname
- {
- public:
- virtual void operator()( SUPER_CALL_ARGUMENTS##hasarguments(__VA_ARGS__) ) = 0;
- virtual ~SuperFunctionCaller_##functionname () {}
- virtual Identifier* getParentIdentifier() const = 0;
- };
-
- // Fallback if the base is pure virtual
- template <class T>
- class SuperFunctionClassCaller_purevirtualfallback_##functionname : public SuperFunctionCaller_##functionname
- {
- public:
- // Fallback does nothing
- inline void operator()( SUPER_CALL_ARGUMENTS##hasarguments(__VA_ARGS__) )
- {
- }
-
- Identifier* getParentIdentifier() const
- {
- return ClassIdentifier<T>::getIdentifier();
- }
- };
-
- // Initializes the SuperFunctionCaller-pointer with a fallback caller in case the base function is pure virtual
- template <class T>
- struct SuperFunctionInitialization<functionnumber, T>
- {
- static void initialize(ClassIdentifier<T>* identifier)
- {
- identifier->superFunctionCaller_##functionname##_ = new SuperFunctionClassCaller_purevirtualfallback_##functionname <T>;
- identifier->bSuperFunctionCaller_##functionname##_isFallback_ = true;
-
- // Calls the initialization of the next super-function (functionnumber + 1)
- SuperFunctionInitialization<functionnumber + 1, T>::initialize(identifier);
- }
- };
-
- // Deletes the SuperFunctionCaller.
- template <class T>
- struct SuperFunctionDestruction<functionnumber, T>
- {
- static void destroy(ClassIdentifier<T>* identifier)
- {
- if (identifier->superFunctionCaller_##functionname##_)
- delete identifier->superFunctionCaller_##functionname##_;
-
- // Calls the destruction of the next super-function (functionnumber + 1)
- SuperFunctionDestruction<functionnumber + 1, T>::destroy(identifier);
- }
- };
-
- // The real super-function caller: Calls T::functionname()
- // T should be the parent, but this will be done by the spezialized condition template
- template <class T>
- class SuperFunctionClassCaller_##functionname : public SuperFunctionCaller_##functionname
- {
- public:
- // @brief Calls the function.
- // @param object The object to call the function on
- // @param ... The arguments of the function
- inline void operator()( SUPER_CALL_ARGUMENTS##hasarguments(__VA_ARGS__) )
- {
- (orxonox_cast<T*>(object))->T:: functionname ( Call the function with it's arguments );
- }
-
- Identifier* getParentIdentifier() const
- {
- return ClassIdentifier<T>::getIdentifier();
- }
- }
- */
-
-
- //// Execute the code for each super-function ////
-
- // (2/3) --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <--
- SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(0, XMLPort, true, Element& xmlelement, XMLPort::Mode mode)
- (xmlelement, mode)
- SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
-
- SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(1, tick, true, float dt)
- (dt)
- SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
-
- SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(2, changedActivity, false)
- ()
- SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
-
- SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(3, changedVisibility, false)
- ()
- SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
-
- SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(4, XMLEventPort, true, Element& xmlelement, XMLPort::Mode mode)
- (xmlelement, mode)
- SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
-
- SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(5, changedScale, false)
- ()
- SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
-
- SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(6, changedOwner, false)
- ()
- SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
-
- SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(7, changedOverlayGroup, false)
- ()
- SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
-
- SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(8, changedName, false)
- ()
- SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
-
- SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(9, changedGametype, false)
- ()
- SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
-
- SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(10, changedUsed, false)
- ()
- SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
-
- SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(11, changedCarrier, false)
- ()
- SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
-
- SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(12, changedPickedUp, false)
- ()
- SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
-
- // (2/3) --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <--
-
-}
-
-#else /* _Super_H__ */
- #ifdef SUPER_INTRUSIVE_DECLARATION_INCLUDE
-
-//////////////////////////////////////////////////////////////////////////
-// This code gets included within the declaration of ClassIdentifier<T> //
-//////////////////////////////////////////////////////////////////////////
-
-//// Common code ////
-
- private:
-
- template <int functionnumber, class TT, int templatehack1, int templatehack2>
- friend struct SuperFunctionCondition;
-
- // Creates the super-function-callers by calling the first SuperFunctionCondition check
- // This get's called within the initialization of an Identifier
- virtual void createSuperFunctionCaller() const
- {
- SuperFunctionCondition<0, T, 0, 0>::superCheck();
- }
-
-
-//// Function-specific code ////
-
- public:
- /**
- @brief Adds a pointer to the SuperFunctionCaller as a member of ClassIdentifier.
- @param functionname The name of the super-function
- */
- #ifndef SUPER_INTRUSIVE_DECLARATION
- #define SUPER_INTRUSIVE_DECLARATION(functionname) \
- SuperFunctionCaller_##functionname * superFunctionCaller_##functionname##_; \
- bool bSuperFunctionCaller_##functionname##_isFallback_
- #endif
-
-
-//// Execute the code for each super-function ////
-
- // (3/3) --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <--
- SUPER_INTRUSIVE_DECLARATION(XMLPort);
- SUPER_INTRUSIVE_DECLARATION(tick);
- SUPER_INTRUSIVE_DECLARATION(changedActivity);
- SUPER_INTRUSIVE_DECLARATION(changedVisibility);
- SUPER_INTRUSIVE_DECLARATION(XMLEventPort);
- SUPER_INTRUSIVE_DECLARATION(changedScale);
- SUPER_INTRUSIVE_DECLARATION(changedOwner);
- SUPER_INTRUSIVE_DECLARATION(changedOverlayGroup);
- SUPER_INTRUSIVE_DECLARATION(changedName);
- SUPER_INTRUSIVE_DECLARATION(changedGametype);
- SUPER_INTRUSIVE_DECLARATION(changedUsed);
- SUPER_INTRUSIVE_DECLARATION(changedCarrier);
- SUPER_INTRUSIVE_DECLARATION(changedPickedUp);
- // (3/3) --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <--
-
-
- #undef SUPER_INTRUSIVE_DECLARATION_INCLUDE
- #endif /* SUPER_INTRUSIVE_DECLARATION_INCLUDE */
-#endif /* _Super_H__ */
Modified: code/branches/core6/src/libraries/core/ViewportEventListener.h
===================================================================
--- code/branches/core6/src/libraries/core/ViewportEventListener.h 2013-03-24 15:16:01 UTC (rev 9562)
+++ code/branches/core6/src/libraries/core/ViewportEventListener.h 2013-03-24 16:33:43 UTC (rev 9563)
@@ -32,7 +32,7 @@
#include "CorePrereqs.h"
#include "util/OgreForwardRefs.h"
-#include "OrxonoxClass.h"
+#include "class/OrxonoxClass.h"
namespace orxonox
{
Modified: code/branches/core6/src/libraries/core/WindowEventListener.h
===================================================================
--- code/branches/core6/src/libraries/core/WindowEventListener.h 2013-03-24 15:16:01 UTC (rev 9562)
+++ code/branches/core6/src/libraries/core/WindowEventListener.h 2013-03-24 16:33:43 UTC (rev 9563)
@@ -35,7 +35,7 @@
#define _WindowEventListener_H__
#include "CorePrereqs.h"
-#include "OrxonoxClass.h"
+#include "class/OrxonoxClass.h"
namespace orxonox
{
Modified: code/branches/core6/src/libraries/core/XMLNameListener.h
===================================================================
--- code/branches/core6/src/libraries/core/XMLNameListener.h 2013-03-24 15:16:01 UTC (rev 9562)
+++ code/branches/core6/src/libraries/core/XMLNameListener.h 2013-03-24 16:33:43 UTC (rev 9563)
@@ -35,7 +35,7 @@
#define _XMLNameListener_H__
#include "CorePrereqs.h"
-#include "OrxonoxClass.h"
+#include "class/OrxonoxClass.h"
namespace orxonox
{
Modified: code/branches/core6/src/libraries/core/XMLPort.h
===================================================================
--- code/branches/core6/src/libraries/core/XMLPort.h 2013-03-24 15:16:01 UTC (rev 9562)
+++ code/branches/core6/src/libraries/core/XMLPort.h 2013-03-24 16:33:43 UTC (rev 9563)
@@ -57,7 +57,7 @@
#include "util/MultiType.h"
#include "util/OrxAssert.h"
#include "util/StringUtils.h"
-#include "Identifier.h"
+#include "class/Identifier.h"
#include "BaseObject.h"
#include "command/Executor.h"
Added: code/branches/core6/src/libraries/core/class/CMakeLists.txt
===================================================================
--- code/branches/core6/src/libraries/core/class/CMakeLists.txt (rev 0)
+++ code/branches/core6/src/libraries/core/class/CMakeLists.txt 2013-03-24 16:33:43 UTC (rev 9563)
@@ -0,0 +1,4 @@
+ADD_SOURCE_FILES(CORE_SRC_FILES
+ Identifier.cc
+ OrxonoxClass.cc
+)
Property changes on: code/branches/core6/src/libraries/core/class/CMakeLists.txt
___________________________________________________________________
Added: svn:eol-style
+ native
Copied: code/branches/core6/src/libraries/core/class/Identifier.cc (from rev 9558, code/branches/core6/src/libraries/core/Identifier.cc)
===================================================================
--- code/branches/core6/src/libraries/core/class/Identifier.cc (rev 0)
+++ code/branches/core6/src/libraries/core/class/Identifier.cc 2013-03-24 16:33:43 UTC (rev 9563)
@@ -0,0 +1,507 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file
+ @brief Implementation of the Identifier class.
+*/
+
+#include "Identifier.h"
+
+#include <ostream>
+
+#include "util/StringUtils.h"
+#include "core/config/ConfigValueContainer.h"
+#include "core/XMLPort.h"
+#include "core/object/ClassFactory.h"
+
+namespace orxonox
+{
+ // ###############################
+ // ### Identifier ###
+ // ###############################
+ int Identifier::hierarchyCreatingCounter_s = 0;
+ unsigned int Identifier::classIDCounter_s = 0;
+
+ /**
+ @brief Constructor: No factory, no object created, new ObjectList and a unique networkID.
+ */
+ Identifier::Identifier()
+ : classID_(classIDCounter_s++)
+ {
+ this->objects_ = new ObjectListBase(this);
+
+ this->bCreatedOneObject_ = false;
+ this->bSetName_ = false;
+ this->factory_ = 0;
+ this->bLoadable_ = false;
+
+ this->bHasConfigValues_ = false;
+
+ // Default network ID is the class ID
+ this->networkID_ = this->classID_;
+ }
+
+ /**
+ @brief Destructor: Deletes the list containing the children.
+ */
+ Identifier::~Identifier()
+ {
+ delete this->objects_;
+
+ if (this->factory_)
+ delete this->factory_;
+
+ for (std::map<std::string, ConfigValueContainer*>::iterator it = this->configValues_.begin(); it != this->configValues_.end(); ++it)
+ delete (it->second);
+ for (std::map<std::string, XMLPortParamContainer*>::iterator it = this->xmlportParamContainers_.begin(); it != this->xmlportParamContainers_.end(); ++it)
+ delete (it->second);
+ for (std::map<std::string, XMLPortObjectContainer*>::iterator it = this->xmlportObjectContainers_.begin(); it != this->xmlportObjectContainers_.end(); ++it)
+ delete (it->second);
+ }
+
+ /**
+ @brief Returns the identifier map with the names as received by typeid(). This is only used internally.
+ */
+ std::map<std::string, Identifier*>& Identifier::getTypeIDIdentifierMap()
+ {
+ static std::map<std::string, Identifier*> identifiers; //!< The map to store all Identifiers.
+ return identifiers;
+ }
+
+ /**
+ @brief Returns an identifier by name and adds it if not available
+ @param name The name of the identifier as typeid().name() suggests
+ @param proposal A pointer to a newly created identifier for the case of non existence in the map
+ @return The identifier (unique instance)
+ */
+ Identifier* Identifier::getIdentifierSingleton(const std::string& name, Identifier* proposal)
+ {
+ std::map<std::string, Identifier*>::const_iterator it = getTypeIDIdentifierMap().find(name);
+
+ if (it != getTypeIDIdentifierMap().end())
+ {
+ // There is already an entry: return it and delete the proposal
+ delete proposal;
+ return it->second;
+ }
+ else
+ {
+ // There is no entry: put the proposal into the map and return it
+ getTypeIDIdentifierMap()[name] = proposal;
+ return proposal;
+ }
+ }
+
+ /**
+ @brief Registers a class, which means that the name and the parents get stored.
+ @param parents A list, containing the Identifiers of all parents of the class
+ @param bRootClass True if the class is either an Interface or the BaseObject itself
+ */
+ void Identifier::initializeClassHierarchy(std::set<const Identifier*>* parents, bool bRootClass)
+ {
+ // Check if at least one object of the given type was created
+ if (!this->bCreatedOneObject_ && Identifier::isCreatingHierarchy())
+ {
+ // If no: We have to store the information and initialize the Identifier
+ orxout(verbose, context::identifier) << "Register Class in ClassIdentifier<" << this->getName() << ">-Singleton -> Initialize Singleton." << endl;
+ if (bRootClass)
+ this->initialize(0); // If a class is derived from two interfaces, the second interface might think it's derived from the first because of the order of constructor-calls. Thats why we set parents to zero in that case.
+ else
+ this->initialize(parents);
+ }
+ }
+
+ /**
+ @brief Initializes the Identifier with a list containing all parents of the class the Identifier belongs to.
+ @param parents A list containing all parents
+ */
+ void Identifier::initialize(std::set<const Identifier*>* parents)
+ {
+ orxout(verbose, context::identifier) << "Initialize ClassIdentifier<" << this->name_ << ">-Singleton." << endl;
+ this->bCreatedOneObject_ = true;
+
+ if (parents)
+ {
+ this->parents_ = (*parents);
+ this->directParents_ = (*parents);
+
+ // Iterate through all parents
+ for (std::set<const Identifier*>::iterator it = parents->begin(); it != parents->end(); ++it)
+ {
+ // Tell the parent we're one of it's children
+ (*it)->children_.insert((*it)->children_.end(), this);
+
+ // Erase all parents of our parent from our direct-parent-list
+ for (std::set<const Identifier*>::const_iterator it1 = (*it)->getParents().begin(); it1 != (*it)->getParents().end(); ++it1)
+ {
+ // Search for the parent's parent in our direct-parent-list
+ for (std::set<const Identifier*>::iterator it2 = this->directParents_.begin(); it2 != this->directParents_.end(); ++it2)
+ {
+ if ((*it1) == (*it2))
+ {
+ // We've found a non-direct parent in our list: Erase it
+ this->directParents_.erase(it2);
+ break;
+ }
+ }
+ }
+ }
+
+ // Now iterate through all direct parents
+ for (std::set<const Identifier*>::iterator it = this->directParents_.begin(); it != this->directParents_.end(); ++it)
+ {
+ // Tell the parent we're one of it's direct children
+ (*it)->directChildren_.insert((*it)->directChildren_.end(), this);
+
+ // Create the super-function dependencies
+ (*it)->createSuperFunctionCaller();
+ }
+ }
+ }
+
+ /**
+ @brief Creates the class-hierarchy by creating and destroying one object of each type.
+ */
+ void Identifier::createClassHierarchy()
+ {
+ orxout(internal_status) << "Create class-hierarchy" << endl;
+ Identifier::startCreatingHierarchy();
+ for (std::map<std::string, Identifier*>::const_iterator it = Identifier::getStringIdentifierMap().begin(); it != Identifier::getStringIdentifierMap().end(); ++it)
+ {
+ // To create the new branch of the class-hierarchy, we create a new object and delete it afterwards.
+ if (it->second->hasFactory())
+ {
+ OrxonoxClass* temp = it->second->fabricate(0);
+ temp->destroy();
+ }
+ }
+ Identifier::stopCreatingHierarchy();
+ orxout(internal_status) << "Finished class-hierarchy creation" << endl;
+ }
+
+ /**
+ @brief Destroys all Identifiers. Called when exiting the program.
+ */
+ void Identifier::destroyAllIdentifiers()
+ {
+ for (std::map<std::string, Identifier*>::iterator it = Identifier::getTypeIDIdentifierMap().begin(); it != Identifier::getTypeIDIdentifierMap().end(); ++it)
+ delete (it->second);
+ }
+
+ /**
+ @brief Sets the name of the class.
+ */
+ void Identifier::setName(const std::string& name)
+ {
+ if (!this->bSetName_)
+ {
+ this->name_ = name;
+ this->bSetName_ = true;
+ Identifier::getStringIdentifierMapIntern()[name] = this;
+ Identifier::getLowercaseStringIdentifierMapIntern()[getLowercase(name)] = this;
+ Identifier::getIDIdentifierMapIntern()[this->networkID_] = this;
+ }
+ }
+
+ /**
+ @brief Creates an object of the type the Identifier belongs to.
+ @return The new object
+ */
+ OrxonoxClass* Identifier::fabricate(BaseObject* creator)
+ {
+ if (this->factory_)
+ {
+ return this->factory_->fabricate(creator);
+ }
+ else
+ {
+ orxout(user_error) << "An error occurred in Identifier.cc:" << endl;
+ orxout(user_error) << "Cannot fabricate an object of type '" << this->name_ << "'. Class has no factory." << endl;
+ orxout(user_error) << "Aborting..." << endl;
+ abort();
+ return 0;
+ }
+ }
+
+ /**
+ @brief Sets the network ID to a new value and changes the entry in the ID-Identifier-map.
+ */
+ void Identifier::setNetworkID(uint32_t id)
+ {
+// Identifier::getIDIdentifierMapIntern().erase(this->networkID_);
+ Identifier::getIDIdentifierMapIntern()[id] = this;
+ this->networkID_ = id;
+ }
+
+ /**
+ @brief Returns true, if the Identifier is at least of the given type.
+ @param identifier The identifier to compare with
+ */
+ bool Identifier::isA(const Identifier* identifier) const
+ {
+ return (identifier == this || (this->parents_.find(identifier) != this->parents_.end()));
+ }
+
+ /**
+ @brief Returns true, if the Identifier is exactly of the given type.
+ @param identifier The identifier to compare with
+ */
+ bool Identifier::isExactlyA(const Identifier* identifier) const
+ {
+ return (identifier == this);
+ }
+
+ /**
+ @brief Returns true, if the assigned identifier is a child of the given identifier.
+ @param identifier The identifier to compare with
+ */
+ bool Identifier::isChildOf(const Identifier* identifier) const
+ {
+ return (this->parents_.find(identifier) != this->parents_.end());
+ }
+
+ /**
+ @brief Returns true, if the assigned identifier is a direct child of the given identifier.
+ @param identifier The identifier to compare with
+ */
+ bool Identifier::isDirectChildOf(const Identifier* identifier) const
+ {
+ return (this->directParents_.find(identifier) != this->directParents_.end());
+ }
+
+ /**
+ @brief Returns true, if the assigned identifier is a parent of the given identifier.
+ @param identifier The identifier to compare with
+ */
+ bool Identifier::isParentOf(const Identifier* identifier) const
+ {
+ return (this->children_.find(identifier) != this->children_.end());
+ }
+
+ /**
+ @brief Returns true, if the assigned identifier is a direct parent of the given identifier.
+ @param identifier The identifier to compare with
+ */
+ bool Identifier::isDirectParentOf(const Identifier* identifier) const
+ {
+ return (this->directChildren_.find(identifier) != this->directChildren_.end());
+ }
+
+ /**
+ @brief Returns the map that stores all Identifiers with their names.
+ @return The map
+ */
+ std::map<std::string, Identifier*>& Identifier::getStringIdentifierMapIntern()
+ {
+ static std::map<std::string, Identifier*> identifierMap;
+ return identifierMap;
+ }
+
+ /**
+ @brief Returns the map that stores all Identifiers with their names in lowercase.
+ @return The map
+ */
+ std::map<std::string, Identifier*>& Identifier::getLowercaseStringIdentifierMapIntern()
+ {
+ static std::map<std::string, Identifier*> lowercaseIdentifierMap;
+ return lowercaseIdentifierMap;
+ }
+
+ /**
+ @brief Returns the map that stores all Identifiers with their network IDs.
+ @return The map
+ */
+ std::map<uint32_t, Identifier*>& Identifier::getIDIdentifierMapIntern()
+ {
+ static std::map<uint32_t, Identifier*> identifierMap;
+ return identifierMap;
+ }
+
+ /**
+ @brief Returns the Identifier with a given name.
+ @param name The name of the wanted Identifier
+ @return The Identifier
+ */
+ Identifier* Identifier::getIdentifierByString(const std::string& name)
+ {
+ std::map<std::string, Identifier*>::const_iterator it = Identifier::getStringIdentifierMapIntern().find(name);
+ if (it != Identifier::getStringIdentifierMapIntern().end())
+ return it->second;
+ else
+ return 0;
+ }
+
+ /**
+ @brief Returns the Identifier with a given name in lowercase.
+ @param name The name of the wanted Identifier
+ @return The Identifier
+ */
+ Identifier* Identifier::getIdentifierByLowercaseString(const std::string& name)
+ {
+ std::map<std::string, Identifier*>::const_iterator it = Identifier::getLowercaseStringIdentifierMapIntern().find(name);
+ if (it != Identifier::getLowercaseStringIdentifierMapIntern().end())
+ return it->second;
+ else
+ return 0;
+ }
+
+ /**
+ @brief Returns the Identifier with a given network ID.
+ @param id The network ID of the wanted Identifier
+ @return The Identifier
+ */
+ Identifier* Identifier::getIdentifierByID(const uint32_t id)
+ {
+ std::map<uint32_t, Identifier*>::const_iterator it = Identifier::getIDIdentifierMapIntern().find(id);
+ if (it != Identifier::getIDIdentifierMapIntern().end())
+ return it->second;
+ else
+ return 0;
+ }
+
+ /**
+ @brief Cleans the NetworkID map (needed on clients for correct initialization)
+ */
+ void Identifier::clearNetworkIDs()
+ {
+ Identifier::getIDIdentifierMapIntern().clear();
+ }
+
+ /**
+ @brief Adds the ConfigValueContainer of a variable, given by the string of its name.
+ @param varname The name of the variablee
+ @param container The container
+ */
+ void Identifier::addConfigValueContainer(const std::string& varname, ConfigValueContainer* container)
+ {
+ std::map<std::string, ConfigValueContainer*>::const_iterator it = this->configValues_.find(varname);
+ if (it != this->configValues_.end())
+ {
+ orxout(internal_warning) << "Overwriting config-value with name " << varname << " in class " << this->getName() << '.' << endl;
+ delete (it->second);
+ }
+
+ this->bHasConfigValues_ = true;
+ this->configValues_[varname] = container;
+ }
+
+ /**
+ @brief Returns the ConfigValueContainer of a variable, given by the string of its name.
+ @param varname The name of the variable
+ @return The ConfigValueContainer
+ */
+ ConfigValueContainer* Identifier::getConfigValueContainer(const std::string& varname)
+ {
+ std::map<std::string, ConfigValueContainer*>::const_iterator it = configValues_.find(varname);
+ if (it != configValues_.end())
+ return it->second;
+ else
+ return 0;
+ }
+
+ /**
+ @brief Returns a XMLPortParamContainer that loads a parameter of this class.
+ @param paramname The name of the parameter
+ @return The container
+ */
+ XMLPortParamContainer* Identifier::getXMLPortParamContainer(const std::string& paramname)
+ {
+ std::map<std::string, XMLPortParamContainer*>::const_iterator it = this->xmlportParamContainers_.find(paramname);
+ if (it != this->xmlportParamContainers_.end())
+ return it->second;
+ else
+ return 0;
+ }
+
+ /**
+ @brief Adds a new XMLPortParamContainer that loads a parameter of this class.
+ @param paramname The name of the parameter
+ @param container The container
+ */
+ void Identifier::addXMLPortParamContainer(const std::string& paramname, XMLPortParamContainer* container)
+ {
+ std::map<std::string, XMLPortParamContainer*>::const_iterator it = this->xmlportParamContainers_.find(paramname);
+ if (it != this->xmlportParamContainers_.end())
+ {
+ orxout(internal_warning) << "Overwriting XMLPortParamContainer in class " << this->getName() << '.' << endl;
+ delete (it->second);
+ }
+
+ this->xmlportParamContainers_[paramname] = container;
+ }
+
+ /**
+ @brief Returns a XMLPortObjectContainer that attaches an object to this class.
+ @param sectionname The name of the section that contains the attachable objects
+ @return The container
+ */
+ XMLPortObjectContainer* Identifier::getXMLPortObjectContainer(const std::string& sectionname)
+ {
+ std::map<std::string, XMLPortObjectContainer*>::const_iterator it = this->xmlportObjectContainers_.find(sectionname);
+ if (it != this->xmlportObjectContainers_.end())
+ return it->second;
+ else
+ return 0;
+ }
+
+ /**
+ @brief Adds a new XMLPortObjectContainer that attaches an object to this class.
+ @param sectionname The name of the section that contains the attachable objects
+ @param container The container
+ */
+ void Identifier::addXMLPortObjectContainer(const std::string& sectionname, XMLPortObjectContainer* container)
+ {
+ std::map<std::string, XMLPortObjectContainer*>::const_iterator it = this->xmlportObjectContainers_.find(sectionname);
+ if (it != this->xmlportObjectContainers_.end())
+ {
+ orxout(internal_warning) << "Overwriting XMLPortObjectContainer in class " << this->getName() << '.' << endl;
+ delete (it->second);
+ }
+
+ this->xmlportObjectContainers_[sectionname] = container;
+ }
+
+ /**
+ @brief Lists the names of all Identifiers in a std::set<const Identifier*>.
+ @param out The outstream
+ @param list The list (or set) of Identifiers
+ @return The outstream
+ */
+ std::ostream& operator<<(std::ostream& out, const std::set<const Identifier*>& list)
+ {
+ for (std::set<const Identifier*>::const_iterator it = list.begin(); it != list.end(); ++it)
+ {
+ if (it != list.begin())
+ out << ' ';
+ out << (*it)->getName();
+ }
+
+ return out;
+ }
+}
Copied: code/branches/core6/src/libraries/core/class/Identifier.h (from rev 9557, code/branches/core6/src/libraries/core/Identifier.h)
===================================================================
--- code/branches/core6/src/libraries/core/class/Identifier.h (rev 0)
+++ code/branches/core6/src/libraries/core/class/Identifier.h 2013-03-24 16:33:43 UTC (rev 9563)
@@ -0,0 +1,502 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @defgroup Identifier Identifier
+ @ingroup Class
+*/
+
+/**
+ @file
+ @ingroup Class Identifier
+ @brief Declaration of Identifier, definition of ClassIdentifier<T>; used to identify the class of an object.
+
+ @anchor IdentifierExample
+
+ An Identifier "identifies" the class of an object. It contains different information about
+ the class: Its name and ID, a list of all instances of this class, a factory to create new
+ instances of this class, and more.
+
+ It also contains information about the inheritance of this class: It stores a list of the
+ Identifiers of all parent-classes as well as a list of all child-classes. These relationships
+ can be tested using functions like @c isA(), @c isChildOf(), @c isParentOf(), and more.
+
+ Every Identifier is in fact a ClassIdentifier<T> (where T is the class that is identified
+ by the Identifier), Identifier is just the common base-class.
+
+ Example:
+ @code
+ MyClass* object = new MyClass(); // create an instance of MyClass
+
+ object->getIdentifier()->getName(); // returns "MyClass"
+
+ OrxonoxClass* other = object->getIdentifier()->fabricate(0); // fabricates a new instance of MyClass
+
+
+ // iterate through all objects of type MyClass:
+ ObjectListBase* objects = object->getIdentifier()->getObjects(); // get a pointer to the object-list
+ int count;
+ for (Iterator<MyClass> it = objects.begin(); it != objects.end(); ++it) // iterate through the objects
+ ++count;
+ orxout() << count << endl; // prints "2" because we created 2 instances of MyClass so far
+
+
+ // test the class hierarchy
+ object->getIdentifier()->isA(Class(MyClass)); // returns true
+ object->isA(Class(MyClass)); // returns true (short version)
+
+ object->isA(Class(BaseClass)); // returns true if MyClass is a child of BaseClass
+
+ Class(ChildClass)->isChildOf(object->getIdentifier()); // returns true if ChildClass is a child of MyClass
+ @endcode
+*/
+
+#ifndef _Identifier_H__
+#define _Identifier_H__
+
+#include "core/CorePrereqs.h"
+
+#include <cassert>
+#include <map>
+#include <set>
+#include <string>
+#include <typeinfo>
+#include <loki/TypeTraits.h>
+
+#include "util/Output.h"
+#include "core/object/MetaObjectList.h"
+#include "core/object/ObjectList.h"
+#include "core/object/ObjectListBase.h"
+#include "Super.h"
+
+namespace orxonox
+{
+ // ###############################
+ // ### Identifier ###
+ // ###############################
+ /**
+ @brief The Identifier is used to identify the class of an object and to store information about the class.
+
+ Each Identifier stores information about one class. The Identifier can then be used to identify
+ this class. On the other hand it's also possible to get the corresponding Identifier of a class,
+ for example by using the macro Class().
+
+ @see See @ref IdentifierExample "Identifier.h" for more information and some examples.
+
+ @note You can't directly create an Identifier, it's just the base-class of ClassIdentifier<T>.
+ */
+ class _CoreExport Identifier
+ {
+ public:
+ /// Returns the name of the class the Identifier belongs to.
+ inline const std::string& getName() const { return this->name_; }
+ void setName(const std::string& name);
+
+ /// Returns the network ID to identify a class through the network.
+ inline uint32_t getNetworkID() const { return this->networkID_; }
+ void setNetworkID(uint32_t id);
+
+ /// Returns the unique ID of the class.
+ ORX_FORCEINLINE unsigned int getClassID() const { return this->classID_; }
+
+ /// Returns the list of all existing objects of this class.
+ inline ObjectListBase* getObjects() const { return this->objects_; }
+
+ /// Sets the Factory.
+ inline void addFactory(Factory* factory) { this->factory_ = factory; }
+ /// Returns true if the Identifier has a Factory.
+ inline bool hasFactory() const { return (this->factory_ != 0); }
+
+ OrxonoxClass* fabricate(BaseObject* creator);
+
+ /// Returns true if the class can be loaded through XML.
+ inline bool isLoadable() const { return this->bLoadable_; }
+ /// Set the class to be loadable through XML or not.
+ inline void setLoadable(bool bLoadable) { this->bLoadable_ = bLoadable; }
+
+ bool isA(const Identifier* identifier) const;
+ bool isExactlyA(const Identifier* identifier) const;
+ bool isChildOf(const Identifier* identifier) const;
+ bool isDirectChildOf(const Identifier* identifier) const;
+ bool isParentOf(const Identifier* identifier) const;
+ bool isDirectParentOf(const Identifier* identifier) const;
+
+
+ /////////////////////////////
+ ////// Class Hierarchy //////
+ /////////////////////////////
+ static void createClassHierarchy();
+
+ /// Returns true, if a branch of the class-hierarchy is being created, causing all new objects to store their parents.
+ inline static bool isCreatingHierarchy() { return (hierarchyCreatingCounter_s > 0); }
+
+ /// Returns the parents of the class the Identifier belongs to.
+ inline const std::set<const Identifier*>& getParents() const { return this->parents_; }
+ /// Returns the begin-iterator of the parents-list.
+ inline std::set<const Identifier*>::const_iterator getParentsBegin() const { return this->parents_.begin(); }
+ /// Returns the end-iterator of the parents-list.
+ inline std::set<const Identifier*>::const_iterator getParentsEnd() const { return this->parents_.end(); }
+
+ /// Returns the children of the class the Identifier belongs to.
+ inline const std::set<const Identifier*>& getChildren() const { return this->children_; }
+ /// Returns the begin-iterator of the children-list.
+ inline std::set<const Identifier*>::const_iterator getChildrenBegin() const { return this->children_.begin(); }
+ /// Returns the end-iterator of the children-list.
+ inline std::set<const Identifier*>::const_iterator getChildrenEnd() const { return this->children_.end(); }
+
+ /// Returns the direct parents of the class the Identifier belongs to.
+ inline const std::set<const Identifier*>& getDirectParents() const { return this->directParents_; }
+ /// Returns the begin-iterator of the direct-parents-list.
+ inline std::set<const Identifier*>::const_iterator getDirectParentsBegin() const { return this->directParents_.begin(); }
+ /// Returns the end-iterator of the direct-parents-list.
+ inline std::set<const Identifier*>::const_iterator getDirectParentsEnd() const { return this->directParents_.end(); }
+
+ /// Returns the direct children the class the Identifier belongs to.
+ inline const std::set<const Identifier*>& getDirectChildren() const { return this->directChildren_; }
+ /// Returns the begin-iterator of the direct-children-list.
+ inline std::set<const Identifier*>::const_iterator getDirectChildrenBegin() const { return this->directChildren_.begin(); }
+ /// Returns the end-iterator of the direct-children-list.
+ inline std::set<const Identifier*>::const_iterator getDirectChildrenEnd() const { return this->directChildren_.end(); }
+
+
+ //////////////////////////
+ ///// Identifier Map /////
+ //////////////////////////
+ static void destroyAllIdentifiers();
+
+ static Identifier* getIdentifierByString(const std::string& name);
+ static Identifier* getIdentifierByLowercaseString(const std::string& name);
+ static Identifier* getIdentifierByID(uint32_t id);
+
+ static void clearNetworkIDs();
+
+ /// Returns the map that stores all Identifiers with their names.
+ static inline const std::map<std::string, Identifier*>& getStringIdentifierMap() { return Identifier::getStringIdentifierMapIntern(); }
+ /// Returns a const_iterator to the beginning of the map that stores all Identifiers with their names.
+ static inline std::map<std::string, Identifier*>::const_iterator getStringIdentifierMapBegin() { return Identifier::getStringIdentifierMap().begin(); }
+ /// Returns a const_iterator to the end of the map that stores all Identifiers with their names.
+ static inline std::map<std::string, Identifier*>::const_iterator getStringIdentifierMapEnd() { return Identifier::getStringIdentifierMap().end(); }
+
+ /// Returns the map that stores all Identifiers with their names in lowercase.
+ static inline const std::map<std::string, Identifier*>& getLowercaseStringIdentifierMap() { return Identifier::getLowercaseStringIdentifierMapIntern(); }
+ /// Returns a const_iterator to the beginning of the map that stores all Identifiers with their names in lowercase.
+ static inline std::map<std::string, Identifier*>::const_iterator getLowercaseStringIdentifierMapBegin() { return Identifier::getLowercaseStringIdentifierMap().begin(); }
+ /// Returns a const_iterator to the end of the map that stores all Identifiers with their names in lowercase.
+ static inline std::map<std::string, Identifier*>::const_iterator getLowercaseStringIdentifierMapEnd() { return Identifier::getLowercaseStringIdentifierMap().end(); }
+
+ /// Returns the map that stores all Identifiers with their IDs.
+ static inline const std::map<uint32_t, Identifier*>& getIDIdentifierMap() { return Identifier::getIDIdentifierMapIntern(); }
+ /// Returns a const_iterator to the beginning of the map that stores all Identifiers with their IDs.
+ static inline std::map<uint32_t, Identifier*>::const_iterator getIDIdentifierMapBegin() { return Identifier::getIDIdentifierMap().begin(); }
+ /// Returns a const_iterator to the end of the map that stores all Identifiers with their IDs.
+ static inline std::map<uint32_t, Identifier*>::const_iterator getIDIdentifierMapEnd() { return Identifier::getIDIdentifierMap().end(); }
+
+
+ /////////////////////////
+ ///// Config Values /////
+ /////////////////////////
+ virtual void updateConfigValues(bool updateChildren = true) const = 0;
+
+ /// Returns true if this class has at least one config value.
+ inline bool hasConfigValues() const { return this->bHasConfigValues_; }
+
+ void addConfigValueContainer(const std::string& varname, ConfigValueContainer* container);
+ ConfigValueContainer* getConfigValueContainer(const std::string& varname);
+
+
+ ///////////////////
+ ///// XMLPort /////
+ ///////////////////
+ /// Returns the map that stores all XMLPort params.
+ inline const std::map<std::string, XMLPortParamContainer*>& getXMLPortParamMap() const { return this->xmlportParamContainers_; }
+ /// Returns a const_iterator to the beginning of the map that stores all XMLPort params.
+ inline std::map<std::string, XMLPortParamContainer*>::const_iterator getXMLPortParamMapBegin() const { return this->xmlportParamContainers_.begin(); }
+ /// Returns a const_iterator to the end of the map that stores all XMLPort params.
+ inline std::map<std::string, XMLPortParamContainer*>::const_iterator getXMLPortParamMapEnd() const { return this->xmlportParamContainers_.end(); }
+
+ /// Returns the map that stores all XMLPort objects.
+ inline const std::map<std::string, XMLPortObjectContainer*>& getXMLPortObjectMap() const { return this->xmlportObjectContainers_; }
+ /// Returns a const_iterator to the beginning of the map that stores all XMLPort objects.
+ inline std::map<std::string, XMLPortObjectContainer*>::const_iterator getXMLPortObjectMapBegin() const { return this->xmlportObjectContainers_.begin(); }
+ /// Returns a const_iterator to the end of the map that stores all XMLPort objects.
+ inline std::map<std::string, XMLPortObjectContainer*>::const_iterator getXMLPortObjectMapEnd() const { return this->xmlportObjectContainers_.end(); }
+
+ void addXMLPortParamContainer(const std::string& paramname, XMLPortParamContainer* container);
+ XMLPortParamContainer* getXMLPortParamContainer(const std::string& paramname);
+
+ void addXMLPortObjectContainer(const std::string& sectionname, XMLPortObjectContainer* container);
+ XMLPortObjectContainer* getXMLPortObjectContainer(const std::string& sectionname);
+
+
+ protected:
+ Identifier();
+ Identifier(const Identifier& identifier); // don't copy
+ virtual ~Identifier();
+
+ static Identifier* getIdentifierSingleton(const std::string& name, Identifier* proposal);
+ virtual void createSuperFunctionCaller() const = 0;
+
+ void initializeClassHierarchy(std::set<const Identifier*>* parents, bool bRootClass);
+
+ /// Returns the map that stores all Identifiers with their names.
+ static std::map<std::string, Identifier*>& getStringIdentifierMapIntern();
+ /// Returns the map that stores all Identifiers with their names in lowercase.
+ static std::map<std::string, Identifier*>& getLowercaseStringIdentifierMapIntern();
+ /// Returns the map that stores all Identifiers with their network IDs.
+ static std::map<uint32_t, Identifier*>& getIDIdentifierMapIntern();
+
+ /// Returns the children of the class the Identifier belongs to.
+ inline std::set<const Identifier*>& getChildrenIntern() const { return this->children_; }
+ /// Returns the direct children of the class the Identifier belongs to.
+ inline std::set<const Identifier*>& getDirectChildrenIntern() const { return this->directChildren_; }
+
+ ObjectListBase* objects_; //!< The list of all objects of this class
+
+ private:
+ /// Increases the hierarchyCreatingCounter_s variable, causing all new objects to store their parents.
+ inline static void startCreatingHierarchy() { hierarchyCreatingCounter_s++; }
+ /// Decreases the hierarchyCreatingCounter_s variable, causing the objects to stop storing their parents.
+ inline static void stopCreatingHierarchy() { hierarchyCreatingCounter_s--; }
+
+ static std::map<std::string, Identifier*>& getTypeIDIdentifierMap();
+
+ void initialize(std::set<const Identifier*>* parents);
+
+ std::set<const Identifier*> parents_; //!< The parents of the class the Identifier belongs to
+ mutable std::set<const Identifier*> children_; //!< The children of the class the Identifier belongs to
+
+ std::set<const Identifier*> directParents_; //!< The direct parents of the class the Identifier belongs to
+ mutable std::set<const Identifier*> directChildren_; //!< The direct children of the class the Identifier belongs to
+
+ bool bCreatedOneObject_; //!< True if at least one object of the given type was created (used to determine the need of storing the parents)
+ bool bSetName_; //!< True if the name is set
+ bool bLoadable_; //!< False = it's not permitted to load the object through XML
+ std::string name_; //!< The name of the class the Identifier belongs to
+ Factory* factory_; //!< The Factory, able to create new objects of the given class (if available)
+ static int hierarchyCreatingCounter_s; //!< Bigger than zero if at least one Identifier stores its parents (its an int instead of a bool to avoid conflicts with multithreading)
+ uint32_t networkID_; //!< The network ID to identify a class through the network
+ const unsigned int classID_; //!< Uniquely identifies a class (might not be the same as the networkID_)
+ static unsigned int classIDCounter_s; //!< Static counter for the unique classIDs
+
+ bool bHasConfigValues_; //!< True if this class has at least one assigned config value
+ std::map<std::string, ConfigValueContainer*> configValues_; //!< A map to link the string of configurable variables with their ConfigValueContainer
+
+ std::map<std::string, XMLPortParamContainer*> xmlportParamContainers_; //!< All loadable parameters
+ std::map<std::string, XMLPortObjectContainer*> xmlportObjectContainers_; //!< All attachable objects
+ };
+
+ _CoreExport std::ostream& operator<<(std::ostream& out, const std::set<const Identifier*>& list);
+
+
+ // ###############################
+ // ### ClassIdentifier ###
+ // ###############################
+ /**
+ @brief The ClassIdentifier is derived from Identifier and holds all class-specific functions and variables the Identifier cannot have.
+
+ ClassIdentifier is a Singleton, which means that only one ClassIdentifier for a given type T exists.
+ This makes it possible to store information about a class, sharing them with all
+ objects of that class without defining static variables in every class.
+
+ To be really sure that not more than exactly one object exists (even with libraries),
+ ClassIdentifiers are stored in a static map in Identifier.
+ */
+ template <class T>
+ class ClassIdentifier : public Identifier
+ {
+ #ifndef DOXYGEN_SHOULD_SKIP_THIS
+ #define SUPER_INTRUSIVE_DECLARATION_INCLUDE
+ #include "Super.h"
+ #endif
+
+ public:
+ static ClassIdentifier<T>* getIdentifier();
+ static ClassIdentifier<T>* getIdentifier(const std::string& name);
+
+ bool initialiseObject(T* object, const std::string& className, bool bRootClass);
+
+ void updateConfigValues(bool updateChildren = true) const;
+
+ private:
+ static void initialiseIdentifier();
+ ClassIdentifier(const ClassIdentifier<T>& identifier) {} // don't copy
+ ClassIdentifier()
+ {
+ SuperFunctionInitialization<0, T>::initialize(this);
+ }
+ ~ClassIdentifier()
+ {
+ SuperFunctionDestruction<0, T>::destroy(this);
+ }
+
+ static ClassIdentifier<T>* classIdentifier_s;
+ };
+
+ template <class T>
+ ClassIdentifier<T>* ClassIdentifier<T>::classIdentifier_s = 0;
+
+ /**
+ @brief Returns the only instance of this class.
+ @return The unique Identifier
+ */
+ template <class T>
+ inline ClassIdentifier<T>* ClassIdentifier<T>::getIdentifier()
+ {
+ // check if the Identifier already exists
+ if (!ClassIdentifier<T>::classIdentifier_s)
+ ClassIdentifier<T>::initialiseIdentifier();
+
+ return ClassIdentifier<T>::classIdentifier_s;
+ }
+
+ /**
+ @brief Does the same as getIdentifier() but sets the name if this wasn't done yet.
+ @param name The name of this Identifier
+ @return The Identifier
+ */
+ template <class T>
+ inline ClassIdentifier<T>* ClassIdentifier<T>::getIdentifier(const std::string& name)
+ {
+ ClassIdentifier<T>* identifier = ClassIdentifier<T>::getIdentifier();
+ identifier->setName(name);
+ return identifier;
+ }
+
+ /**
+ @brief Assigns the static field for the identifier singleton.
+ */
+ template <class T>
+ void ClassIdentifier<T>::initialiseIdentifier()
+ {
+ // Get the name of the class
+ std::string name = typeid(T).name();
+
+ // create a new identifier anyway. Will be deleted in Identifier::getIdentifier if not used.
+ ClassIdentifier<T>* proposal = new ClassIdentifier<T>();
+
+ // Get the entry from the map
+ ClassIdentifier<T>::classIdentifier_s = (ClassIdentifier<T>*)Identifier::getIdentifierSingleton(name, proposal);
+
+ if (ClassIdentifier<T>::classIdentifier_s == proposal)
+ {
+ orxout(verbose, context::identifier) << "Requested Identifier for " << name << " was not yet existing and got created." << endl;
+ }
+ else
+ {
+ orxout(verbose, context::identifier) << "Requested Identifier for " << name << " was already existing and got assigned." << endl;
+ }
+ }
+
+ /**
+ @brief Adds an object of the given type to the ObjectList.
+ @param object The object to add
+ @param className The name of the class T
+ @param bRootClass True if this is a root class (i.e. it inherits directly from OrxonoxClass)
+ */
+ template <class T>
+ bool ClassIdentifier<T>::initialiseObject(T* object, const std::string& className, bool bRootClass)
+ {
+ if (bRootClass)
+ orxout(verbose, context::object_list) << "Register Root-Object: " << className << endl;
+ else
+ orxout(verbose, context::object_list) << "Register Object: " << className << endl;
+
+ object->identifier_ = this;
+ if (Identifier::isCreatingHierarchy())
+ {
+ if (bRootClass && !object->parents_)
+ object->parents_ = new std::set<const Identifier*>();
+
+ if (object->parents_)
+ {
+ this->initializeClassHierarchy(object->parents_, bRootClass);
+ object->parents_->insert(object->parents_->end(), this);
+ }
+
+ object->setConfigValues();
+ return true;
+ }
+ else
+ {
+ orxout(verbose, context::object_list) << "Added object to " << this->getName() << "-list." << endl;
+ object->metaList_->add(this->objects_, this->objects_->add(new ObjectListElement<T>(object)));
+
+ // Add pointer of type T to the map in the OrxonoxClass instance that enables "dynamic_casts"
+ object->objectPointers_.push_back(std::make_pair(this->getClassID(), static_cast<void*>(object)));
+ return false;
+ }
+ }
+
+ /**
+ @brief Updates the config-values of all existing objects of this class by calling their setConfigValues() function.
+ */
+ template <class T>
+ void ClassIdentifier<T>::updateConfigValues(bool updateChildren) const
+ {
+ if (!this->hasConfigValues())
+ return;
+
+ for (ObjectListIterator<T> it = ObjectList<T>::begin(); it; ++it)
+ it->setConfigValues();
+
+ if (updateChildren)
+ for (std::set<const Identifier*>::const_iterator it = this->getChildrenBegin(); it != this->getChildrenEnd(); ++it)
+ (*it)->updateConfigValues(false);
+ }
+
+
+ // ###############################
+ // ### orxonox_cast ###
+ // ###############################
+ /**
+ @brief
+ Casts on object of type OrxonoxClass to any derived type that is
+ registered in the class hierarchy.
+ @return
+ Returns NULL if the cast is not possible
+ @note
+ In case of NULL return (and using MSVC), a dynamic_cast might still be possible if
+ a class forgot to register its objects.
+ Also note that the function is implemented differently for GCC/MSVC.
+ */
+ template <class T, class U>
+ ORX_FORCEINLINE T orxonox_cast(U* source)
+ {
+#ifdef ORXONOX_COMPILER_MSVC
+ typedef Loki::TypeTraits<typename Loki::TypeTraits<T>::PointeeType>::NonConstType ClassType;
+ if (source != NULL)
+ return source->template getDerivedPointer<ClassType>(ClassIdentifier<ClassType>::getIdentifier()->getClassID());
+ else
+ return NULL;
+#else
+ return dynamic_cast<T>(source);
+#endif
+ }
+}
+
+#endif /* _Identifier_H__ */
Copied: code/branches/core6/src/libraries/core/class/OrxonoxClass.cc (from rev 9562, code/branches/core6/src/libraries/core/OrxonoxClass.cc)
===================================================================
--- code/branches/core6/src/libraries/core/class/OrxonoxClass.cc (rev 0)
+++ code/branches/core6/src/libraries/core/class/OrxonoxClass.cc 2013-03-24 16:33:43 UTC (rev 9563)
@@ -0,0 +1,141 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file
+ @brief Implementation of OrxonoxClass.
+*/
+
+#include "OrxonoxClass.h"
+
+#include <cassert>
+#include "core/object/MetaObjectList.h"
+#include "core/object/Context.h"
+#include "Identifier.h"
+
+namespace orxonox
+{
+ /**
+ @brief Constructor: Sets the default values.
+ */
+ OrxonoxClass::OrxonoxClass()
+ {
+ this->identifier_ = 0;
+ this->parents_ = 0;
+ this->metaList_ = new MetaObjectList();
+ this->referenceCount_ = 0;
+ this->requestedDestruction_ = false;
+ // Optimisation
+ this->objectPointers_.reserve(6);
+ }
+
+ /**
+ @brief Destructor: Removes the object from the object-lists, notifies all DestructionListener (for example @ref WeakPtr "weak pointers") that this object is being deleted.
+ */
+ OrxonoxClass::~OrxonoxClass()
+ {
+// if (!this->requestedDestruction_)
+// orxout(internal_warning) << "Destroyed object without destroy() (" << this->getIdentifier()->getName() << ')' << endl;
+
+ assert(this->referenceCount_ <= 0);
+
+ this->unregisterObject();
+
+ // parents_ exists only if isCreatingHierarchy() of the associated Identifier returned true while creating the class
+ if (this->parents_)
+ delete this->parents_;
+
+ // notify all destruction listeners
+ for (std::set<DestructionListener*>::iterator it = this->destructionListeners_.begin(); it != this->destructionListeners_.end(); )
+ (*(it++))->objectDeleted();
+ }
+
+ /**
+ @brief Deletes the object if no @ref orxonox::SmartPtr "smart pointers" point to this object. Otherwise schedules the object to be deleted as soon as possible.
+ */
+ void OrxonoxClass::destroy()
+ {
+ assert(this); // Just in case someone tries to delete a NULL pointer
+ this->requestedDestruction_ = true;
+ if (this->referenceCount_ == 0)
+ {
+ this->preDestroy();
+ if (this->referenceCount_ == 0)
+ delete this;
+ }
+ }
+
+ /**
+ @brief Removes this object from the object-lists.
+ */
+ void OrxonoxClass::unregisterObject()
+ {
+ if (this->metaList_)
+ delete this->metaList_;
+ this->metaList_ = 0;
+ }
+
+ /// Returns true if the object's class is of the given type or a derivative.
+ bool OrxonoxClass::isA(const Identifier* identifier)
+ { return this->getIdentifier()->isA(identifier); }
+ /// Returns true if the object's class is exactly of the given type.
+ bool OrxonoxClass::isExactlyA(const Identifier* identifier)
+ { return this->getIdentifier()->isExactlyA(identifier); }
+ /// Returns true if the object's class is a child of the given type.
+ bool OrxonoxClass::isChildOf(const Identifier* identifier)
+ { return this->getIdentifier()->isChildOf(identifier); }
+ /// Returns true if the object's class is a direct child of the given type.
+ bool OrxonoxClass::isDirectChildOf(const Identifier* identifier)
+ { return this->getIdentifier()->isDirectChildOf(identifier); }
+ /// Returns true if the object's class is a parent of the given type.
+ bool OrxonoxClass::isParentOf(const Identifier* identifier)
+ { return this->getIdentifier()->isParentOf(identifier); }
+ /// Returns true if the object's class is a direct parent of the given type.
+ bool OrxonoxClass::isDirectParentOf(const Identifier* identifier)
+ { return this->getIdentifier()->isDirectParentOf(identifier); }
+
+
+ /// Returns true if the object's class is of the given type or a derivative.
+ bool OrxonoxClass::isA(const OrxonoxClass* object)
+ { return this->getIdentifier()->isA(object->getIdentifier()); }
+ /// Returns true if the object's class is exactly of the given type.
+ bool OrxonoxClass::isExactlyA(const OrxonoxClass* object)
+ { return this->getIdentifier()->isExactlyA(object->getIdentifier()); }
+ /// Returns true if the object's class is a child of the given type.
+ bool OrxonoxClass::isChildOf(const OrxonoxClass* object)
+ { return this->getIdentifier()->isChildOf(object->getIdentifier()); }
+ /// Returns true if the object's class is a direct child of the given type.
+ bool OrxonoxClass::isDirectChildOf(const OrxonoxClass* object)
+ { return this->getIdentifier()->isDirectChildOf(object->getIdentifier()); }
+ /// Returns true if the object's class is a parent of the given type.
+ bool OrxonoxClass::isParentOf(const OrxonoxClass* object)
+ { return this->getIdentifier()->isParentOf(object->getIdentifier()); }
+ /// Returns true if the object's class is a direct child of the given type.
+ bool OrxonoxClass::isDirectParentOf(const OrxonoxClass* object)
+ { return this->getIdentifier()->isDirectParentOf(object->getIdentifier()); }
+}
Copied: code/branches/core6/src/libraries/core/class/OrxonoxClass.h (from rev 9562, code/branches/core6/src/libraries/core/OrxonoxClass.h)
===================================================================
--- code/branches/core6/src/libraries/core/class/OrxonoxClass.h (rev 0)
+++ code/branches/core6/src/libraries/core/class/OrxonoxClass.h 2013-03-24 16:33:43 UTC (rev 9563)
@@ -0,0 +1,199 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @defgroup OrxonoxClass OrxonoxClass
+ @ingroup Class
+*/
+
+/**
+ @file
+ @ingroup Class OrxonoxClass
+ @brief Declaration of OrxonoxClass, the base class of all objects and interfaces in Orxonox.
+
+ All objects and interfaces of the game-logic (not the engine) are derived from OrxonoxClass.
+ It stores the Identifier and the MetaObjectList and has all needed functions to create and use the class-hierarchy.
+*/
+
+#ifndef _OrxonoxClass_H__
+#define _OrxonoxClass_H__
+
+#include "core/CorePrereqs.h"
+
+#include <set>
+#include <vector>
+#include "Super.h"
+
+namespace orxonox
+{
+ /**
+ @brief The class all objects and interfaces of the game-logic (not the engine) are derived from.
+
+ The BaseObject and Interfaces are derived with @c virtual @c public @c OrxonoxClass from OrxonoxClass.
+ OrxonoxClass is needed to create the class-hierarchy at startup and to store the Identifier and the
+ MetaObjectList, as well as to provide an interface for SmartPtr and WeakPtr.
+ */
+ class _CoreExport OrxonoxClass
+ {
+ template <class T>
+ friend class ClassIdentifier;
+
+ template <class T>
+ friend class SmartPtr;
+
+ friend class DestructionListener;
+
+ public:
+ OrxonoxClass();
+ virtual ~OrxonoxClass();
+
+ void destroy();
+ void unregisterObject();
+
+ /// Function to collect the SetConfigValue-macro calls.
+ void setConfigValues() {};
+
+ /// Returns the Identifier of the object.
+ inline Identifier* getIdentifier() const { return this->identifier_; }
+
+ bool isA(const Identifier* identifier);
+ bool isExactlyA(const Identifier* identifier);
+ bool isChildOf(const Identifier* identifier);
+ bool isDirectChildOf(const Identifier* identifier);
+ bool isParentOf(const Identifier* identifier);
+ bool isDirectParentOf(const Identifier* identifier);
+
+ /// Returns true if the object's class is of the given type or a derivative.
+ template <class B> inline bool isA(const SubclassIdentifier<B>* identifier)
+ { return this->isA(*identifier); }
+ /// Returns true if the object's class is exactly of the given type.
+ template <class B> inline bool isExactlyA(const SubclassIdentifier<B>* identifier)
+ { return this->isExactlyA(*identifier); }
+ /// Returns true if the object's class is a child of the given type.
+ template <class B> inline bool isChildOf(const SubclassIdentifier<B>* identifier)
+ { return this->isChildOf(*identifier); }
+ /// Returns true if the object's class is a direct child of the given type.
+ template <class B> inline bool isDirectChildOf(const SubclassIdentifier<B>* identifier)
+ { return this->isDirectChildOf(*identifier); }
+ /// Returns true if the object's class is a parent of the given type.
+ template <class B> inline bool isParentOf(const SubclassIdentifier<B>* identifier)
+ { return this->isParentOf(*identifier); }
+ /// Returns true if the object's class is a direct parent of the given type.
+ template <class B> inline bool isDirectParentOf(const SubclassIdentifier<B>* identifier)
+ { return this->isDirectParentOf(*identifier); }
+
+ bool isA(const OrxonoxClass* object);
+ bool isExactlyA(const OrxonoxClass* object);
+ bool isChildOf(const OrxonoxClass* object);
+ bool isDirectChildOf(const OrxonoxClass* object);
+ bool isParentOf(const OrxonoxClass* object);
+ bool isDirectParentOf(const OrxonoxClass* object);
+
+ /// Returns the number of @ref orxonox::SmartPtr "smart pointers" that point to this object.
+ inline unsigned int getReferenceCount() const
+ { return this->referenceCount_; }
+
+ /**
+ @brief
+ Returns a valid pointer of any derived type that is
+ registered in the class hierarchy.
+ @return
+ Returns NULL if the no pointer was found.
+ */
+ ORX_FORCEINLINE void* getDerivedPointer(unsigned int classID)
+ {
+ for (int i = this->objectPointers_.size() - 1; i >= 0; --i)
+ {
+ if (this->objectPointers_[i].first == classID)
+ return this->objectPointers_[i].second;
+ }
+ return NULL;
+ }
+
+ /// Version of getDerivedPointer with template
+ template <class T> ORX_FORCEINLINE T* getDerivedPointer(unsigned int classID)
+ { return static_cast<T*>(this->getDerivedPointer(classID)); }
+ /// Const version of getDerivedPointer with template
+ template <class T> ORX_FORCEINLINE const T* getDerivedPointer(unsigned int classID) const
+ { return const_cast<OrxonoxClass*>(this)->getDerivedPointer<T>(classID); }
+
+ protected:
+ /// This virtual function is called if destroy() is called and no SmartPtr points to this object. Used in some cases to create a new SmartPtr to prevent destruction.
+ virtual void preDestroy() {}
+
+ private:
+ /// Increments the reference counter (for smart pointers).
+ inline void incrementReferenceCount()
+ { ++this->referenceCount_; }
+ /// Decrements the reference counter (for smart pointers).
+ inline void decrementReferenceCount()
+ {
+ --this->referenceCount_;
+ if (this->referenceCount_ == 0 && this->requestedDestruction_)
+ this->destroy();
+ }
+
+ /// Register a destruction listener (for example a weak pointer which points to this object).
+ inline void registerDestructionListener(DestructionListener* pointer)
+ { this->destructionListeners_.insert(pointer); }
+ /// Unegister a destruction listener (for example a weak pointer which pointed to this object before).
+ inline void unregisterDestructionListener(DestructionListener* pointer)
+ { this->destructionListeners_.erase(pointer); }
+
+ Identifier* identifier_; //!< The Identifier of the object
+ std::set<const Identifier*>* parents_; //!< List of all parents of the object
+ MetaObjectList* metaList_; //!< MetaObjectList, containing all ObjectLists and ObjectListElements the object is registered in
+ int referenceCount_; //!< Counts the references from smart pointers to this object
+ bool requestedDestruction_; //!< Becomes true after someone called delete on this object
+ std::set<DestructionListener*> destructionListeners_; //!< All destruction listeners (for example weak pointers which point to this object and like to get notified if it dies)
+
+ /// 'Fast map' that holds this-pointers of all derived types
+ std::vector<std::pair<unsigned int, void*> > objectPointers_;
+ };
+
+ /**
+ @brief This listener is used to inform weak pointers if an object of type OrxonoxClass gets destroyed.
+ */
+ class _CoreExport DestructionListener
+ {
+ friend class OrxonoxClass;
+
+ protected:
+ virtual ~DestructionListener() {}
+
+ inline void registerAsDestructionListener(OrxonoxClass* object)
+ { if (object) { object->registerDestructionListener(this); } }
+ inline void unregisterAsDestructionListener(OrxonoxClass* object)
+ { if (object) { object->unregisterDestructionListener(this); } }
+
+ virtual void objectDeleted() = 0;
+ };
+
+}
+
+#endif /* _OrxonoxClass_H__ */
Copied: code/branches/core6/src/libraries/core/class/SubclassIdentifier.h (from rev 9556, code/branches/core6/src/libraries/core/SubclassIdentifier.h)
===================================================================
--- code/branches/core6/src/libraries/core/class/SubclassIdentifier.h (rev 0)
+++ code/branches/core6/src/libraries/core/class/SubclassIdentifier.h 2013-03-24 16:33:43 UTC (rev 9563)
@@ -0,0 +1,204 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file
+ @ingroup Class Identifier
+ @brief Definition of SubclassIdentifier.
+
+ @anchor SubclassIdentifierExample
+
+ SubclassIdentifier is a separated class, acting like an Identifier, but has a given class.
+ You can only assign Identifiers of exactly the given class or of a derivative to a SubclassIdentifier.
+
+ Example:
+
+ You can assign an Identifier either through the constructor or by using the assignment @c operator=:
+ @code
+ SubclassIdentifier<BaseClass> identifier = Class(SubClass);
+ @endcode
+
+ The @c operator-> is overloaded an returns the assigned Identifier. That way you can just call
+ functions of the assigned Identifier by using @c ->function():
+ @code
+ SubclassIdentifier<BaseClass> identifier = Class(SubClass);
+ identifier->getName(); // returns "SubClass"
+ @endcode
+
+ There are two possibilities to create an object out of a SubclassIdentifier: Either you just use
+ the @c fabricate() function of the assigned Identifier through the overloaded @c operator->, which
+ returns a @c OrxonoxClass* pointer, or you use the function of SubclassIdentifier, this time by using
+ @c operator., which returns a @c BaseClass* pointer (@a BaseClass is the baseclass specified by the
+ template argument):
+ @code
+ identifier->fabricate(); // calls Identifier::fabricate(), creates a SubClass, returns a OrxonoxClass* pointer
+
+ identifier.fabricate(); // calls SubclassIdentifier::fabricate(), creates a SubClass, returns a BaseClass* pointer
+ @endcode
+*/
+
+#ifndef _SubclassIdentifier_H__
+#define _SubclassIdentifier_H__
+
+#include "core/CorePrereqs.h"
+
+#include <cstdlib>
+#include "util/Output.h"
+#include "Identifier.h"
+
+namespace orxonox
+{
+ // ###############################
+ // ### SubclassIdentifier ###
+ // ###############################
+ /**
+ @brief The SubclassIdentifier acts almost like an Identifier, but has some prerequisites.
+
+ You can only assign an Identifier that belongs to a class T (or derived) to a SubclassIdentifier<T>.
+ If you assign something else, the program prints an error.
+
+ Because we know the base-type, a @c dynamic_cast is done, which makes it easier to create a new object.
+
+ @see See @ref SubclassIdentifierExample "SubclassIdentifier.h" for some examples.
+ */
+ template <class T>
+ class SubclassIdentifier
+ {
+ public:
+ /// Constructor: Automaticaly assigns the Identifier of the given class.
+ SubclassIdentifier()
+ {
+ this->identifier_ = ClassIdentifier<T>::getIdentifier();
+ }
+
+ /// Constructor: Assigns the given Identifier.
+ SubclassIdentifier(Identifier* identifier)
+ {
+ this->operator=(identifier);
+ }
+
+ /// Copyconstructor: Assigns the identifier of another SubclassIdentifier.
+ template <class O>
+ SubclassIdentifier(const SubclassIdentifier<O>& identifier)
+ {
+ this->operator=(identifier.getIdentifier());
+ }
+
+ /**
+ @brief Overloading of the = operator: assigns the identifier and checks its type.
+ @param identifier The Identifier to assign
+ @return The SubclassIdentifier itself
+ */
+ SubclassIdentifier<T>& operator=(Identifier* identifier)
+ {
+ if (!identifier || !identifier->isA(ClassIdentifier<T>::getIdentifier()))
+ {
+ orxout(internal_error) << "An error occurred in SubclassIdentifier (Identifier.h):" << endl;
+ if (identifier)
+ {
+ orxout(internal_error) << "Class " << identifier->getName() << " is not a " << ClassIdentifier<T>::getIdentifier()->getName() << '!' << endl;
+ orxout(internal_error) << "SubclassIdentifier<" << ClassIdentifier<T>::getIdentifier()->getName() << "> = Class(" << identifier->getName() << ") is forbidden." << endl;
+ }
+ else
+ {
+ orxout(internal_error) << "Can't assign NULL identifier" << endl;
+ }
+ }
+ else
+ {
+ this->identifier_ = identifier;
+ }
+ return *this;
+ }
+
+ /// Overloading of the = operator: assigns the identifier of another SubclassIdentifier.
+ template <class O>
+ SubclassIdentifier<T>& operator=(const SubclassIdentifier<O>& identifier)
+ {
+ return this->operator=(identifier.getIdentifier());
+ }
+
+ /// Overloading of the * operator: returns the assigned identifier.
+ inline Identifier* operator*() const
+ {
+ return this->identifier_;
+ }
+
+ /// Overloading of the -> operator: returns the assigned identifier.
+ inline Identifier* operator->() const
+ {
+ return this->identifier_;
+ }
+
+ /// Returns the assigned identifier. This allows you to assign a SubclassIdentifier to a normal Identifier*.
+ inline operator Identifier*() const
+ {
+ return this->identifier_;
+ }
+
+ /// Creates a new object of the type of the assigned Identifier and dynamic_casts it to the minimal type given by T.
+ T* fabricate(BaseObject* creator) const
+ {
+ OrxonoxClass* newObject = this->identifier_->fabricate(creator);
+
+ // Check if the creation was successful
+ if (newObject)
+ {
+ return orxonox_cast<T*>(newObject);
+ }
+ else
+ {
+ // Something went terribly wrong
+ if (this->identifier_)
+ {
+ orxout(user_error) << "An error occurred in SubclassIdentifier (Identifier.h):" << endl;
+ orxout(user_error) << "Class " << this->identifier_->getName() << " is not a " << ClassIdentifier<T>::getIdentifier()->getName() << '!' << endl;
+ orxout(user_error) << "Couldn't fabricate a new Object." << endl;
+ }
+ else
+ {
+ orxout(user_error) << "An error occurred in SubclassIdentifier (Identifier.h):" << endl;
+ orxout(user_error) << "Couldn't fabricate a new Object - Identifier is undefined." << endl;
+ }
+
+ orxout(user_error) << "Aborting..." << endl;
+ abort();
+ return 0;
+ }
+ }
+
+ /// Returns the assigned identifier.
+ inline Identifier* getIdentifier() const
+ { return this->identifier_; }
+
+ private:
+ Identifier* identifier_; //!< The assigned identifier
+ };
+}
+
+#endif /* _SubclassIdentifier_H__ */
Copied: code/branches/core6/src/libraries/core/class/Super.h (from rev 9552, code/branches/core6/src/libraries/core/Super.h)
===================================================================
--- code/branches/core6/src/libraries/core/class/Super.h (rev 0)
+++ code/branches/core6/src/libraries/core/class/Super.h 2013-03-24 16:33:43 UTC (rev 9563)
@@ -0,0 +1,634 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @defgroup Super Super
+ @ingroup Class
+*/
+
+/**
+ @file
+ @ingroup Class Super
+ @brief Definition of all super-function related macros, used to call functions of the base class.
+
+ This file defines all macros needed to add a new "super-function". If you add
+ a super-function, you can call <tt>SUPER(myclass, functionname, arguments)</tt>
+ inside your code and the function of the parent-class gets called. This is comparable
+ to <tt>super.functionname(arguments)</tt> in Java or other languages.
+
+ This works only with virtual functions that return nothing (@c void) and belong to
+ classes that have an @ref orxonox::Identifier "Identifier". Arguments however are
+ supported, there's no limitation for their number and type, except that the type has
+ to be known in Super.h.
+
+ To add a new super-function, you have to process 4 steps:
+
+ -# Add a new @c SUPER macro <br />
+ This allows you to call the super-function in your code. <br />
+ Location: This file (Super.h), marked with "--> HERE <--" comments (1/3)
+ -# Call the @c SUPER_FUNCTION_GLOBAL_DECLARATION_PART1/2 macros. <br />
+ This defines some global classes and templates, needed to create and call the super-functions. <br />
+ Location: This file (Super.h), marked with "--> HERE <--" comments (2/3)
+ -# Call the @c SUPER_INTRUSIVE_DECLARATION macro. <br />
+ This will be included into the declaration of @c ClassIdentifier<T>. <br />
+ Location: This file (Super.h), marked with "--> HERE <--" comments (3/3)
+ -# Call the @c SUPER_FUNCTION macro. <br />
+ This defines a partially specialized template that will decide if a class is "super" to another class.
+ If the check returns true, a @c SuperFunctionCaller gets created, which will be used by the @c SUPER macro.
+ You have to add this into the header-file of the baseclass of the super-function (the class that first
+ implements the function), below the class declaration. You can't call it directly in this file, because
+ otherwise you had to include the headerfile right here, which would cause some ugly back-dependencies,
+ include loops and slower compilation. <br />
+ Dont forget to include Super.h in the header-file. <br />
+ Location: The header-file of the baseclass (Baseclass.h), below the class declaration
+*/
+
+#ifndef _Super_H__
+#define _Super_H__
+
+#include "core/CorePrereqs.h"
+#include "util/Output.h"
+
+///////////////////////
+// Macro definitions //
+///////////////////////
+
+//// Common macros ////
+
+ /**
+ @brief Declares a new super-function by creating a specialized template. Add this below the class declaration of the baseclass.
+ @param functionnumber Each super-function needs a unique number, starting with zero, increasing by one
+ @param baseclass The baseclass of the super-function (~the root)
+ @param functionname The name of the super-function
+ @param purevirtualbase "true" if the function is pure virtual in the baseclass, "false" if the function is implemented (without "")
+ */
+ #define SUPER_FUNCTION(functionnumber, baseclass, functionname, purevirtualbase) \
+ template <class T, int templatehack2> \
+ struct SuperFunctionCondition<functionnumber, T, 0, templatehack2> \
+ { \
+ static void superCheck() \
+ { \
+ SuperFunctionCondition<functionnumber, T, 0, templatehack2>::apply(static_cast<T*>(0)); \
+ SuperFunctionCondition<functionnumber + 1, T, 0, templatehack2>::superCheck(); \
+ } \
+ \
+ static void apply(void*) {} \
+ \
+ static void apply(baseclass*) \
+ { \
+ ClassIdentifier<T>* identifier = ClassIdentifier<T>::getIdentifier(); \
+ for (std::set<const Identifier*>::iterator it = identifier->getDirectChildrenIntern().begin(); it != identifier->getDirectChildrenIntern().end(); ++it) \
+ { \
+ if (((ClassIdentifier<T>*)(*it))->bSuperFunctionCaller_##functionname##_isFallback_ && ((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_) \
+ { \
+ delete ((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_; \
+ ((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_ = 0; \
+ ((ClassIdentifier<T>*)(*it))->bSuperFunctionCaller_##functionname##_isFallback_ = false; \
+ } \
+ \
+ if (!((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_) \
+ { \
+ orxout(verbose, context::super) << "Added SuperFunctionCaller for " << #functionname << ": " << ClassIdentifier<T>::getIdentifier()->getName() << " <- " << ((ClassIdentifier<T>*)(*it))->getName() << endl; \
+ ((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_ = new SuperFunctionClassCaller_##functionname <T>; \
+ } \
+ else if (((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_->getParentIdentifier() != ClassIdentifier<T>::getIdentifier()) \
+ orxout(internal_warning, context::super) << "SuperFunctionCaller for " << #functionname << " in " << ((ClassIdentifier<T>*)(*it))->getName() << " calls function of " << ((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_->getParentIdentifier()->getName() << " but " << ClassIdentifier<T>::getIdentifier()->getName() << " is also possible (do you use multiple inheritance?)" << endl; \
+ } \
+ } \
+ }; \
+ \
+ SUPER_FUNCTION_PUREVIRTUAL_WORKAROUND##purevirtualbase(functionnumber, baseclass)
+
+ #define SUPER_FUNCTION_PUREVIRTUAL_WORKAROUND0(functionnumber, baseclass) SUPER_FUNCTION_PUREVIRTUAL_WORKAROUNDfalse(functionnumber, baseclass)
+ #define SUPER_FUNCTION_PUREVIRTUAL_WORKAROUND1(functionnumber, baseclass) SUPER_FUNCTION_PUREVIRTUAL_WORKAROUNDtrue(functionnumber, baseclass)
+ #define SUPER_FUNCTION_PUREVIRTUAL_WORKAROUNDfalse(functionnumber, baseclass)
+ #define SUPER_FUNCTION_PUREVIRTUAL_WORKAROUNDtrue(functionnumber, baseclass) \
+ template <int templatehack2> \
+ struct SuperFunctionCondition<functionnumber, baseclass, 0, templatehack2> \
+ { \
+ static void superCheck() \
+ { \
+ SuperFunctionCondition<functionnumber + 1, baseclass, 0, templatehack2>::superCheck(); \
+ } \
+ };
+
+
+ /*
+ //// Comments about the macro ////
+
+ // Partially specialized template (templatehack is now specialized too).
+ //
+ // This ensures the compiler takes THIS template if the header-file of the super-function
+ // is included. In any other case, the compiler just uses the fallback template which is
+ // defined in this file.
+ template <class T, templatehack2>
+ struct SuperFunctionCondition<functionnumber, T, 0, templatehack2>
+ {
+ static void superCheck()
+ {
+ // This call to the apply-function is the whole check. By calling the function with
+ // a T* pointer, the right function get's called.
+ SuperFunctionCondition<functionnumber, T, 0, templatehack2>::apply(static_cast<T*>(0));
+
+ // Go go the superCheck for of next super-function (functionnumber + 1)
+ SuperFunctionCondition<functionnumber + 1, T, 0, templatehack2>::superCheck();
+ }
+
+ // This function gets called if T is not a child of the baseclass.
+ // The function does nothing.
+ static void apply(void* temp) {}
+
+ // This function gets called if T is a child of the baseclass and can therefore be converted.
+ // The function adds a SuperFunctionCaller to the Identifier of all subclasses of T.
+ static void apply(baseclass* temp)
+ {
+ ClassIdentifier<T>* identifier = ClassIdentifier<T>::getIdentifier();
+
+ // Iterate through all children
+ for (std::set<const Identifier*>::iterator it = identifier->getDirectChildrenIntern().begin(); it != identifier->getDirectChildrenIntern().end(); ++it)
+ {
+ // Check if the caller is a fallback-caller
+ if (((ClassIdentifier<T>*)(*it))->bSuperFunctionCaller_##functionname##_isFallback_ && ((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_)
+ {
+ // Delete the fallback caller an prepare to get a real caller
+ delete ((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_;
+ ((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_ = 0;
+ ((ClassIdentifier<T>*)(*it))->bSuperFunctionCaller_##functionname##_isFallback_ = false;
+ }
+
+ // Check if there's not already a caller
+ if (!((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_)
+ {
+ // Add the SuperFunctionCaller
+ orxout(verbose, context::super) << "adding functionpointer to " << ((ClassIdentifier<T>*)(*it))->getName() << endl;
+ ((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_ = new SuperFunctionClassCaller_##functionname <T>;
+ }
+
+ // If there is already a caller, but for another parent, print a warning
+ else if (((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_->getParentIdentifier() != ClassIdentifier<T>::getIdentifier())
+ orxout(internal_warning, context::super) << "SuperFunctionCaller for " << #functionname << " in " << ((ClassIdentifier<T>*)(*it))->getName() << " calls function of " << ((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_->getParentIdentifier()->getName() << " but " << ClassIdentifier<T>::getIdentifier()->getName() << " is also possible (do you use multiple inheritance?)" << endl;
+ }
+ }
+ };
+ SUPER_FUNCTION_PUREVIRTUAL_WORKAROUND##purevirtualbase
+
+
+ // The following piece of code is only added if purevirtualbase = true
+
+ // Explicit specialization of the Condition template for the baseclass to avoid
+ // errors if the function is pure virtual in the baseclass.
+ template <int templatehack2> \
+ struct SuperFunctionCondition<functionnumber, baseclass, 0, templatehack2> \
+ { \
+ // The superCheck function acts like the fallback - it advances to the check for the next super-function (functionnumber + 1)
+ static void superCheck() \
+ { \
+ SuperFunctionCondition<functionnumber + 1, baseclass, 0, templatehack2>::superCheck(); \
+ } \
+ };
+ */
+
+ /// SUPER-macro: Calls Parent::functionname(...) where Parent is the direct parent of @a classname
+ #ifdef ORXONOX_COMPILER_MSVC
+ #define SUPER(classname, functionname, ...) \
+ __super::functionname(__VA_ARGS__)
+ #else
+ #define SUPER(classname, functionname, ...) \
+ SUPER_##functionname(classname, functionname, __VA_ARGS__)
+ #endif
+
+ // helper macro: for functions without arguments
+ #define SUPER_NOARGS(classname, functionname) \
+ (*ClassIdentifier<classname>::getIdentifier()->superFunctionCaller_##functionname##_)(this)
+
+ // helper macro: for functions with arguments
+ #define SUPER_ARGS(classname, functionname, ...) \
+ (*ClassIdentifier<classname>::getIdentifier()->superFunctionCaller_##functionname##_)(this, __VA_ARGS__)
+
+
+//// Function-specific macros ////
+
+ /*
+ Add a macro for each super-function
+
+ Example (no arguments):
+ #define SUPER_myfunction(classname, functionname, ...) \
+ SUPER_NOARGS(classname, functionname)
+
+ Example (with arguments):
+ #define SUPER_myfunction(classname, functionname, ...) \
+ SUPER_ARGS(classname, functionname, __VA_ARGS__)
+ */
+
+ // (1/3) --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <--
+ #define SUPER_XMLPort(classname, functionname, ...) \
+ SUPER_ARGS(classname, functionname, __VA_ARGS__)
+
+ #define SUPER_tick(classname, functionname, ...) \
+ SUPER_ARGS(classname, functionname, __VA_ARGS__)
+
+ #define SUPER_changedActivity(classname, functionname, ...) \
+ SUPER_NOARGS(classname, functionname)
+
+ #define SUPER_changedVisibility(classname, functionname, ...) \
+ SUPER_NOARGS(classname, functionname)
+
+ #define SUPER_XMLEventPort(classname, functionname, ...) \
+ SUPER_ARGS(classname, functionname, __VA_ARGS__)
+
+ #define SUPER_changedScale(classname, functionname, ...) \
+ SUPER_NOARGS(classname, functionname)
+
+ #define SUPER_changedOwner(classname, functionname, ...) \
+ SUPER_NOARGS(classname, functionname)
+
+ #define SUPER_changedOverlayGroup(classname, functionname, ...) \
+ SUPER_NOARGS(classname, functionname)
+
+ #define SUPER_changedName(classname, functionname, ...) \
+ SUPER_NOARGS(classname, functionname)
+
+ #define SUPER_changedGametype(classname, functionname, ...) \
+ SUPER_NOARGS(classname, functionname)
+
+ #define SUPER_changedUsed(classname, functionname, ...) \
+ SUPER_NOARGS(classname, functionname)
+
+ #define SUPER_changedCarrier(classname, functionname, ...) \
+ SUPER_NOARGS(classname, functionname)
+
+ #define SUPER_changedPickedUp(classname, functionname, ...) \
+ SUPER_NOARGS(classname, functionname)
+
+ // (1/3) --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <--
+
+
+namespace orxonox
+{
+ /////////////////////////////////////////////////////////////////////////////////////////////////////
+ // This code gets included by Identifier.h and every other header file that needs a super-function //
+ /////////////////////////////////////////////////////////////////////////////////////////////////////
+
+ //// Common code ////
+
+ // Base templates
+ /**
+ @brief Creates the SuperFunctionCaller if T is a child of the super-functions baseclass.
+ */
+ template <int functionnumber, class T, int templatehack1, int templatehack2>
+ struct SuperFunctionCondition
+ {
+ static void superCheck() {}
+ };
+
+ /**
+ @brief Initializes the SuperFunctionCaller-pointer with zero.
+ */
+ template <int functionnumber, class T>
+ struct SuperFunctionInitialization
+ {
+ static void initialize(ClassIdentifier<T>*) {}
+ };
+
+ /**
+ @brief Deletes the SuperFunctionCaller.
+ */
+ template <int functionnumber, class T>
+ struct SuperFunctionDestruction
+ {
+ static void destroy(ClassIdentifier<T>*) {}
+ };
+
+
+ //// Function-specific code ////
+
+ /**
+ @brief Creates the needed objects and templates to call a super-function.
+ @param functionnumber Each super-function needs a unique number, starting with zero, increasing by one
+ @param functionname The name of the super-function
+ @param hasarguments "false" if the function doesn't take any arguments, "true" if it does (without "")
+ @param ... Variadic: If the function takes arguments, add them here with type and name. Example: int myvalue, float myothervalue
+ */
+ #define SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(functionnumber, functionname, hasarguments, ...) \
+ template <class T, int templatehack1, int templatehack2> \
+ struct SuperFunctionCondition<functionnumber, T, templatehack1, templatehack2> \
+ { \
+ static void superCheck() \
+ { \
+ SuperFunctionCondition<functionnumber + 1, T, templatehack1, templatehack2>::superCheck(); \
+ } \
+ }; \
+ \
+ class _CoreExport SuperFunctionCaller_##functionname \
+ { \
+ public: \
+ virtual void operator()( SUPER_CALL_ARGUMENTS##hasarguments(__VA_ARGS__) ) = 0; \
+ virtual ~SuperFunctionCaller_##functionname () {} \
+ virtual Identifier* getParentIdentifier() const = 0; \
+ }; \
+ \
+ template <class T> \
+ class SuperFunctionClassCaller_purevirtualfallback_##functionname : public SuperFunctionCaller_##functionname \
+ { \
+ public: \
+ inline void operator()( SUPER_CALL_ARGUMENTS##hasarguments(__VA_ARGS__) ) \
+ { \
+ } \
+ \
+ Identifier* getParentIdentifier() const \
+ { \
+ return ClassIdentifier<T>::getIdentifier(); \
+ } \
+ }; \
+ \
+ template <class T> \
+ struct SuperFunctionInitialization<functionnumber, T> \
+ { \
+ static void initialize(ClassIdentifier<T>* identifier) \
+ { \
+ identifier->superFunctionCaller_##functionname##_ = new SuperFunctionClassCaller_purevirtualfallback_##functionname <T>; \
+ identifier->bSuperFunctionCaller_##functionname##_isFallback_ = true; \
+ SuperFunctionInitialization<functionnumber + 1, T>::initialize(identifier); \
+ } \
+ }; \
+ \
+ template <class T> \
+ struct SuperFunctionDestruction<functionnumber, T> \
+ { \
+ static void destroy(ClassIdentifier<T>* identifier) \
+ { \
+ if (identifier->superFunctionCaller_##functionname##_) \
+ delete identifier->superFunctionCaller_##functionname##_; \
+ SuperFunctionDestruction<functionnumber + 1, T>::destroy(identifier); \
+ } \
+ }; \
+ \
+ template <class T> \
+ class SuperFunctionClassCaller_##functionname : public SuperFunctionCaller_##functionname \
+ { \
+ public: \
+ inline void operator()( SUPER_CALL_ARGUMENTS##hasarguments(__VA_ARGS__) ) \
+ { \
+ (orxonox_cast<T*>(object))->T:: functionname
+
+ /*
+ JUST ADD THE FUNCTION ARGUMENTS BETWEEN BOTH MACROS, ENCLOSED BY BRACKETS
+ EXAMPLE:
+
+ SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(0, myfunction, true, int myvalue, float myothervalue) <-- !!! DONT ADD A SEMICOLON HERE !!!
+ (myvalue, myothervalue)
+ SUPER_FUNCTION_GLOBAL_DECLARATION_PART2
+ */
+
+ #define SUPER_FUNCTION_GLOBAL_DECLARATION_PART2 \
+ ; \
+ } \
+ \
+ Identifier* getParentIdentifier() const \
+ { \
+ return ClassIdentifier<T>::getIdentifier(); \
+ } \
+ };
+
+ #define SUPER_CALL_ARGUMENTSfalse(...) OrxonoxClass* object
+ #define SUPER_CALL_ARGUMENTS0(...) OrxonoxClass* object
+ #define SUPER_CALL_ARGUMENTStrue(...) OrxonoxClass* object, __VA_ARGS__
+ #define SUPER_CALL_ARGUMENTS1(...) OrxonoxClass* object, __VA_ARGS__
+
+
+ /*
+ //// COMMENTS ABOUT THE MACRO ////
+
+ // Partially specialized template (templatehack not yet specialized, this
+ // will be done by the real condition in the header-file of the super-function)
+ // Only used as fallback
+ template <class T, int templatehack1, int templatehack2>
+ struct SuperFunctionCondition<functionnumber, T, templatehack1, templatehack2>
+ {
+ // If this function gets called, the header-file of the super function is not
+ // included, so this fallback template (templatehack not specialized) is used
+ static void superCheck()
+ {
+ // Calls the condition-check of the next super-function (functionnumber + 1)
+ SuperFunctionCondition<functionnumber + 1, T, templatehack1, templatehack2>::superCheck();
+ }
+ };
+
+ // Baseclass of the super-function caller. The real call will be done by a
+ // templatized subclass through the virtual () operator.
+ class _CoreExport SuperFunctionCaller_##functionname
+ {
+ public:
+ virtual void operator()( SUPER_CALL_ARGUMENTS##hasarguments(__VA_ARGS__) ) = 0;
+ virtual ~SuperFunctionCaller_##functionname () {}
+ virtual Identifier* getParentIdentifier() const = 0;
+ };
+
+ // Fallback if the base is pure virtual
+ template <class T>
+ class SuperFunctionClassCaller_purevirtualfallback_##functionname : public SuperFunctionCaller_##functionname
+ {
+ public:
+ // Fallback does nothing
+ inline void operator()( SUPER_CALL_ARGUMENTS##hasarguments(__VA_ARGS__) )
+ {
+ }
+
+ Identifier* getParentIdentifier() const
+ {
+ return ClassIdentifier<T>::getIdentifier();
+ }
+ };
+
+ // Initializes the SuperFunctionCaller-pointer with a fallback caller in case the base function is pure virtual
+ template <class T>
+ struct SuperFunctionInitialization<functionnumber, T>
+ {
+ static void initialize(ClassIdentifier<T>* identifier)
+ {
+ identifier->superFunctionCaller_##functionname##_ = new SuperFunctionClassCaller_purevirtualfallback_##functionname <T>;
+ identifier->bSuperFunctionCaller_##functionname##_isFallback_ = true;
+
+ // Calls the initialization of the next super-function (functionnumber + 1)
+ SuperFunctionInitialization<functionnumber + 1, T>::initialize(identifier);
+ }
+ };
+
+ // Deletes the SuperFunctionCaller.
+ template <class T>
+ struct SuperFunctionDestruction<functionnumber, T>
+ {
+ static void destroy(ClassIdentifier<T>* identifier)
+ {
+ if (identifier->superFunctionCaller_##functionname##_)
+ delete identifier->superFunctionCaller_##functionname##_;
+
+ // Calls the destruction of the next super-function (functionnumber + 1)
+ SuperFunctionDestruction<functionnumber + 1, T>::destroy(identifier);
+ }
+ };
+
+ // The real super-function caller: Calls T::functionname()
+ // T should be the parent, but this will be done by the spezialized condition template
+ template <class T>
+ class SuperFunctionClassCaller_##functionname : public SuperFunctionCaller_##functionname
+ {
+ public:
+ // @brief Calls the function.
+ // @param object The object to call the function on
+ // @param ... The arguments of the function
+ inline void operator()( SUPER_CALL_ARGUMENTS##hasarguments(__VA_ARGS__) )
+ {
+ (orxonox_cast<T*>(object))->T:: functionname ( Call the function with it's arguments );
+ }
+
+ Identifier* getParentIdentifier() const
+ {
+ return ClassIdentifier<T>::getIdentifier();
+ }
+ }
+ */
+
+
+ //// Execute the code for each super-function ////
+
+ // (2/3) --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <--
+ SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(0, XMLPort, true, Element& xmlelement, XMLPort::Mode mode)
+ (xmlelement, mode)
+ SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
+
+ SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(1, tick, true, float dt)
+ (dt)
+ SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
+
+ SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(2, changedActivity, false)
+ ()
+ SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
+
+ SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(3, changedVisibility, false)
+ ()
+ SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
+
+ SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(4, XMLEventPort, true, Element& xmlelement, XMLPort::Mode mode)
+ (xmlelement, mode)
+ SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
+
+ SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(5, changedScale, false)
+ ()
+ SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
+
+ SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(6, changedOwner, false)
+ ()
+ SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
+
+ SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(7, changedOverlayGroup, false)
+ ()
+ SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
+
+ SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(8, changedName, false)
+ ()
+ SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
+
+ SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(9, changedGametype, false)
+ ()
+ SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
+
+ SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(10, changedUsed, false)
+ ()
+ SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
+
+ SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(11, changedCarrier, false)
+ ()
+ SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
+
+ SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(12, changedPickedUp, false)
+ ()
+ SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
+
+ // (2/3) --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <--
+
+}
+
+#else /* _Super_H__ */
+ #ifdef SUPER_INTRUSIVE_DECLARATION_INCLUDE
+
+//////////////////////////////////////////////////////////////////////////
+// This code gets included within the declaration of ClassIdentifier<T> //
+//////////////////////////////////////////////////////////////////////////
+
+//// Common code ////
+
+ private:
+
+ template <int functionnumber, class TT, int templatehack1, int templatehack2>
+ friend struct SuperFunctionCondition;
+
+ // Creates the super-function-callers by calling the first SuperFunctionCondition check
+ // This get's called within the initialization of an Identifier
+ virtual void createSuperFunctionCaller() const
+ {
+ SuperFunctionCondition<0, T, 0, 0>::superCheck();
+ }
+
+
+//// Function-specific code ////
+
+ public:
+ /**
+ @brief Adds a pointer to the SuperFunctionCaller as a member of ClassIdentifier.
+ @param functionname The name of the super-function
+ */
+ #ifndef SUPER_INTRUSIVE_DECLARATION
+ #define SUPER_INTRUSIVE_DECLARATION(functionname) \
+ SuperFunctionCaller_##functionname * superFunctionCaller_##functionname##_; \
+ bool bSuperFunctionCaller_##functionname##_isFallback_
+ #endif
+
+
+//// Execute the code for each super-function ////
+
+ // (3/3) --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <--
+ SUPER_INTRUSIVE_DECLARATION(XMLPort);
+ SUPER_INTRUSIVE_DECLARATION(tick);
+ SUPER_INTRUSIVE_DECLARATION(changedActivity);
+ SUPER_INTRUSIVE_DECLARATION(changedVisibility);
+ SUPER_INTRUSIVE_DECLARATION(XMLEventPort);
+ SUPER_INTRUSIVE_DECLARATION(changedScale);
+ SUPER_INTRUSIVE_DECLARATION(changedOwner);
+ SUPER_INTRUSIVE_DECLARATION(changedOverlayGroup);
+ SUPER_INTRUSIVE_DECLARATION(changedName);
+ SUPER_INTRUSIVE_DECLARATION(changedGametype);
+ SUPER_INTRUSIVE_DECLARATION(changedUsed);
+ SUPER_INTRUSIVE_DECLARATION(changedCarrier);
+ SUPER_INTRUSIVE_DECLARATION(changedPickedUp);
+ // (3/3) --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <--
+
+
+ #undef SUPER_INTRUSIVE_DECLARATION_INCLUDE
+ #endif /* SUPER_INTRUSIVE_DECLARATION_INCLUDE */
+#endif /* _Super_H__ */
Modified: code/branches/core6/src/libraries/core/command/ArgumentCompletionFunctions.cc
===================================================================
--- code/branches/core6/src/libraries/core/command/ArgumentCompletionFunctions.cc 2013-03-24 15:16:01 UTC (rev 9562)
+++ code/branches/core6/src/libraries/core/command/ArgumentCompletionFunctions.cc 2013-03-24 16:33:43 UTC (rev 9563)
@@ -38,7 +38,7 @@
#include "util/Convert.h"
#include "util/StringUtils.h"
-#include "core/Identifier.h"
+#include "core/class/Identifier.h"
#include "core/config/SettingsConfigFile.h"
#include "core/config/ConfigValueContainer.h"
#include "CommandExecutor.h"
Modified: code/branches/core6/src/libraries/core/command/Functor.h
===================================================================
--- code/branches/core6/src/libraries/core/command/Functor.h 2013-03-24 15:16:01 UTC (rev 9562)
+++ code/branches/core6/src/libraries/core/command/Functor.h 2013-03-24 16:33:43 UTC (rev 9563)
@@ -119,7 +119,7 @@
#include "util/Output.h"
#include "util/MultiType.h"
-#include "core/OrxonoxClass.h"
+#include "core/class/OrxonoxClass.h"
#include "FunctorPtr.h"
namespace orxonox
Modified: code/branches/core6/src/libraries/core/command/Shell.h
===================================================================
--- code/branches/core6/src/libraries/core/command/Shell.h 2013-03-24 15:16:01 UTC (rev 9562)
+++ code/branches/core6/src/libraries/core/command/Shell.h 2013-03-24 16:33:43 UTC (rev 9563)
@@ -49,7 +49,7 @@
#include "util/output/BaseWriter.h"
#include "core/Core.h"
-#include "core/OrxonoxClass.h"
+#include "core/class/OrxonoxClass.h"
namespace orxonox
{
Modified: code/branches/core6/src/libraries/core/config/ConfigValueContainer.h
===================================================================
--- code/branches/core6/src/libraries/core/config/ConfigValueContainer.h 2013-03-24 15:16:01 UTC (rev 9562)
+++ code/branches/core6/src/libraries/core/config/ConfigValueContainer.h 2013-03-24 16:33:43 UTC (rev 9563)
@@ -50,7 +50,7 @@
#include <vector>
#include "util/MultiType.h"
-#include "core/Identifier.h"
+#include "core/class/Identifier.h"
namespace orxonox
{
Modified: code/branches/core6/src/libraries/core/config/ConfigValueIncludes.h
===================================================================
--- code/branches/core6/src/libraries/core/config/ConfigValueIncludes.h 2013-03-24 15:16:01 UTC (rev 9562)
+++ code/branches/core6/src/libraries/core/config/ConfigValueIncludes.h 2013-03-24 16:33:43 UTC (rev 9563)
@@ -102,7 +102,7 @@
#include "core/CorePrereqs.h"
-#include "core/Identifier.h"
+#include "core/class/Identifier.h"
#include "ConfigValueContainer.h"
namespace orxonox
Modified: code/branches/core6/src/libraries/core/input/InputBuffer.h
===================================================================
--- code/branches/core6/src/libraries/core/input/InputBuffer.h 2013-03-24 15:16:01 UTC (rev 9562)
+++ code/branches/core6/src/libraries/core/input/InputBuffer.h 2013-03-24 16:33:43 UTC (rev 9563)
@@ -33,7 +33,7 @@
#include <list>
#include <string>
-#include "core/OrxonoxClass.h"
+#include "core/class/OrxonoxClass.h"
#include "InputHandler.h"
namespace orxonox
Modified: code/branches/core6/src/libraries/core/input/JoyStickQuantityListener.h
===================================================================
--- code/branches/core6/src/libraries/core/input/JoyStickQuantityListener.h 2013-03-24 15:16:01 UTC (rev 9562)
+++ code/branches/core6/src/libraries/core/input/JoyStickQuantityListener.h 2013-03-24 16:33:43 UTC (rev 9563)
@@ -37,7 +37,7 @@
#include "InputPrereqs.h"
#include <vector>
-#include "core/OrxonoxClass.h"
+#include "core/class/OrxonoxClass.h"
namespace orxonox
{
Modified: code/branches/core6/src/libraries/core/input/KeyBinderManager.h
===================================================================
--- code/branches/core6/src/libraries/core/input/KeyBinderManager.h 2013-03-24 15:16:01 UTC (rev 9562)
+++ code/branches/core6/src/libraries/core/input/KeyBinderManager.h 2013-03-24 16:33:43 UTC (rev 9563)
@@ -35,7 +35,7 @@
#include <string>
#include "util/Singleton.h"
-#include "core/OrxonoxClass.h"
+#include "core/class/OrxonoxClass.h"
namespace orxonox //tolua_export
{ //tolua_export
Modified: code/branches/core6/src/libraries/core/object/ClassFactory.h
===================================================================
--- code/branches/core6/src/libraries/core/object/ClassFactory.h 2013-03-24 15:16:01 UTC (rev 9562)
+++ code/branches/core6/src/libraries/core/object/ClassFactory.h 2013-03-24 16:33:43 UTC (rev 9563)
@@ -42,7 +42,7 @@
#include <string>
#include "util/Output.h"
-#include "core/Identifier.h"
+#include "core/class/Identifier.h"
namespace orxonox
{
Modified: code/branches/core6/src/libraries/core/object/ContextObject.h
===================================================================
--- code/branches/core6/src/libraries/core/object/ContextObject.h 2013-03-24 15:16:01 UTC (rev 9562)
+++ code/branches/core6/src/libraries/core/object/ContextObject.h 2013-03-24 16:33:43 UTC (rev 9563)
@@ -36,7 +36,7 @@
#include "core/CorePrereqs.h"
-#include "core/OrxonoxClass.h"
+#include "core/class/OrxonoxClass.h"
namespace orxonox
{
Modified: code/branches/core6/src/libraries/core/object/Iterator.h
===================================================================
--- code/branches/core6/src/libraries/core/object/Iterator.h 2013-03-24 15:16:01 UTC (rev 9562)
+++ code/branches/core6/src/libraries/core/object/Iterator.h 2013-03-24 16:33:43 UTC (rev 9563)
@@ -55,7 +55,7 @@
#include "core/CorePrereqs.h"
-#include "core/Identifier.h"
+#include "core/class/Identifier.h"
#include "ObjectListBase.h"
namespace orxonox
Modified: code/branches/core6/src/libraries/core/object/MetaObjectList.cc
===================================================================
--- code/branches/core6/src/libraries/core/object/MetaObjectList.cc 2013-03-24 15:16:01 UTC (rev 9562)
+++ code/branches/core6/src/libraries/core/object/MetaObjectList.cc 2013-03-24 16:33:43 UTC (rev 9563)
@@ -34,7 +34,7 @@
#include "MetaObjectList.h"
#include "util/Output.h"
-#include "core/Identifier.h"
+#include "core/class/Identifier.h"
#include "ObjectListBase.h"
namespace orxonox
Modified: code/branches/core6/src/libraries/core/object/ObjectListIterator.h
===================================================================
--- code/branches/core6/src/libraries/core/object/ObjectListIterator.h 2013-03-24 15:16:01 UTC (rev 9562)
+++ code/branches/core6/src/libraries/core/object/ObjectListIterator.h 2013-03-24 16:33:43 UTC (rev 9563)
@@ -55,7 +55,7 @@
#define _ObjectListIterator_H__
#include "core/CorePrereqs.h"
-#include "core/Identifier.h"
+#include "core/class/Identifier.h"
#include "ObjectList.h"
namespace orxonox
Modified: code/branches/core6/src/libraries/core/object/SmartPtr.h
===================================================================
--- code/branches/core6/src/libraries/core/object/SmartPtr.h 2013-03-24 15:16:01 UTC (rev 9562)
+++ code/branches/core6/src/libraries/core/object/SmartPtr.h 2013-03-24 16:33:43 UTC (rev 9563)
@@ -122,7 +122,7 @@
#include <cassert>
-#include "core/OrxonoxClass.h"
+#include "core/class/OrxonoxClass.h"
#include "WeakPtr.h"
namespace orxonox
Modified: code/branches/core6/src/libraries/core/object/WeakPtr.h
===================================================================
--- code/branches/core6/src/libraries/core/object/WeakPtr.h 2013-03-24 15:16:01 UTC (rev 9562)
+++ code/branches/core6/src/libraries/core/object/WeakPtr.h 2013-03-24 16:33:43 UTC (rev 9563)
@@ -84,7 +84,7 @@
#include <cassert>
-#include "core/OrxonoxClass.h"
+#include "core/class/OrxonoxClass.h"
#include "core/command/Functor.h"
namespace orxonox
Modified: code/branches/core6/src/libraries/network/ClientConnectionListener.h
===================================================================
--- code/branches/core6/src/libraries/network/ClientConnectionListener.h 2013-03-24 15:16:01 UTC (rev 9562)
+++ code/branches/core6/src/libraries/network/ClientConnectionListener.h 2013-03-24 16:33:43 UTC (rev 9563)
@@ -30,7 +30,7 @@
#define _ClientConnectionListener_H__
#include "NetworkPrereqs.h"
-#include "core/OrxonoxClass.h"
+#include "core/class/OrxonoxClass.h"
namespace orxonox
{
Modified: code/branches/core6/src/libraries/network/NetworkChatListener.h
===================================================================
--- code/branches/core6/src/libraries/network/NetworkChatListener.h 2013-03-24 15:16:01 UTC (rev 9562)
+++ code/branches/core6/src/libraries/network/NetworkChatListener.h 2013-03-24 16:33:43 UTC (rev 9563)
@@ -31,7 +31,7 @@
#include "NetworkPrereqs.h"
-#include "core/OrxonoxClass.h"
+#include "core/class/OrxonoxClass.h"
namespace orxonox
{
Modified: code/branches/core6/src/libraries/network/NetworkFunction.h
===================================================================
--- code/branches/core6/src/libraries/network/NetworkFunction.h 2013-03-24 15:16:01 UTC (rev 9562)
+++ code/branches/core6/src/libraries/network/NetworkFunction.h 2013-03-24 16:33:43 UTC (rev 9563)
@@ -38,7 +38,7 @@
#include <boost/preprocessor/cat.hpp>
#include <boost/static_assert.hpp>
-#include "core/Identifier.h"
+#include "core/class/Identifier.h"
#include "core/command/Functor.h"
#include "FunctionCallManager.h"
#include "synchronisable/Synchronisable.h"
Modified: code/branches/core6/src/libraries/network/WANDiscoverable.h
===================================================================
--- code/branches/core6/src/libraries/network/WANDiscoverable.h 2013-03-24 15:16:01 UTC (rev 9562)
+++ code/branches/core6/src/libraries/network/WANDiscoverable.h 2013-03-24 16:33:43 UTC (rev 9563)
@@ -29,7 +29,7 @@
#define _WANDiscoverable_H__
#include "NetworkPrereqs.h"
-#include "core/OrxonoxClass.h"
+#include "core/class/OrxonoxClass.h"
#include "core/CoreIncludes.h"
#include "MasterServerComm.h"
Modified: code/branches/core6/src/libraries/network/WANDiscovery.h
===================================================================
--- code/branches/core6/src/libraries/network/WANDiscovery.h 2013-03-24 15:16:01 UTC (rev 9562)
+++ code/branches/core6/src/libraries/network/WANDiscovery.h 2013-03-24 16:33:43 UTC (rev 9563)
@@ -31,7 +31,7 @@
#include "NetworkPrereqs.h"
#include "packet/ServerInformation.h"
#include "core/CoreIncludes.h"
-#include "core/OrxonoxClass.h"
+#include "core/class/OrxonoxClass.h"
#include "core/config/ConfigValueIncludes.h"
#include "MasterServerComm.h"
#include "MasterServerProtocol.h"
Modified: code/branches/core6/src/libraries/network/synchronisable/Synchronisable.h
===================================================================
--- code/branches/core6/src/libraries/network/synchronisable/Synchronisable.h 2013-03-24 15:16:01 UTC (rev 9562)
+++ code/branches/core6/src/libraries/network/synchronisable/Synchronisable.h 2013-03-24 16:33:43 UTC (rev 9563)
@@ -39,7 +39,7 @@
#include <set>
#include "util/mbool.h"
-#include "core/OrxonoxClass.h"
+#include "core/class/OrxonoxClass.h"
#include "SynchronisableVariable.h"
#include "NetworkCallback.h"
Modified: code/branches/core6/src/libraries/tools/Timer.h
===================================================================
--- code/branches/core6/src/libraries/tools/Timer.h 2013-03-24 15:16:01 UTC (rev 9562)
+++ code/branches/core6/src/libraries/tools/Timer.h 2013-03-24 16:33:43 UTC (rev 9563)
@@ -78,7 +78,7 @@
#include "tools/ToolsPrereqs.h"
-#include "core/OrxonoxClass.h"
+#include "core/class/OrxonoxClass.h"
#include "core/command/ExecutorPtr.h"
namespace orxonox
Modified: code/branches/core6/src/libraries/tools/interfaces/Tickable.h
===================================================================
--- code/branches/core6/src/libraries/tools/interfaces/Tickable.h 2013-03-24 15:16:01 UTC (rev 9562)
+++ code/branches/core6/src/libraries/tools/interfaces/Tickable.h 2013-03-24 16:33:43 UTC (rev 9563)
@@ -43,8 +43,8 @@
#include "tools/ToolsPrereqs.h"
-#include "core/OrxonoxClass.h"
-#include "core/Super.h"
+#include "core/class/OrxonoxClass.h"
+#include "core/class/Super.h"
namespace orxonox
{
Modified: code/branches/core6/src/libraries/tools/interfaces/TimeFactorListener.h
===================================================================
--- code/branches/core6/src/libraries/tools/interfaces/TimeFactorListener.h 2013-03-24 15:16:01 UTC (rev 9562)
+++ code/branches/core6/src/libraries/tools/interfaces/TimeFactorListener.h 2013-03-24 16:33:43 UTC (rev 9563)
@@ -30,7 +30,7 @@
#define _TimeFactorListener_H__
#include "tools/ToolsPrereqs.h"
-#include "core/OrxonoxClass.h"
+#include "core/class/OrxonoxClass.h"
namespace orxonox
{
Modified: code/branches/core6/src/modules/designtools/ScreenshotManager.h
===================================================================
--- code/branches/core6/src/modules/designtools/ScreenshotManager.h 2013-03-24 15:16:01 UTC (rev 9562)
+++ code/branches/core6/src/modules/designtools/ScreenshotManager.h 2013-03-24 16:33:43 UTC (rev 9563)
@@ -43,7 +43,7 @@
#include <OgreHardwarePixelBuffer.h>
#include "util/Singleton.h"
-#include "core/OrxonoxClass.h"
+#include "core/class/OrxonoxClass.h"
namespace orxonox
{
Modified: code/branches/core6/src/modules/designtools/SkyboxGenerator.h
===================================================================
--- code/branches/core6/src/modules/designtools/SkyboxGenerator.h 2013-03-24 15:16:01 UTC (rev 9562)
+++ code/branches/core6/src/modules/designtools/SkyboxGenerator.h 2013-03-24 16:33:43 UTC (rev 9563)
@@ -35,7 +35,7 @@
#ifndef __SkyboxGenerator_h__
#define __SkyboxGenerator_h__
-#include "core/OrxonoxClass.h"
+#include "core/class/OrxonoxClass.h"
#include "util/Singleton.h"
#include "tools/interfaces/Tickable.h"
@@ -118,4 +118,4 @@
};
}
-#endif // __SkyboxGenerator_h__
\ No newline at end of file
+#endif // __SkyboxGenerator_h__
Modified: code/branches/core6/src/modules/notifications/NotificationManager.h
===================================================================
--- code/branches/core6/src/modules/notifications/NotificationManager.h 2013-03-24 15:16:01 UTC (rev 9562)
+++ code/branches/core6/src/modules/notifications/NotificationManager.h 2013-03-24 16:33:43 UTC (rev 9563)
@@ -41,7 +41,7 @@
#include <map>
#include <string>
-#include "core/OrxonoxClass.h"
+#include "core/class/OrxonoxClass.h"
#include "util/Singleton.h"
#include "interfaces/NotificationListener.h"
Modified: code/branches/core6/src/modules/pickup/PickupManager.cc
===================================================================
--- code/branches/core6/src/modules/pickup/PickupManager.cc 2013-03-24 15:16:01 UTC (rev 9562)
+++ code/branches/core6/src/modules/pickup/PickupManager.cc 2013-03-24 16:33:43 UTC (rev 9563)
@@ -36,7 +36,7 @@
#include "core/CoreIncludes.h"
#include "core/LuaState.h"
#include "core/GUIManager.h"
-#include "core/Identifier.h"
+#include "core/class/Identifier.h"
#include "network/Host.h"
#include "network/NetworkFunction.h"
#include "util/ScopedSingletonManager.h"
Modified: code/branches/core6/src/modules/questsystem/QuestManager.h
===================================================================
--- code/branches/core6/src/modules/questsystem/QuestManager.h 2013-03-24 15:16:01 UTC (rev 9562)
+++ code/branches/core6/src/modules/questsystem/QuestManager.h 2013-03-24 16:33:43 UTC (rev 9563)
@@ -42,7 +42,7 @@
#include <string>
#include "util/Singleton.h"
-#include "core/OrxonoxClass.h"
+#include "core/class/OrxonoxClass.h"
namespace orxonox // tolua_export
{ // tolua_export
Modified: code/branches/core6/src/modules/weapons/projectiles/BasicProjectile.h
===================================================================
--- code/branches/core6/src/modules/weapons/projectiles/BasicProjectile.h 2013-03-24 15:16:01 UTC (rev 9562)
+++ code/branches/core6/src/modules/weapons/projectiles/BasicProjectile.h 2013-03-24 16:33:43 UTC (rev 9563)
@@ -38,7 +38,7 @@
#include "worldentities/pawns/Pawn.h"
-#include "core/OrxonoxClass.h"
+#include "core/class/OrxonoxClass.h"
namespace orxonox
{
Modified: code/branches/core6/src/orxonox/CameraManager.h
===================================================================
--- code/branches/core6/src/orxonox/CameraManager.h 2013-03-24 15:16:01 UTC (rev 9562)
+++ code/branches/core6/src/orxonox/CameraManager.h 2013-03-24 16:33:43 UTC (rev 9563)
@@ -40,7 +40,7 @@
#include <list>
#include "util/OgreForwardRefs.h"
#include "util/Singleton.h"
-#include "core/OrxonoxClass.h"
+#include "core/class/OrxonoxClass.h"
namespace orxonox
{
Modified: code/branches/core6/src/orxonox/LevelInfo.h
===================================================================
--- code/branches/core6/src/orxonox/LevelInfo.h 2013-03-24 15:16:01 UTC (rev 9562)
+++ code/branches/core6/src/orxonox/LevelInfo.h 2013-03-24 16:33:43 UTC (rev 9563)
@@ -44,7 +44,7 @@
#include "core/BaseObject.h"
#include <iostream>
#include <fstream>
-#include "core/OrxonoxClass.h"
+#include "core/class/OrxonoxClass.h"
namespace orxonox // tolua_export
{ // tolua_export
Modified: code/branches/core6/src/orxonox/LevelManager.h
===================================================================
--- code/branches/core6/src/orxonox/LevelManager.h 2013-03-24 15:16:01 UTC (rev 9562)
+++ code/branches/core6/src/orxonox/LevelManager.h 2013-03-24 16:33:43 UTC (rev 9563)
@@ -45,7 +45,7 @@
#include "LevelInfo.h"
#include "util/Singleton.h"
-#include "core/OrxonoxClass.h"
+#include "core/class/OrxonoxClass.h"
// tolua_begin
namespace orxonox
Modified: code/branches/core6/src/orxonox/MoodManager.h
===================================================================
--- code/branches/core6/src/orxonox/MoodManager.h 2013-03-24 15:16:01 UTC (rev 9562)
+++ code/branches/core6/src/orxonox/MoodManager.h 2013-03-24 16:33:43 UTC (rev 9563)
@@ -33,7 +33,7 @@
#include <string>
#include "util/Singleton.h"
-#include "core/OrxonoxClass.h"
+#include "core/class/OrxonoxClass.h"
namespace orxonox
{
Modified: code/branches/core6/src/orxonox/chat/ChatListener.h
===================================================================
--- code/branches/core6/src/orxonox/chat/ChatListener.h 2013-03-24 15:16:01 UTC (rev 9562)
+++ code/branches/core6/src/orxonox/chat/ChatListener.h 2013-03-24 16:33:43 UTC (rev 9563)
@@ -31,7 +31,7 @@
#include "OrxonoxPrereqs.h"
-#include "core/OrxonoxClass.h"
+#include "core/class/OrxonoxClass.h"
namespace orxonox
{
Modified: code/branches/core6/src/orxonox/controllers/FormationController.h
===================================================================
--- code/branches/core6/src/orxonox/controllers/FormationController.h 2013-03-24 15:16:01 UTC (rev 9562)
+++ code/branches/core6/src/orxonox/controllers/FormationController.h 2013-03-24 16:33:43 UTC (rev 9563)
@@ -32,10 +32,10 @@
#include "OrxonoxPrereqs.h"
#include <vector>
-#include "core/Super.h"
+#include "core/class/Super.h"
#include "util/Math.h"
-#include "core/OrxonoxClass.h"
+#include "core/class/OrxonoxClass.h"
#include "controllers/Controller.h"
#include "worldentities/ControllableEntity.h"
Modified: code/branches/core6/src/orxonox/gamestates/GSLevel.h
===================================================================
--- code/branches/core6/src/orxonox/gamestates/GSLevel.h 2013-03-24 15:16:01 UTC (rev 9562)
+++ code/branches/core6/src/orxonox/gamestates/GSLevel.h 2013-03-24 16:33:43 UTC (rev 9563)
@@ -33,7 +33,7 @@
#include <string>
#include <set>
-#include "core/OrxonoxClass.h"
+#include "core/class/OrxonoxClass.h"
#include "core/GameState.h"
namespace orxonox
Modified: code/branches/core6/src/orxonox/gamestates/GSMainMenu.h
===================================================================
--- code/branches/core6/src/orxonox/gamestates/GSMainMenu.h 2013-03-24 15:16:01 UTC (rev 9562)
+++ code/branches/core6/src/orxonox/gamestates/GSMainMenu.h 2013-03-24 16:33:43 UTC (rev 9563)
@@ -33,7 +33,7 @@
#include "util/OgreForwardRefs.h"
#include "core/GameState.h"
-#include "core/OrxonoxClass.h"
+#include "core/class/OrxonoxClass.h"
namespace orxonox
{
Modified: code/branches/core6/src/orxonox/gametypes/Gametype.h
===================================================================
--- code/branches/core6/src/orxonox/gametypes/Gametype.h 2013-03-24 15:16:01 UTC (rev 9562)
+++ code/branches/core6/src/orxonox/gametypes/Gametype.h 2013-03-24 16:33:43 UTC (rev 9563)
@@ -36,7 +36,7 @@
#include <string>
#include "core/BaseObject.h"
-#include "core/SubclassIdentifier.h"
+#include "core/class/SubclassIdentifier.h"
#include "tools/interfaces/Tickable.h"
#include "infos/GametypeInfo.h"
Modified: code/branches/core6/src/orxonox/infos/PlayerInfo.h
===================================================================
--- code/branches/core6/src/orxonox/infos/PlayerInfo.h 2013-03-24 15:16:01 UTC (rev 9562)
+++ code/branches/core6/src/orxonox/infos/PlayerInfo.h 2013-03-24 16:33:43 UTC (rev 9563)
@@ -32,7 +32,7 @@
#include "OrxonoxPrereqs.h"
#include "Info.h"
-#include "core/SubclassIdentifier.h"
+#include "core/class/SubclassIdentifier.h"
namespace orxonox // tolua_export
{ // tolua_export
Modified: code/branches/core6/src/orxonox/interfaces/GametypeMessageListener.h
===================================================================
--- code/branches/core6/src/orxonox/interfaces/GametypeMessageListener.h 2013-03-24 15:16:01 UTC (rev 9562)
+++ code/branches/core6/src/orxonox/interfaces/GametypeMessageListener.h 2013-03-24 16:33:43 UTC (rev 9563)
@@ -30,7 +30,7 @@
#define _GametypeMessageListener_H__
#include "OrxonoxPrereqs.h"
-#include "core/OrxonoxClass.h"
+#include "core/class/OrxonoxClass.h"
namespace orxonox
{
Modified: code/branches/core6/src/orxonox/interfaces/NotificationListener.h
===================================================================
--- code/branches/core6/src/orxonox/interfaces/NotificationListener.h 2013-03-24 15:16:01 UTC (rev 9562)
+++ code/branches/core6/src/orxonox/interfaces/NotificationListener.h 2013-03-24 16:33:43 UTC (rev 9563)
@@ -43,7 +43,7 @@
#include "util/StringUtils.h"
-#include "core/OrxonoxClass.h"
+#include "core/class/OrxonoxClass.h"
namespace orxonox
{
Modified: code/branches/core6/src/orxonox/interfaces/PickupCarrier.cc
===================================================================
--- code/branches/core6/src/orxonox/interfaces/PickupCarrier.cc 2013-03-24 15:16:01 UTC (rev 9562)
+++ code/branches/core6/src/orxonox/interfaces/PickupCarrier.cc 2013-03-24 16:33:43 UTC (rev 9563)
@@ -34,7 +34,7 @@
#include "PickupCarrier.h"
#include "core/CoreIncludes.h"
-#include "core/Identifier.h"
+#include "core/class/Identifier.h"
#include "Pickupable.h"
Modified: code/branches/core6/src/orxonox/interfaces/PickupCarrier.h
===================================================================
--- code/branches/core6/src/orxonox/interfaces/PickupCarrier.h 2013-03-24 15:16:01 UTC (rev 9562)
+++ code/branches/core6/src/orxonox/interfaces/PickupCarrier.h 2013-03-24 16:33:43 UTC (rev 9563)
@@ -40,7 +40,7 @@
#include <set>
#include <vector>
-#include "core/OrxonoxClass.h"
+#include "core/class/OrxonoxClass.h"
namespace orxonox
{
Modified: code/branches/core6/src/orxonox/interfaces/PickupListener.h
===================================================================
--- code/branches/core6/src/orxonox/interfaces/PickupListener.h 2013-03-24 15:16:01 UTC (rev 9562)
+++ code/branches/core6/src/orxonox/interfaces/PickupListener.h 2013-03-24 16:33:43 UTC (rev 9563)
@@ -38,7 +38,7 @@
#include "Pickupable.h"
-#include "core/OrxonoxClass.h"
+#include "core/class/OrxonoxClass.h"
namespace orxonox
{
Modified: code/branches/core6/src/orxonox/interfaces/Pickupable.cc
===================================================================
--- code/branches/core6/src/orxonox/interfaces/Pickupable.cc 2013-03-24 15:16:01 UTC (rev 9562)
+++ code/branches/core6/src/orxonox/interfaces/Pickupable.cc 2013-03-24 16:33:43 UTC (rev 9563)
@@ -33,7 +33,7 @@
#include "Pickupable.h"
-#include "core/Identifier.h"
+#include "core/class/Identifier.h"
#include "core/CoreIncludes.h"
#include "util/Convert.h"
Modified: code/branches/core6/src/orxonox/interfaces/Pickupable.h
===================================================================
--- code/branches/core6/src/orxonox/interfaces/Pickupable.h 2013-03-24 15:16:01 UTC (rev 9562)
+++ code/branches/core6/src/orxonox/interfaces/Pickupable.h 2013-03-24 16:33:43 UTC (rev 9563)
@@ -38,9 +38,9 @@
#include "OrxonoxPrereqs.h"
#include <list>
-#include "core/Super.h"
+#include "core/class/Super.h"
-#include "core/OrxonoxClass.h"
+#include "core/class/OrxonoxClass.h"
#include "Rewardable.h"
namespace orxonox
Modified: code/branches/core6/src/orxonox/interfaces/PlayerTrigger.h
===================================================================
--- code/branches/core6/src/orxonox/interfaces/PlayerTrigger.h 2013-03-24 15:16:01 UTC (rev 9562)
+++ code/branches/core6/src/orxonox/interfaces/PlayerTrigger.h 2013-03-24 16:33:43 UTC (rev 9563)
@@ -37,7 +37,7 @@
#include "OrxonoxPrereqs.h"
-#include "core/OrxonoxClass.h"
+#include "core/class/OrxonoxClass.h"
#include "core/object/WeakPtr.h"
namespace orxonox
Modified: code/branches/core6/src/orxonox/interfaces/RadarListener.h
===================================================================
--- code/branches/core6/src/orxonox/interfaces/RadarListener.h 2013-03-24 15:16:01 UTC (rev 9562)
+++ code/branches/core6/src/orxonox/interfaces/RadarListener.h 2013-03-24 16:33:43 UTC (rev 9563)
@@ -30,7 +30,7 @@
#define _RadarListener_H__
#include "OrxonoxPrereqs.h"
-#include "core/OrxonoxClass.h"
+#include "core/class/OrxonoxClass.h"
namespace orxonox
{
Modified: code/branches/core6/src/orxonox/interfaces/RadarViewable.h
===================================================================
--- code/branches/core6/src/orxonox/interfaces/RadarViewable.h 2013-03-24 15:16:01 UTC (rev 9562)
+++ code/branches/core6/src/orxonox/interfaces/RadarViewable.h 2013-03-24 16:33:43 UTC (rev 9563)
@@ -35,7 +35,7 @@
#include <cassert>
#include "util/Math.h"
-#include "core/OrxonoxClass.h"
+#include "core/class/OrxonoxClass.h"
#include "core/object/SmartPtr.h"
namespace orxonox
Modified: code/branches/core6/src/orxonox/interfaces/Rewardable.h
===================================================================
--- code/branches/core6/src/orxonox/interfaces/Rewardable.h 2013-03-24 15:16:01 UTC (rev 9562)
+++ code/branches/core6/src/orxonox/interfaces/Rewardable.h 2013-03-24 16:33:43 UTC (rev 9563)
@@ -35,7 +35,7 @@
#define _Rewardable_H__
#include "OrxonoxPrereqs.h"
-#include "core/OrxonoxClass.h"
+#include "core/class/OrxonoxClass.h"
namespace orxonox
{
Modified: code/branches/core6/src/orxonox/interfaces/TeamColourable.h
===================================================================
--- code/branches/core6/src/orxonox/interfaces/TeamColourable.h 2013-03-24 15:16:01 UTC (rev 9562)
+++ code/branches/core6/src/orxonox/interfaces/TeamColourable.h 2013-03-24 16:33:43 UTC (rev 9563)
@@ -32,7 +32,7 @@
#include "OrxonoxPrereqs.h"
#include "util/UtilPrereqs.h"
-#include "core/OrxonoxClass.h"
+#include "core/class/OrxonoxClass.h"
namespace orxonox
{
Modified: code/branches/core6/src/orxonox/overlays/OrxonoxOverlay.h
===================================================================
--- code/branches/core6/src/orxonox/overlays/OrxonoxOverlay.h 2013-03-24 15:16:01 UTC (rev 9562)
+++ code/branches/core6/src/orxonox/overlays/OrxonoxOverlay.h 2013-03-24 16:33:43 UTC (rev 9563)
@@ -41,8 +41,8 @@
#include "util/Math.h"
#include "util/OgreForwardRefs.h"
#include "core/BaseObject.h"
-#include "core/Super.h"
#include "core/WindowEventListener.h"
+#include "core/class/Super.h"
namespace orxonox
{
Modified: code/branches/core6/src/orxonox/sound/BaseSound.h
===================================================================
--- code/branches/core6/src/orxonox/sound/BaseSound.h 2013-03-24 15:16:01 UTC (rev 9562)
+++ code/branches/core6/src/orxonox/sound/BaseSound.h 2013-03-24 16:33:43 UTC (rev 9563)
@@ -34,7 +34,7 @@
#include <string>
#include <boost/shared_ptr.hpp>
#include <OgreDataStream.h>
-#include "core/OrxonoxClass.h"
+#include "core/class/OrxonoxClass.h"
namespace orxonox
{
Modified: code/branches/core6/src/orxonox/sound/SoundManager.h
===================================================================
--- code/branches/core6/src/orxonox/sound/SoundManager.h 2013-03-24 15:16:01 UTC (rev 9562)
+++ code/branches/core6/src/orxonox/sound/SoundManager.h 2013-03-24 16:33:43 UTC (rev 9563)
@@ -38,7 +38,7 @@
#include <boost/shared_ptr.hpp>
#include "util/Singleton.h"
-#include "core/OrxonoxClass.h"
+#include "core/class/OrxonoxClass.h"
#include "core/object/SmartPtr.h"
// tolua_begin
Modified: code/branches/core6/src/orxonox/weaponsystem/WeaponMode.h
===================================================================
--- code/branches/core6/src/orxonox/weaponsystem/WeaponMode.h 2013-03-24 15:16:01 UTC (rev 9562)
+++ code/branches/core6/src/orxonox/weaponsystem/WeaponMode.h 2013-03-24 16:33:43 UTC (rev 9563)
@@ -35,7 +35,7 @@
#include <string>
#include "util/Math.h"
#include "core/BaseObject.h"
-#include "core/SubclassIdentifier.h"
+#include "core/class/SubclassIdentifier.h"
#include "tools/Timer.h"
namespace orxonox
Modified: code/branches/core6/src/orxonox/weaponsystem/WeaponSystem.cc
===================================================================
--- code/branches/core6/src/orxonox/weaponsystem/WeaponSystem.cc 2013-03-24 15:16:01 UTC (rev 9562)
+++ code/branches/core6/src/orxonox/weaponsystem/WeaponSystem.cc 2013-03-24 16:33:43 UTC (rev 9563)
@@ -29,7 +29,7 @@
#include "WeaponSystem.h"
#include "core/CoreIncludes.h"
-#include "core/SubclassIdentifier.h"
+#include "core/class/SubclassIdentifier.h"
#include "worldentities/pawns/Pawn.h"
#include "WeaponSlot.h"
Modified: code/branches/core6/src/orxonox/worldentities/SpawnPoint.h
===================================================================
--- code/branches/core6/src/orxonox/worldentities/SpawnPoint.h 2013-03-24 15:16:01 UTC (rev 9562)
+++ code/branches/core6/src/orxonox/worldentities/SpawnPoint.h 2013-03-24 16:33:43 UTC (rev 9563)
@@ -32,7 +32,7 @@
#include "OrxonoxPrereqs.h"
#include <string>
-#include "core/SubclassIdentifier.h"
+#include "core/class/SubclassIdentifier.h"
#include "worldentities/StaticEntity.h"
namespace orxonox
More information about the Orxonox-commit
mailing list