1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-04 13:13:25 +03:00

Coding - Apply .clang-format formatting #286

Update empty method guards to new style with regex (see PR).
Used clang-format 18.1.8.
New actions to validate code formatting is added.
Update .clang-format with disabling of include sorting.
  It is temporary changes, then include will be sorted.
Apply formatting for /src and /tools folder.
The files with .hxx,.cxx,.lxx,.h,.pxx,.hpp,*.cpp extensions.
This commit is contained in:
dpasukhi
2025-01-25 20:15:22 +00:00
parent dbba6f1289
commit a5a7b3185b
14005 changed files with 1273539 additions and 1195567 deletions

View File

@@ -20,5 +20,4 @@
typedef NCollection_Array1<TCollection_AsciiString> TColStd_Array1OfAsciiString;
#endif

View File

@@ -19,5 +19,4 @@
typedef NCollection_Array1<Standard_Boolean> TColStd_Array1OfBoolean;
#endif

View File

@@ -19,5 +19,4 @@
typedef NCollection_Array1<Standard_Byte> TColStd_Array1OfByte;
#endif

View File

@@ -19,5 +19,4 @@
typedef NCollection_Array1<Standard_Character> TColStd_Array1OfCharacter;
#endif

View File

@@ -20,5 +20,4 @@
typedef NCollection_Array1<TCollection_ExtendedString> TColStd_Array1OfExtendedString;
#endif

View File

@@ -20,5 +20,4 @@
typedef NCollection_Array1<Standard_Integer> TColStd_Array1OfInteger;
#endif

View File

@@ -20,5 +20,4 @@
typedef NCollection_Array1<TColStd_ListOfInteger> TColStd_Array1OfListOfInteger;
#endif

View File

@@ -19,5 +19,4 @@
typedef NCollection_Array1<Standard_Real> TColStd_Array1OfReal;
#endif

View File

@@ -20,5 +20,4 @@
typedef NCollection_Array1<Handle(Standard_Transient)> TColStd_Array1OfTransient;
#endif

View File

@@ -19,5 +19,4 @@
typedef NCollection_Array2<Standard_Boolean> TColStd_Array2OfBoolean;
#endif

View File

@@ -19,5 +19,4 @@
typedef NCollection_Array2<Standard_Character> TColStd_Array2OfCharacter;
#endif

View File

@@ -20,5 +20,4 @@
typedef NCollection_Array2<Standard_Integer> TColStd_Array2OfInteger;
#endif

View File

@@ -19,5 +19,4 @@
typedef NCollection_Array2<Standard_Real> TColStd_Array2OfReal;
#endif

View File

@@ -20,5 +20,4 @@
typedef NCollection_Array2<Handle(Standard_Transient)> TColStd_Array2OfTransient;
#endif

View File

@@ -11,7 +11,6 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef TColStd_DataMapIteratorOfDataMapOfAsciiStringInteger_HeaderFile
#define TColStd_DataMapIteratorOfDataMapOfAsciiStringInteger_HeaderFile

View File

@@ -11,7 +11,6 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef TColStd_DataMapIteratorOfDataMapOfIntegerInteger_HeaderFile
#define TColStd_DataMapIteratorOfDataMapOfIntegerInteger_HeaderFile

View File

@@ -11,7 +11,6 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef TColStd_DataMapIteratorOfDataMapOfIntegerListOfInteger_HeaderFile
#define TColStd_DataMapIteratorOfDataMapOfIntegerListOfInteger_HeaderFile

View File

@@ -11,7 +11,6 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef TColStd_DataMapIteratorOfDataMapOfIntegerReal_HeaderFile
#define TColStd_DataMapIteratorOfDataMapOfIntegerReal_HeaderFile

View File

@@ -11,7 +11,6 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef TColStd_DataMapIteratorOfDataMapOfIntegerTransient_HeaderFile
#define TColStd_DataMapIteratorOfDataMapOfIntegerTransient_HeaderFile

View File

@@ -11,7 +11,6 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef TColStd_DataMapIteratorOfDataMapOfStringInteger_HeaderFile
#define TColStd_DataMapIteratorOfDataMapOfStringInteger_HeaderFile

View File

@@ -11,7 +11,6 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef TColStd_DataMapIteratorOfDataMapOfTransientTransient_HeaderFile
#define TColStd_DataMapIteratorOfDataMapOfTransientTransient_HeaderFile

View File

@@ -19,8 +19,9 @@
#include <Standard_Integer.hxx>
#include <NCollection_DataMap.hxx>
typedef NCollection_DataMap<TCollection_AsciiString,Standard_Integer> TColStd_DataMapOfAsciiStringInteger;
typedef NCollection_DataMap<TCollection_AsciiString,Standard_Integer>::Iterator TColStd_DataMapIteratorOfDataMapOfAsciiStringInteger;
typedef NCollection_DataMap<TCollection_AsciiString, Standard_Integer>
TColStd_DataMapOfAsciiStringInteger;
typedef NCollection_DataMap<TCollection_AsciiString, Standard_Integer>::Iterator
TColStd_DataMapIteratorOfDataMapOfAsciiStringInteger;
#endif

View File

@@ -18,8 +18,8 @@
#include <Standard_Integer.hxx>
#include <NCollection_DataMap.hxx>
typedef NCollection_DataMap<Standard_Integer,Standard_Integer> TColStd_DataMapOfIntegerInteger;
typedef NCollection_DataMap<Standard_Integer,Standard_Integer>::Iterator TColStd_DataMapIteratorOfDataMapOfIntegerInteger;
typedef NCollection_DataMap<Standard_Integer, Standard_Integer> TColStd_DataMapOfIntegerInteger;
typedef NCollection_DataMap<Standard_Integer, Standard_Integer>::Iterator
TColStd_DataMapIteratorOfDataMapOfIntegerInteger;
#endif

View File

@@ -19,8 +19,9 @@
#include <TColStd_ListOfInteger.hxx>
#include <NCollection_DataMap.hxx>
typedef NCollection_DataMap<Standard_Integer,TColStd_ListOfInteger> TColStd_DataMapOfIntegerListOfInteger;
typedef NCollection_DataMap<Standard_Integer,TColStd_ListOfInteger>::Iterator TColStd_DataMapIteratorOfDataMapOfIntegerListOfInteger;
typedef NCollection_DataMap<Standard_Integer, TColStd_ListOfInteger>
TColStd_DataMapOfIntegerListOfInteger;
typedef NCollection_DataMap<Standard_Integer, TColStd_ListOfInteger>::Iterator
TColStd_DataMapIteratorOfDataMapOfIntegerListOfInteger;
#endif

View File

@@ -18,8 +18,8 @@
#include <Standard_Integer.hxx>
#include <NCollection_DataMap.hxx>
typedef NCollection_DataMap<Standard_Integer,Standard_Real> TColStd_DataMapOfIntegerReal;
typedef NCollection_DataMap<Standard_Integer,Standard_Real>::Iterator TColStd_DataMapIteratorOfDataMapOfIntegerReal;
typedef NCollection_DataMap<Standard_Integer, Standard_Real> TColStd_DataMapOfIntegerReal;
typedef NCollection_DataMap<Standard_Integer, Standard_Real>::Iterator
TColStd_DataMapIteratorOfDataMapOfIntegerReal;
#endif

View File

@@ -19,8 +19,9 @@
#include <Standard_Transient.hxx>
#include <NCollection_DataMap.hxx>
typedef NCollection_DataMap<Standard_Integer,Handle(Standard_Transient)> TColStd_DataMapOfIntegerTransient;
typedef NCollection_DataMap<Standard_Integer,Handle(Standard_Transient)>::Iterator TColStd_DataMapIteratorOfDataMapOfIntegerTransient;
typedef NCollection_DataMap<Standard_Integer, Handle(Standard_Transient)>
TColStd_DataMapOfIntegerTransient;
typedef NCollection_DataMap<Standard_Integer, Handle(Standard_Transient)>::Iterator
TColStd_DataMapIteratorOfDataMapOfIntegerTransient;
#endif

View File

@@ -18,8 +18,9 @@
#include <TCollection_ExtendedString.hxx>
#include <NCollection_DataMap.hxx>
typedef NCollection_DataMap<TCollection_ExtendedString,Standard_Integer> TColStd_DataMapOfStringInteger;
typedef NCollection_DataMap<TCollection_ExtendedString,Standard_Integer>::Iterator TColStd_DataMapIteratorOfDataMapOfStringInteger;
typedef NCollection_DataMap<TCollection_ExtendedString, Standard_Integer>
TColStd_DataMapOfStringInteger;
typedef NCollection_DataMap<TCollection_ExtendedString, Standard_Integer>::Iterator
TColStd_DataMapIteratorOfDataMapOfStringInteger;
#endif

View File

@@ -18,8 +18,9 @@
#include <Standard_Transient.hxx>
#include <NCollection_DataMap.hxx>
typedef NCollection_DataMap<Handle(Standard_Transient),Handle(Standard_Transient)> TColStd_DataMapOfTransientTransient;
typedef NCollection_DataMap<Handle(Standard_Transient),Handle(Standard_Transient)>::Iterator TColStd_DataMapIteratorOfDataMapOfTransientTransient;
typedef NCollection_DataMap<Handle(Standard_Transient), Handle(Standard_Transient)>
TColStd_DataMapOfTransientTransient;
typedef NCollection_DataMap<Handle(Standard_Transient), Handle(Standard_Transient)>::Iterator
TColStd_DataMapIteratorOfDataMapOfTransientTransient;
#endif

View File

@@ -21,5 +21,4 @@
DEFINE_HARRAY1(TColStd_HArray1OfAsciiString, TColStd_Array1OfAsciiString)
#endif

View File

@@ -20,5 +20,4 @@
DEFINE_HARRAY1(TColStd_HArray1OfBoolean, TColStd_Array1OfBoolean)
#endif

View File

@@ -20,5 +20,4 @@
DEFINE_HARRAY1(TColStd_HArray1OfByte, TColStd_Array1OfByte)
#endif

View File

@@ -21,5 +21,4 @@
DEFINE_HARRAY1(TColStd_HArray1OfCharacter, TColStd_Array1OfCharacter)
#endif

View File

@@ -21,5 +21,4 @@
DEFINE_HARRAY1(TColStd_HArray1OfExtendedString, TColStd_Array1OfExtendedString)
#endif

View File

@@ -21,5 +21,4 @@
DEFINE_HARRAY1(TColStd_HArray1OfInteger, TColStd_Array1OfInteger)
#endif

View File

@@ -20,5 +20,4 @@
DEFINE_HARRAY1(TColStd_HArray1OfListOfInteger, TColStd_Array1OfListOfInteger)
#endif

View File

@@ -20,5 +20,4 @@
DEFINE_HARRAY1(TColStd_HArray1OfReal, TColStd_Array1OfReal)
#endif

View File

@@ -21,5 +21,4 @@
DEFINE_HARRAY1(TColStd_HArray1OfTransient, TColStd_Array1OfTransient)
#endif

View File

@@ -21,5 +21,4 @@
DEFINE_HARRAY2(TColStd_HArray2OfBoolean, TColStd_Array2OfBoolean)
#endif

View File

@@ -21,5 +21,4 @@
DEFINE_HARRAY2(TColStd_HArray2OfCharacter, TColStd_Array2OfCharacter)
#endif

View File

@@ -21,5 +21,4 @@
DEFINE_HARRAY2(TColStd_HArray2OfInteger, TColStd_Array2OfInteger)
#endif

View File

@@ -20,5 +20,4 @@
DEFINE_HARRAY2(TColStd_HArray2OfReal, TColStd_Array2OfReal)
#endif

View File

@@ -21,5 +21,4 @@
DEFINE_HARRAY2(TColStd_HArray2OfTransient, TColStd_Array2OfTransient)
#endif

View File

@@ -13,21 +13,18 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <TColStd_HPackedMapOfInteger.hxx>
IMPLEMENT_STANDARD_RTTIEXT(TColStd_HPackedMapOfInteger,Standard_Transient)
IMPLEMENT_STANDARD_RTTIEXT(TColStd_HPackedMapOfInteger, Standard_Transient)
//! Constructor of empty map
TColStd_HPackedMapOfInteger::TColStd_HPackedMapOfInteger (const Standard_Integer NbBuckets)
TColStd_HPackedMapOfInteger::TColStd_HPackedMapOfInteger(const Standard_Integer NbBuckets)
{
myMap.ReSize(NbBuckets);
}
//! Constructor from already existing map; performs copying
TColStd_HPackedMapOfInteger::TColStd_HPackedMapOfInteger (const TColStd_PackedMapOfInteger &theOther)
{
myMap.Assign ( theOther );
TColStd_HPackedMapOfInteger::TColStd_HPackedMapOfInteger(const TColStd_PackedMapOfInteger& theOther)
{
myMap.Assign(theOther);
}

View File

@@ -22,7 +22,6 @@
#include <Standard_Transient.hxx>
#include <Standard_Integer.hxx>
class TColStd_HPackedMapOfInteger;
DEFINE_STANDARD_HANDLE(TColStd_HPackedMapOfInteger, Standard_Transient)
@@ -31,39 +30,21 @@ class TColStd_HPackedMapOfInteger : public Standard_Transient
{
public:
Standard_EXPORT TColStd_HPackedMapOfInteger(const Standard_Integer NbBuckets = 1);
Standard_EXPORT TColStd_HPackedMapOfInteger(const TColStd_PackedMapOfInteger& theOther);
const TColStd_PackedMapOfInteger& Map() const;
TColStd_PackedMapOfInteger& ChangeMap();
const TColStd_PackedMapOfInteger& Map() const;
TColStd_PackedMapOfInteger& ChangeMap();
DEFINE_STANDARD_RTTIEXT(TColStd_HPackedMapOfInteger,Standard_Transient)
DEFINE_STANDARD_RTTIEXT(TColStd_HPackedMapOfInteger, Standard_Transient)
protected:
private:
TColStd_PackedMapOfInteger myMap;
};
#include <TColStd_HPackedMapOfInteger.lxx>
#endif // _TColStd_HPackedMapOfInteger_HeaderFile

View File

@@ -14,13 +14,13 @@
// commercial license or contractual agreement.
//! Access to the map
inline const TColStd_PackedMapOfInteger& TColStd_HPackedMapOfInteger::Map () const
{
return myMap;
inline const TColStd_PackedMapOfInteger& TColStd_HPackedMapOfInteger::Map() const
{
return myMap;
}
//! Access to the map for modification
inline TColStd_PackedMapOfInteger& TColStd_HPackedMapOfInteger::ChangeMap ()
{
return myMap;
inline TColStd_PackedMapOfInteger& TColStd_HPackedMapOfInteger::ChangeMap()
{
return myMap;
}

View File

@@ -21,5 +21,4 @@
DEFINE_HSEQUENCE(TColStd_HSequenceOfAsciiString, TColStd_SequenceOfAsciiString)
#endif

View File

@@ -21,5 +21,4 @@
DEFINE_HSEQUENCE(TColStd_HSequenceOfExtendedString, TColStd_SequenceOfExtendedString)
#endif

View File

@@ -20,5 +20,4 @@
DEFINE_HSEQUENCE(TColStd_HSequenceOfHAsciiString, TColStd_SequenceOfHAsciiString)
#endif

View File

@@ -20,5 +20,4 @@
DEFINE_HSEQUENCE(TColStd_HSequenceOfHExtendedString, TColStd_SequenceOfHExtendedString)
#endif

View File

@@ -21,5 +21,4 @@
DEFINE_HSEQUENCE(TColStd_HSequenceOfInteger, TColStd_SequenceOfInteger)
#endif

View File

@@ -20,5 +20,4 @@
DEFINE_HSEQUENCE(TColStd_HSequenceOfReal, TColStd_SequenceOfReal)
#endif

View File

@@ -21,5 +21,4 @@
DEFINE_HSEQUENCE(TColStd_HSequenceOfTransient, TColStd_SequenceOfTransient)
#endif

View File

@@ -17,6 +17,7 @@
#include <TCollection_AsciiString.hxx>
#include <NCollection_IndexedDataMap.hxx>
typedef NCollection_IndexedDataMap<TCollection_AsciiString,TCollection_AsciiString> TColStd_IndexedDataMapOfStringString;
typedef NCollection_IndexedDataMap<TCollection_AsciiString, TCollection_AsciiString>
TColStd_IndexedDataMapOfStringString;
#endif // TColStd_IndexedDataMapOfStringString_HeaderFile

View File

@@ -18,7 +18,7 @@
#include <Standard_Transient.hxx>
#include <NCollection_IndexedDataMap.hxx>
typedef NCollection_IndexedDataMap<Handle(Standard_Transient),Handle(Standard_Transient)> TColStd_IndexedDataMapOfTransientTransient;
typedef NCollection_IndexedDataMap<Handle(Standard_Transient), Handle(Standard_Transient)>
TColStd_IndexedDataMapOfTransientTransient;
#endif

View File

@@ -20,5 +20,4 @@
typedef NCollection_IndexedMap<Standard_Integer> TColStd_IndexedMapOfInteger;
#endif

View File

@@ -19,5 +19,4 @@
typedef NCollection_IndexedMap<Standard_Real> TColStd_IndexedMapOfReal;
#endif

View File

@@ -20,5 +20,4 @@
typedef NCollection_IndexedMap<Handle(Standard_Transient)> TColStd_IndexedMapOfTransient;
#endif

View File

@@ -11,7 +11,6 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef TColStd_ListIteratorOfListOfAsciiString_HeaderFile
#define TColStd_ListIteratorOfListOfAsciiString_HeaderFile

View File

@@ -11,7 +11,6 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef TColStd_ListIteratorOfListOfInteger_HeaderFile
#define TColStd_ListIteratorOfListOfInteger_HeaderFile

View File

@@ -11,7 +11,6 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef TColStd_ListIteratorOfListOfReal_HeaderFile
#define TColStd_ListIteratorOfListOfReal_HeaderFile

View File

@@ -11,7 +11,6 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef TColStd_ListIteratorOfListOfTransient_HeaderFile
#define TColStd_ListIteratorOfListOfTransient_HeaderFile

View File

@@ -18,8 +18,7 @@
#include <TCollection_AsciiString.hxx>
#include <NCollection_List.hxx>
typedef NCollection_List<TCollection_AsciiString> TColStd_ListOfAsciiString;
typedef NCollection_List<TCollection_AsciiString> TColStd_ListOfAsciiString;
typedef NCollection_List<TCollection_AsciiString>::Iterator TColStd_ListIteratorOfListOfAsciiString;
#endif

View File

@@ -18,8 +18,7 @@
#include <Standard_Integer.hxx>
#include <NCollection_List.hxx>
typedef NCollection_List<Standard_Integer> TColStd_ListOfInteger;
typedef NCollection_List<Standard_Integer> TColStd_ListOfInteger;
typedef NCollection_List<Standard_Integer>::Iterator TColStd_ListIteratorOfListOfInteger;
#endif

View File

@@ -17,8 +17,7 @@
#include <NCollection_List.hxx>
typedef NCollection_List<Standard_Real> TColStd_ListOfReal;
typedef NCollection_List<Standard_Real> TColStd_ListOfReal;
typedef NCollection_List<Standard_Real>::Iterator TColStd_ListIteratorOfListOfReal;
#endif

View File

@@ -19,7 +19,7 @@
#include <NCollection_List.hxx>
typedef NCollection_List<Handle(Standard_Transient)> TColStd_ListOfTransient;
typedef NCollection_List<Handle(Standard_Transient)>::Iterator TColStd_ListIteratorOfListOfTransient;
typedef NCollection_List<Handle(Standard_Transient)>::Iterator
TColStd_ListIteratorOfListOfTransient;
#endif

View File

@@ -11,7 +11,6 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef TColStd_MapIteratorOfMapOfAsciiString_HeaderFile
#define TColStd_MapIteratorOfMapOfAsciiString_HeaderFile

View File

@@ -11,7 +11,6 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef TColStd_MapIteratorOfMapOfInteger_HeaderFile
#define TColStd_MapIteratorOfMapOfInteger_HeaderFile

View File

@@ -11,7 +11,6 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef TColStd_MapIteratorOfMapOfReal_HeaderFile
#define TColStd_MapIteratorOfMapOfReal_HeaderFile

View File

@@ -11,7 +11,6 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef TColStd_MapIteratorOfMapOfTransient_HeaderFile
#define TColStd_MapIteratorOfMapOfTransient_HeaderFile

View File

@@ -18,8 +18,7 @@
#include <TCollection_AsciiString.hxx>
#include <NCollection_Map.hxx>
typedef NCollection_Map<TCollection_AsciiString> TColStd_MapOfAsciiString;
typedef NCollection_Map<TCollection_AsciiString> TColStd_MapOfAsciiString;
typedef NCollection_Map<TCollection_AsciiString>::Iterator TColStd_MapIteratorOfMapOfAsciiString;
#endif

View File

@@ -18,8 +18,7 @@
#include <Standard_Integer.hxx>
#include <NCollection_Map.hxx>
typedef NCollection_Map<Standard_Integer> TColStd_MapOfInteger;
typedef NCollection_Map<Standard_Integer> TColStd_MapOfInteger;
typedef NCollection_Map<Standard_Integer>::Iterator TColStd_MapIteratorOfMapOfInteger;
#endif

View File

@@ -17,8 +17,7 @@
#include <NCollection_Map.hxx>
typedef NCollection_Map<Standard_Real> TColStd_MapOfReal;
typedef NCollection_Map<Standard_Real> TColStd_MapOfReal;
typedef NCollection_Map<Standard_Real>::Iterator TColStd_MapIteratorOfMapOfReal;
#endif

View File

@@ -18,8 +18,7 @@
#include <Standard_Transient.hxx>
#include <NCollection_Map.hxx>
typedef NCollection_Map<Handle(Standard_Transient)> TColStd_MapOfTransient;
typedef NCollection_Map<Handle(Standard_Transient)> TColStd_MapOfTransient;
typedef NCollection_Map<Handle(Standard_Transient)>::Iterator TColStd_MapIteratorOfMapOfTransient;
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -33,7 +33,6 @@ public:
DEFINE_STANDARD_ALLOC
private:
//! 5 lower bits
static const unsigned int MASK_LOW = 0x001f;
@@ -44,23 +43,32 @@ private:
//! 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.
//! - 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:
TColStd_intMapNode (TColStd_intMapNode* thePtr = NULL)
: myNext (thePtr), myMask (0), myData (0) {}
TColStd_intMapNode(TColStd_intMapNode* thePtr = NULL)
: myNext(thePtr),
myMask(0),
myData(0)
{
}
TColStd_intMapNode (Standard_Integer theValue, TColStd_intMapNode*& thePtr)
: myNext (thePtr),
myMask ((unsigned int) (theValue & MASK_HIGH)),
myData (1 << (theValue & MASK_LOW)) {}
TColStd_intMapNode(Standard_Integer theValue, TColStd_intMapNode*& thePtr)
: myNext(thePtr),
myMask((unsigned int)(theValue & MASK_HIGH)),
myData(1 << (theValue & MASK_LOW))
{
}
TColStd_intMapNode (unsigned int theMask, unsigned int theData, TColStd_intMapNode* thePtr)
: myNext (thePtr),
myMask (theMask),
myData (theData) {}
TColStd_intMapNode(unsigned int theMask, unsigned int theData, TColStd_intMapNode* thePtr)
: myNext(thePtr),
myMask(theMask),
myData(theData)
{
}
unsigned int Mask() const { return myMask; }
@@ -71,7 +79,7 @@ private:
unsigned int& ChangeData() { return myData; }
//! Compute the sequential index of this packed node in the map.
Standard_Integer Key() const { return Standard_Integer (myMask & MASK_HIGH); }
Standard_Integer Key() const { return Standard_Integer(myMask & MASK_HIGH); }
//! Return the number of set integer keys.
size_t NbValues() const { return size_t(myMask & MASK_LOW) + 1; }
@@ -80,11 +88,14 @@ private:
Standard_Boolean HasValues() const { return (myData != 0); }
//! Return TRUE if the given integer key is set within this packed node.
Standard_Integer HasValue (Standard_Integer theValue) const { return (myData & (1 << (theValue & MASK_LOW))); }
Standard_Integer HasValue(Standard_Integer theValue) const
{
return (myData & (1 << (theValue & MASK_LOW)));
}
//! Add integer key to this packed node.
//! @return TRUE if key has been added
Standard_Boolean AddValue (Standard_Integer theValue)
Standard_Boolean AddValue(Standard_Integer theValue)
{
const Standard_Integer aValInt = (1 << (theValue & MASK_LOW));
if ((myData & aValInt) == 0)
@@ -98,7 +109,7 @@ private:
//! Delete integer key from this packed node.
//! @return TRUE if key has been deleted
Standard_Boolean DelValue (Standard_Integer theValue)
Standard_Boolean DelValue(Standard_Integer theValue)
{
const Standard_Integer aValInt = (1 << (theValue & MASK_LOW));
if ((myData & aValInt) != 0)
@@ -112,89 +123,90 @@ private:
//! Find the smallest non-zero bit under the given mask. Outputs the new mask
//! that does not contain the detected bit.
Standard_Integer FindNext (unsigned int& theMask) const;
Standard_Integer FindNext(unsigned int& theMask) const;
//! Return the next node having the same hash code.
TColStd_intMapNode* Next() const { return myNext; }
//! Set the next node having the same hash code.
void SetNext (TColStd_intMapNode* theNext) { myNext = theNext; }
void SetNext(TColStd_intMapNode* theNext) { myNext = theNext; }
public:
//! Support of Map interface.
Standard_Integer HashCode (Standard_Integer theUpper) const
Standard_Integer HashCode(Standard_Integer theUpper) const
{
return (myMask >> 5) % theUpper + 1;
}
//! Support of Map interface.
Standard_Boolean IsEqual (Standard_Integer theOther) const
Standard_Boolean IsEqual(Standard_Integer theOther) const
{
return ((myMask >> 5) == (unsigned)theOther);
}
private:
TColStd_intMapNode* myNext;
unsigned int myMask;
unsigned int myData;
unsigned int myMask;
unsigned int myData;
};
public:
//! Iterator of class TColStd_PackedMapOfInteger.
class Iterator
{
public:
/// Empty Constructor.
Iterator()
: myBuckets (NULL),
myNode (NULL),
myNbBuckets (-1),
myBucket (-1),
myIntMask (~0U),
myKey (0) {}
: myBuckets(NULL),
myNode(NULL),
myNbBuckets(-1),
myBucket(-1),
myIntMask(~0U),
myKey(0)
{
}
/// Constructor.
Iterator (const TColStd_PackedMapOfInteger& theMap)
: myBuckets (theMap.myData1),
myNode (NULL),
myNbBuckets (theMap.myData1 != NULL ? theMap.myNbBuckets : -1),
myBucket (-1),
myIntMask (~0U)
Iterator(const TColStd_PackedMapOfInteger& theMap)
: myBuckets(theMap.myData1),
myNode(NULL),
myNbBuckets(theMap.myData1 != NULL ? theMap.myNbBuckets : -1),
myBucket(-1),
myIntMask(~0U)
{
next();
myKey = myNode != NULL ? TColStd_intMapNode_findNext (myNode, myIntMask) : 0;
myKey = myNode != NULL ? TColStd_intMapNode_findNext(myNode, myIntMask) : 0;
}
//! Re-initialize with the same or another Map instance.
void Initialize (const TColStd_PackedMapOfInteger& theMap)
void Initialize(const TColStd_PackedMapOfInteger& theMap)
{
myBuckets = theMap.myData1;
myBucket = -1;
myNode = NULL;
myBuckets = theMap.myData1;
myBucket = -1;
myNode = NULL;
myNbBuckets = theMap.myData1 != NULL ? theMap.myNbBuckets : -1;
next();
myIntMask = ~0U;
myKey = myNode != NULL ? TColStd_intMapNode_findNext (myNode, myIntMask) : 0;
myKey = myNode != NULL ? TColStd_intMapNode_findNext(myNode, myIntMask) : 0;
}
//! Restart the iteration
void Reset()
{
myBucket = -1;
myNode = NULL;
myNode = NULL;
next();
myIntMask = ~0U;
myKey = myNode != NULL ? TColStd_intMapNode_findNext (myNode, myIntMask) : 0;
myKey = myNode != NULL ? TColStd_intMapNode_findNext(myNode, myIntMask) : 0;
}
//! Query the iterated key.
Standard_Integer Key() const
{
Standard_NoSuchObject_Raise_if ((myIntMask == ~0U), "TColStd_MapIteratorOfPackedMapOfInteger::Key");
Standard_NoSuchObject_Raise_if((myIntMask == ~0U),
"TColStd_MapIteratorOfPackedMapOfInteger::Key");
return myKey;
}
@@ -206,13 +218,14 @@ public:
{
for (; myNode != NULL; next())
{
myKey = TColStd_intMapNode_findNext (myNode, myIntMask);
myKey = TColStd_intMapNode_findNext(myNode, myIntMask);
if (myIntMask != ~0u)
{
break;
}
}
}
private:
//! Go to the next bucket in the map.
void next()
@@ -241,53 +254,54 @@ public:
private:
TColStd_intMapNode** myBuckets;
TColStd_intMapNode* myNode;
Standard_Integer myNbBuckets;
Standard_Integer myBucket;
Standard_Integer myNbBuckets;
Standard_Integer myBucket;
unsigned int myIntMask; //!< all bits set above the iterated position
Standard_Integer myKey; //!< Currently iterated key
};
public:
//! Constructor
TColStd_PackedMapOfInteger (const Standard_Integer theNbBuckets = 1)
: myData1 (NULL),
myNbBuckets (theNbBuckets),
myNbPackedMapNodes (0),
myExtent (0) {}
//! Copy constructor
TColStd_PackedMapOfInteger (const TColStd_PackedMapOfInteger& theOther)
: myData1 (NULL),
myNbBuckets (1),
myNbPackedMapNodes (0),
myExtent (0)
TColStd_PackedMapOfInteger(const Standard_Integer theNbBuckets = 1)
: myData1(NULL),
myNbBuckets(theNbBuckets),
myNbPackedMapNodes(0),
myExtent(0)
{
Assign (theOther);
}
inline TColStd_PackedMapOfInteger&
operator = (const TColStd_PackedMapOfInteger& Other)
{ return Assign(Other); }
//! Copy constructor
TColStd_PackedMapOfInteger(const TColStd_PackedMapOfInteger& theOther)
: myData1(NULL),
myNbBuckets(1),
myNbPackedMapNodes(0),
myExtent(0)
{
Assign(theOther);
}
inline TColStd_PackedMapOfInteger& operator=(const TColStd_PackedMapOfInteger& Other)
{
return Assign(Other);
}
Standard_EXPORT TColStd_PackedMapOfInteger& Assign(const TColStd_PackedMapOfInteger&);
Standard_EXPORT void ReSize(const Standard_Integer NbBuckets);
Standard_EXPORT void Clear();
Standard_EXPORT TColStd_PackedMapOfInteger&
Assign (const TColStd_PackedMapOfInteger&);
Standard_EXPORT void ReSize (const Standard_Integer NbBuckets);
Standard_EXPORT void Clear ();
~TColStd_PackedMapOfInteger() { Clear(); }
Standard_EXPORT Standard_Boolean
Add (const Standard_Integer aKey);
Standard_EXPORT Standard_Boolean
Contains (const Standard_Integer aKey) const;
Standard_EXPORT Standard_Boolean
Remove (const Standard_Integer aKey);
//! Returns the number of map buckets (not that since integers are packed in this map, the number is smaller than extent).
Standard_EXPORT Standard_Boolean Add(const Standard_Integer aKey);
Standard_EXPORT Standard_Boolean Contains(const Standard_Integer aKey) const;
Standard_EXPORT Standard_Boolean Remove(const Standard_Integer aKey);
//! Returns the number of map buckets (not that since integers are packed in this map, the number
//! is smaller than extent).
Standard_Integer NbBuckets() const { return myNbBuckets; }
//! Returns map extent.
Standard_Integer Extent() const { return Standard_Integer (myExtent); }
Standard_Integer Extent() const { return Standard_Integer(myExtent); }
//! Returns TRUE if map is empty.
Standard_Boolean IsEmpty() const { return myNbPackedMapNodes == 0; }
@@ -295,187 +309,200 @@ public:
/**
* Query the minimal contained key value.
*/
Standard_EXPORT Standard_Integer GetMinimalMapped () const;
Standard_EXPORT Standard_Integer GetMinimalMapped() const;
/**
* Query the maximal contained key value.
*/
Standard_EXPORT Standard_Integer GetMaximalMapped () const;
Standard_EXPORT Standard_Integer GetMaximalMapped() const;
//! Prints useful statistics about the map.
//! It can be used to test the quality of the hashcoding.
Standard_EXPORT void Statistics (Standard_OStream& theStream) const;
Standard_EXPORT void Statistics(Standard_OStream& theStream) const;
public:
//!@name Boolean operations with maps as sets of integers
//!@{
/**
* Sets this Map to be the result of union (aka addition, fuse, merge, boolean OR) operation between two given Maps.
* The new Map contains the values that are contained either in the first map or in the second map or in both.
* All previous contents of this Map is cleared. This map (result of the boolean operation) can also be passed as one of operands.
* Sets this Map to be the result of union (aka addition, fuse, merge, boolean OR) operation
* between two given Maps. The new Map contains the values that are contained either in the first
* map or in the second map or in both. All previous contents of this Map is cleared. This map
* (result of the boolean operation) can also be passed as one of operands.
*/
Standard_EXPORT void Union (const TColStd_PackedMapOfInteger&,
const TColStd_PackedMapOfInteger&);
Standard_EXPORT void Union(const TColStd_PackedMapOfInteger&, const TColStd_PackedMapOfInteger&);
/**
* Apply to this Map the boolean operation union (aka addition, fuse, merge, boolean OR) with another (given) Map.
* The result contains the values that were previously contained in this map or contained in the given (operand) map.
* This algorithm is similar to method Union().
* Apply to this Map the boolean operation union (aka addition, fuse, merge, boolean OR) with
* another (given) Map. The result contains the values that were previously contained in this map
* or contained in the given (operand) map. This algorithm is similar to method Union().
* @return True if content of this map is changed
*/
Standard_EXPORT Standard_Boolean Unite (const TColStd_PackedMapOfInteger&);
Standard_EXPORT Standard_Boolean Unite(const TColStd_PackedMapOfInteger&);
/**
* Overloaded operator version of Unite().
*/
TColStd_PackedMapOfInteger& operator |= (const TColStd_PackedMapOfInteger& MM)
{ Unite(MM); return *this; }
TColStd_PackedMapOfInteger& operator|=(const TColStd_PackedMapOfInteger& MM)
{
Unite(MM);
return *this;
}
/**
* Sets this Map to be the result of intersection (aka multiplication, common, boolean AND) operation between two given Maps.
* The new Map contains only the values that are contained in both map operands.
* All previous contents of this Map is cleared. This same map (result of the boolean operation) can also be used as one of operands.
* The order of operands makes no difference; the method minimizes internally the number of iterations using the smallest map for the loop.
* Sets this Map to be the result of intersection (aka multiplication, common, boolean AND)
* operation between two given Maps. The new Map contains only the values that are contained in
* both map operands. All previous contents of this Map is cleared. This same map (result of the
* boolean operation) can also be used as one of operands. The order of operands makes no
* difference; the method minimizes internally the number of iterations using the smallest map for
* the loop.
*/
Standard_EXPORT void Intersection (const TColStd_PackedMapOfInteger&,
const TColStd_PackedMapOfInteger&);
Standard_EXPORT void Intersection(const TColStd_PackedMapOfInteger&,
const TColStd_PackedMapOfInteger&);
/**
* Apply to this Map the intersection operation (aka multiplication, common, boolean AND) with another (given) Map.
* The result contains only the values that are contained in both this and the given maps.
* This algorithm is similar to method Intersection().
* Apply to this Map the intersection operation (aka multiplication, common, boolean AND) with
* another (given) Map. The result contains only the values that are contained in both this and
* the given maps. This algorithm is similar to method Intersection().
* @return True if content of this map is changed
*/
Standard_EXPORT Standard_Boolean Intersect (const TColStd_PackedMapOfInteger&);
Standard_EXPORT Standard_Boolean Intersect(const TColStd_PackedMapOfInteger&);
/**
* Overloaded operator version of Intersect().
*/
TColStd_PackedMapOfInteger& operator &= (const TColStd_PackedMapOfInteger& MM)
{ Intersect(MM); return *this; }
TColStd_PackedMapOfInteger& operator&=(const TColStd_PackedMapOfInteger& MM)
{
Intersect(MM);
return *this;
}
/**
* Sets this Map to be the result of subtraction
* (aka set-theoretic difference, relative complement, exclude, cut, boolean NOT) operation between two given Maps.
* The new Map contains only the values that are contained in the first map operands and not contained in the second one.
* All previous contents of this Map is cleared.
* (aka set-theoretic difference, relative complement, exclude, cut, boolean NOT) operation
* between two given Maps. The new Map contains only the values that are contained in the first
* map operands and not contained in the second one. All previous contents of this Map is cleared.
* This map (result of the boolean operation) can also be used as the first operand.
*/
Standard_EXPORT void Subtraction (const TColStd_PackedMapOfInteger&,
const TColStd_PackedMapOfInteger&);
Standard_EXPORT void Subtraction(const TColStd_PackedMapOfInteger&,
const TColStd_PackedMapOfInteger&);
/**
* Apply to this Map the subtraction (aka set-theoretic difference, relative complement, exclude, cut, boolean NOT) operation with another (given) Map.
* The result contains only the values that were previously contained in this map and not contained in this map.
* This algorithm is similar to method Subtract() with two operands.
* Apply to this Map the subtraction (aka set-theoretic difference, relative complement, exclude,
* cut, boolean NOT) operation with another (given) Map. The result contains only the values that
* were previously contained in this map and not contained in this map. This algorithm is similar
* to method Subtract() with two operands.
* @return True if contents of this map is changed
*/
Standard_EXPORT Standard_Boolean Subtract (const TColStd_PackedMapOfInteger&);
Standard_EXPORT Standard_Boolean Subtract(const TColStd_PackedMapOfInteger&);
/**
* Overloaded operator version of Subtract().
*/
TColStd_PackedMapOfInteger& operator -= (const TColStd_PackedMapOfInteger& MM)
{ Subtract(MM); return *this; }
TColStd_PackedMapOfInteger& operator-=(const TColStd_PackedMapOfInteger& MM)
{
Subtract(MM);
return *this;
}
/**
* Sets this Map to be the result of symmetric difference (aka exclusive disjunction, boolean XOR) operation between two given Maps.
* The new Map contains the values that are contained only in the first or the second operand maps but not in both.
* All previous contents of this Map is cleared.
* This map (result of the boolean operation) can also be used as one of operands.
* Sets this Map to be the result of symmetric difference (aka exclusive disjunction, boolean XOR)
* operation between two given Maps. The new Map contains the values that are contained only in
* the first or the second operand maps but not in both. All previous contents of this Map is
* cleared. This map (result of the boolean operation) can also be used as one of operands.
*/
Standard_EXPORT void Difference (const TColStd_PackedMapOfInteger&,
const TColStd_PackedMapOfInteger&);
Standard_EXPORT void Difference(const TColStd_PackedMapOfInteger&,
const TColStd_PackedMapOfInteger&);
/**
* Apply to this Map the symmetric difference (aka exclusive disjunction, boolean XOR) operation with another (given) Map.
* The result contains the values that are contained only in this or the operand map, but not in both.
* This algorithm is similar to method Difference().
* Apply to this Map the symmetric difference (aka exclusive disjunction, boolean XOR) operation
* with another (given) Map. The result contains the values that are contained only in this or the
* operand map, but not in both. This algorithm is similar to method Difference().
* @return True if contents of this map is changed
*/
Standard_EXPORT Standard_Boolean Differ (const TColStd_PackedMapOfInteger&);
Standard_EXPORT Standard_Boolean Differ(const TColStd_PackedMapOfInteger&);
/**
* Overloaded operator version of Differ().
*/
TColStd_PackedMapOfInteger& operator ^= (const TColStd_PackedMapOfInteger& MM)
{ Differ(MM); return *this; }
TColStd_PackedMapOfInteger& operator^=(const TColStd_PackedMapOfInteger& MM)
{
Differ(MM);
return *this;
}
/**
* Returns True if this map is equal to the given one, i.e. they contain the
* same sets of elements
*/
Standard_EXPORT Standard_Boolean IsEqual (const TColStd_PackedMapOfInteger&) const;
Standard_EXPORT Standard_Boolean IsEqual(const TColStd_PackedMapOfInteger&) const;
/**
* Overloaded operator version of IsEqual().
*/
Standard_Boolean operator == (const TColStd_PackedMapOfInteger& MM) const
{ return IsEqual(MM); }
Standard_Boolean operator==(const TColStd_PackedMapOfInteger& MM) const { return IsEqual(MM); }
/**
* Returns True if this map is subset of the given one, i.e. all elements
* Returns True if this map is subset of the given one, i.e. all elements
* contained in this map is contained also in the operand map.
* if this map is empty that this method returns true for any operand map.
*/
Standard_EXPORT Standard_Boolean IsSubset (const TColStd_PackedMapOfInteger&) const;
Standard_EXPORT Standard_Boolean IsSubset(const TColStd_PackedMapOfInteger&) const;
/**
* Overloaded operator version of IsSubset().
*/
Standard_Boolean operator <= (const TColStd_PackedMapOfInteger& MM) const
{ return IsSubset(MM); }
Standard_Boolean operator<=(const TColStd_PackedMapOfInteger& MM) const { return IsSubset(MM); }
/**
* Returns True if this map has common items with the given one.
*/
Standard_EXPORT Standard_Boolean HasIntersection (const TColStd_PackedMapOfInteger&) const;
Standard_EXPORT Standard_Boolean HasIntersection(const TColStd_PackedMapOfInteger&) const;
//!@}
protected:
//! Returns TRUE if resizing the map should be considered.
Standard_Boolean Resizable() const { return IsEmpty() || (myNbPackedMapNodes > myNbBuckets); }
protected:
//! Returns TRUE if resizing the map should be considered.
Standard_Boolean Resizable() const { return IsEmpty() || (myNbPackedMapNodes > myNbBuckets); }
//! Return an integer index for specified key.
static Standard_Integer packedKeyIndex (Standard_Integer theKey) { return (unsigned)theKey >> 5; }
//! Return an integer index for specified key.
static Standard_Integer packedKeyIndex(Standard_Integer theKey) { return (unsigned)theKey >> 5; }
private:
//! Find the smallest non-zero bit under the given mask.
//! Outputs the new mask that does not contain the detected bit.
Standard_EXPORT static Standard_Integer TColStd_intMapNode_findNext (const TColStd_intMapNode* theNode,
unsigned int& theMask);
Standard_EXPORT static Standard_Integer TColStd_intMapNode_findNext(
const TColStd_intMapNode* theNode,
unsigned int& theMask);
//! Find the highest non-zero bit under the given mask.
//! Outputs the new mask that does not contain the detected bit.
Standard_EXPORT static Standard_Integer TColStd_intMapNode_findPrev (const TColStd_intMapNode* theNode,
unsigned int& theMask);
Standard_EXPORT static Standard_Integer TColStd_intMapNode_findPrev(
const TColStd_intMapNode* theNode,
unsigned int& theMask);
//! Compute the population (i.e., the number of non-zero bits) of the 32-bit word theData.
//! The population is stored decremented as it is defined in TColStd_intMapNode.
//! Source: H.S.Warren, Hacker's Delight, Addison-Wesley Inc. 2002, Ch.5.1
static size_t TColStd_Population (unsigned int& theMask, unsigned int theData)
static size_t TColStd_Population(unsigned int& theMask, unsigned int theData)
{
unsigned int aRes = theData - ((theData>>1) & 0x55555555);
aRes = (aRes & 0x33333333) + ((aRes>>2) & 0x33333333);
aRes = (aRes + (aRes>>4)) & 0x0f0f0f0f;
aRes = aRes + (aRes>>8);
aRes = aRes + (aRes>>16);
theMask = (theMask & TColStd_PackedMapOfInteger::MASK_HIGH) | ((aRes - 1) & TColStd_PackedMapOfInteger::MASK_LOW);
unsigned int aRes = theData - ((theData >> 1) & 0x55555555);
aRes = (aRes & 0x33333333) + ((aRes >> 2) & 0x33333333);
aRes = (aRes + (aRes >> 4)) & 0x0f0f0f0f;
aRes = aRes + (aRes >> 8);
aRes = aRes + (aRes >> 16);
theMask = (theMask & TColStd_PackedMapOfInteger::MASK_HIGH)
| ((aRes - 1) & TColStd_PackedMapOfInteger::MASK_LOW);
return size_t(aRes & 0x3f);
}
private:
TColStd_intMapNode** myData1; //!< data array
Standard_Integer myNbBuckets; //!< number of buckets (size of data array)
Standard_Integer myNbPackedMapNodes; //!< amount of packed map nodes
// clang-format off
// clang-format off
Standard_Size myExtent; //!< extent of this map (number of unpacked integer keys)
// clang-format on
// clang-format on
};
#endif

View File

@@ -19,5 +19,4 @@
typedef NCollection_Sequence<Standard_Address> TColStd_SequenceOfAddress;
#endif

View File

@@ -20,5 +20,4 @@
typedef NCollection_Sequence<TCollection_AsciiString> TColStd_SequenceOfAsciiString;
#endif

View File

@@ -19,5 +19,4 @@
typedef NCollection_Sequence<Standard_Boolean> TColStd_SequenceOfBoolean;
#endif

View File

@@ -20,5 +20,4 @@
typedef NCollection_Sequence<TCollection_ExtendedString> TColStd_SequenceOfExtendedString;
#endif

View File

@@ -20,5 +20,4 @@
typedef NCollection_Sequence<Handle(TCollection_HAsciiString)> TColStd_SequenceOfHAsciiString;
#endif

View File

@@ -20,5 +20,4 @@
typedef NCollection_Sequence<Handle(TCollection_HExtendedString)> TColStd_SequenceOfHExtendedString;
#endif

View File

@@ -20,5 +20,4 @@
typedef NCollection_Sequence<Standard_Integer> TColStd_SequenceOfInteger;
#endif

View File

@@ -19,5 +19,4 @@
typedef NCollection_Sequence<Standard_Real> TColStd_SequenceOfReal;
#endif

View File

@@ -20,5 +20,4 @@
typedef NCollection_Sequence<Handle(Standard_Transient)> TColStd_SequenceOfTransient;
#endif