Orxonox: src/core/CoreIncludes.h File Reference

# CoreIncludes.h File Reference

Definition of macros for Identifier and Factory. More...

`#include "CorePrereqs.h"`
`#include "util/Debug.h"`
`#include "Identifier.h"`
`#include "Factory.h"`
`#include "ClassFactory.h"`
`#include "ObjectList.h"`

## Defines

#define | Class(ClassName) orxonox::ClassIdentifier<ClassName>::getIdentifier()
| Returns the Identifier of the given class.
#define | ClassByID(networkID) orxonox::Factory::getIdentifier(networkID)
| Returns the Identifier with a given network ID through the factory.
#define | ClassByString(String) orxonox::Factory::getIdentifier(String)
| Returns the Identifier with a given name through the factory.
#define | CreateFactory(ClassName) bool bCreated##ClassName##Factory = orxonox::ClassFactory<ClassName>::create(#ClassName, true)
| Creates the entry in the Factory.
#define | CreateUnloadableFactory(ClassName) bool bCreated##ClassName##Factory = orxonox::ClassFactory<ClassName>::create(#ClassName, false)
| Creates the entry in the Factory for classes which should not be loaded through XML.
#define | InternRegisterObject(ClassName, bRootClass)
| Intern macro, containing the common parts of RegisterObject and RegisterRootObject.
#define | InternRegisterRootObject(ClassName)
| Intern macro, containing the specific part of RegisterRootObject.
#define | RegisterObject(ClassName)
| RegisterObject - with and without debug output.
#define | RegisterRootObject(ClassName)
| RegisterRootObject - with and without debug output.

## Detailed Description

Definition of macros for Identifier and Factory.

Every class needs the RegisterObject(class) macro in its constructor. If the class is an interface or the BaseObject itself, it needs the macro RegisterRootObject(class) instead.

To allow the object being created through the factory, use the CreateFactory(class) macro outside the of the class implementation, so it gets executed before main().

## Define Documentation

#define Class | ( | ClassName |  | ) | orxonox::ClassIdentifier<ClassName>::getIdentifier()

Returns the Identifier of the given class.

Parameters:

  | ClassName | The name of the class

Referenced by orxonox::PickupCollection::add(), orxonox::DistanceTrigger::addTargets(), orxonox::Bot::Bot(), orxonox::TeamBaseMatchBase::changeTeamColour(), orxonox::PongCenterpoint::checkGametype(), orxonox::DistanceTrigger::DistanceTrigger(), orxonox::Gametype::Gametype(), orxonox::TeamDeathmatch::getBestSpawnPoint(), orxonox::PickupCollection::getEquipmentItems(), orxonox::WeaponSystem::getMunition(), orxonox::PickupCollection::getPassiveItems(), orxonox::PickupCollection::getUsableItems(), orxonox::HumanPlayer::HumanPlayer(), orxonox::BigExplosion::init(), orxonox::Level::networkcallback_applyXMLFile(), orxonox::CheckPoint::notifyMaskUpdate(), orxonox::TeamDeathmatch::playerStartsControllingPawn(), orxonox::Pong::Pong(), orxonox::PongBot::PongBot(), orxonox::Level::setGametypeString(), orxonox::Pong::spawnPlayer(), and orxonox::GametypeStatus::tick().

#define ClassByID | ( | networkID |  | ) | orxonox::Factory::getIdentifier(networkID)

Returns the Identifier with a given network ID through the factory.

Parameters:

  | networkID | The network ID of the class

Referenced by orxonox::Synchronisable::fabricate(), and orxonox::Synchronisable::getData().

#define ClassByString | ( | String |  | ) | orxonox::Factory::getIdentifier(String)

Returns the Identifier with a given name through the factory.

Parameters:

  | String | The name of the class

Referenced by orxonox::DistanceTrigger::addTargets(), orxonox::packet::ClassID::process(), orxonox::DistanceTrigger::removeTargets(), orxonox::Template::setBaseclass(), orxonox::Level::setGametypeString(), orxonox::WeaponMode::setMunitionName(), and orxonox::SpawnPoint::setSpawnClassName().

#define CreateFactory | ( | ClassName |  | ) | bool bCreated##ClassName##Factory = orxonox::ClassFactory<ClassName>::create(#ClassName, true)

Creates the entry in the Factory.

Parameters:

  | ClassName | The name of the class

#define CreateUnloadableFactory | ( | ClassName |  | ) | bool bCreated##ClassName##Factory = orxonox::ClassFactory<ClassName>::create(#ClassName, false)

Creates the entry in the Factory for classes which should not be loaded through XML.

Parameters:

  | ClassName | The name of the class

#define InternRegisterObject | ( | ClassName,
|  | bRootClass |  | ) |

Value:

    this->setIdentifier(orxonox::ClassIdentifier<ClassName>::getIdentifier(#ClassName)); \
        if (orxonox::Identifier::isCreatingHierarchy()) \
        { \
            if (this->getParents()) \
            { \
                orxonox::ClassIdentifier<ClassName>::getIdentifier(#ClassName)->initializeClassHierarchy(this->getParents(), bRootClass); \
                this->getParents()->insert(this->getParents()->end(), this->getIdentifier()); \
            } \
            this->setConfigValues(); \
            return; \
        } \
        orxonox::ClassIdentifier<ClassName>::getIdentifier()->addObject(this)

Intern macro, containing the common parts of RegisterObject and RegisterRootObject.

Parameters:

  | ClassName | The name of the class
  | bRootClass | True if the class is directly derived from OrxonoxClass

#define InternRegisterRootObject | ( | ClassName |  | ) |

Value:

    if (orxonox::Identifier::isCreatingHierarchy() && !this->getParents()) \
            this->createParents(); \
        InternRegisterObject(ClassName, true)

Intern macro, containing the specific part of RegisterRootObject.

Parameters:

  | ClassName | The name of the class

#define RegisterObject | ( | ClassName |  | ) |

Value:

    COUT(5) << "*** Register Object: " << #ClassName << std::endl; \
        InternRegisterObject(ClassName, false)

RegisterObject - with and without debug output.

Parameters:

  | ClassName | The name of the class

Referenced by orxonox::AddQuest::AddQuest(), orxonox::AddQuestHint::AddQuestHint(), orxonox::AddReward::AddReward(), orxonox::AIController::AIController(), orxonox::AnnounceMessage::AnnounceMessage(), orxonox::ArtificialController::ArtificialController(), orxonox::Asteroids::Asteroids(), orxonox::Attacher::Attacher(), orxonox::Backlight::Backlight(), orxonox::BarColour::BarColour(), orxonox::BaseItem::BaseItem(), orxonox::BigExplosion::BigExplosion(), orxonox::Billboard::Billboard(), orxonox::BillboardProjectile::BillboardProjectile(), orxonox::BlinkingBillboard::BlinkingBillboard(), orxonox::Bot::Bot(), orxonox::BoxCollisionShape::BoxCollisionShape(), orxonox::Camera::Camera(), orxonox::CameraPosition::CameraPosition(), orxonox::ChangeQuestStatus::ChangeQuestStatus(), orxonox::ChatOverlay::ChatOverlay(), orxonox::CheckPoint::CheckPoint(), orxonox::CollisionShape::CollisionShape(), orxonox::CompleteQuest::CompleteQuest(), orxonox::CompoundCollisionShape::CompoundCollisionShape(), orxonox::ConeCollisionShape::ConeCollisionShape(), orxonox::ControllableEntity::ControllableEntity(), orxonox::Controller::Controller(), orxonox::Deathmatch::Deathmatch(), orxonox::DeathMessage::DeathMessage(), orxonox::DebugFPSText::DebugFPSText(), orxonox::DebugRTRText::DebugRTRText(), orxonox::DefaultWeaponmodeLink::DefaultWeaponmodeLink(), orxonox::Destroyer::Destroyer(), orxonox::DistanceTrigger::DistanceTrigger(), orxonox::DroppedItem::DroppedItem(), orxonox::EnergyDrink::EnergyDrink(), orxonox::Engine::Engine(), orxonox::EquipmentItem::EquipmentItem(), orxonox::EventDispatcher::EventDispatcher(), orxonox::EventListener::EventListener(), orxonox::EventTarget::EventTarget(), orxonox::EventTrigger::EventTrigger(), orxonox::ExplosionChunk::ExplosionChunk(), orxonox::FadeoutText::FadeoutText(), orxonox::FadingBillboard::FadingBillboard(), orxonox::FailQuest::FailQuest(), orxonox::ForceField::ForceField(), orxonox::FusionFire::FusionFire(), orxonox::FusionMunition::FusionMunition(), orxonox::Gametype::Gametype(), orxonox::GametypeInfo::GametypeInfo(), orxonox::GametypeStatus::GametypeStatus(), orxonox::GlobalQuest::GlobalQuest(), orxonox::GlobalShader::GlobalShader(), orxonox::GraphicsManager::GraphicsManager(), orxonox::GSLevel::GSLevel(), orxonox::GUIOverlay::GUIOverlay(), orxonox::HealthImmediate::HealthImmediate(), orxonox::HealthUsable::HealthUsable(), orxonox::HsW01::HsW01(), orxonox::HUDBar::HUDBar(), orxonox::HUDHealthBar::HUDHealthBar(), orxonox::HUDNavigation::HUDNavigation(), orxonox::HUDRadar::HUDRadar(), orxonox::HUDSpeedBar::HUDSpeedBar(), orxonox::HUDTimer::HUDTimer(), orxonox::HumanController::HumanController(), orxonox::HumanPlayer::HumanPlayer(), orxonox::Info::Info(), orxonox::InGameConsole::InGameConsole(), orxonox::QuestNotification::initialize(), orxonox::Item::Item(), orxonox::JoyStickDeviceNumberListener::JoyStickDeviceNumberListener(), orxonox::Jump::Jump(), orxonox::KeyDetector::KeyDetector(), orxonox::KillMessage::KillMessage(), orxonox::LaserFire::LaserFire(), orxonox::LaserMunition::LaserMunition(), orxonox::Level::Level(), orxonox::Light::Light(), orxonox::LightningGun::LightningGun(), orxonox::LightningGunProjectile::LightningGunProjectile(), orxonox::LocalQuest::LocalQuest(), orxonox::Map::Map(), orxonox::MobileEntity::MobileEntity(), orxonox::Model::Model(), orxonox::ModifierPickup::ModifierPickup(), orxonox::MovableEntity::MovableEntity(), orxonox::MultiStateEngine::MultiStateEngine(), orxonox::Munition::Munition(), orxonox::MuzzleFlash::MuzzleFlash(), orxonox::Namespace::Namespace(), orxonox::NetworkFunctionStatic::NetworkFunctionStatic(), orxonox::NetworkMemberFunctionBase::NetworkMemberFunctionBase(), orxonox::Notification::Notification(), orxonox::NotificationOverlay::NotificationOverlay(), orxonox::NotificationQueue::NotificationQueue(), orxonox::OverlayText::OverlayText(), orxonox::ParticleEmitter::ParticleEmitter(), orxonox::ParticleInterface::ParticleInterface(), orxonox::ParticleProjectile::ParticleProjectile(), orxonox::ParticleSpawner::ParticleSpawner(), orxonox::PassiveItem::PassiveItem(), orxonox::Pawn::Pawn(), orxonox::PickupSpawner::PickupSpawner(), orxonox::PlaneCollisionShape::PlaneCollisionShape(), orxonox::Planet::Planet(), orxonox::PlayerInfo::PlayerInfo(), orxonox::PlayerTrigger::PlayerTrigger(), orxonox::Pong::Pong(), orxonox::PongAI::PongAI(), orxonox::PongBall::PongBall(), orxonox::PongBat::PongBat(), orxonox::PongBot::PongBot(), orxonox::PongCenterpoint::PongCenterpoint(), orxonox::PongScore::PongScore(), orxonox::Projectile::Projectile(), orxonox::Quest::Quest(), orxonox::QuestDescription::QuestDescription(), orxonox::QuestEffect::QuestEffect(), orxonox::QuestEffectBeacon::QuestEffectBeacon(), orxonox::QuestHint::QuestHint(), orxonox::QuestItem::QuestItem(), orxonox::QuestListener::QuestListener(), orxonox::ReplenishingMunition::ReplenishingMunition(), orxonox::Rewardable::Rewardable(), orxonox::Scene::Scene(), orxonox::Scoreboard::Scoreboard(), orxonox::Script::Script(), orxonox::ScriptController::ScriptController(), orxonox::Shader::Shader(), orxonox::SoundMainMenu::SoundMainMenu(), orxonox::SpaceShip::SpaceShip(), orxonox::SpawnPoint::SpawnPoint(), orxonox::Spectator::Spectator(), orxonox::SphereCollisionShape::SphereCollisionShape(), orxonox::StaticEntity::StaticEntity(), orxonox::Stats::Stats(), orxonox::TeamBaseMatch::TeamBaseMatch(), orxonox::TeamBaseMatchBase::TeamBaseMatchBase(), orxonox::TeamBaseMatchScore::TeamBaseMatchScore(), orxonox::TeamDeathmatch::TeamDeathmatch(), orxonox::TeamSpawnPoint::TeamSpawnPoint(), orxonox::Template::Template(), orxonox::Test::Test(), orxonox::TimerBase::TimerBase(), orxonox::TrafficControl::TrafficControl(), orxonox::Trigger::Trigger(), orxonox::UnderAttack::UnderAttack(), orxonox::UnderAttackHealthBar::UnderAttackHealthBar(), orxonox::UsableItem::UsableItem(), orxonox::WaypointController::WaypointController(), orxonox::WaypointPatrolController::WaypointPatrolController(), orxonox::Weapon::Weapon(), orxonox::WeaponMode::WeaponMode(), orxonox::WeaponPack::WeaponPack(), orxonox::WeaponSet::WeaponSet(), orxonox::WeaponSlot::WeaponSlot(), orxonox::WeaponSystem::WeaponSystem(), orxonox::WorldEntity::WorldEntity(), and orxonox::WorldEntityCollisionShape::WorldEntityCollisionShape().

#define RegisterRootObject | ( | ClassName |  | ) |

Value:

    COUT(5) << "*** Register Root-Object: " << #ClassName << std::endl; \
        InternRegisterRootObject(ClassName)

RegisterRootObject - with and without debug output.

Parameters:

  | ClassName | The name of the class

Referenced by orxonox::BaseObject::BaseObject(), orxonox::ChatListener::ChatListener(), orxonox::ClientConnectionListener::ClientConnectionListener(), orxonox::GameConfiguration::GameConfiguration(), orxonox::GametypeMessageListener::GametypeMessageListener(), orxonox::GSGraphics::GSGraphics(), orxonox::CoreConfiguration::initialise(), orxonox::InputBuffer::InputBuffer(), orxonox::InputManager::InputManager(), orxonox::KeyBinder::KeyBinder(), orxonox::NetworkFunctionBase::NetworkFunctionBase(), orxonox::NotificationManager::NotificationManager(), orxonox::PawnListener::PawnListener(), orxonox::PawnManager::PawnManager(), orxonox::PlayerManager::PlayerManager(), orxonox::QuestManager::QuestManager(), orxonox::RadarListener::RadarListener(), orxonox::RadarViewable::RadarViewable(), orxonox::Shell::Shell(), orxonox::Synchronisable::Synchronisable(), orxonox::TclThreadManager::TclThreadManager(), orxonox::TeamColourable::TeamColourable(), orxonox::Tickable::Tickable(), orxonox::TimeFactorListener::TimeFactorListener(), orxonox::WindowEventListener::WindowEventListener(), and orxonox::XMLNameListener::XMLNameListener().