Orfeo Toolbox  4.0
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.clear();
56  for(unsigned int i=0; i<sList.size(); i++)
57  {
58  m_Value.push_back(sList[i]);
59  }
60  }
61 
62  void AddString(std::string value)
63  {
64  m_Value.push_back(value);
65  }
66 
69  {
70  return m_Value;
71  }
72 
74  std::string GetNthElement(unsigned int i) const
75  {
76  if (m_Value.size() < i)
77  {
78  itkExceptionMacro( "Invalid index "<<i<<" the string list has only "<<m_Value.size()<<" elements...")
79  }
80 
81  return m_Value[i];
82  }
83 
85  void SetNthElement(unsigned int i, std::string value)
86  {
87  if (m_Value.size() < i)
88  {
89  itkExceptionMacro( "Invalid index "<<i<<" the string list has only "<<m_Value.size()<<" elements...")
90  }
91  m_Value[i] = value;
92  }
93 
94  bool HasValue() const
95  {
96  return !m_Value.empty();
97  }
98 
99  void ClearValue()
100  {
101  m_Value.clear();
102  }
103 
105  {
106  m_Value.push_back("");
107  SetActive(false);
108  this->Modified();
109  }
110 
111 protected:
114  {
115  this->SetName("String List");
116  this->SetKey("strList");
117  }
118 
121  {
122  }
123 
125 
126 private:
127  StringListParameter(const StringListParameter &); //purposely not implemented
128  void operator =(const StringListParameter&); //purposely not implemented
129 
130 }; // End class Parameter
131 
132 } // End namespace Wrapper
133 } // End namespace otb
134 
135 #endif

Generated at Sat Mar 8 2014 16:28:52 for Orfeo Toolbox with doxygen 1.8.3.1