FromItem.h
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/FromItem.h
22 
23  \brief An abstract class that models a source of data in a query.
24 */
25 
26 #ifndef __TERRALIB_DATAACCESS_INTERNAL_FROMITEM_H
27 #define __TERRALIB_DATAACCESS_INTERNAL_FROMITEM_H
28 
29 // TerraLib
30 #include "../../common/BaseVisitable.h"
31 #include "QueryVisitor.h"
32 
33 // STL
34 #include <string>
35 
36 namespace te
37 {
38  namespace da
39  {
40 // Forward declarations
41  class Expression;
42 
43  /*!
44  \class FromItem
45 
46  \brief An abstract class that models a source of data in a query.
47 
48  \sa From, DataSetType, DataSetName, SubSelect, DataSet, FromFunctionCall, Join
49  */
51  {
52  public:
53 
55 
56  /*!
57  \brief Constructor.
58 
59  \param alias An alias to the source data item.
60  */
61  FromItem(const std::string& alias) : m_alias(alias) {}
62 
63  /*! \brief Copy constructor. */
64  FromItem(const FromItem& rhs);
65 
66  /*! \brief Virtual destructor. */
67  virtual ~FromItem() {}
68 
69  /*! Assignment operator. */
70  FromItem& operator=(const FromItem& rhs);
71 
72  /*! \brief It creates a new copy of this FromItem. */
73  virtual FromItem* clone() const = 0;
74 
75  /*!
76  \brief It sets the alias for a from source item.
77 
78  \param alias The alias for a from source item.
79 
80  \note The FromItem will take the ownership of the given alias.
81  */
82  void setAlias(const std::string& alias);
83 
84  /*!
85  \brief It returns the alias associated to the source item.
86 
87  \return The alias for the source item.
88  */
89  const std::string& getAlias() const;
90 
91  protected:
92 
93  std::string m_alias; //!< An alias for the output name.
94  };
95 
96  /*! \brief For use with boost conteiners. */
97  inline FromItem* new_clone(const FromItem& a)
98  {
99  return a.clone();
100  }
101 
102  } // end namespace da
103 } // end namespace te
104 
105 #endif // __TERRALIB_DATAACCESS_INTERNAL_FROMITEM_H
106 
std::string m_alias
An alias for the output name.
Definition: FromItem.h:93
An abstract class that models a source of data in a query.
Definition: FromItem.h:50
The root of all hierarchies that can be visited.
Definition: BaseVisitable.h:53
TE_DEFINE_VISITABLE FromItem(const std::string &alias)
Constructor.
Definition: FromItem.h:61
A visitor interface for the Query hierarchy.
virtual FromItem * clone() const =0
It creates a new copy of this FromItem.
URI C++ Library.
#define TE_DEFINE_VISITABLE
Definition: BaseVisitable.h:75
Expression * new_clone(const Expression &a)
For use with boost conteiners.
Definition: Expression.h:64
virtual ~FromItem()
Virtual destructor.
Definition: FromItem.h:67
#define TEDATAACCESSEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:97