Octane v1.01.20 - The Open Compression Toolkit for C++ | http://octane.sourceforge.net/ |
00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 //--------------------------------------------------------------------------- 00012 00013 00014 //--------------------------------------------------------------------------- 00015 // recursive header protection 00016 #ifndef CompressorManagerH 00017 #define CompressorManagerH 00018 //--------------------------------------------------------------------------- 00019 00020 //--------------------------------------------------------------------------- 00021 // application includes 00022 #include "../compressors/compressor.hpp" 00023 // system includes 00024 #include <string> 00025 #include <vector> 00026 #include <assert.h> 00027 //--------------------------------------------------------------------------- 00028 00029 00030 00031 00032 //--------------------------------------------------------------------------- 00038 class CompressorManager : public OctaneClass 00039 { 00040 protected: 00042 std::vector<OctaneCompressor*> compressorvector_basetypes; 00044 std::vector<OctaneCompressor*> compressorvector_instantiated; 00045 public: 00047 CompressorManager(); 00049 ~CompressorManager(); 00050 public: 00052 int GetBaseCompressorCount() {return compressorvector_basetypes.size();}; 00054 int GetInstantiatedCompressorCount() {return compressorvector_instantiated.size();}; 00056 OctaneCompressor* GetBaseCompressorp(int index) {assert(index<GetBaseCompressorCount()); return compressorvector_basetypes[index];}; 00058 OctaneCompressor* GetInstantiatedCompressorp(int index) {assert(index<GetInstantiatedCompressorCount()); return compressorvector_instantiated[index];}; 00059 public: 00062 OctaneCompressor* FindBaseCompressorClass(const std::string &compressorname); 00066 OctaneCompressor *FindInstantiatedCompressorpFromStringId(std::string idstring); 00069 OctaneCompressor *FindInstantiatedCompressorpFromGuid(unsigned short int guidindex); 00071 void RegisterBaseCompressor(OctaneCompressor* compressorp); 00073 void UnRegisterBaseCompressor(OctaneCompressor* compressorp); 00074 public: 00076 void Initialize(); 00078 void DeInitialize(); 00079 public: 00082 OctaneCompressor *CreateCompressorFromSavedStream(bitreader &from); 00085 bool AddCompressor (OctaneCompressor *compressorp); 00088 bool DeleteCompressor (OctaneCompressor *compressorp); 00089 }; 00090 //--------------------------------------------------------------------------- 00091 00092 00093 00094 00095 00096 00097 //--------------------------------------------------------------------------- 00099 extern CompressorManager *global_compressormanagerp; 00100 //--------------------------------------------------------------------------- 00101 00102 00103 00104 00105 00106 //--------------------------------------------------------------------------- 00111 class CompressorManager_SingletonInsurer 00112 { 00113 public: 00118 CompressorManager_SingletonInsurer(OctaneCompressor *compressorp) {if (global_compressormanagerp==NULL) global_compressormanagerp= new CompressorManager();global_compressormanagerp->RegisterBaseCompressor(compressorp);}; 00119 }; 00120 //--------------------------------------------------------------------------- 00121 00122 00123 00124 00125 00126 //--------------------------------------------------------------------------- 00127 #endif 00128 //--------------------------------------------------------------------------- 00129