src/terralib/fe/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 ObjectId.cpp
22 
23  \brief An object identifier is meant to represent a unique identifier for an object instance within the context of the web service or database that is serving the object.
24  */
25 
26 // TerraLib
27 #include "ObjectId.h"
28 #include "../dataaccess/query_h.h"
29 
30 // STL
31 #include <cassert>
32 
33 te::fe::ObjectId::ObjectId(const char* id, OidType oidType)
34  : m_id(id),
35  m_oidType(oidType)
36 {
37  assert(m_id.empty() == false);
38 }
39 
40 te::fe::ObjectId::~ObjectId() = default;
41 
42 void te::fe::ObjectId::setId(const std::string& id)
43 {
44  assert(id.empty() == false);
45  m_id = id;
46 }
47 
48 const std::string& te::fe::ObjectId::getId() const
49 {
50  return m_id;
51 }
52 
54 {
55  m_oidType = t;
56 }
57 
59 {
60  return m_oidType;
61 }
62 
64 {
65  ObjectId* obj = new ObjectId(m_id.c_str(), m_oidType);
66 
67  return obj;
68 }
69 
const std::string & getId() const
It returns the feature identification value.
OidType m_oidType
May be one of: GmlObjectId, FeatureId, ObjectId, RecordId.
Definition: fe/ObjectId.h:132
~ObjectId()
Destructor.
ObjectId(const char *id, OidType oidType)
It initializes a new ObjectId.
OidType
The type of object identification used.
Definition: fe/ObjectId.h:67
An object identifier is meant to represent a unique identifier for an object instance within the cont...
Definition: fe/ObjectId.h:58
ObjectId * clone() const
It creates a new copy of this object.
OidType getOidType() const
It returns the format type used by the feature identification value.
std::string m_id
The id in a string format.
Definition: fe/ObjectId.h:131
void setOidType(OidType t)
It sets the format type used by the feature identification value.
void setId(const std::string &id)
It sets the feature identification value.