RixInterfaces.h

Go to the documentation of this file.
00001 /* $Id: //depot/main/rmanprod/rman/include/shadeop.h#18 $  (Pixar - RenderMan Division) $Date: 2005/06/02 $ */
00002 /*
00003 ** Copyright (c) 2004 PIXAR.  All rights reserved.  This program or
00004 ** documentation contains proprietary confidential information and trade
00005 ** secrets of PIXAR.  Reverse engineering of object code is prohibited.
00006 ** Use of copyright notice is precautionary and does not imply
00007 ** publication.
00008 **
00009 **                      RESTRICTED RIGHTS NOTICE
00010 **       
00011 ** Use, duplication, or disclosure by the Government is subject to the
00012 ** following restrictions:  For civilian agencies, subparagraphs (a) through
00013 ** (d) of the Commercial Computer Software--Restricted Rights clause at
00014 ** 52.227-19 of the FAR; and, for units of the Department of Defense, DoD
00015 ** Supplement to the FAR, clause 52.227-7013 (c)(1)(ii), Rights in
00016 ** Technical Data and Computer Software.
00017 **
00018 ** Pixar
00019 ** 1200 Park Ave.
00020 ** Emeryville, CA  94608
00021 */
00022 
00023 #ifndef RIX_INTERFACE_H
00024 #define RIX_INTERFACE_H
00025 
00072 #include <stddef.h>             // for size_t
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

Generated on Wed May 10 11:00:40 2006 for PRManHeaders by  doxygen 1.4.6