All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ObjectId.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/dataaccess/dataset/ObjectId.cpp
22 
23  \brief This class represents an unique id for a data set element.
24 */
25 
26 // TerraLib
27 #include "ObjectId.h"
28 
29 // STL
30 #include <cassert>
31 
33 {
34 }
35 
37 {
38  for(std::size_t i = 0; i < rhs.m_data.size(); ++i)
39  m_data.push_back(rhs.m_data[i].clone());
40 }
41 
43 {
44 }
45 
46 const boost::ptr_vector<te::dt::AbstractData>& te::da::ObjectId::getValue() const
47 {
48  return m_data;
49 }
50 
52 {
53  std::string value;
54 
55  for(std::size_t i = 0; i < m_data.size(); ++i)
56  value += m_data[i].toString();
57 
58  return value;
59 }
60 
62 {
63  assert(data);
64 
65  m_data.push_back(data);
66 }
67 
69 {
70  return new ObjectId(*this);
71 }
72 
73 bool te::da::ObjectId::operator<(const ObjectId& rhs) const
74 {
75  return getValueAsString() < rhs.getValueAsString();
76 }
bool operator<(const ObjectId &rhs) const
Definition: ObjectId.cpp:73
~ObjectId()
Destructor.
Definition: ObjectId.cpp:42
This class represents an unique id for a data set element.
const boost::ptr_vector< te::dt::AbstractData > & getValue() const
It gets the properties values used to uniquely identify a data set element.
Definition: ObjectId.cpp:46
void addValue(te::dt::AbstractData *data)
It adds a property value to uniquely identify a data set element.
Definition: ObjectId.cpp:61
This class represents an unique id for a data set element.
Definition: ObjectId.h:47
std::string getValueAsString() const
It gets the properties values used to uniquely identify a data set element as string.
Definition: ObjectId.cpp:51
A base class for values that can be retrieved from the data access module.
Definition: AbstractData.h:57
boost::ptr_vector< te::dt::AbstractData > m_data
A vector of property values.
Definition: ObjectId.h:91
ObjectId()
Default constructor.
Definition: ObjectId.cpp:32
ObjectId * clone() const
Definition: ObjectId.cpp:68