00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef RIX_INTERFACE_H
00024 #define RIX_INTERFACE_H
00025
00072 #include <stddef.h>
00073
00075 enum RixInterfaceId {
00076 k_RixThreadUtils = 0,
00077 k_RixMessages,
00078 k_RixStats,
00079 k_RixGlobalData,
00080 k_RixThreadData,
00081 k_RixLocalData
00082 };
00083
00084
00089 class RixInterface {
00090 public:
00093 virtual int GetVersion() const { return m_version; }
00094
00095 protected:
00097 int m_version;
00098
00100 RixInterface(int version) : m_version(version) { }
00101
00103 virtual ~RixInterface() { }
00104 };
00105
00106
00110 class RixContext {
00111 public:
00114 virtual RixInterface* GetRixInterface(RixInterfaceId id) const;
00115
00117 virtual ~RixContext();
00118 };
00119
00120
00128 class RixMutex {
00129 public:
00131 virtual ~RixMutex() { }
00132
00134 virtual void Lock() = 0;
00135
00137 virtual void Unlock() = 0;
00138 };
00139
00140
00144 class RixThreadUtils : public RixInterface {
00145 public:
00147 virtual RixMutex* NewMutex() const = 0;
00148
00149 protected:
00151 RixThreadUtils() : RixInterface(1) { }
00152 };
00153
00154
00157 class RixMessages : public RixInterface {
00158 public:
00166 virtual void Error(const char* format, ...) = 0;
00167
00169 virtual void ErrorAlways(const char* format, ...) = 0;
00170
00172 virtual void Warning(const char* format, ...) = 0;
00173
00175 virtual void WarningAlways(const char* format, ...) = 0;
00176
00178 virtual void Info(const char* format, ...) = 0;
00179
00181 virtual void InfoAlways(const char* format, ...) = 0;
00182
00183 protected:
00185 RixMessages() : RixInterface(1) { }
00186 };
00187
00188
00203 class RixStats : public RixInterface {
00204 public:
00211 virtual void AddTimerStat(float* seconds, const char* name,
00212 const char* description) = 0;
00213
00220 virtual void AddMemoryStat(size_t* bytes, const char* name,
00221 const char* description) = 0;
00222
00225 typedef void (*Reporter)(class RixXmlFile* file);
00226
00244 virtual void AddReporter(Reporter func) = 0;
00245
00246 protected:
00248 RixStats() : RixInterface(1) { }
00249 };
00250
00251
00254 class RixXmlFile {
00255 public:
00261 virtual void WriteXml(const char* format, ...) = 0;
00262
00265 virtual void WriteText(const char* format, ...) = 0;
00266 };
00267
00268
00270 typedef void (*RixCleanupFunc)(RixContext* context, void* data);
00271
00272
00315 class RixStorage : public RixInterface {
00316 public:
00318 virtual void* Get(const char* key) = 0;
00319
00323 virtual void Set(const char* key, void* data,
00324 RixCleanupFunc cleanup = NULL) = 0;
00325
00328 virtual void Clear(const char* key) = 0;
00329
00331 virtual void Lock() = 0;
00332
00334 virtual void Unlock() = 0;
00335
00336 protected:
00338 RixStorage() : RixInterface(1) { }
00339 };
00340
00341
00342 #endif // RIX_INTERFACE_H