1 // Created on: 2009-01-29
2 // Created by: Pavel TELKOV
3 // Copyright (c) 2009-2012 OPEN CASCADE SAS
5 // The content of this file is subject to the Open CASCADE Technology Public
6 // License Version 6.5 (the "License"). You may not use the content of this file
7 // except in compliance with the License. Please obtain a copy of the License
8 // at http://www.opencascade.org and read it completely before using this file.
10 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
11 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13 // The Original Code and all software distributed under the License is
14 // distributed on an "AS IS" basis, without warranty of any kind, and the
15 // Initial Developer hereby disclaims all such warranties, including without
16 // limitation, any warranties of merchantability, fitness for a particular
17 // purpose or non-infringement. Please see the License for the specific terms
18 // and conditions governing the rights and limitations under the License.
22 * Purpose: This class represent pair of integer indices
23 * It is restricted to store more than two indices in it
24 * This pair uses to store element indices connected to link
27 #ifndef BRepMesh_PairOfIndex_HeaderFile
28 #define BRepMesh_PairOfIndex_HeaderFile
30 #include <Standard_OutOfRange.hxx>
32 class BRepMesh_PairOfIndex
35 BRepMesh_PairOfIndex()
36 { myIndx1 = myIndx2 = -1; }
38 BRepMesh_PairOfIndex(const BRepMesh_PairOfIndex& theOther)
40 myIndx1 = theOther.myIndx1;
41 myIndx2 = theOther.myIndx2;
47 myIndx1 = myIndx2 = -1;
50 //! append index (store first of last index of pair)
51 void Append(const Standard_Integer theIndx)
58 Standard_OutOfRange::Raise ("BRepMesh_PairOfIndex::Append, more than two index to store");
63 //! prepend index (store first index)
64 void Prepend(const Standard_Integer theIndx)
67 Standard_OutOfRange::Raise ("BRepMesh_PairOfIndex::Append, more than two index to store");
72 //! returns is pair not initialized by index
73 Standard_Boolean IsEmpty() const
75 return (myIndx1 < 0 /*optimisation && myIndx2 < 0*/);
78 //! returns numner of initialized indeces
79 Standard_Integer Extent() const
81 return (myIndx1 < 0 ? 0 : (myIndx2 < 0 ? 1 : 2));
84 //! returns first index from pair
85 Standard_Integer FirstIndex() const
90 //! returns last index
91 Standard_Integer LastIndex() const
93 return (myIndx2 < 0 ? myIndx1 : myIndx2);
96 Standard_Integer Index(const Standard_Integer theNum) const
98 return (theNum == 1 ? myIndx1 : myIndx2 /*(theNum == 2 ? myIndx2 : -1 )*/);
101 void SetIndex(const Standard_Integer theNum,
102 const Standard_Integer theIndex)
104 theNum == 1 ? myIndx1 = theIndex : myIndx2 = theIndex;
108 void RemoveIndex (const Standard_Integer theNum)
116 Standard_Integer myIndx1;
117 Standard_Integer myIndx2;