All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ParameterValue.cpp
Go to the documentation of this file.
1 /* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2 
3  This file is part of the TerraLib - a Framework for building GIS enabled applications.
4 
5  TerraLib is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  TerraLib is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with TerraLib. See COPYING. If not, write to
17  TerraLib Team at <terralib-team@terralib.org>.
18  */
19 
20 /*!
21  \file terralib/se/ParameterValue.cpp
22 
23  \brief The ParameterValueType uses WFS-Filter expressions to give values for SE graphic parameters.
24 */
25 
26 // TerraLib
27 #include "../common/STLUtils.h"
28 #include "../fe/Expression.h"
29 #include "../fe/Literal.h"
30 #include "ParameterValue.h"
31 
33  : m_mixedData(0),
34  m_expression(0)
35 {
36 }
37 
39  : m_mixedData(0),
40  m_expression(0)
41 {
42  if(rhs.m_mixedData)
43  m_mixedData = new std::string(*rhs.m_mixedData);
44 
45  if(rhs.m_expression)
47 }
48 
50 {
51  delete m_mixedData;
52  delete m_expression;
53 }
54 
56 {
57 }
58 
59 te::se::ParameterValue::ParameterValue(const std::string& value)
60 {
61  add(value);
62 }
63 
65 {
66  for(std::size_t i = 0; i < rhs.m_parameters.size(); ++i)
68 }
69 
71 {
73 }
74 
76 {
77  m_parameters.push_back(p);
78 }
79 
80 void te::se::ParameterValue::add(const std::string& value)
81 {
83  p->m_expression = new te::fe::Literal(value);
84  add(p);
85 }
86 
88 {
89  return m_parameters.size();
90 }
91 
93 {
94  assert(i < m_parameters.size());
95  return m_parameters[i];
96 }
97 
99 {
100  return new ParameterValue(*this);
101 }
te::fe::Expression * m_expression
Parameter from an expression.
The ParameterValueType uses WFS-Filter expressions to give values for SE graphic parameters.
std::string * m_mixedData
Parameter from a mixed data content.
The "ParameterValueType" uses WFS-Filter expressions to give values for SE graphic parameters...
const Parameter * getParameter(size_t i) const
virtual ~ParameterValue()
Virtual destructor.
virtual Expression * clone() const =0
It returns a clone of this object.
size_t getNParameters() const
ParameterValue * clone() const
It creates a new copy of this object.
This class can be used to represent literal values.
Definition: Literal.h:56
ParameterValue()
It initializes an empty ParameterValue.
void FreeContents(boost::unordered_map< K, V * > &m)
This function can be applied to a map of pointers. It will delete each pointer in the map...
Definition: BoostUtils.h:55
void add(Parameter *p)
std::vector< Parameter * > m_parameters
Regular text may be mixed and WFS-Filter expressions to give values for SE graphic parameters...