Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __mitkIOAdapter_h
00018 #define __mitkIOAdapter_h
00019
00020 #include "mitkBaseProcess.h"
00021
00022 #include "itkObject.h"
00023
00024
00025 namespace mitk
00026 {
00027
00028
00029
00030
00031 class MITK_CORE_EXPORT IOAdapterBase: public itk::Object
00032 {
00033 public:
00035 typedef IOAdapterBase Self;
00036 typedef itk::Object Superclass;
00037 typedef itk::SmartPointer<Self>Pointer;
00038 typedef itk::SmartPointer<const Self>ConstPointer;
00039
00041 virtual itk::SmartPointer<BaseProcess> CreateIOProcessObject(const std::string filename, const std::string filePrefix, const std::string filePattern) = 0;
00042 virtual bool CanReadFile(const std::string filename, const std::string filePrefix, const std::string filePattern) = 0;
00043
00044 protected:
00045 IOAdapterBase() {}
00046 ~IOAdapterBase() {}
00047
00048 private:
00049 IOAdapterBase(const Self&);
00050 void operator=(const Self&);
00051 };
00052
00053
00054
00055
00056
00057
00058 template <class T>
00059 class IOAdapter : public IOAdapterBase
00060 {
00061 public:
00063 typedef IOAdapter Self;
00064 typedef itk::SmartPointer<Self> Pointer;
00065
00067 itkFactorylessNewMacro(Self);
00068 mitk::BaseProcess::Pointer CreateIOProcessObject(const std::string filename, const std::string filePrefix, const std::string filePattern)
00069 {
00070 typename T::Pointer ioProcessObject = T::New();
00071 ioProcessObject->SetFileName(filename.c_str());
00072 ioProcessObject->SetFilePrefix(filePrefix.c_str());
00073 ioProcessObject->SetFilePattern(filePattern.c_str());
00074 return ioProcessObject.GetPointer();
00075 }
00076
00077 virtual bool CanReadFile(const std::string filename, const std::string filePrefix, const std::string filePattern)
00078 {
00079 return T::CanReadFile(filename, filePrefix, filePattern);
00080 }
00081
00082 protected:
00083 IOAdapter() {}
00084 ~IOAdapter() {}
00085
00086 private:
00087 IOAdapter(const Self&);
00088 void operator=(const Self&);
00089 };
00090
00091
00092 }
00093
00094 #endif