Orfeo Toolbox  3.16
otbWrapperStringListParameter.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: ORFEO Toolbox
4  Language: C++
5  Date: $Date$
6  Version: $Revision$
7 
8 
9  Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
10  See OTBCopyright.txt for details.
11 
12 
13  This software is distributed WITHOUT ANY WARRANTY; without even
14  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  PURPOSE. See the above copyright notices for more information.
16 
17 =========================================================================*/
18 #ifndef __otbWrapperStringListParameter_h
19 #define __otbWrapperStringListParameter_h
20 
21 #include <string>
22 #include "otbWrapperParameter.h"
23 
24 namespace otb
25 {
26 namespace Wrapper
27 {
28 
33  : public Parameter
34 {
35 public:
41 
42  typedef std::vector<std::string> StringListType;
43 
45  itkNewMacro(Self)
46 ;
47 
49  itkTypeMacro(StringListParameter, Parameter)
50 ;
51 
54  {
55  m_Value = sList;
56  }
57 
58  void AddString(std::string value)
59  {
60  m_Value.push_back(value);
61  }
62 
65  {
66  return m_Value;
67  }
68 
70  std::string GetNthElement(unsigned int i) const
71  {
72  if (m_Value.size() < i)
73  {
74  itkExceptionMacro( "Invalid index "<<i<<" the string list has only "<<m_Value.size()<<" elements...")
75  }
76 
77  return m_Value[i];
78  }
79 
81  void SetNthElement(unsigned int i, std::string value)
82  {
83  if (m_Value.size() < i)
84  {
85  itkExceptionMacro( "Invalid index "<<i<<" the string list has only "<<m_Value.size()<<" elements...")
86  }
87  m_Value[i] = value;
88  }
89 
90  bool HasValue() const
91  {
92  return !m_Value.empty();
93  }
94 
95  void ClearValue()
96  {
97  m_Value.clear();
98  }
99 
101  {
102  m_Value.push_back("");
103  SetActive(false);
104  this->Modified();
105  }
106 
107 protected:
110  {
111  this->SetName("String List");
112  this->SetKey("strList");
113  }
114 
117  {
118  }
119 
121 
122 private:
123  StringListParameter(const StringListParameter &); //purposely not implemented
124  void operator =(const StringListParameter&); //purposely not implemented
125 
126 }; // End class Parameter
127 
128 } // End namespace Wrapper
129 } // End namespace otb
130 
131 #endif

Generated at Sun Feb 3 2013 00:59:22 for Orfeo Toolbox with doxygen 1.8.1.1