Loading...
Searching...
No Matches
CheckConstraint.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/dataset/CheckConstraint.h
22
23 \brief A class that describes a check constraint.
24*/
25
26#ifndef __TERRALIB_DATAACCESS_INTERNAL_CHECKCONSTRAINT_H
27#define __TERRALIB_DATAACCESS_INTERNAL_CHECKCONSTRAINT_H
28
29// TerraLib
30#include "Constraint.h"
31
32namespace te
33{
34// Forward declarations
35 namespace dt { class Property; }
36
37 namespace da
38 {
39 /*!
40 \class CheckConstraint
41
42 \brief A class that describes a check constraint.
43
44 \sa DataSetType, Constraint, PrimaryKey, UniqueKey, ForeignKey
45 */
47 {
48 public:
49
50 /*!
51 \brief Constructor.
52
53 \param dt The DataSetType associated to the check constraint.
54 \param id The constraint identifier.
55
56 \note The new constraint will belong to the given DataSetType.
57
58 \warning The identifier value (id) may be used by data source implementations. So, don't rely on its value!
59 */
60 CheckConstraint(DataSetType* dt = 0, unsigned int id = 0);
61
62 /*!
63 \brief Constructor.
64
65 \param name The check constraint name.
66 \param parent The parent DataSetType of this check constraint.
67 \param id The constraint identifier.
68
69 \note The new constraint will belong to the given DataSetType.
70
71 \warning The identifier value (id) may be used by data source implementations. So, don't rely on its value!
72 */
73 CheckConstraint(const std::string& name,
74 DataSetType* dt = 0,
75 unsigned int id = 0);
76
77 /*!
78 \brief Copy constructor not allowed.
79
80 The new object will not have an associated DataSetType.
81
82 \param rhs Right-hand-side instance.
83 */
85
86 /*! \brief Destructor. */
88
89 /*!
90 \brief Assignment operator.
91
92 The new object will not have an assigned DataSetType.
93
94 \param rhs Right-hand-side instance.
95
96 \return A reference to this.
97 */
99
100 /*!
101 \brief It returns the check constraint expression.
102
103 \return The check constraint expression.
104 */
105 const std::string& getExpression() const { return m_expression; }
106
107 /*!
108 \brief It sets the check constraint expression.
109
110 \param name The check constraint expression.
111 */
112 void setExpression(const std::string& e) { m_expression = e; }
113
114 /*!
115 \brief It returns the constraint type: CHECK.
116
117 \return The constraint type CHECK.
118 */
119 ConstraintType getType() const { return CHECK; }
120
121 /*!
122 \brief It returns a clone of the object.
123
124 The new object will not have an associated DataSetType.
125
126 \return A clone of the object.
127 */
129
130 private:
131
132 std::string m_expression; //!< The check constraint expression.
133 };
134
135 } // end namespace da
136} // end namespace te
137
138#endif // __TERRALIB_DATAACCESS_INTERNAL_CHECKCONSTRAINT_H
139
A class that describes a constraint.
A class that describes a check constraint.
~CheckConstraint()
Destructor.
Constraint * clone()
It returns a clone of the object.
void setExpression(const std::string &e)
It sets the check constraint expression.
ConstraintType getType() const
It returns the constraint type: CHECK.
CheckConstraint(const std::string &name, DataSetType *dt=0, unsigned int id=0)
Constructor.
std::string m_expression
The check constraint expression.
CheckConstraint(DataSetType *dt=0, unsigned int id=0)
Constructor.
CheckConstraint(const CheckConstraint &rhs)
Copy constructor not allowed.
const std::string & getExpression() const
It returns the check constraint expression.
CheckConstraint & operator=(const CheckConstraint &rhs)
Assignment operator.
A class that models the description of a dataset.
Definition: DataSetType.h:73
ConstraintType
A ConstraintType can have one of the following types:
Definition: Enums.h:66
@ CHECK
Definition: Enums.h:71
TerraLib.
#define TEDATAACCESSEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:97