#include <RixInterfaces.h>
Inheritance diagram for RixStorage:

Public Member Functions | |
| virtual void * | Get (const char *key)=0 | 
| Get the data associated with the given key, or NULL if there is none.   | |
| virtual void | Set (const char *key, void *data, RixCleanupFunc cleanup=NULL)=0 | 
| Set the data associated with the given key, along with an optional cleanup function.   | |
| virtual void | Clear (const char *key)=0 | 
| Clear any data associated with the given key, calling its cleanup function (if any).   | |
| virtual void | Lock ()=0 | 
| Lock this object. (Unnecessary unless it's used for global storage.).   | |
| virtual void | Unlock ()=0 | 
| Unlock this object.   | |
| virtual int | GetVersion () const | 
| Get the version number of this interface.   | |
Protected Member Functions | |
| RixStorage () | |
| Constructor is for internal use only.   | |
Protected Attributes | |
| int | m_version | 
| Version number of this interface.   | |
For example, a shader plugin might share per-thread data as follows:
RixStorage* storage = (RixStorage*) rslContext->GetRixInterface(k_RixThreadData); void* mydata = storage->Get("mydata"); if (mydata == NULL) { mydata = MakeData(); storage->Set("mydata", mydata, CleanupData); }
Per-thread storage is thread-safe, but per-frame storage must be locked:
RixStorage* storage = (RixStorage*) rslCtx->GetRixInterface(k_RixFrameData); storage->Lock(); void* myglobal = storage->Get("myglobal"); if (myglobal == NULL) { myglobal = MakeData(); storage->Set("myglobal", myglobal, CleanupData); } storage->Unlock();
A cleanup function has a prototype like the following:
void myCleanup(RixContext* context, void* data);
      
  | 
  
| 
 Constructor is for internal use only. 
  | 
  
      
  | 
  
| 
 Clear any data associated with the given key, calling its cleanup function (if any). 
  | 
  
      
  | 
  
| 
 Get the data associated with the given key, or NULL if there is none. 
  | 
  
      
  | 
  
| 
 Get the version number of this interface. Different interfaces might have different version numbers in a given release.  | 
  
      
  | 
  
| 
 Lock this object. (Unnecessary unless it's used for global storage.). 
  | 
  
      
  | 
  ||||||||||||||||
| 
 Set the data associated with the given key, along with an optional cleanup function. Any previously associated data is discarded (calling its cleanup function, if any). The key is copied.  | 
  
      
  | 
  
| 
 Unlock this object. 
  | 
  
      
  | 
  
| 
 Version number of this interface. 
  | 
  
 1.4.6