IdentityConstraint.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 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 General Public License for more details.
14 
15  You should have received a copy of the GNU 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 IdentityConstraint.h
22 
23  \brief This is the base class for XML Schema elements that are related to identity constraint.
24 */
25 
26 #ifndef __TERRALIB_XSD_INTERNAL_IDENTITYCONSTRAINT_H
27 #define __TERRALIB_XSD_INTERNAL_IDENTITYCONSTRAINT_H
28 
29 // TerraLib
30 #include "Annotated.h"
31 #include "Identifiable.h"
32 
33 // Boost
34 #include <boost/ptr_container/ptr_vector.hpp>
35 
36 namespace te
37 {
38  namespace xsd
39  {
40 // Forward declarations
41  class Field;
42  class Selector;
43 
44  /*!
45  \class IdentityConstraint
46 
47  \brief This is the base class for XML Schema elements that are related to identity constraint.
48 
49  Specifically the classes Key, KeyRef and Unique are derived from this base class.
50 
51  \sa Key, KeyRef, Unique
52  */
54  {
55  public:
56 
57  /*!
58  \brief Constructor.
59 
60  \param id It specifies a unique ID for this element. It may be a NULL value.
61  \param name It specifies the name of this element. It is required a non-NULL value.
62 
63  \note The IdentityConstraint object will take the ownership of the id and name pointers.
64  */
65  IdentityConstraint(std::string* name, Annotation* ann = 0, std::string* id = 0);
66 
67  /*!
68  \brief Copy constructor.
69 
70  \param rhs Right-hand-side object.
71 
72  \todo Implement!
73  */
75 
76  /*! \brief Destructor. */
77  virtual ~IdentityConstraint();
78 
79  /*!
80  \brief Assignment operator.
81 
82  \param rhs Right-hand-side object.
83 
84  \return A reference to this object.
85  */
86  IdentityConstraint& operator=(const IdentityConstraint& rhs);
87 
88  /*!
89  \brief It returns the name of this element.
90 
91  \return The name of this element.
92  */
93  std::string* getName() const;
94 
95  /*!
96  \brief It returns the Selector element of this element.
97 
98  \return The Selector element.
99  */
100  Selector* getSelector() const;
101 
102  /*!
103  \brief It returns the list of Fields elements of this element.
104 
105  \return The list of Fields.
106  */
107  const boost::ptr_vector<Field>& getFields() const;
108 
109  /*!
110  \brief It sets a name for this element.
111 
112  \param name A name for this element. Required a non-NULL value.
113 
114  \note The IdentityConstraint object will take the ownership of the given pointer.
115  */
116  void setName(std::string* name);
117 
118  /*!
119  \brief It sets the Selector element of this element.
120 
121  \param s It specifies the Selector element.
122 
123  \note The IdentityConstraint object will take the ownership of the given pointer.
124  */
125  void setSelector(Selector* s);
126 
127  /*!
128  \brief Adds a new field to this element.
129 
130  \param f The field that will be added.
131 
132  \note The IdentityConstraint object will take the ownership of the given pointer.
133  */
134  void addField(Field* f);
135 
136  /*!
137  \brief It clones the object.
138 
139  \return A clone of the object. The caller will take the ownership.
140  */
141  virtual IdentityConstraint* clone() const = 0;
142 
143  protected:
144 
145  std::string* m_name; //!< It specifies the name of this element. (Required)
146  Selector* m_selector; //!< It specified the selector element of this. (Required)
147  boost::ptr_vector<Field> m_fieldVec; //!< The list of fields. (Required at least one)
148  };
149 
150  } // end namespace xsd
151 } // end namespace te
152 
153 #endif // __TERRALIB_XSD_INTERNAL_IDENTITYCONSTRAINT_H
A base class for XSD classes that may allow annotation.
Definition: Annotated.h:49
std::string * m_name
It specifies the name of this element. (Required)
A base class for XSD classes that may allow annotation.
A base class for XSD classes that must provide a unique ID property.
Definition: Identifiable.h:46
Selector * m_selector
It specified the selector element of this. (Required)
URI C++ Library.
It models the field element of an XML Schema.
Definition: Field.h:47
It models the selector element of an XML Schema.
Definition: Selector.h:44
This is the base class for XML Schema elements that are related to identity constraint.
A base class for XSD classes that must provide a unique ID property.
#define TEXSDEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:57
boost::ptr_vector< Field > m_fieldVec
The list of fields. (Required at least one)
A class that models a XSD annotation element.
Definition: Annotation.h:55