SubSelect.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/query/SubSelect.cpp
22 
23  \brief A Select can be used as a source of information in another query.
24 */
25 
26 // TerraLib
27 #include "Select.h"
28 #include "SubSelect.h"
29 
30 te::da::SubSelect::SubSelect(Select* s, const std::string& alias)
31  : FromItem(alias),
32  m_select(s)
33 {
34 }
35 
36 te::da::SubSelect::SubSelect(const Select& s, const std::string& alias)
37  : FromItem(alias),
38  m_select(static_cast<Select*>(s.clone()))
39 {
40 }
41 
43 
44 {
45  m_select.reset(rhs.m_select.get() ? static_cast<Select*>(rhs.m_select->clone()) : nullptr);
46 }
47 
49 
51 {
52  if(this != &rhs)
53  {
55  m_select.reset(rhs.m_select.get() ? static_cast<Select*>(rhs.m_select->clone()) : nullptr);
56  }
57 
58  return *this;
59 }
60 
62 {
63  return new SubSelect(*this);
64 }
65 
67 {
68  return m_select.get();
69 }
70 
72 {
73  m_select.reset(s);
74 }
75 
~SubSelect()
Destructor.
An abstract class that models a source of data in a query.
Definition: FromItem.h:50
Select * getSelect() const
It returns the associated subselect.
Definition: SubSelect.cpp:66
std::unique_ptr< Select > m_select
The associated SubSelect.
Definition: SubSelect.h:101
FromItem * clone() const
It creates a new copy of this FromItem.
Definition: SubSelect.cpp:61
FromItem & operator=(const FromItem &rhs)
Definition: FromItem.cpp:34
SubSelect & operator=(const SubSelect &rhs)
Definition: SubSelect.cpp:50
A Select models a query to be used when retrieving data from a data source.
A Select models a query to be used when retrieving data from a DataSource.
Definition: Select.h:65
TE_DEFINE_VISITABLE SubSelect(Select *s, const std::string &alias)
Constructor.
Definition: SubSelect.cpp:30
void setSelect(Select *s)
It sets the real SubSelect associated to this object.
Definition: SubSelect.cpp:71
A Select can be used as a source of information in another query.
A Select can be used as a source of information in another query.
Definition: SubSelect.h:49