All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SubSelect.cpp
Go to the documentation of this file.
1 /* Copyright (C) 2008-2013 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  : FromItem(rhs),
44  m_select(0)
45 {
46  m_select.reset(rhs.m_select.get() ? static_cast<Select*>(rhs.m_select->clone()) : 0);
47 }
48 
50 {
51 }
52 
54 {
55  if(this != &rhs)
56  {
58  m_select.reset(rhs.m_select.get() ? static_cast<Select*>(rhs.m_select->clone()) : 0);
59  }
60 
61  return *this;
62 }
63 
65 {
66  return new SubSelect(*this);
67 }
68 
70 {
71  return m_select.get();
72 }
73 
75 {
76  m_select.reset(s);
77 }
78 
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
A Select can be used as a source of information in another query.
SubSelect & operator=(const SubSelect &rhs)
Definition: SubSelect.cpp:53
FromItem * clone() const
It creates a new copy of this FromItem.
Definition: SubSelect.cpp:64
An abstract class that models a source of data in a query.
Definition: FromItem.h:50
std::auto_ptr< Select > m_select
The associated SubSelect.
Definition: SubSelect.h:101
Select * getSelect() const
It returns the associated subselect.
Definition: SubSelect.cpp:69
~SubSelect()
Destructor.
Definition: SubSelect.cpp:49
FromItem & operator=(const FromItem &rhs)
Definition: FromItem.cpp:34
A Select can be used as a source of information in another query.
Definition: SubSelect.h:49
void setSelect(Select *s)
It sets the real SubSelect associated to this object.
Definition: SubSelect.cpp:74
TE_DEFINE_VISITABLE SubSelect(Select *s, const std::string &alias)
Constructor.
Definition: SubSelect.cpp:30