src/terralib/dataaccess/dataset/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 
32 te::da::ObjectId::ObjectId() = default;
33 
35 {
36  for(std::size_t i = 0; i < rhs.m_data.size(); ++i)
37  m_data.push_back(rhs.m_data[i].clone());
38 }
39 
40 te::da::ObjectId::~ObjectId() = default;
41 
42 const boost::ptr_vector<te::dt::AbstractData>& te::da::ObjectId::getValue() const
43 {
44  return m_data;
45 }
46 
48 {
49  std::string value;
50 
51  for(std::size_t i = 0; i < m_data.size(); ++i)
52  value += m_data[i].toString();
53 
54  return value;
55 }
56 
58 {
59  assert(data);
60 
61  m_data.push_back(data);
62 }
63 
65 {
66  return new ObjectId(*this);
67 }
68 
69 bool te::da::ObjectId::operator<(const ObjectId& rhs) const
70 {
71  return getValueAsString() < rhs.getValueAsString();
72 }
bool operator<(const ObjectId &rhs) const
~ObjectId()
Destructor.
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.
void addValue(te::dt::AbstractData *data)
It adds a property value to uniquely identify a data set element.
This class represents an unique id for a data set element.
std::string getValueAsString() const
It gets the properties values used to uniquely identify a data set element as string.
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.
ObjectId()
Default constructor.