GroupByItem.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/GroupByItem.h
22 
23  \brief A class that can be used in a GROUP BY clause.
24 */
25 
26 #ifndef __TERRALIB_DATAACCESS_INTERNAL_GROUPBYITEM_H
27 #define __TERRALIB_DATAACCESS_INTERNAL_GROUPBYITEM_H
28 
29 // TerraLib
30 #include "../Config.h"
31 
32 // STL
33 #include <memory>
34 #include <string>
35 
36 namespace te
37 {
38  namespace da
39  {
40 // Forward declarations
41  class Expression;
42 
43  /*!
44  \class GroupByItem
45 
46  \brief A class that can be used in a GROUP BY clause.
47 
48  \sa GroupBy
49  */
51  {
52  public:
53 
54  /*!
55  \brief Constructor.
56 
57  \param e An expression to be used in an GROUP BY clause.
58  \param order The sort order.
59  */
60  explicit GroupByItem(const Expression& e);
61 
62  /*!
63  \brief Constructor.
64 
65  \param e An expression to be used in an GROUP BY clause.
66  \param order The sort order.
67 
68  \note The GroupByItem will take the ownership of Expression.
69  */
70  explicit GroupByItem(Expression* e);
71 
72  /*!
73  \brief Constructor.
74 
75  \param propertyName A property name.
76  \param order The sort order.
77  */
78  explicit GroupByItem(const std::string& propertyName);
79 
80  /*! \brief Copy constructor. */
81  explicit GroupByItem(const GroupByItem& rhs);
82 
83  /*! \brief Destructor. */
84  ~GroupByItem();
85 
86  /*! Assignment operator. */
87  GroupByItem& operator=(const GroupByItem& rhs);
88 
89  /*!
90  \brief It sets the expression to sort the result of a query.
91 
92  \param e The expression to be used to sort the result of a query.
93 
94  \note The GroupByItem will take the expression ownership.
95  */
96  void setExpression(Expression* e);
97 
98  /*!
99  \brief It returns the exprsssion to be used to sort the result of a query.
100 
101  \return The exprsssion to be used to sort the result of a query.
102  */
103  Expression* getExpression() const;
104 
105  private:
106 
107  std::auto_ptr<Expression> m_field; //!< A valid expression.
108  };
109 
110  } // end namespace da
111 } // end namespace te
112 
113 #endif // __TERRALIB_DATAACCESS_INTERNAL_GROUPBYITEM_H
114 
A class that can be used in a GROUP BY clause.
Definition: GroupByItem.h:50
This is an abstract class that models a query expression.
Definition: Expression.h:47
URI C++ Library.
std::auto_ptr< Expression > m_field
A valid expression.
Definition: GroupByItem.h:107
#define TEDATAACCESSEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:97