MeVisLabToolboxReference
MeVisLab/Standard/Sources/ML/MLObjMgr/ObjLoader/mlObjLoaderFrame.h
Go to the documentation of this file.
00001 // **InsertLicense** code
00002 //-------------------------------------------------------------------------
00005 
00010 //-------------------------------------------------------------------------
00011 
00012 #ifndef __mlObjLoaderFrame_H
00013 #define __mlObjLoaderFrame_H
00014 
00015 // Include dll-specific settings.
00016 #include "MLObjLoaderSystem.h"
00017 #include <ObjMgr/mlObjMgrObjectContainer.h>
00018 
00019 #ifdef WIN32
00020 # define SLASH '\\'
00021 #else
00022 # define SLASH '/'
00023 #endif
00024 
00025 #define ML_PRINT_CONDITIONAL_ERROR(a,b,c,d) \
00026 if (a) { \
00027   ML_PRINT_ERROR(b,c,d); \
00028 }
00029 
00030 
00031 ML_START_NAMESPACE
00032 
00033   class olFullPath;
00034 
00037   class MLOBJMGR_EXPORT olSpecializedLoader
00038   {
00039     ML_ABSTRACT_CLASS_HEADER(olSpecializedLoader);
00040     
00041     friend class olFullPath;
00042     
00043   private:
00044       
00045     void  storeInfoFilePath(const std::string &infoFile);
00046     
00047   protected:
00048       
00052     bool         _suppressErrorLog;
00053     
00056     bool         _sawErrors;
00057     
00061     std::string  _infoFileDirectory;
00062     
00065     std::string  _miscInfo;
00066     
00068     olSpecializedLoader();
00069     
00070   public:
00071       
00073     virtual ~olSpecializedLoader();
00074     
00076     inline bool  suppressErrorLog() const { return _suppressErrorLog; }
00078     inline void  setSuppressErrorLog(bool trueOrFalse) { _suppressErrorLog = trueOrFalse; }
00079     
00081     inline bool  sawErrors() const { return _sawErrors; }
00083     inline void  resetErrors()     { _sawErrors = false; }
00084     
00088     virtual bool isValidHeader(const char *header, const size_t length) = 0;
00089     
00096     virtual void readDoc(const std::string &infoFile, omObjectContainer &oc, bool accumulate);
00097     
00099     virtual const std::string getName() const = 0;
00100     
00102     virtual const std::string miscInfo() { return _miscInfo; }
00103   };
00104 
00110   class MLOBJMGR_EXPORT olFullPath
00111   {
00112   public:
00114     olFullPath(const olSpecializedLoader &sl, const std::string &relPath) {
00115       _fullPath = sl._infoFileDirectory + SLASH;
00116       _fullPath+= relPath;
00117     }
00118     
00120     olFullPath(const olSpecializedLoader &sl, const char *relPath) {
00121       _fullPath = sl._infoFileDirectory + SLASH;
00122       _fullPath+= relPath;
00123     }
00124     
00126     operator const char *() const {
00127       return _fullPath.c_str();
00128     }
00129     
00130   private:
00131     std::string _fullPath;
00132   };
00133 
00134 ML_END_NAMESPACE
00135 
00136 #endif // __mlObjLoaderFrame_H