Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

Phx::Core Class Reference

The Core class is the primary interface through which the Phoenix simulator is driven. More...

#include <PhxCore.h>

Inheritance diagram for Phx::Core:

Phx::LockedPtrInterface< Core > List of all members.

Public Member Functions

virtual void main (void)=0
NamedInterface::ManagernamedInterfaceManager ()
 Retrieves a pointer to the NamedInterface::Manager instance that is charged with keeping track of objects for this Core.
const NamedInterface::ManagernamedInterfaceManager () const
Description::ManagerdescriptionManager ()
 Retrieves a pointer to the Description::Manager instance that is charged with keeping track of Description types for this Core.
const Description::ManagerdescriptionManager () const
virtual const String & dataPath (void) const =0
 Returns the path to the Phoenix data directory.
virtual uint32_t threadCount (void) const =0
 Returns the number of threads used by the core.
virtual const Ptr< Log > & log (void)=0
 Returns the system log for this core.

Static Public Member Functions

static const Ptr< Log > & systemLog (void)
 Returns the system log for the program.
static void newCore (void)
 Creates the program Core instance.
static Corecore (void)
 Returns the program Core instance.
static void deleteCore (void)
 Deletes the program Core instance.

Static Public Attributes

static const NamedInterface::Identifier FRAME_START_EVENT_NOTIFIER_IDENTIFIER
 Identifier for the system 'start frame' EventNotifier.
static const String FRAME_START_EVENT_NOTIFIER_NAME
 Text name for the system 'start frame' EventNotifier.
static const NamedInterface::Identifier FRAME_END_EVENT_NOTIFIER_IDENTIFIER
 Identifier for the system 'end frame' EventNotifier.
static const String FRAME_END_EVENT_NOTIFIER_NAME
 Text name for the system 'end frame' EventNotifier.
static const NamedInterface::Identifier QUIT_EVENT_NOTIFIER_IDENTIFIER
 Identifier for the system 'Quit' notifier.
static const String QUIT_EVENT_NOTIFIER_NAME
 Text name for the system 'Quit' notifier.
static const NamedInterface::Identifier EXIT_EVENT_NOTIFIER_IDENTIFIER
 Identifier for the system 'Exit' notifier.
static const String EXIT_EVENT_NOTIFIER_NAME
 Text name for the system 'Exit' notifier.
static const NamedInterface::Identifier WALL_CLOCK_IDENTIFIER
 Identifier for the system WallClock object.
static const String WALL_CLOCK_NAME
 Text name for the system WallClock object.
static const NamedInterface::Identifier FRAME_CLOCK_IDENTIFIER
 Identifier for the system FrameClock object.
static const String FRAME_CLOCK_NAME
 Text name for the system FrameClock object.

Protected Member Functions

void setNamedInterfaceManager (const Ptr< NamedInterface::Manager > &manager)
void setDescriptionManager (const Ptr< Description::Manager > &manager)
void setCore (Core *core)

Detailed Description

The Core class is the primary interface through which the Phoenix simulator is driven.

The Core is the controller of the simulation. It presides over the top level facilities needed to run the program, and is responsible for running the main-loop of the simulation.


Member Function Documentation

static Core* Phx::Core::core void   )  [inline, static]
 

Returns the program Core instance.

This is non-zero after newCore() is called, and before deleteCore() is called.

virtual const String& Phx::Core::dataPath void   )  const [pure virtual]
 

Returns the path to the Phoenix data directory.

With few exceptions, all game content will be located in this directory. While this will typically be located somewhere relative to the application binary, it is possible that it will be somewhere else (e.g., on another filesystem). Hence, all references to game data should use this path as their base to avoid configuration problems.

Returns:
The data directory path, ending in a '/'.

Description::Manager* Phx::Core::descriptionManager  )  [inline]
 

Retrieves a pointer to the Description::Manager instance that is charged with keeping track of Description types for this Core.

Note:
Even though the manager can be manipulated as a Ptr, it is returned as a raw pointer here to avoid circular dependence. It should not be converted back to a smart-pointer by the client.

This interface is safely accessible by multiple concurrent clients.

Returns:
A raw pointer to the core's Description::Manager instance.

virtual const Ptr<Log>& Phx::Core::log void   )  [pure virtual]
 

Returns the system log for this core.

If this is the first core, this is the same log returned by Log::systemLog(). This log can also be accessed via the named interface manager using Log::LOG_IDENTIFIER.

Use this log for general errors and information logging pertaining to program execution. Auxilliary logs should be used for logging non-essential information (e.g., for chat logs) that is not useful to administrators and/or developers. The system log is the place to look for crash/debug information, etc. and shouldn't be cluttered too heavily.

NamedInterface::Manager* Phx::Core::namedInterfaceManager  )  [inline]
 

Retrieves a pointer to the NamedInterface::Manager instance that is charged with keeping track of objects for this Core.

Note:
Even though the manager can be manipulated as a Ptr, it is returned as a raw pointer here to avoid circular dependence. It should not be converted back to a smart-pointer by the client.

This interface is safely accessible by multiple concurrent clients.

Returns:
A raw pointer to the core's NamedInterface::Manager instance.

static const Ptr<Log>& Phx::Core::systemLog void   )  [static]
 

Returns the system log for the program.

This is a safe call that is equivalent to core()->log() when the core is running. After the core shuts down, the returned long redirects to std::cerr.

Todo:
systemLog is not actually safe yet -- returns 0 after core is gone.

virtual uint32_t Phx::Core::threadCount void   )  const [pure virtual]
 

Returns the number of threads used by the core.

This information is typically irrelevant to clients -- some may require it, however, for selecting thread affinities.


Member Data Documentation

const NamedInterface::Identifier Phx::Core::EXIT_EVENT_NOTIFIER_IDENTIFIER [static]
 

Identifier for the system 'Exit' notifier.

This notifier is notified by the Core after the last frame has finished and the program is about to exit. This notification allows final processing to occur before the program finishes.

See also:
QUIT_EVENT_NOTIFIER_IDENTIFIER

const NamedInterface::Identifier Phx::Core::FRAME_CLOCK_IDENTIFIER [static]
 

Identifier for the system FrameClock object.

Note:
While the FrameClock interface, in general, may indicate a fractional number of frames the system FrameClock is guaranteed to always return a whole number of frames and will increment by exactly 1.0 every frame. Hence, Clock::time() will always return precisely the number of elapsed frames in the simulation.

const NamedInterface::Identifier Phx::Core::QUIT_EVENT_NOTIFIER_IDENTIFIER [static]
 

Identifier for the system 'Quit' notifier.

The 'quit' notifier is an EventNotifier that can be triggered by any client in order to terminate the program. The frame will finish executing, the Core will issue the 'Exit' notification, the main loop will finish and the program will exit.

See also:
EXIT_EVENT_NOTIFIER_IDENTIFIER

const NamedInterface::Identifier Phx::Core::WALL_CLOCK_IDENTIFIER [static]
 

Identifier for the system WallClock object.

Note:
The system WallClock is not guaranteed to proceed at a rate identical to real-time. It may be slowed or quickened, or even stopped completely. However, the time will never go backward and guaranteed only to change between frames, consistent with the current value of the Clock::rate() attribute.


The documentation for this class was generated from the following file:
Generated on Mon Jul 10 19:45:29 2006 for Phoenix OSFS by  doxygen 1.4.2