Commit b2e54004 authored by Julien Michel's avatar Julien Michel

ENH: Modifying extended filename heplers to implement proper checks of options...

ENH: Modifying extended filename heplers to implement proper checks of options changes in ImageFileReader
parent 0fdc4d1a
......@@ -46,9 +46,9 @@ public:
typedef std::map< std::string, std::string > OptionMapType;
void SetExtendedFileName(const char * extFname);
OptionMapType GetOptionMap(void) const;
virtual void SetExtendedFileName(const char * extFname);
const OptionMapType & GetOptionMap(void) const;
itkGetStringMacro(ExtendedFileName);
itkGetStringMacro(SimpleFileName);
......
......@@ -38,19 +38,19 @@ namespace otb
* \ingroup OTBExtendedFilename
*/
class ITK_EXPORT ExtendedFilenameToReaderOptions : public itk::Object
class ITK_EXPORT ExtendedFilenameToReaderOptions : public ExtendedFilenameHelper
{
public:
/** Standard class typedefs. */
typedef ExtendedFilenameToReaderOptions Self;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
typedef itk::Object Superclass;
typedef ExtendedFilenameHelper Superclass;
itkTypeMacro(ExtendedFilenameToReaderOptions, itk::Object);
itkTypeMacro(ExtendedFilenameToReaderOptions, otb::ExtendedFilenameHelper);
itkNewMacro(Self);
typedef ExtendedFilenameHelper FNameHelperType;
typedef Superclass FNameHelperType;
typedef FNameHelperType::OptionMapType MapType;
typedef MapType::iterator MapIteratorType;
......@@ -68,10 +68,9 @@ public:
};
/* Set Methods */
void SetExtendedFileName(const char * extFname);
virtual void SetExtendedFileName(const char * extFname);
/* Get Methods */
bool SimpleFileNameIsSet () const;
const char* GetSimpleFileName () const;
bool ExtGEOMFileNameIsSet () const;
const char* GetExtGEOMFileName () const;
bool SubDatasetIndexIsSet () const;
......@@ -93,7 +92,6 @@ private:
ExtendedFilenameToReaderOptions(const Self &); //purposely not implemented
void operator =(const Self&); //purposely not implemented
FNameHelperType::Pointer m_FilenameHelper;
OptionType m_Options;
};
......
......@@ -39,19 +39,19 @@ namespace otb
* \ingroup OTBExtendedFilename
*/
class ITK_EXPORT ExtendedFilenameToWriterOptions : public itk::Object
class ITK_EXPORT ExtendedFilenameToWriterOptions : public ExtendedFilenameHelper
{
public:
/** Standard class typedefs. */
typedef ExtendedFilenameToWriterOptions Self;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
typedef itk::Object Superclass;
typedef ExtendedFilenameHelper Superclass;
itkTypeMacro(ExtendedFilenameToWriterOptions, itk::Object);
itkTypeMacro(ExtendedFilenameToWriterOptions, otb::ExtendedFilenameHelper);
itkNewMacro(Self);
typedef ExtendedFilenameHelper FNameHelperType;
typedef Superclass FNameHelperType;
typedef FNameHelperType::OptionMapType MapType;
typedef MapType::iterator MapIteratorType;
......@@ -73,10 +73,9 @@ public:
};
/* Set Methods */
void SetExtendedFileName(const char * extFname);
virtual void SetExtendedFileName(const char * extFname);
/* Get Methods */
bool SimpleFileNameIsSet () const;
const char* GetSimpleFileName () const;
bool WriteGEOMFileIsSet () const;
bool WriteRPCTagsIsSet() const;
bool GetWriteGEOMFile () const;
......@@ -102,7 +101,6 @@ private:
ExtendedFilenameToWriterOptions(const Self &); //purposely not implemented
void operator =(const Self&); //purposely not implemented
FNameHelperType::Pointer m_FilenameHelper;
OptionType m_Options;
};
......
......@@ -66,7 +66,7 @@ ExtendedFilenameHelper
}
ExtendedFilenameHelper::OptionMapType
const ExtendedFilenameHelper::OptionMapType &
ExtendedFilenameHelper
::GetOptionMap(void) const
{
......
......@@ -22,10 +22,8 @@ namespace otb
{
ExtendedFilenameToReaderOptions
::ExtendedFilenameToReaderOptions() : itk::Object()
::ExtendedFilenameToReaderOptions() : ExtendedFilenameHelper()
{
m_FilenameHelper = FNameHelperType::New();
m_Options.simpleFileName.first = false;
m_Options.simpleFileName.second = "";
......@@ -59,11 +57,11 @@ void
ExtendedFilenameToReaderOptions
::SetExtendedFileName(const char *extFname)
{
this->m_FilenameHelper->SetExtendedFileName(extFname);
MapType map = this->m_FilenameHelper->GetOptionMap();
Superclass::SetExtendedFileName(extFname);
MapType map = GetOptionMap();
m_Options.simpleFileName.first = true;
m_Options.simpleFileName.second = this->m_FilenameHelper->GetSimpleFileName();
m_Options.simpleFileName.second = this->GetSimpleFileName();
if (!map["geom"].empty())
{
......@@ -144,12 +142,6 @@ ExtendedFilenameToReaderOptions
{
return m_Options.simpleFileName.first;
}
const char*
ExtendedFilenameToReaderOptions
::GetSimpleFileName () const
{
return m_Options.simpleFileName.second.c_str();
}
bool
ExtendedFilenameToReaderOptions
......
......@@ -24,10 +24,8 @@ namespace otb
{
ExtendedFilenameToWriterOptions
::ExtendedFilenameToWriterOptions() : itk::Object()
::ExtendedFilenameToWriterOptions() : ExtendedFilenameHelper()
{
m_FilenameHelper = FNameHelperType::New();
m_Options.simpleFileName.first = false;
m_Options.simpleFileName.second = "";
......@@ -54,12 +52,12 @@ void
ExtendedFilenameToWriterOptions
::SetExtendedFileName(const char *extFname)
{
this->m_FilenameHelper->SetExtendedFileName(extFname);
this->Superclass::SetExtendedFileName(extFname);
// TODO: Rename map to a less confusing (with std::map) name
MapType map = this->m_FilenameHelper->GetOptionMap();
MapType map = this->GetOptionMap();
m_Options.simpleFileName.first = true;
m_Options.simpleFileName.second = this->m_FilenameHelper->GetSimpleFileName();
m_Options.simpleFileName.second = this->GetSimpleFileName();
MapIteratorType it;
for ( it=map.begin(); it != map.end(); it++ )
......@@ -189,12 +187,6 @@ ExtendedFilenameToWriterOptions
{
return m_Options.simpleFileName.first;
}
const char*
ExtendedFilenameToWriterOptions
::GetSimpleFileName () const
{
return m_Options.simpleFileName.second.c_str();
}
bool
ExtendedFilenameToWriterOptions
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment