00001 /*======================================================================= 00002 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), *** 00003 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. *** 00004 *** *** 00005 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS *** 00006 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR *** 00007 *** WRITTEN AUTHORIZATION OF FEI S.A.S. *** 00008 *** *** 00009 *** RESTRICTED RIGHTS LEGEND *** 00010 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS *** 00011 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN *** 00012 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT *** 00013 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN *** 00014 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. *** 00015 *** *** 00016 *** COPYRIGHT (C) 1996-2022 BY FEI S.A.S, *** 00017 *** BORDEAUX, FRANCE *** 00018 *** ALL RIGHTS RESERVED *** 00019 **=======================================================================*/ 00020 /*======================================================================= 00021 ** Author : C. OGNIER (Jun 2003) 00022 **=======================================================================*/ 00023 00024 00025 #ifndef _SORASTERREADERSET_ 00026 #define _SORASTERREADERSET_ 00027 00028 #include <Inventor/image/SoRasterImageRW.h> 00029 #include <Inventor/threads/SbThreadRWMutex.h> 00030 00031 #include <Inventor/STL/map> 00032 00033 class SoRasterImageFile; //FORWARD 00034 00062 class SoRasterReaderSet { 00063 00064 public: 00069 static SoRasterImageRW* getReader(SoRasterImageIO* imageIO); 00070 00074 static void addReader(SoRasterImageRW* reader); 00075 00080 static void deleteReaders(int start, int num = -1); 00081 00085 static SoType getReaderAt(int index); 00086 00090 static int getNumReaders(); 00091 00092 00093 private: 00094 static void initClasses(); 00095 static void exitClasses(); 00096 00097 static SoRasterImageRW* getReader(SoRasterImageFile* imageFile, const SbString& suffix); 00098 00100 static SoRasterImageRW* getReader(const SbString& filename); 00101 00102 private: 00103 SoRasterReaderSet(); 00104 ~SoRasterReaderSet(); 00105 00106 private: 00107 typedef std::vector<SoRasterImageRW*> SoRasterImageRWVector; 00108 00109 struct ThreadDataStruct 00110 { 00111 bool isLoaded; 00112 SoRasterImageRWVector* readersList; 00113 }; 00114 00115 00116 static void loadAllReaders(); 00117 static ThreadDataStruct* getCurrentThreadData(); 00118 00119 static SbThreadRWMutex s_readersMutex; 00120 static SbThreadMutex s_getReaderMutex; 00121 static std::map<SbThreadId_t, ThreadDataStruct*> s_threadsReaders; 00122 00123 }; 00124 00125 #endif 00126 00127 00128