Home || Architecture || Video Search || Visual Search || Scripts || Applications || Important Messages || OGL || Src

OglImageCacheStore.h

Go to the documentation of this file.
00001 /*
00002  *  OglImageCacheStore.h
00003  *  For MediaTable
00004  *
00005  *  Created by Daan Odijk on 14-09-09.
00006  *
00007  *  Based completely on OglImageCache.h from OglGui, with 1 modifications:
00008  *  - OglImageCacheStore is a singleton instance
00009  *
00010  */
00011 
00012 #ifndef MediaTable_OglImageCacheStore_h
00013 #define MediaTable_OglImageCacheStore_h
00014 
00015 #include "OglGui/OglImageCache.h"
00016 
00017 namespace Impala {
00018 namespace Application {
00019 namespace MediaTable {
00020 
00021 class OglImageCacheStore : public OglGui::OglImageCache
00022 {
00023 public:
00024         static void Initialize(int size)
00025         {
00026                 if (sInstance)
00027                 {
00028                         ILOG_WARN("OglImageCacheStore already initialized. Skipping.");
00029                         return;
00030                 }
00031         else
00032                         sInstance = new OglImageCacheStore(size);
00033         }
00034 
00035         static OglImageCacheStore* GetInstance()
00036         {
00037                 if(!sInstance)
00038             Initialize(sDefaultSize);
00039                 return sInstance;
00040         }
00041 
00042         void Clear()
00043     {
00044                 delete sInstance;
00045                 sInstance = 0;
00046         }
00047 
00048 private:
00049     // constructor: private
00050         OglImageCacheStore(int size) : OglImageCache(size)
00051         {
00052                 Init();
00053         }
00054 
00055     // copy constructor: private
00056         OglImageCacheStore(OglImageCacheStore const&) : OglImageCache(0) {};
00057 
00058     // assignment operator: private
00059         OglImageCacheStore& operator=(OglImageCacheStore const&){};
00060 
00061         void Init()
00062         {
00063                 ILOG_DEBUG("Initializing OglImageCacheStore");
00064         }
00065 
00066         static OglImageCacheStore*          sInstance;
00067         static int                                      sDefaultSize;
00068 
00069         ILOG_VAR_DEC;
00070 };
00071 
00072 OglImageCacheStore* OglImageCacheStore::sInstance       = 0;
00073 int                     OglImageCacheStore::sDefaultSize    = 1000;
00074 
00075 ILOG_VAR_INIT(OglImageCacheStore, Application.MediaTable);
00076 
00077 } // namespace MediaTable
00078 } // namespace Application
00079 } // namespace Impala
00080 
00081 #endif // OglImageCacheStore_h

Generated on Fri Mar 19 09:30:33 2010 for ImpalaSrc by  doxygen 1.5.1