0026377: Passing Handle objects as arguments to functions as non-const reference...
[occt.git] / src / BOPDS / BOPDS_PassKey.hxx
CommitLineData
42cf5bc1 1// Created by: Peter KURNEV
2// Copyright (c) 2010-2014 OPEN CASCADE SAS
3// Copyright (c) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
4// Copyright (c) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT,
5// EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6//
7// This file is part of Open CASCADE Technology software library.
8//
9// This library is free software; you can redistribute it and/or modify it under
10// the terms of the GNU Lesser General Public License version 2.1 as published
11// by the Free Software Foundation, with special exception defined in the file
12// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
13// distribution for complete text of the license and disclaimer of any warranty.
14//
15// Alternatively, this file may be used under the terms of Open CASCADE
16// commercial license or contractual agreement.
17
18#ifndef _BOPDS_PassKey_HeaderFile
19#define _BOPDS_PassKey_HeaderFile
20
21#include <Standard.hxx>
22#include <Standard_DefineAlloc.hxx>
23#include <Standard_Handle.hxx>
24
25#include <BOPCol_BaseAllocator.hxx>
26#include <Standard_Integer.hxx>
27#include <BOPCol_PInteger.hxx>
28#include <BOPCol_ListOfInteger.hxx>
29#include <Standard_Boolean.hxx>
30
31
32
33//! The class BOPDS_PassKey is to provide
34//! possibility to map objects that
35//! have a set of integer IDs as a base
36class BOPDS_PassKey
37{
38public:
39
40 DEFINE_STANDARD_ALLOC
41
42
43
44 //! Empty contructor
45 BOPDS_PassKey();
46virtual ~BOPDS_PassKey();
47
48
49 //! Contructor
50 //! theAllocator - the allocator to manage the memory
51 BOPDS_PassKey(const BOPCol_BaseAllocator& theAllocator);
52
53
54 //! Copy Contructor
55 BOPDS_PassKey(const BOPDS_PassKey& Other);
56BOPDS_PassKey& operator =(const BOPDS_PassKey& Other);
57
58
59 //! Clear the contents
60 void Clear();
61
62
63 //! Modifier
64 //! Sets one Id <theI1>
65 void SetIds (const Standard_Integer theI1);
66
67
68 //! Modifier
69 //! Sets two Id <theI1>,<theI2>
70 void SetIds (const Standard_Integer theI1, const Standard_Integer theI2);
71
72
73 //! Modifier
74 //! Sets three Id <theI1>,<theI2>,<theI3>
75 void SetIds (const Standard_Integer theI1, const Standard_Integer theI2, const Standard_Integer theI3);
76
77
78 //! Modifier
79 //! Sets four Id <theI1>,<theI2>,<theI3>,<theI4>
80 void SetIds (const Standard_Integer theI1, const Standard_Integer theI2, const Standard_Integer theI3, const Standard_Integer theI4);
81
82
83 //! Modifier
84 //! Sets the list of Id <theLI>
85 Standard_EXPORT void SetIds (const BOPCol_ListOfInteger& theLI);
86
87
88 //! Selector
89 //! Returns the number of Ids>
90 Standard_Integer NbIds() const;
91
92
93 //! Query
94 //! Returns true if the PassKey is equal to <the theOther>
95 Standard_Boolean IsEqual (const BOPDS_PassKey& theOther) const;
96
97
98 //! Query
99 //! Returns hash code
100 Standard_Integer HashCode (const Standard_Integer theUpper) const;
101
102
103 //! Selector
104 //! Returns Id of index <theIndex>
105 Standard_Integer Id (const Standard_Integer theIndex) const;
106
107
108 //! Selector
109 //! Returns the first two Ids <theI1>,<theI2>
110 void Ids (Standard_Integer& theI1, Standard_Integer& theI2) const;
111
112 Standard_EXPORT void Dump (const Standard_Integer aHex = 0) const;
113
114
115
116
117protected:
118
119
120 BOPCol_PInteger Allocate (const Standard_Integer theSize);
121
122
123 BOPCol_BaseAllocator myAllocator;
124 Standard_Integer myNbIds;
125 Standard_Integer mySum;
126 BOPCol_PInteger myPtr;
127
128
129private:
130
131
132
133
134
135};
136
137
138#include <BOPDS_PassKey.lxx>
139
140
141
142
143
144#endif // _BOPDS_PassKey_HeaderFile