libcrbn/sampler/smcache.hpp

00001 
00002 #ifndef __sampler_module_cache_hpp__
00003 #define __sampler_module_cache_hpp__
00004 
00005 #include <crbn/basic/basic.h>
00006 
00007 #include <vector>
00008 
00009 #include <crbn/sampler/smod.h>
00010 
00011 struct sm_entry {
00012   char* type;
00013   void* modid;
00014   int32 ref;
00015   SMOD_CREATE_FUNC create;
00016 
00017   sm_entry() : type( 0 ), modid( 0 ), ref( 0 ), create( 0 ) {}
00018   sm_entry( char* t, void* mi, SMOD_CREATE_FUNC c ) : type( t ), modid( mi ), ref( 1 ), create( c ) {}
00019 };
00020 
00021 class SmpModCache
00022 {
00023 public:
00024   // ctor.
00025   SmpModCache();
00026 
00027   // dtor.
00028   ~SmpModCache();
00029 
00030   // make all clean
00031   void clear();
00032 
00033   // return a sampler module entry. If it doesn't
00034   // exist, it load it.
00035   sm_entry* get( char* sampler_type );
00036 
00037   void unref( char* sampler_type );
00038 private:
00039   std::vector<sm_entry*> _sm_entries;
00040 };
00041 
00042 #endif // __sampler_module_cache_hpp__

Generated on Tue Nov 14 15:40:08 2006 for libcrbn by  doxygen 1.5.0