1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-06-05 11:24:17 +03:00
occt/src/BRepMesh/BRepMesh_PairOfIndex.hxx
abv ed4415982c 0024624: Lost word in license statement in source files
License statement text corrected; compiler warnings caused by Bison 2.41 disabled for MSVC; a few other compiler warnings on 54-bit Windows eliminated by appropriate type cast
Wrong license statements corrected in several files.
Copyright and license statements added in XSD and GLSL files.
Copyright year updated in some files.
Obsolete documentation files removed from DrawResources.
2014-03-25 16:38:55 +04:00

116 lines
2.9 KiB
C++

// Created on: 2009-01-29
// Created by: Pavel TELKOV
// Copyright (c) 2009-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
/*
* Purpose: This class represent pair of integer indices
* It is restricted to store more than two indices in it
* This pair uses to store element indices connected to link
*/
#ifndef BRepMesh_PairOfIndex_HeaderFile
#define BRepMesh_PairOfIndex_HeaderFile
#include <Standard_OutOfRange.hxx>
class BRepMesh_PairOfIndex
{
public:
BRepMesh_PairOfIndex()
{ myIndx1 = myIndx2 = -1; }
BRepMesh_PairOfIndex(const BRepMesh_PairOfIndex& theOther)
{
myIndx1 = theOther.myIndx1;
myIndx2 = theOther.myIndx2;
}
//! Clear indices
void Clear()
{
myIndx1 = myIndx2 = -1;
}
//! append index (store first of last index of pair)
void Append(const Standard_Integer theIndx)
{
if ( myIndx1 < 0 )
myIndx1 = theIndx;
else
{
if ( myIndx2 >= 0 )
Standard_OutOfRange::Raise ("BRepMesh_PairOfIndex::Append, more than two index to store");
myIndx2 = theIndx;
}
}
//! prepend index (store first index)
void Prepend(const Standard_Integer theIndx)
{
if ( myIndx2 >= 0 )
Standard_OutOfRange::Raise ("BRepMesh_PairOfIndex::Append, more than two index to store");
myIndx2 = myIndx1;
myIndx1 = theIndx;
}
//! returns is pair not initialized by index
Standard_Boolean IsEmpty() const
{
return (myIndx1 < 0 /*optimisation && myIndx2 < 0*/);
}
//! returns numner of initialized indeces
Standard_Integer Extent() const
{
return (myIndx1 < 0 ? 0 : (myIndx2 < 0 ? 1 : 2));
}
//! returns first index from pair
Standard_Integer FirstIndex() const
{
return myIndx1;
}
//! returns last index
Standard_Integer LastIndex() const
{
return (myIndx2 < 0 ? myIndx1 : myIndx2);
}
Standard_Integer Index(const Standard_Integer theNum) const
{
return (theNum == 1 ? myIndx1 : myIndx2 /*(theNum == 2 ? myIndx2 : -1 )*/);
}
void SetIndex(const Standard_Integer theNum,
const Standard_Integer theIndex)
{
theNum == 1 ? myIndx1 = theIndex : myIndx2 = theIndex;
}
//! remove indicated
void RemoveIndex (const Standard_Integer theNum)
{
if ( theNum == 1 )
myIndx1 = myIndx2;
myIndx2 = -1;
}
//! fields
private:
Standard_Integer myIndx1;
Standard_Integer myIndx2;
};
#endif