Skip to content
Snippets Groups Projects
Commit 29bf0a99 authored by Julien Malik's avatar Julien Malik
Browse files

MRG

parents f4631800 45604efd
No related branches found
No related tags found
No related merge requests found
......@@ -28,8 +28,8 @@ namespace Wrapper
/** \class NumericalParameter
* \brief This class represents a numerical parameter
*/
template <typename T> NumericalParameter
: public Parameter
template <class T>
class ITK_EXPORT NumericalParameter : public Parameter
{
public:
/** Standard class typedef */
......@@ -54,7 +54,7 @@ public:
}
/** Set any value */
virtual SetAnyValue(boost::any v)
virtual void SetAnyValue(boost::any v)
{
// Perform any cast
m_Value=boost::any_cast<T>(v);
......@@ -96,8 +96,8 @@ public:
protected:
/** Constructor */
NumericalParameter()
: m_Value(itk::NumericTraits<T>::Zero()),
m_DefaultValue(itk::NumericTraits<T>::Zero()),
: m_Value(itk::NumericTraits<T>::Zero),
m_DefaultValue(itk::NumericTraits<T>::Zero),
m_MinimumValue(itk::NumericTraits<T>::min()),
m_MaximumValue(itk::NumericTraits<T>::max())
{}
......
......@@ -68,7 +68,7 @@ public:
itkNewMacro(Self);
/** RTTI support */
itkTypeMacro(Parameter,itk::LightObject);
itkTypeMacro(Parameter,itk::Object);
/** Set the parameter name */
itkSetStringMacro(Name);
......
......@@ -40,6 +40,12 @@ public:
typedef itk::SmartPointer<const Self> ConstPointer;
typedef Parameter ParameterType;
/** Defining ::New() static method */
itkNewMacro(Self);
/** RTTI support */
itkTypeMacro(ParameterList,itk::Object);
void AddParameter();
ParameterType * GetParameter(std::string & key);
......
......@@ -15,13 +15,39 @@ ADD_TEST(owTvParameter ${OTB_WRAPPER_TESTS}
"param1"
)
# ------- Source files CXX -----------------------------------
# NumericalParameter class test
ADD_TEST(owTuNumericalParameter ${OTB_WRAPPER_TESTS}
otbWrapperNumericalParameterNew
)
# EmptyParameter class test
ADD_TEST(owTuEmptyParameter ${OTB_WRAPPER_TESTS}
otbWrapperEmptyParameterNew
)
# NumericalParameter class test
ADD_TEST(owTuNumericalParameter ${OTB_WRAPPER_TESTS}
otbWrapperNumericalParameterNew
)
ADD_TEST(owTvNumericalParameter ${OTB_WRAPPER_TESTS}
otbWrapperNumericalParameterTest1
42.42
"mykey"
"my description"
)
# ----------------Source files CXX -----------------------------------
SET(Wrapper_SRCS
otbWrapperTests.cxx
otbWrapperParameterTest.cxx
otbWrapperNumericalParameterTest.cxx
otbWrapperEmptyParameterTest.cxx
#otbWrapperApplicationTest.cxx
otbWrapperParameterListTest.cxx
)
ADD_EXECUTABLE(otbWrapperTests ${Wrapper_SRCS})
TARGET_LINK_LIBRARIES(otbWrapperTests OTBIO OTBCommon ITKIO ITKCommon OTBTesting)
TARGET_LINK_LIBRARIES(otbWrapperTests OTBIO OTBCommon ITKIO ITKCommon OTBTesting)
/*=========================================================================
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.
=========================================================================*/
#if defined(_MSC_VER)
#pragma warning ( disable : 4786 )
#endif
#include "otbWrapperEmptyParameter.h"
int otbWrapperEmptyParameterNew(int argc, char* argv[])
{
typedef otb::Wrapper::EmptyParameter EmptyParameterType;
EmptyParameterType::Pointer parameter = EmptyParameterType::New();
//std::cout << parameter << std::endl;
return EXIT_SUCCESS;
}
/*=========================================================================
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.
=========================================================================*/
#if defined(_MSC_VER)
#pragma warning ( disable : 4786 )
#endif
#include "otbWrapperNumericalParameter.h"
int otbWrapperNumericalParameterNew(int argc, char* argv[])
{
typedef otb::Wrapper::NumericalParameter <int> NumericalParameterType;
NumericalParameterType::Pointer parameter = NumericalParameterType::New();
return EXIT_SUCCESS;
}
int otbWrapperNumericalParameterTest1(int argc, char* argv[])
{
typedef otb::Wrapper::NumericalParameter <double> NumericalParameterType;
NumericalParameterType::Pointer numParam = NumericalParameterType::New();
const double value = atof (argv[1]);
const std::string key = argv[2];
const std::string desc = argv[3];
numParam->SetValue(value);
numParam->SetKey(key);
numParam->SetDescription(desc);
boost::any myAny = numParam->GetAnyValue();
std::cout << "value: " << boost::any_cast<double>(myAny) << std::endl;
return EXIT_SUCCESS;
}
/*=========================================================================
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.
=========================================================================*/
#if defined(_MSC_VER)
#pragma warning ( disable : 4786 )
#endif
#include "otbWrapperParameterList.h"
int otbWrapperParameterListNew(int argc, char* argv[])
{
typedef otb::Wrapper::ParameterList ParameterListType;
ParameterListType::Pointer parameter = ParameterListType::New();
//std::cout << parameter << std::endl;
return EXIT_SUCCESS;
}
......@@ -28,4 +28,9 @@ void RegisterTests()
{
REGISTER_TEST(otbWrapperParameterNew);
REGISTER_TEST(otbWrapperParameterTest1);
REGISTER_TEST(otbWrapperNumericalParameterNew);
REGISTER_TEST(otbWrapperNumericalParameterTest1);
REGISTER_TEST(otbWrapperEmptyParameterNew);
//REGISTER_TEST(otbWrapperApplicationNew);
REGISTER_TEST(otbWrapperParameterListNew);
}
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