mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-14 13:30:48 +03:00
0033370: Foundation Classes - Moving into STL and Boost functionality
NCollection containers update: - NCollection_Array1 - updated functionality - NCollection_Array2 - NCollection_Array1 as a wrapper for 2array - NCollection_Vector -> NCollection_DynamicArray was renamed and reworked. TCollection: - Use static empty string to avoid allocations on empty string NCollection allocators update: - NCollection_Allocator - allocator that used Standard::Allocate - NCollection_OccAllocator - allocator-wrapper that used OCC BaseAllocator objects - NCollection_IncAllocator - rework to increase performance Standard: - Rework functionality to use different allocation libs - Implement basic of new way to wrap allocations tools - Define 4 ways to allocation (defines in configure stage) Additional changes: - Hash function uses std::hash functionality - size_t as a hash value - New HashUtils with Murmur and FVN hash algo for x32 and x64 - Deprecated _0.cxx and .gxx DE classes reorganized - Create own utility for std memory - Update Standard_Transient to be more platform-independent Math TK changes: - math_Vector -> match_BaseVector<> - Buffer decreased to cash 32 elements instead of 512
This commit is contained in:
@@ -82,7 +82,6 @@ TDF_LabelIndexedMap.hxx
|
||||
TDF_LabelIntegerMap.hxx
|
||||
TDF_LabelList.hxx
|
||||
TDF_LabelMap.hxx
|
||||
TDF_LabelMapHasher.hxx
|
||||
TDF_LabelNode.cxx
|
||||
TDF_LabelNode.hxx
|
||||
TDF_LabelNodePtr.hxx
|
||||
|
@@ -17,11 +17,10 @@
|
||||
#define TDF_AttributeDataMap_HeaderFile
|
||||
|
||||
#include <TDF_Attribute.hxx>
|
||||
#include <TColStd_MapTransientHasher.hxx>
|
||||
#include <NCollection_DataMap.hxx>
|
||||
|
||||
typedef NCollection_DataMap<Handle(TDF_Attribute),Handle(TDF_Attribute),TColStd_MapTransientHasher> TDF_AttributeDataMap;
|
||||
typedef NCollection_DataMap<Handle(TDF_Attribute),Handle(TDF_Attribute),TColStd_MapTransientHasher>::Iterator TDF_DataMapIteratorOfAttributeDataMap;
|
||||
typedef NCollection_DataMap<Handle(TDF_Attribute),Handle(TDF_Attribute)> TDF_AttributeDataMap;
|
||||
typedef NCollection_DataMap<Handle(TDF_Attribute),Handle(TDF_Attribute)>::Iterator TDF_DataMapIteratorOfAttributeDataMap;
|
||||
|
||||
|
||||
#endif
|
||||
|
@@ -18,11 +18,10 @@
|
||||
|
||||
#include <TDF_Attribute.hxx>
|
||||
#include <TDF_Attribute.hxx>
|
||||
#include <TColStd_MapTransientHasher.hxx>
|
||||
#include <NCollection_DoubleMap.hxx>
|
||||
|
||||
typedef NCollection_DoubleMap<Handle(TDF_Attribute),Handle(TDF_Attribute),TColStd_MapTransientHasher,TColStd_MapTransientHasher> TDF_AttributeDoubleMap;
|
||||
typedef NCollection_DoubleMap<Handle(TDF_Attribute),Handle(TDF_Attribute),TColStd_MapTransientHasher,TColStd_MapTransientHasher>::Iterator TDF_DoubleMapIteratorOfAttributeDoubleMap;
|
||||
typedef NCollection_DoubleMap<Handle(TDF_Attribute),Handle(TDF_Attribute)> TDF_AttributeDoubleMap;
|
||||
typedef NCollection_DoubleMap<Handle(TDF_Attribute),Handle(TDF_Attribute)>::Iterator TDF_DoubleMapIteratorOfAttributeDoubleMap;
|
||||
|
||||
|
||||
#endif
|
||||
|
@@ -16,11 +16,10 @@
|
||||
#ifndef TDF_AttributeIndexedMap_HeaderFile
|
||||
#define TDF_AttributeIndexedMap_HeaderFile
|
||||
|
||||
#include <TColStd_MapTransientHasher.hxx>
|
||||
#include <NCollection_IndexedMap.hxx>
|
||||
|
||||
class TDF_Attribute;
|
||||
typedef NCollection_IndexedMap<Handle(TDF_Attribute),TColStd_MapTransientHasher> TDF_AttributeIndexedMap;
|
||||
typedef NCollection_IndexedMap<Handle(TDF_Attribute)> TDF_AttributeIndexedMap;
|
||||
|
||||
|
||||
#endif
|
||||
|
@@ -17,11 +17,10 @@
|
||||
#define TDF_AttributeMap_HeaderFile
|
||||
|
||||
#include <TDF_Attribute.hxx>
|
||||
#include <TColStd_MapTransientHasher.hxx>
|
||||
#include <NCollection_Map.hxx>
|
||||
|
||||
typedef NCollection_Map<Handle(TDF_Attribute),TColStd_MapTransientHasher> TDF_AttributeMap;
|
||||
typedef NCollection_Map<Handle(TDF_Attribute),TColStd_MapTransientHasher>::Iterator TDF_MapIteratorOfAttributeMap;
|
||||
typedef NCollection_Map<Handle(TDF_Attribute)> TDF_AttributeMap;
|
||||
typedef NCollection_Map<Handle(TDF_Attribute)>::Iterator TDF_MapIteratorOfAttributeMap;
|
||||
|
||||
|
||||
#endif
|
||||
|
@@ -28,6 +28,7 @@
|
||||
#include <TDF_LabelMap.hxx>
|
||||
#include <TDF_ListIteratorOfLabelList.hxx>
|
||||
#include <TDF_RelocationTable.hxx>
|
||||
#include <Standard_TypeMismatch.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : Copy
|
||||
|
@@ -15,6 +15,7 @@
|
||||
|
||||
#include <NCollection_DataMap.hxx>
|
||||
#include <Standard_Mutex.hxx>
|
||||
#include <Standard_CStringHasher.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
|
||||
namespace TDF_DerivedAttributeGlobals
|
||||
@@ -35,16 +36,16 @@ namespace TDF_DerivedAttributeGlobals
|
||||
return THE_CREATORS_LIST;
|
||||
}
|
||||
//! Global map of the string-type of derived attribute -> instance of such attribute
|
||||
static NCollection_DataMap<Standard_CString, Handle(TDF_Attribute)>& Attributes()
|
||||
static NCollection_DataMap<Standard_CString, Handle(TDF_Attribute), Standard_CStringHasher>& Attributes()
|
||||
{
|
||||
static NCollection_DataMap<Standard_CString, Handle(TDF_Attribute)> THE_DERIVED;
|
||||
static NCollection_DataMap<Standard_CString, Handle(TDF_Attribute), Standard_CStringHasher> THE_DERIVED;
|
||||
return THE_DERIVED;
|
||||
}
|
||||
|
||||
//! Global map of the string-type of derived attribute -> type name to identify this attribute
|
||||
static NCollection_DataMap<Standard_CString, TCollection_AsciiString*>& Types()
|
||||
static NCollection_DataMap<Standard_CString, TCollection_AsciiString*, Standard_CStringHasher>& Types()
|
||||
{
|
||||
static NCollection_DataMap<Standard_CString, TCollection_AsciiString*> THE_DERIVED_TYPES;
|
||||
static NCollection_DataMap<Standard_CString, TCollection_AsciiString*, Standard_CStringHasher> THE_DERIVED_TYPES;
|
||||
return THE_DERIVED_TYPES;
|
||||
}
|
||||
|
||||
@@ -154,7 +155,7 @@ void TDF_DerivedAttribute::Attributes (NCollection_List<Handle(TDF_Attribute)>&
|
||||
{
|
||||
Standard_Mutex::Sentry aSentry (TDF_DerivedAttributeGlobals::Mutex());
|
||||
Initialize();
|
||||
NCollection_DataMap<Standard_CString, Handle(TDF_Attribute)>::Iterator anAttrIter;
|
||||
NCollection_DataMap<Standard_CString, Handle(TDF_Attribute), Standard_CStringHasher>::Iterator anAttrIter;
|
||||
for (anAttrIter.Initialize (TDF_DerivedAttributeGlobals::Attributes()); anAttrIter.More(); anAttrIter.Next())
|
||||
{
|
||||
theList.Append (anAttrIter.Value());
|
||||
|
@@ -20,8 +20,8 @@
|
||||
#include <TCollection_ExtendedString.hxx>
|
||||
#include <NCollection_DoubleMap.hxx>
|
||||
|
||||
typedef NCollection_DoubleMap<Standard_GUID,TCollection_ExtendedString,Standard_GUID,TCollection_ExtendedString> TDF_GUIDProgIDMap;
|
||||
typedef NCollection_DoubleMap<Standard_GUID,TCollection_ExtendedString,Standard_GUID,TCollection_ExtendedString>::Iterator TDF_DoubleMapIteratorOfGUIDProgIDMap;
|
||||
typedef NCollection_DoubleMap<Standard_GUID,TCollection_ExtendedString> TDF_GUIDProgIDMap;
|
||||
typedef NCollection_DoubleMap<Standard_GUID,TCollection_ExtendedString>::Iterator TDF_DoubleMapIteratorOfGUIDProgIDMap;
|
||||
|
||||
|
||||
#endif
|
||||
|
@@ -19,8 +19,8 @@
|
||||
#include <Standard_GUID.hxx>
|
||||
#include <NCollection_Map.hxx>
|
||||
|
||||
typedef NCollection_Map<Standard_GUID,Standard_GUID> TDF_IDMap;
|
||||
typedef NCollection_Map<Standard_GUID,Standard_GUID>::Iterator TDF_MapIteratorOfIDMap;
|
||||
typedef NCollection_Map<Standard_GUID> TDF_IDMap;
|
||||
typedef NCollection_Map<Standard_GUID>::Iterator TDF_MapIteratorOfIDMap;
|
||||
|
||||
|
||||
#endif
|
||||
|
@@ -259,8 +259,9 @@ friend class TDF_ChildIterator;
|
||||
friend class TDF_Attribute;
|
||||
friend class TDF_AttributeIterator;
|
||||
friend class TDF_Data;
|
||||
friend class TDF_LabelMapHasher;
|
||||
|
||||
template<class T>
|
||||
friend struct std::hash;
|
||||
|
||||
protected:
|
||||
|
||||
|
@@ -23,6 +23,18 @@
|
||||
#include <TDF_TagSource.hxx>
|
||||
#include <TDF_Data.hxx>
|
||||
|
||||
namespace std
|
||||
{
|
||||
template<>
|
||||
struct hash<TDF_Label>
|
||||
{
|
||||
size_t operator()(const TDF_Label& theNode) const
|
||||
{
|
||||
return std::hash<TDF_LabelNodePtr>{}(theNode.myLabelNode);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
inline TDF_Label::TDF_Label()
|
||||
:myLabelNode(NULL)
|
||||
{}
|
||||
|
@@ -17,11 +17,10 @@
|
||||
#define TDF_LabelDataMap_HeaderFile
|
||||
|
||||
#include <TDF_Label.hxx>
|
||||
#include <TDF_LabelMapHasher.hxx>
|
||||
#include <NCollection_DataMap.hxx>
|
||||
|
||||
typedef NCollection_DataMap<TDF_Label,TDF_Label,TDF_LabelMapHasher> TDF_LabelDataMap;
|
||||
typedef NCollection_DataMap<TDF_Label,TDF_Label,TDF_LabelMapHasher>::Iterator TDF_DataMapIteratorOfLabelDataMap;
|
||||
typedef NCollection_DataMap<TDF_Label,TDF_Label> TDF_LabelDataMap;
|
||||
typedef NCollection_DataMap<TDF_Label,TDF_Label>::Iterator TDF_DataMapIteratorOfLabelDataMap;
|
||||
|
||||
|
||||
#endif
|
||||
|
@@ -16,11 +16,11 @@
|
||||
#ifndef TDF_LabelDoubleMap_HeaderFile
|
||||
#define TDF_LabelDoubleMap_HeaderFile
|
||||
|
||||
#include <TDF_LabelMapHasher.hxx>
|
||||
#include <TDF_Label.hxx>
|
||||
#include <NCollection_DoubleMap.hxx>
|
||||
|
||||
typedef NCollection_DoubleMap<TDF_Label,TDF_Label,TDF_LabelMapHasher,TDF_LabelMapHasher> TDF_LabelDoubleMap;
|
||||
typedef NCollection_DoubleMap<TDF_Label,TDF_Label,TDF_LabelMapHasher,TDF_LabelMapHasher>::Iterator TDF_DoubleMapIteratorOfLabelDoubleMap;
|
||||
typedef NCollection_DoubleMap<TDF_Label,TDF_Label> TDF_LabelDoubleMap;
|
||||
typedef NCollection_DoubleMap<TDF_Label,TDF_Label>::Iterator TDF_DoubleMapIteratorOfLabelDoubleMap;
|
||||
|
||||
|
||||
#endif
|
||||
|
@@ -16,10 +16,9 @@
|
||||
#ifndef TDF_LabelIndexedMap_HeaderFile
|
||||
#define TDF_LabelIndexedMap_HeaderFile
|
||||
|
||||
#include <TDF_LabelMapHasher.hxx>
|
||||
#include <NCollection_IndexedMap.hxx>
|
||||
|
||||
typedef NCollection_IndexedMap<TDF_Label,TDF_LabelMapHasher> TDF_LabelIndexedMap;
|
||||
typedef NCollection_IndexedMap<TDF_Label> TDF_LabelIndexedMap;
|
||||
|
||||
|
||||
#endif
|
||||
|
@@ -18,11 +18,10 @@
|
||||
|
||||
#include <TDF_Label.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <TDF_LabelMapHasher.hxx>
|
||||
#include <NCollection_DataMap.hxx>
|
||||
|
||||
typedef NCollection_DataMap<TDF_Label,Standard_Integer,TDF_LabelMapHasher> TDF_LabelIntegerMap;
|
||||
typedef NCollection_DataMap<TDF_Label,Standard_Integer,TDF_LabelMapHasher>::Iterator TDF_DataMapIteratorOfLabelIntegerMap;
|
||||
typedef NCollection_DataMap<TDF_Label,Standard_Integer> TDF_LabelIntegerMap;
|
||||
typedef NCollection_DataMap<TDF_Label,Standard_Integer>::Iterator TDF_DataMapIteratorOfLabelIntegerMap;
|
||||
|
||||
|
||||
#endif
|
||||
|
@@ -17,11 +17,10 @@
|
||||
#define TDF_LabelMap_HeaderFile
|
||||
|
||||
#include <TDF_Label.hxx>
|
||||
#include <TDF_LabelMapHasher.hxx>
|
||||
#include <NCollection_Map.hxx>
|
||||
|
||||
typedef NCollection_Map<TDF_Label,TDF_LabelMapHasher> TDF_LabelMap;
|
||||
typedef NCollection_Map<TDF_Label,TDF_LabelMapHasher>::Iterator TDF_MapIteratorOfLabelMap;
|
||||
typedef NCollection_Map<TDF_Label> TDF_LabelMap;
|
||||
typedef NCollection_Map<TDF_Label>::Iterator TDF_MapIteratorOfLabelMap;
|
||||
|
||||
|
||||
#endif
|
||||
|
@@ -1,43 +0,0 @@
|
||||
// Created by: DAUTRY Philippe
|
||||
// Copyright (c) 1997-1999 Matra Datavision
|
||||
// Copyright (c) 1999-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.
|
||||
|
||||
#ifndef _TDF_LabelMapHasher_HeaderFile
|
||||
#define _TDF_LabelMapHasher_HeaderFile
|
||||
|
||||
#include <TDF_Label.hxx>
|
||||
|
||||
//! A label hasher for label maps.
|
||||
class TDF_LabelMapHasher
|
||||
{
|
||||
public:
|
||||
//! Computes a hash code for the given label, in the range [1, theUpperBound]
|
||||
//! @param theLabel the label which hash code is to be computed
|
||||
//! @param theUpperBound the upper bound of the range a computing hash code must be within
|
||||
//! @return a computed hash code, in the range [1, theUpperBound]
|
||||
static Standard_Integer HashCode(const TDF_Label& theLabel, const Standard_Integer theUpperBound)
|
||||
{
|
||||
return ::HashCode(theLabel.myLabelNode, theUpperBound);
|
||||
}
|
||||
|
||||
//! Returns True when the two keys are the same. Two
|
||||
//! same keys must have the same hashcode, the
|
||||
//! contrary is not necessary.
|
||||
static Standard_Boolean IsEqual(const TDF_Label& aLab1, const TDF_Label& aLab2)
|
||||
{
|
||||
return aLab1.IsEqual(aLab2);
|
||||
}
|
||||
};
|
||||
|
||||
#endif // _TDF_LabelMapHasher_HeaderFile
|
Reference in New Issue
Block a user