Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
otb
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
David Youssefi
otb
Commits
ca08e4af
Commit
ca08e4af
authored
13 years ago
by
Cyrille Valladeau
Browse files
Options
Downloads
Patches
Plain Diff
ADD : output image list + test
parent
54e4e31e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Code/Core/otbWrapperStringListParameter.h
+115
-0
115 additions, 0 deletions
Code/Core/otbWrapperStringListParameter.h
Testing/Core/otbWrapperStringListParameterTest.cxx
+63
-0
63 additions, 0 deletions
Testing/Core/otbWrapperStringListParameterTest.cxx
with
178 additions
and
0 deletions
Code/Core/otbWrapperStringListParameter.h
0 → 100644
+
115
−
0
View file @
ca08e4af
/*=========================================================================
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
This diff is collapsed.
Click to expand it.
Testing/Core/otbWrapperStringListParameterTest.cxx
0 → 100644
+
63
−
0
View file @
ca08e4af
/*=========================================================================
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
;
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment