// commercial license or contractual agreement.
#include <TColStd_PackedMapOfInteger.hxx>
-#include <TColStd_MapIteratorOfPackedMapOfInteger.hxx>
+
#include <TCollection_MapNode.hxx>
#include <Standard_Type.hxx>
// 27 upper bits
#define MASK_HIGH (~MASK_LOW)
-/**
- * Class implementing a block of 32 consecutive integer values as a node of
- * a Map collection. The data are stored in 64 bits as:
- * - bits 0 - 4 : (number of integers stored in the block) - 1;
- * - bits 5 - 31: base address of the block of integers (low bits assumed 0)
- * - bits 32 - 63: 32-bit field where each bit indicates the presence of the
- * corresponding integer in the block. Number of non-zero bits
- * must be equal to the number expressed in bits 0-4.
- */
-class TColStd_intMapNode : public TCollection_MapNode
+//! Class implementing a block of 32 consecutive integer values as a node of a Map collection.
+class TColStd_PackedMapOfInteger::TColStd_intMapNode : public TCollection_MapNode
{
public:
inline TColStd_intMapNode (TCollection_MapNode * ptr = 0L)
return ((myMask >> 5) == (unsigned)theOther);
}
- /**
- * Local friend function, used in TColStd_MapIteratorOfPackedMapOfInteger.
- */
- friend Standard_Integer TColStd_intMapNode_findNext(const TColStd_intMapNode*,
- unsigned int& );
-
- /**
- * Local friend function.
- */
- friend Standard_Integer TColStd_intMapNode_findPrev(const TColStd_intMapNode*,
- unsigned int& );
-
private:
unsigned int myMask;
unsigned int myData;
//purpose :
//=======================================================================
-Standard_Boolean TColStd_intMapNode::AddValue (const Standard_Integer theValue)
+Standard_Boolean TColStd_PackedMapOfInteger::TColStd_intMapNode::AddValue (const Standard_Integer theValue)
{
Standard_Boolean aResult (Standard_False);
const Standard_Integer aValInt = (1 << (theValue & MASK_LOW));
//purpose :
//=======================================================================
-Standard_Boolean TColStd_intMapNode::DelValue (const Standard_Integer theValue)
+Standard_Boolean TColStd_PackedMapOfInteger::TColStd_intMapNode::DelValue (const Standard_Integer theValue)
{
Standard_Boolean aResult (Standard_False);
const Standard_Integer aValInt = (1 << (theValue & MASK_LOW));
//=======================================================================
//function : TColStd_intMapNode_findNext
-//purpose : Find the smallest non-zero bit under the given mask. Outputs
-// the new mask that does not contain the detected bit.
+//purpose :
//=======================================================================
-
-Standard_Integer TColStd_intMapNode_findNext (const TColStd_intMapNode* theNode,
- unsigned int& theMask)
+Standard_Integer TColStd_PackedMapOfInteger::TColStd_intMapNode_findNext (const Standard_Address theNode,
+ unsigned int& theMask)
{
- unsigned int val = theNode->myData & theMask;
+ const TColStd_intMapNode* aNode = reinterpret_cast<const TColStd_intMapNode*> (theNode);
+ unsigned int val = aNode->Data() & theMask;
int nZeros (0);
if (val == 0)
theMask = ~0U; // void, nothing to do
}
theMask = (aMask << 1);
}
- return nZeros + theNode->Key();
+ return nZeros + aNode->Key();
}
//=======================================================================
//function : TColStd_intMapNode_findPrev
-//purpose : Find the highest non-zero bit under the given mask. Outputs
-// the new mask that does not contain the detected bit.
+//purpose :
//=======================================================================
-
-Standard_Integer TColStd_intMapNode_findPrev (const TColStd_intMapNode* theNode,
- unsigned int& theMask)
+Standard_Integer TColStd_PackedMapOfInteger::TColStd_intMapNode_findPrev (const Standard_Address theNode,
+ unsigned int& theMask)
{
- unsigned int val = theNode->myData & theMask;
+ const TColStd_intMapNode* aNode = reinterpret_cast<const TColStd_intMapNode*> (theNode);
+ unsigned int val = aNode->Data() & theMask;
int nZeros (0);
if (val == 0)
theMask = ~0U; // void, nothing to do
}
theMask = (aMask >> 1);
}
- return (31 - nZeros) + theNode->Key();
+ return (31 - nZeros) + aNode->Key();
}
//=======================================================================
}
if (pFoundNode) {
unsigned int aFullMask (0xffffffff);
- aResult = TColStd_intMapNode_findNext (pFoundNode, aFullMask);
+ aResult = TColStd_intMapNode_findNext ((const Standard_Address )pFoundNode, aFullMask);
}
}
return aResult;
}
if (pFoundNode) {
unsigned int aFullMask (0xffffffff);
- aResult = TColStd_intMapNode_findPrev (pFoundNode, aFullMask);
+ aResult = TColStd_intMapNode_findPrev ((const Standard_Address )pFoundNode, aFullMask);
}
}
return aResult;