Commit d9eb0ab2 authored by Thomas Feuvrier's avatar Thomas Feuvrier

Correction sur le CommandLineArgument : modification de la méthode de lecture...

Correction sur le CommandLineArgument : modification de la méthode de lecture des parametres : suppression de l améthode template, donc suppression du fichier .txx.
parent 81a33d9b
......@@ -20,7 +20,7 @@
#include <assert.h>
#include <iostream>
#include "otbConfigure.h" // Pour OTB_VERSION_MAJOR, OTB_VERSION_MINOR et OTB_VERSION_PATCH genere dans le ccmake
#include "otbConfigure.h" // Pour OTB_VERSION_STRING genere par le ccmake
namespace otb
{
......@@ -32,7 +32,6 @@ CommandLineArgumentParseResult
::PrintSelf(std::ostream& os/*, itk::Indent indent*/)const
{
}
......@@ -43,63 +42,6 @@ CommandLineArgumentParseResult
return (m_OptionMap.find(std::string(option)) != m_OptionMap.end());
}
/*
unsigned int
CommandLineArgumentParseResult
::GetParameterUInt(const char *option, unsigned int number) const
{
return GetParameter<unsigned int>(option,number);
}
int
CommandLineArgumentParseResult
::GetParameterInt(const char *option, unsigned int number) const
{
return GetParameter<int>(option,number);
}
unsigned short
CommandLineArgumentParseResult
::GetParameterUShort(const char *option, unsigned int number) const
{
return GetParameter<unsigned short>(option,number);
}
short
CommandLineArgumentParseResult
::GetParameterShort(const char *option, unsigned int number) const
{
return GetParameter<short>(option,number);
}
unsigned long
CommandLineArgumentParseResult
::GetParameterULong(const char *option, unsigned int number) const
{
return GetParameter<unsigned long>(option,number);
}
long
CommandLineArgumentParseResult
::GetParameterLong(const char *option, unsigned int number) const
{
return GetParameter<long>(option,number);
}
float
CommandLineArgumentParseResult
::GetParameterFloat(const char *option, unsigned int number) const
{
return GetParameter<float>(option,number);
}
double
CommandLineArgumentParseResult
::GetParameterDouble(const char *option, unsigned int number) const
{
return GetParameter<double>(option,number);
}
*/
std::string
CommandLineArgumentParseResult
::GetParameterString(const char *option, unsigned int number)const
......
......@@ -30,6 +30,7 @@
//#include "itkIndent.h"
#include "itkProcessObject.h"
#include "otbMacro.h"
namespace otb
{
......@@ -62,11 +63,17 @@ public:
void PrintSelf(std::ostream& os/*, itk::Indent indent*/) const;
#define otbGetParameterMacro(name,type) \
virtual type GetParameter##name (const char *option, unsigned int number=0) const \
{ \
return GetParameter<type>(option,number); \
#define otbGetParameterMacro(name,type) \
virtual type GetParameter##name (const char *option, unsigned int number=0) const \
{ \
std::string parameter = this->GetParameterString(option, number); \
type lValeur; \
::otb::StringStream flux; \
flux << parameter; \
flux >> lValeur; \
return lValeur; \
}
otbGetParameterMacro(Short,short);
otbGetParameterMacro(UShort,unsigned short);
otbGetParameterMacro(Int,int);
......@@ -192,19 +199,6 @@ private:
std::string m_ProgramName;
};
// Not defined in class CommandArgumentParser to avoid known bug on VC++ 6.0
// (explicit template instanciation on class methods are forbidden in this compiler)
/*template< typename TypeValeur >
TypeValeur GetParameter(CommandLineArgumentParseResult* parser,
const char *option, unsigned int number=0);*/
}
#ifndef OTB_MANUAL_INSTANTIATION
#include "otbCommandLineArgumentParser.txx"
#endif
#endif // __otbCommandLineArgumentParser_h_
/*=========================================================================
Program: ORFEO Toolbox
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
See OTBCopyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef _otbCommandLineArgumentParser_txx
#define _otbCommandLineArgumentParser_txx
#include "otbCommandLineArgumentParser.h"
#include "otbMacro.h"
namespace otb
{
template<typename TypeValeur >
TypeValeur
CommandLineArgumentParseResult
::GetParameter(const char *option, unsigned int number)const
{
std::string parameter = this->GetParameterString(option, number);
TypeValeur lValeur;
::otb::StringStream flux;
flux << parameter;
flux >> lValeur;
return lValeur;
}
} // end namespace otb
#endif
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