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

ADD : output image list + test

parent 54e4e31e
No related branches found
No related tags found
No related merge requests found
/*=========================================================================
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 __otbWrapperStringListParameter_h
#define __otbWrapperStringListParameter_h
#include <string>
#include "otbWrapperParameter.h"
namespace otb
{
namespace Wrapper
{
/** \class StringListParameter
* \brief This class represent a list of string parameter for the wrapper framework
*/
class StringListParameter
: public Parameter
{
public:
/** Standard class typedef */
typedef StringListParameter Self;
typedef Parameter Superclass;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
typedef std::vector< boost::any > StringListType;
/** Defining ::New() static method */
itkNewMacro(Self);
/** RTTI support */
itkTypeMacro(StringListParameter, Parameter);
/** Set the value */
void SetValue( StringListType sList)
{
m_Value = sList;
}
void AddValue( std::string value)
{
m_Value.push_back( value );
}
/** Get the value */
StringListType GetValue() const
{
return m_Value;
}
/** Get the value */
std::string GetNthElement( unsigned int i ) const
{
if( m_Value.size() < i )
{
itkExceptionMacro( "Invalid index "<<i<<" the string list has only "<<m_Value.size()<<" elements...")
}
return boost::any_cast<std::string>(m_Value[i]);
}
bool HasValue() const
{
if (m_Value.empty() == true )
{
return false;
}
else
{
return !m_Value[0].empty();
}
}
void ClearValue()
{
m_Value.clear();
}
protected:
/** Constructor */
StringListParameter()
{}
/** Destructor */
virtual ~StringListParameter()
{}
StringListType m_Value;
private:
StringListParameter(const StringListParameter &); //purposely not implemented
void operator =(const StringListParameter&); //purposely not implemented
}; // End class Parameter
} // End namespace Wrapper
} // End namespace otb
#endif
/*=========================================================================
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 "otbWrapperStringListParameter.h"
int otbWrapperStringListParameterNew(int argc, char* argv[])
{
typedef otb::Wrapper::StringListParameter StringListParameterType;
StringListParameterType::Pointer parameter = StringListParameterType::New();
return EXIT_SUCCESS;
}
int otbWrapperStringListParameterTest1(int argc, char* argv[])
{
typedef otb::Wrapper::StringListParameter StringListParameterType;
StringListParameterType::Pointer numParam = StringListParameterType::New();
const std::string value1 = argv[1];
const std::string value2 = argv[2];
const std::string value3 = argv[3];
const std::string key = argv[4];
const std::string desc = argv[5];
numParam->AddValue(value1);
StringListParameterType::StringListType sList;
sList.push_back(value2);
sList.push_back(value3);
numParam->SetValue( sList );
numParam->SetKey(key);
numParam->SetDescription(desc);
if( boost::any_cast<std::string>(numParam->GetValue()[0]) != value2 )
{
return EXIT_FAILURE;
}
if( numParam->GetNthElement(1) != value3 )
{
return EXIT_FAILURE;
}
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