llfeaturemanager.h

Go to the documentation of this file.
00001 
00032 #ifndef LL_LLFEATUREMANAGER_H
00033 #define LL_LLFEATUREMANAGER_H
00034 
00035 #include "stdtypes.h"
00036 
00037 #include "llstring.h"
00038 #include "llskipmap.h"
00039 #include <map>
00040 
00041 class LLFeatureInfo
00042 {
00043 public:
00044         LLFeatureInfo() : mValid(FALSE), mAvailable(FALSE), mRecommendedLevel(-1) {}
00045         LLFeatureInfo(const char *name, const BOOL available, const S32 level);
00046 
00047         BOOL isValid() const    { return mValid; };
00048 
00049 public:
00050         BOOL            mValid;
00051         LLString        mName;
00052         BOOL            mAvailable;
00053         S32                     mRecommendedLevel;
00054 };
00055 
00056 
00057 class LLFeatureList
00058 {
00059 public:
00060         LLFeatureList(const char *name = "default");
00061         virtual ~LLFeatureList();
00062 
00063         BOOL isFeatureAvailable(const char *name);
00064         S32 getRecommendedLevel(const char *name);
00065 
00066         void setFeatureAvailable(const char *name, const BOOL available);
00067         void setRecommendedLevel(const char *name, const S32 level);
00068 
00069         BOOL loadFeatureList(FILE *fp);
00070 
00071         BOOL maskList(LLFeatureList &mask);
00072 
00073         void addFeature(const char *name, const BOOL available, const S32 level);
00074 
00075         void dump();
00076 protected:
00077         LLString        mName;
00078         typedef std::map<LLString, LLFeatureInfo> feature_map_t;
00079         feature_map_t   mFeatures;
00080 };
00081 
00082 
00083 class LLFeatureManager : public LLFeatureList
00084 {
00085 public:
00086         LLFeatureManager() : mInited(FALSE), mTableVersion(0), mSafe(FALSE), mGPUClass(0) {}
00087 
00088         void maskCurrentList(const char *name); // Mask the current feature list with the named list
00089 
00090         BOOL loadFeatureTables();
00091 
00092         S32     getGPUClass()                                   { return mGPUClass; }
00093         std::string& getGPUString()             { return mGPUString; }
00094         
00095         void cleanupFeatureTables();
00096 
00097         S32 getVersion() const                          { return mTableVersion; }
00098         void setSafe(const BOOL safe)           { mSafe = safe; }
00099         BOOL isSafe() const                                     { return mSafe; }
00100 
00101         LLFeatureList *findMask(const char *name);
00102         BOOL maskFeatures(const char *name);
00103 
00104 
00105         void initCPUFeatureMasks();
00106         void initGraphicsFeatureMasks();
00107         
00108         void applyRecommendedFeatures();
00109 
00110 protected:
00111         void loadGPUClass();
00112         void initBaseMask();
00113 
00114         std::map<LLString, LLFeatureList *> mMaskList;
00115         BOOL            mInited;
00116         S32                     mTableVersion;
00117         BOOL            mSafe;                                  // Reinitialize everything to the "safe" mask
00118         S32                     mGPUClass;
00119         std::string     mGPUString;
00120 };
00121 
00122 extern LLFeatureManager *gFeatureManagerp;
00123 
00124 #endif // LL_LLFEATUREMANAGER_H

Generated on Thu Jul 1 06:08:30 2010 for Second Life Viewer by  doxygen 1.4.7