025314: Usage of smart pointers for dynamically allocated memory in BVH
[occt.git] / src / BVH / BVH_ObjectSet.hxx
CommitLineData
3c4e78f2 1// Created on: 2013-12-20
2// Created by: Denis BOGOLEPOV
d5f74e42 3// Copyright (c) 2013-2014 OPEN CASCADE SAS
3c4e78f2 4//
5// This file is part of Open CASCADE Technology software library.
6//
d5f74e42 7// This library is free software; you can redistribute it and/or modify it under
8// the terms of the GNU Lesser General Public License version 2.1 as published
3c4e78f2 9// by the Free Software Foundation, with special exception defined in the file
10// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11// distribution for complete text of the license and disclaimer of any warranty.
12//
13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
15
16#ifndef _BVH_ObjectSet_Header
17#define _BVH_ObjectSet_Header
18
19#include <BVH_Set.hxx>
20#include <BVH_Object.hxx>
21
679d3878 22//! Array of abstract entities (bounded by BVH boxes) to built BVH.
23//! \tparam T Numeric data type
24//! \tparam N Vector dimension
3c4e78f2 25template<class T, int N>
26class BVH_ObjectSet : public BVH_Set<T, N>
27{
28public:
29
679d3878 30 //! Type of array of geometric objects.
3c4e78f2 31 typedef NCollection_Vector<NCollection_Handle<BVH_Object<T, N> > > BVH_ObjectList;
32
33public:
34
679d3878 35 //! Creates new set of geometric objects.
3c4e78f2 36 BVH_ObjectSet();
37
38 //! Releases resources of set of geometric objects.
39 virtual ~BVH_ObjectSet();
40
41public:
42
679d3878 43 //! Removes all geometric objects.
3c4e78f2 44 virtual void Clear();
45
679d3878 46 //! Returns reference to the array of geometric objects.
3c4e78f2 47 BVH_ObjectList& Objects();
48
679d3878 49 //! Returns reference to the array of geometric objects.
3c4e78f2 50 const BVH_ObjectList& Objects() const;
51
52public:
53
54 //! Return total number of objects.
55 virtual Standard_Integer Size() const;
56
679d3878 57 //! Returns AABB of the given object.
3c4e78f2 58 virtual BVH_Box<T, N> Box (const Standard_Integer theIndex) const;
59
679d3878 60 //! Returns centroid position along the given axis.
3c4e78f2 61 virtual T Center (const Standard_Integer theIndex, const Standard_Integer theAxis) const;
62
679d3878 63 //! Performs transposing the two given objects in the set.
3c4e78f2 64 virtual void Swap (const Standard_Integer theIndex1, const Standard_Integer theIndex2);
65
66protected:
67
68 BVH_ObjectList myObjects; //!< Array of geometric objects
69
70};
71
72#include <BVH_ObjectSet.lxx>
73
74#endif // _BVH_ObjectSet_Header