Skip to content
Snippets Groups Projects
Commit c083e27e authored by Cyrille Valladeau's avatar Cyrille Valladeau
Browse files

ENH: supress Set and Set AnyValue methods taht are not used

parent 7af859e2
No related branches found
No related tags found
No related merge requests found
Showing
with 12 additions and 151 deletions
......@@ -149,32 +149,6 @@ ChoiceParameter::GetValue()
return m_CurrentChoice;
}
/** Set any value */
void
ChoiceParameter::SetAnyValue(boost::any v)
{
// Perform any cast
unsigned int val = boost::any_cast<unsigned int>(v);
if ( val >= GetNbChoices() )
{
itkExceptionMacro(<< "Invalid choice value : " << val)
}
m_CurrentChoice = val;
// Call Modified();
this->Modified();
}
/** Return any value */
boost::any
ChoiceParameter::GetAnyValue()
{
return boost::any(m_CurrentChoice);
}
/** Return any value */
std::vector<std::string>
ChoiceParameter::GetParametersKeys()
......
......@@ -85,12 +85,6 @@ public:
/** Return any value */
virtual unsigned int GetValue();
/** Set any value */
virtual void SetAnyValue(boost::any v);
/** Return any value */
virtual boost::any GetAnyValue();
bool HasValue() const
{
// a choice parameter always has a value
......
......@@ -75,22 +75,6 @@ public:
m_Reader = ImageFileReaderType::Pointer();
}
/** Return any value */
virtual boost::any GetAnyValue()
{
return boost::any(m_Image);
}
/** Set any value */
virtual void SetAnyValue(boost::any v)
{
// Perform any cast
m_Image = boost::any_cast<ComplexVectorImageType::Pointer>(v);
// Call Modified();
this->Modified();
}
bool HasValue() const
{
return m_Image.IsNotNull();
......
......@@ -78,22 +78,6 @@ public:
m_Reader = ImageFileReaderType::Pointer();
}
/** Return any value */
virtual boost::any GetAnyValue()
{
return boost::any(m_Image);
}
/** Set any value */
virtual void SetAnyValue(boost::any v)
{
// Perform any cast
m_Image = boost::any_cast<VectorImageType::Pointer>(v);
// Call Modified();
this->Modified();
}
bool HasValue() const
{
return m_Image.IsNotNull();
......
......@@ -81,22 +81,6 @@ public:
m_Reader = VectorDataFileReaderType::Pointer();
}
/** Return any value */
virtual boost::any GetAnyValue()
{
return boost::any(m_VectorData);
}
/** Set any value */
virtual void SetAnyValue(boost::any v)
{
// Perform any cast
m_VectorData = boost::any_cast<VectorDataType::Pointer>(v);
// Call Modified();
this->Modified();
}
bool HasValue() const
{
return m_VectorData.IsNotNull();
......
......@@ -53,22 +53,6 @@ public:
m_Value = m_DefaultValue;
}
/** Set any value */
virtual void SetAnyValue(boost::any v)
{
// Perform any cast
m_Value = boost::any_cast<ScalarType>(v);
// Call Modified();
this->Modified();
}
/** Return any value */
virtual boost::any GetAnyValue()
{
return m_Value;
}
/** Set the value */
void SetValue( ScalarType value)
{
......
......@@ -51,12 +51,6 @@ public:
/** Get the value */
itkGetObjectMacro(Image, VectorImageType);
/** Return any value */
virtual boost::any GetAnyValue()
{
return boost::any(m_Image);
}
/** Return any value */
void SetValue(VectorImageType* image)
{
......
......@@ -51,12 +51,6 @@ public:
/** Get the value */
itkGetObjectMacro(VectorData, VectorDataType);
/** Return any value */
virtual boost::any GetAnyValue()
{
return boost::any(m_VectorData);
}
/** Return any value */
void SetValue(VectorDataType* vd)
{
......
......@@ -124,23 +124,6 @@ public:
{
}
/** Return the parameter value as a boost:any. Should be
* reimplemented in each relevant sub-class (default implementation
* raise exception) */
virtual boost::any GetAnyValue() const
{
itkExceptionMacro(<<"GetAnyValue() method must be re-implemented by sub-classes.");
return boost::any(); // avoid warning
}
/** Set the parameter value as a boost:any. Should be
* reimplemented in each relevant sub-class (default implementation
* raise exception) */
virtual void SetAnyValue(boost::any)
{
itkExceptionMacro(<<"SetAnyValue() method must be re-implemented by sub-classes.");
}
virtual bool HasValue() const
{
itkExceptionMacro(<<"HasValue() method must be re-implemented by sub-classes.");
......
......@@ -45,22 +45,6 @@ public:
/** RTTI support */
itkTypeMacro(StringParameter, Parameter);
/** Set any value */
virtual void SetAnyValue(boost::any v)
{
// Perform any cast
m_Value = boost::any_cast<std::string>(v);
// Call Modified();
this->Modified();
}
/** Return any value */
virtual boost::any GetAnyValue()
{
return m_Value;
}
/** Set the value */
void SetValue( std::string value)
{
......
......@@ -28,3 +28,15 @@ int otbWrapperInputImageParameterNew(int argc, char* argv[])
return EXIT_SUCCESS;
}
int otbWrapperInputImageParameterTest1(int argc, char* argv[])
{
typedef otb::Wrapper::InputImageParameter InputImageParameterType;
InputImageParameterType::Pointer param = InputImageParameterType::New();
param->SetFromFileName(argv[1]);
param->SetKey(argv[2]);
param->SetDescription(argv[3]);
return EXIT_SUCCESS;
}
......@@ -43,9 +43,5 @@ int otbWrapperNumericalParameterTest1(int argc, char* argv[])
numParam->SetKey(key);
numParam->SetDescription(desc);
boost::any myAny = numParam->GetAnyValue();
std::cout << "value: " << boost::any_cast<double>(myAny) << std::endl;
return EXIT_SUCCESS;
}
......@@ -43,8 +43,5 @@ int otbWrapperStringParameterTest1(int argc, char* argv[])
numParam->SetKey(key);
numParam->SetDescription(desc);
boost::any myAny = numParam->GetAnyValue();
std::cout << "value: " << boost::any_cast<std::string>(myAny) << std::endl;
return EXIT_SUCCESS;
}
......@@ -43,8 +43,5 @@ int otbWrapperStringParameterTest1(int argc, char* argv[])
numParam->SetKey(key);
numParam->SetDescription(desc);
boost::any myAny = numParam->GetAnyValue();
std::cout << "value: " << boost::any_cast<std::string>(myAny) << std::endl;
return EXIT_SUCCESS;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment