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-2020 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 00063 class SoRasterReaderSet { 00064 00065 public: 00070 static SoRasterImageRW* getReader(SoRasterImageIO* imageIO); 00071 00075 static void addReader(SoRasterImageRW* reader); 00076 00081 static void deleteReaders(int start, int num = -1); 00082 00086 static SoType getReaderAt(int index); 00087 00091 static int getNumReaders(); 00092 00093 00094 private: 00095 static void initClasses(); 00096 static void exitClasses(); 00097 00098 static SoRasterImageRW* getReader(SoRasterImageFile* imageFile, const SbString& suffix); 00099 00100 private: 00101 SoRasterReaderSet(); 00102 ~SoRasterReaderSet(); 00103 00104 private: 00105 typedef std::vector<SoRasterImageRW*> SoRasterImageRWVector; 00106 00107 struct ThreadDataStruct 00108 { 00109 bool isLoaded; 00110 SoRasterImageRWVector* readersList; 00111 }; 00112 00113 00114 static void loadAllReaders(); 00115 static ThreadDataStruct* getCurrentThreadData(); 00116 00117 static SbThreadRWMutex s_readersMutex; 00118 static SbThreadMutex s_getReaderMutex; 00119 static std::map<SbThreadId_t, ThreadDataStruct*> s_threadsReaders; 00120 00121 }; 00122 00123 #endif 00124 00125 00126