Branch.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 Branch.h
22 
23  \brief A struct that represents a node-branch in an R-tree.
24 */
25 
26 #ifndef __TERRALIB_SAM_RTREE_INTERNAL_BRANCH_H
27 #define __TERRALIB_SAM_RTREE_INTERNAL_BRANCH_H
28 
29 // TerraLib
30 #include "../../geometry/Envelope.h"
31 
32 namespace te
33 {
34  namespace sam
35  {
36  namespace rtree
37  {
38  /*!
39  \struct Branch
40 
41  \brief It represents a node-branch of a Rtree.
42 
43  \warning The types that can be used in DATATYPE template are very strict: int, unsigned, long and pointers.
44  */
45  template<class NODE, class DATATYPE> struct Branch
46  {
47  te::gm::Envelope m_mbr; //!< Bounding box containing all the objects under the branch or an object bounding box.
48 
49  union
50  {
51  NODE* m_child; //!< A pointer to the child node.
52  DATATYPE m_data; //!< An object-identifier (oid).
53  };
54 
56  {
57  m_child = 0;
58  }
59 
60  };
61 
62  } // end namespace rtree
63  } // end namespace sam
64 } // end namespace te
65 
66 
67 #endif // __TERRALIB_SAM_RTREE_INTERNAL_BRANCH_H
68 
DATATYPE m_data
An object-identifier (oid).
Definition: Branch.h:52
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:51
URI C++ Library.
It represents a node-branch of a Rtree.
Definition: Branch.h:45
te::gm::Envelope m_mbr
Bounding box containing all the objects under the branch or an object bounding box.
Definition: Branch.h:47
NODE * m_child
A pointer to the child node.
Definition: Branch.h:51