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-2014 BY FEI S.A.S, *** 00017 *** MERIGNAC, 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 00099 private: 00100 SoRasterReaderSet(); 00101 ~SoRasterReaderSet(); 00102 00103 private: 00104 typedef std::vector<SoRasterImageRW*> SoRasterImageRWVector; 00105 00106 struct ThreadDataStruct 00107 { 00108 bool isLoaded; 00109 SoRasterImageRWVector* readersList; 00110 }; 00111 00112 00113 static void loadAllReaders(); 00114 static ThreadDataStruct* getCurrentThreadData(); 00115 00116 static SbThreadRWMutex s_readersMutex; 00117 static SbThreadMutex s_getReaderMutex; 00118 static std::map<SbThreadId_t, ThreadDataStruct*> s_threadsReaders; 00119 00120 }; 00121 00122 #endif 00123 00124 00125