00001 #ifndef PHX_CORE_H 00002 #define PHX_CORE_H 00003 00004 #include <Phx/PhxConfig.h> 00005 #include <Phx/PhxTypes.h> 00006 00007 // Needed util components 00008 #include <Phx/Util/PhxListeners.h> 00009 #include <Phx/Util/PhxLocks.h> 00010 #include <Phx/Util/PhxLog.h> 00011 00012 // Core components 00013 #include <Phx/Core/PhxNamedInterface.h> 00014 #include <Phx/Core/PhxDescription.h> 00015 #include <Phx/Core/PhxModule.h> 00016 #include <Phx/Core/PhxClock.h> 00017 #include <Phx/Core/PhxEventNotifier.h> 00018 00026 namespace Phx { 00027 00036 class Core : public LockedPtrInterface<Core> { 00037 public: 00038 00040 const static NamedInterface::Identifier FRAME_START_EVENT_NOTIFIER_IDENTIFIER; 00042 const static String FRAME_START_EVENT_NOTIFIER_NAME; 00043 00045 const static NamedInterface::Identifier FRAME_END_EVENT_NOTIFIER_IDENTIFIER; 00047 const static String FRAME_END_EVENT_NOTIFIER_NAME; 00048 00059 const static NamedInterface::Identifier QUIT_EVENT_NOTIFIER_IDENTIFIER; 00061 const static String QUIT_EVENT_NOTIFIER_NAME; 00062 00071 const static NamedInterface::Identifier EXIT_EVENT_NOTIFIER_IDENTIFIER; 00073 const static String EXIT_EVENT_NOTIFIER_NAME; 00074 00083 const static NamedInterface::Identifier WALL_CLOCK_IDENTIFIER; 00085 const static String WALL_CLOCK_NAME; 00086 00096 const static NamedInterface::Identifier FRAME_CLOCK_IDENTIFIER; 00098 const static String FRAME_CLOCK_NAME; 00099 00100 // Invoked by the program entry point. 00101 // This should NEVER be called by another client. 00102 virtual void main(void) = 0; 00103 00104 // --------- NAMED INTERFACE MANAGER --------- 00105 00122 NamedInterface::Manager* namedInterfaceManager() { return mInterfaceManager.ptr(); } 00123 00124 // const version of the above 00125 const NamedInterface::Manager* namedInterfaceManager() const { return mInterfaceManager.ptr(); } 00126 00127 // --------- DESCRIPTION MANAGER --------- 00128 00144 Description::Manager* descriptionManager() { return mDescriptionManager.ptr(); } 00145 00146 // const version of the above 00147 const Description::Manager* descriptionManager() const { return mDescriptionManager.ptr(); } 00148 00149 // --------- PROGRAM CONFIGURATION --------- 00150 00163 virtual const String& dataPath(void) const = 0; 00164 00171 virtual uint32_t threadCount(void) const = 0; 00172 00187 virtual const Ptr<Log>& log(void) = 0; 00188 00199 static const Ptr<Log>& systemLog(void); 00200 00204 static void newCore(void); 00205 00212 static Core* core(void) { return mCore; } 00213 00217 static void deleteCore(void); 00218 00219 protected: 00220 void setNamedInterfaceManager(const Ptr<NamedInterface::Manager>& manager) 00221 { mInterfaceManager = manager; } 00222 00223 void setDescriptionManager(const Ptr<Description::Manager>& manager) 00224 { mDescriptionManager = manager; } 00225 00226 void setCore(Core* core) { 00227 mCore = core; 00228 } 00229 private: 00230 static Core* mCore; 00231 Ptr<NamedInterface::Manager> mInterfaceManager; 00232 Ptr<Description::Manager> mDescriptionManager; 00233 }; 00234 00235 }; // namespace Phx 00236 00237 #endif /* PHX_CORE_H */ 00238
1.4.2