1
0
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:
dpasukhi
2023-08-05 17:53:19 +01:00
parent 6dbfade692
commit 1103eb60af
649 changed files with 10704 additions and 12037 deletions

View File

@@ -1,4 +1,3 @@
Transfer_Actor.gxx
Transfer_ActorDispatch.cxx
Transfer_ActorDispatch.hxx
Transfer_ActorOfFinderProcess.cxx
@@ -21,18 +20,15 @@ Transfer_Finder.cxx
Transfer_Finder.hxx
Transfer_FinderProcess.cxx
Transfer_FinderProcess.hxx
Transfer_FindHasher.cxx
Transfer_FindHasher.hxx
Transfer_HSequenceOfBinder.hxx
Transfer_HSequenceOfFinder.hxx
Transfer_Iterator.gxx
Transfer_IteratorOfProcessForFinder.hxx
Transfer_IteratorOfProcessForFinder_0.cxx
Transfer_IteratorOfProcessForTransient.hxx
Transfer_IteratorOfProcessForTransient_0.cxx
Transfer_MapContainer.cxx
Transfer_MapContainer.hxx
Transfer_Mapper.gxx
Transfer_MultipleBinder.cxx
Transfer_MultipleBinder.hxx
Transfer_ProcessForFinder.hxx
@@ -61,7 +57,6 @@ Transfer_TransferMapOfProcessForFinder.hxx
Transfer_TransferMapOfProcessForTransient.hxx
Transfer_TransferOutput.cxx
Transfer_TransferOutput.hxx
Transfer_TransferProcess.gxx
Transfer_TransientListBinder.cxx
Transfer_TransientListBinder.hxx
Transfer_TransientMapper.hxx

View File

@@ -1,69 +0,0 @@
// 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.
//#include <Transfer_Actor.ixx>
// TheStart : Handle(Standard_Transient) ou (Transfer_Finder)
Transfer_Actor::Transfer_Actor () { }
Standard_Boolean Transfer_Actor::Recognize (const TheStart& /*start*/)
{ return Standard_True; }
Handle(Transfer_Binder) Transfer_Actor::Transferring
(const TheStart& /*start*/,
const Handle(Transfer_TransferProcess)& /*TP*/,
const Message_ProgressRange& /*theProgress*/)
{ return NullResult(); }
Handle(Transfer_SimpleBinderOfTransient)
Transfer_Actor::TransientResult
(const Handle(Standard_Transient)& res) const
{
Handle(Transfer_SimpleBinderOfTransient) binder;
if (res.IsNull()) return binder;
binder = new Transfer_SimpleBinderOfTransient;
binder->SetResult (res);
return binder;
}
Handle(Transfer_Binder) Transfer_Actor::NullResult () const
{
Handle(Transfer_Binder) binder;
return binder;
}
void Transfer_Actor::SetNext
(const Handle(Transfer_Actor)& next)
{
if (thenext == next) return;
if (thenext.IsNull()) thenext = next;
else if (thenext->IsLast()) { next->SetNext(thenext); thenext = next; }
else thenext->SetNext(next);
}
Handle(Transfer_Actor) Transfer_Actor::Next () const
{ return thenext; }
void Transfer_Actor::SetLast (const Standard_Boolean mode)
{ thelast = mode; }
Standard_Boolean Transfer_Actor::IsLast () const
{ return thelast; }

View File

@@ -16,35 +16,114 @@
#include <Transfer_ActorOfProcessForFinder.hxx>
#include <Standard_Type.hxx>
#include <Transfer_ActorOfProcessForFinder.hxx>
#include <Standard_DomainError.hxx>
#include <Standard_Handle.hxx>
#include <Standard_Transient.hxx>
#include <Standard_Type.hxx>
#include <Transfer_ActorOfProcessForFinder.hxx>
#include <Transfer_Binder.hxx>
#include <Transfer_Finder.hxx>
#include <Transfer_FindHasher.hxx>
#include <Transfer_ProcessForFinder.hxx>
#include <Transfer_TransferMapOfProcessForFinder.hxx>
#include <Transfer_IteratorOfProcessForFinder.hxx>
#include <Transfer_Binder.hxx>
#include <Transfer_ProcessForFinder.hxx>
#include <Transfer_SimpleBinderOfTransient.hxx>
#include <Standard_Transient.hxx>
#include <Transfer_TransferMapOfProcessForFinder.hxx>
#define TheStart Handle(Transfer_Finder)
#define TheStart_hxx <Transfer_Finder.hxx>
#define TheMapHasher Transfer_FindHasher
#define TheMapHasher_hxx <Transfer_FindHasher.hxx>
#define Handle_TheList Handle(Transfer_HSequenceOfFinder)
#define TheList Transfer_HSequenceOfFinder
#define TheList_hxx <Transfer_HSequenceOfFinder.hxx>
#define Transfer_TransferMap Transfer_TransferMapOfProcessForFinder
#define Transfer_TransferMap_hxx <Transfer_TransferMapOfProcessForFinder.hxx>
#define Transfer_Iterator Transfer_IteratorOfProcessForFinder
#define Transfer_Iterator_hxx <Transfer_IteratorOfProcessForFinder.hxx>
#define Transfer_Actor Transfer_ActorOfProcessForFinder
#define Transfer_Actor_hxx <Transfer_ActorOfProcessForFinder.hxx>
#define Handle_Transfer_Actor Handle(Transfer_ActorOfProcessForFinder)
#define Transfer_TransferProcess Transfer_ProcessForFinder
#define Transfer_TransferProcess_hxx <Transfer_ProcessForFinder.hxx>
#define Handle_Transfer_TransferProcess Handle(Transfer_ProcessForFinder)
#include <Transfer_Actor.gxx>
//=======================================================================
// Function: Transfer_ActorOfProcessForFinder
// Purpose :
//=======================================================================
Transfer_ActorOfProcessForFinder::Transfer_ActorOfProcessForFinder() { }
//=======================================================================
// Function: Recognize
// Purpose :
//=======================================================================
Standard_Boolean Transfer_ActorOfProcessForFinder::Recognize(const Handle(Transfer_Finder)& /*start*/)
{
return Standard_True;
}
//=======================================================================
// Function: Transferring
// Purpose :
//=======================================================================
Handle(Transfer_Binder) Transfer_ActorOfProcessForFinder::Transferring
(const Handle(Transfer_Finder)& /*start*/,
const Handle(Transfer_ProcessForFinder)& /*TP*/,
const Message_ProgressRange& /*theProgress*/)
{
return NullResult();
}
//=======================================================================
// Function: TransientResult
// Purpose :
//=======================================================================
Handle(Transfer_SimpleBinderOfTransient)
Transfer_ActorOfProcessForFinder::TransientResult
(const Handle(Standard_Transient)& res) const
{
Handle(Transfer_SimpleBinderOfTransient) binder;
if (res.IsNull()) return binder;
binder = new Transfer_SimpleBinderOfTransient;
binder->SetResult(res);
return binder;
}
//=======================================================================
// Function: NullResult
// Purpose :
//=======================================================================
Handle(Transfer_Binder) Transfer_ActorOfProcessForFinder::NullResult() const
{
Handle(Transfer_Binder) binder;
return binder;
}
//=======================================================================
// Function: SetNext
// Purpose :
//=======================================================================
void Transfer_ActorOfProcessForFinder::SetNext
(const Handle(Transfer_ActorOfProcessForFinder)& next)
{
if (thenext == next)
return;
if (thenext.IsNull())
thenext = next;
else if (thenext->IsLast())
{
next->SetNext(thenext);
thenext = next;
}
else
thenext->SetNext(next);
}
//=======================================================================
// Function: Next
// Purpose :
//=======================================================================
Handle(Transfer_ActorOfProcessForFinder) Transfer_ActorOfProcessForFinder::Next() const
{
return thenext;
}
//=======================================================================
// Function: SetLast
// Purpose :
//=======================================================================
void Transfer_ActorOfProcessForFinder::SetLast(const Standard_Boolean mode)
{
thelast = mode;
}
//=======================================================================
// Function: IsLast
// Purpose :
//=======================================================================
Standard_Boolean Transfer_ActorOfProcessForFinder::IsLast() const
{
return thelast;
}

View File

@@ -16,33 +16,117 @@
#include <Transfer_ActorOfProcessForTransient.hxx>
#include <Standard_Type.hxx>
#include <Transfer_ActorOfProcessForTransient.hxx>
#include <Standard_DomainError.hxx>
#include <Standard_Transient.hxx>
#include <Transfer_ProcessForTransient.hxx>
#include <Transfer_TransferMapOfProcessForTransient.hxx>
#include <Transfer_IteratorOfProcessForTransient.hxx>
#include <Standard_Type.hxx>
#include <Transfer_ActorOfProcessForTransient.hxx>
#include <Transfer_Binder.hxx>
#include <Transfer_IteratorOfProcessForTransient.hxx>
#include <Transfer_ProcessForTransient.hxx>
#include <Transfer_SimpleBinderOfTransient.hxx>
#include <Transfer_TransferMapOfProcessForTransient.hxx>
#define TheStart Handle(Standard_Transient)
#define TheStart_hxx <Standard_Transient.hxx>
#define TheMapHasher TColStd_MapTransientHasher
#define TheMapHasher_hxx <TColStd_MapTransientHasher.hxx>
#define Handle_TheList Handle(TColStd_HSequenceOfTransient)
#define TheList TColStd_HSequenceOfTransient
#define TheList_hxx <TColStd_HSequenceOfTransient.hxx>
#define Transfer_TransferMap Transfer_TransferMapOfProcessForTransient
#define Transfer_TransferMap_hxx <Transfer_TransferMapOfProcessForTransient.hxx>
#define Transfer_Iterator Transfer_IteratorOfProcessForTransient
#define Transfer_Iterator_hxx <Transfer_IteratorOfProcessForTransient.hxx>
#define Transfer_Actor Transfer_ActorOfProcessForTransient
#define Transfer_Actor_hxx <Transfer_ActorOfProcessForTransient.hxx>
#define Handle_Transfer_Actor Handle(Transfer_ActorOfProcessForTransient)
#define Transfer_TransferProcess Transfer_ProcessForTransient
#define Transfer_TransferProcess_hxx <Transfer_ProcessForTransient.hxx>
#define Handle_Transfer_TransferProcess Handle(Transfer_ProcessForTransient)
#include <Transfer_Actor.gxx>
//=======================================================================
// Function: Transfer_ActorOfProcessForTransient
// Purpose :
//=======================================================================
Transfer_ActorOfProcessForTransient::Transfer_ActorOfProcessForTransient()
{}
//=======================================================================
// Function: Recognize
// Purpose :
//=======================================================================
Standard_Boolean Transfer_ActorOfProcessForTransient::Recognize(const Handle(Standard_Transient)& /*start*/)
{
return Standard_True;
}
//=======================================================================
// Function: Transferring
// Purpose :
//=======================================================================
Handle(Transfer_Binder) Transfer_ActorOfProcessForTransient::Transferring
(const Handle(Standard_Transient)& /*start*/,
const Handle(Transfer_ProcessForTransient)& /*TP*/,
const Message_ProgressRange& /*theProgress*/)
{
return NullResult();
}
//=======================================================================
// Function: TransientResult
// Purpose :
//=======================================================================
Handle(Transfer_SimpleBinderOfTransient)
Transfer_ActorOfProcessForTransient::TransientResult
(const Handle(Standard_Transient)& res) const
{
Handle(Transfer_SimpleBinderOfTransient) binder;
if (res.IsNull()) return binder;
binder = new Transfer_SimpleBinderOfTransient;
binder->SetResult(res);
return binder;
}
//=======================================================================
// Function: NullResult
// Purpose :
//=======================================================================
Handle(Transfer_Binder) Transfer_ActorOfProcessForTransient::NullResult() const
{
Handle(Transfer_Binder) binder;
return binder;
}
//=======================================================================
// Function: SetNext
// Purpose :
//=======================================================================
void Transfer_ActorOfProcessForTransient::SetNext
(const Handle(Transfer_ActorOfProcessForTransient)& next)
{
if (thenext == next)
return;
if (thenext.IsNull())
thenext = next;
else if (thenext->IsLast())
{
next->SetNext(thenext);
thenext = next;
}
else
thenext->SetNext(next);
}
//=======================================================================
// Function: Next
// Purpose :
//=======================================================================
Handle(Transfer_ActorOfProcessForTransient) Transfer_ActorOfProcessForTransient::Next() const
{
return thenext;
}
//=======================================================================
// Function: SetLast
// Purpose :
//=======================================================================
void Transfer_ActorOfProcessForTransient::SetLast(const Standard_Boolean mode)
{
thelast = mode;
}
//=======================================================================
// Function: IsLast
// Purpose :
//=======================================================================
Standard_Boolean Transfer_ActorOfProcessForTransient::IsLast() const
{
return thelast;
}

View File

@@ -1,34 +0,0 @@
// 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.
#include <Transfer_Finder.hxx>
#include <Transfer_FindHasher.hxx>
//============================================================================
// function : HashCode
// purpose :
//============================================================================
Standard_Integer Transfer_FindHasher::HashCode (const Handle (Transfer_Finder) & theFinder,
const Standard_Integer theUpperBound)
{
return ::HashCode (theFinder->GetHashCode() - 1, theUpperBound);
}
Standard_Boolean Transfer_FindHasher::IsEqual
(const Handle(Transfer_Finder)& K1, const Handle(Transfer_Finder)& K2)
{
if (K1.IsNull()) return Standard_False;
return K1->Equates(K2);
}

View File

@@ -19,59 +19,33 @@
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Transfer_Finder.hxx>
#include <Standard_Handle.hxx>
#include <Standard_Integer.hxx>
class Transfer_Finder;
//! FindHasher defines HashCode for Finder, which is : ask a
//! Finder its HashCode ! Because this is the Finder itself which
//! brings the HashCode for its Key
//!
//! This class complies to the template given in TCollection by
//! MapHasher itself
class Transfer_FindHasher
class Transfer_FindHasher
{
public:
DEFINE_STANDARD_ALLOC
//! Returns hash code for the given finder, in the range [1, theUpperBound].
//! Asks the finder its hash code, then transforms it to be in the required range
//! @param theFinder the finder 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]
Standard_EXPORT static Standard_Integer HashCode (const Handle (Transfer_Finder) & theFinder,
Standard_Integer theUpperBound);
size_t operator()(const Handle(Transfer_Finder)& theFinder) const
{
return theFinder->GetHashCode();
}
//! Returns True if two keys are the same.
//! The test does not work on the Finders themselves but by
//! calling their methods Equates
Standard_EXPORT static Standard_Boolean IsEqual (const Handle(Transfer_Finder)& K1, const Handle(Transfer_Finder)& K2);
protected:
private:
bool operator() (const Handle(Transfer_Finder)& theK1,
const Handle(Transfer_Finder)& theK2) const
{
if (theK1.IsNull()) return false;
return theK1->Equates(theK2);
}
};
#endif // _Transfer_FindHasher_HeaderFile

View File

@@ -21,10 +21,10 @@
IMPLEMENT_STANDARD_RTTIEXT(Transfer_Finder,Standard_Transient)
void Transfer_Finder::SetHashCode (const Standard_Integer code)
void Transfer_Finder::SetHashCode (const size_t code)
{ thecode = code; }
Standard_Integer Transfer_Finder::GetHashCode () const
size_t Transfer_Finder::GetHashCode () const
{ return thecode; }
Handle(Standard_Type) Transfer_Finder::ValueType () const

View File

@@ -45,7 +45,7 @@ public:
//! Returns the HashCode which has been stored by SetHashCode
//! (remark that HashCode could be deferred then be defined by
//! sub-classes, the result is the same)
Standard_EXPORT Standard_Integer GetHashCode() const;
Standard_EXPORT size_t GetHashCode() const;
//! Specific testof equality : to be defined by each sub-class,
//! must be False if Finders have not the same true Type, else
@@ -151,14 +151,14 @@ protected:
//! Stores the HashCode which corresponds to the Value given to
//! create the Mapper
Standard_EXPORT void SetHashCode (const Standard_Integer code);
Standard_EXPORT void SetHashCode (const size_t code);
private:
Standard_Integer thecode;
size_t thecode;
NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)> theattrib;

View File

@@ -1,73 +0,0 @@
// 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.
// Transfer_Iterator.gxx
#include <Standard_NoSuchObject.hxx>
// TheStart est suppose Handle(Standard_Transient) ou (Transfer_Finder)
// Il a servi a instancier TheList qui est une HSequence
Transfer_Iterator::Transfer_Iterator (const Standard_Boolean withstarts)
: Transfer_TransferIterator ()
{ if (withstarts) thestarts = new TheList(); }
void Transfer_Iterator::Add
(const Handle(Transfer_Binder)& binder)
{
if (!thestarts.IsNull()) throw Standard_NoSuchObject("Transfer_Iterator : Add, Starting Object required not provided");
AddItem(binder);
}
void Transfer_Iterator::Add
(const Handle(Transfer_Binder)& binder, const TheStart& start)
{
AddItem(binder);
if (!thestarts.IsNull()) thestarts->Append(start);
}
void Transfer_Iterator::Filter
(const Handle(TheList)& list, const Standard_Boolean keep)
{
if (list.IsNull() || thestarts.IsNull()) return;
Standard_Integer i, j, nb = thestarts->Length();
if (nb == 0) return;
Handle(Transfer_Binder) factice;
Transfer_TransferMap amap (nb);
for (i = 1; i <= nb; i ++) {
j = amap.Add (thestarts->Value(i),factice);
SelectItem (j,!keep);
}
// Comparaison
nb = list->Length();
for (i = 1; i <= nb; i ++) {
j = amap.FindIndex (list->Value(i));
if (j > 0) SelectItem (j,keep);
}
}
Standard_Boolean Transfer_Iterator::HasStarting () const
{ return (!thestarts.IsNull()); }
const TheStart& Transfer_Iterator::Starting () const
{
// if (thecurr == 0 || thecurr > themaxi) throw Standard_NoSuchObject
// ("TransferIterator : Starting");
// if (theselect->Value(thecurr) == 0) throw Standard_NoSuchObject
// ("TransferIterator : Starting");
if (thestarts.IsNull()) throw Standard_NoSuchObject("TransferIterator : No Starting defined at all");
return thestarts->Value(thecurr);
}

View File

@@ -23,24 +23,80 @@
#include <Transfer_TransferMapOfProcessForFinder.hxx>
#include <Transfer_ActorOfProcessForFinder.hxx>
#include <Transfer_Binder.hxx>
#define TheStart Handle(Transfer_Finder)
#define TheStart_hxx <Transfer_Finder.hxx>
#define TheMapHasher Transfer_FindHasher
#define TheMapHasher_hxx <Transfer_FindHasher.hxx>
#define Handle_TheList Handle(Transfer_HSequenceOfFinder)
#define TheList Transfer_HSequenceOfFinder
#define TheList_hxx <Transfer_HSequenceOfFinder.hxx>
#define Transfer_TransferMap Transfer_TransferMapOfProcessForFinder
#define Transfer_TransferMap_hxx <Transfer_TransferMapOfProcessForFinder.hxx>
#define Transfer_Iterator Transfer_IteratorOfProcessForFinder
#define Transfer_Iterator_hxx <Transfer_IteratorOfProcessForFinder.hxx>
#define Transfer_Actor Transfer_ActorOfProcessForFinder
#define Transfer_Actor_hxx <Transfer_ActorOfProcessForFinder.hxx>
#define Handle_Transfer_Actor Handle(Transfer_ActorOfProcessForFinder)
#define Transfer_TransferProcess Transfer_ProcessForFinder
#define Transfer_TransferProcess_hxx <Transfer_ProcessForFinder.hxx>
#define Handle_Transfer_TransferProcess Handle(Transfer_ProcessForFinder)
#include <Transfer_Iterator.gxx>
//=======================================================================
// Function: Transfer_IteratorOfProcessForFinder
// Purpose :
//=======================================================================
Transfer_IteratorOfProcessForFinder::Transfer_IteratorOfProcessForFinder(const Standard_Boolean withstarts)
: Transfer_TransferIterator()
{
if (withstarts) thestarts = new Transfer_HSequenceOfFinder();
}
//=======================================================================
// Function: Add
// Purpose :
//=======================================================================
void Transfer_IteratorOfProcessForFinder::Add
(const Handle(Transfer_Binder)& binder)
{
if (!thestarts.IsNull()) throw Standard_NoSuchObject("Transfer_IteratorOfProcessForFinder : Add, Starting Object required not provided");
AddItem(binder);
}
//=======================================================================
// Function: Add
// Purpose :
//=======================================================================
void Transfer_IteratorOfProcessForFinder::Add
(const Handle(Transfer_Binder)& binder, const Handle(Transfer_Finder)& start)
{
AddItem(binder);
if (!thestarts.IsNull()) thestarts->Append(start);
}
//=======================================================================
// Function: Filter
// Purpose :
//=======================================================================
void Transfer_IteratorOfProcessForFinder::Filter
(const Handle(Transfer_HSequenceOfFinder)& list, const Standard_Boolean keep)
{
if (list.IsNull() || thestarts.IsNull()) return;
Standard_Integer i, j, nb = thestarts->Length();
if (nb == 0) return;
Handle(Transfer_Binder) factice;
Transfer_TransferMapOfProcessForFinder amap(nb);
for (i = 1; i <= nb; i++) {
j = amap.Add(thestarts->Value(i), factice);
SelectItem(j, !keep);
}
// Comparison
nb = list->Length();
for (i = 1; i <= nb; i++) {
j = amap.FindIndex(list->Value(i));
if (j > 0) SelectItem(j, keep);
}
}
//=======================================================================
// Function: HasStarting
// Purpose :
//=======================================================================
Standard_Boolean Transfer_IteratorOfProcessForFinder::HasStarting() const
{
return (!thestarts.IsNull());
}
//=======================================================================
// Function: Starting
// Purpose :
//=======================================================================
const Handle(Transfer_Finder)& Transfer_IteratorOfProcessForFinder::Starting() const
{
if (thestarts.IsNull()) throw Standard_NoSuchObject("TransferIterator : No Starting defined at all");
return thestarts->Value(thecurr);
}

View File

@@ -22,24 +22,81 @@
#include <Transfer_TransferMapOfProcessForTransient.hxx>
#include <Transfer_ActorOfProcessForTransient.hxx>
#include <Transfer_Binder.hxx>
#define TheStart Handle(Standard_Transient)
#define TheStart_hxx <Standard_Transient.hxx>
#define TheMapHasher TColStd_MapTransientHasher
#define TheMapHasher_hxx <TColStd_MapTransientHasher.hxx>
#define Handle_TheList Handle(TColStd_HSequenceOfTransient)
#define TheList TColStd_HSequenceOfTransient
#define TheList_hxx <TColStd_HSequenceOfTransient.hxx>
#define Transfer_TransferMap Transfer_TransferMapOfProcessForTransient
#define Transfer_TransferMap_hxx <Transfer_TransferMapOfProcessForTransient.hxx>
#define Transfer_Iterator Transfer_IteratorOfProcessForTransient
#define Transfer_Iterator_hxx <Transfer_IteratorOfProcessForTransient.hxx>
#define Transfer_Actor Transfer_ActorOfProcessForTransient
#define Transfer_Actor_hxx <Transfer_ActorOfProcessForTransient.hxx>
#define Handle_Transfer_Actor Handle(Transfer_ActorOfProcessForTransient)
#define Transfer_TransferProcess Transfer_ProcessForTransient
#define Transfer_TransferProcess_hxx <Transfer_ProcessForTransient.hxx>
#define Handle_Transfer_TransferProcess Handle(Transfer_ProcessForTransient)
#include <Transfer_Iterator.gxx>
//=======================================================================
//function : Transfer_IteratorOfProcessForTransient
//purpose :
//=======================================================================
Transfer_IteratorOfProcessForTransient::Transfer_IteratorOfProcessForTransient(const Standard_Boolean withstarts)
: Transfer_TransferIterator()
{
if (withstarts) thestarts = new TColStd_HSequenceOfTransient();
}
//=======================================================================
//function : Add
//purpose :
//=======================================================================
void Transfer_IteratorOfProcessForTransient::Add
(const Handle(Transfer_Binder)& binder)
{
if (!thestarts.IsNull()) throw Standard_NoSuchObject("Transfer_IteratorOfProcessForTransient : Add, Starting Object required not provided");
AddItem(binder);
}
//=======================================================================
//function : Add
//purpose :
//=======================================================================
void Transfer_IteratorOfProcessForTransient::Add
(const Handle(Transfer_Binder)& binder, const Handle(Standard_Transient)& start)
{
AddItem(binder);
if (!thestarts.IsNull()) thestarts->Append(start);
}
//=======================================================================
//function : Filter
//purpose :
//=======================================================================
void Transfer_IteratorOfProcessForTransient::Filter
(const Handle(TColStd_HSequenceOfTransient)& list, const Standard_Boolean keep)
{
if (list.IsNull() || thestarts.IsNull()) return;
Standard_Integer i, j, nb = thestarts->Length();
if (nb == 0) return;
Handle(Transfer_Binder) factice;
Transfer_TransferMapOfProcessForTransient amap(nb);
for (i = 1; i <= nb; i++)
{
j = amap.Add(thestarts->Value(i), factice);
SelectItem(j, !keep);
}
// Comparison
nb = list->Length();
for (i = 1; i <= nb; i++)
{
j = amap.FindIndex(list->Value(i));
if (j > 0) SelectItem(j, keep);
}
}
//=======================================================================
//function : HasStarting
//purpose :
//=======================================================================
Standard_Boolean Transfer_IteratorOfProcessForTransient::HasStarting() const
{
return (!thestarts.IsNull());
}
//=======================================================================
//function : Starting
//purpose :
//=======================================================================
const Handle(Standard_Transient)& Transfer_IteratorOfProcessForTransient::Starting() const
{
if (thestarts.IsNull()) throw Standard_NoSuchObject("TransferIterator : No Starting defined at all");
return thestarts->Value(thecurr);
}

View File

@@ -1,41 +0,0 @@
// 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.
//#include <Transfer_Mapper.ixx>
#include <Standard_Integer.hxx>
Transfer_Mapper::Transfer_Mapper (const TheKey& akey)
: theval (akey)
{ SetHashCode ( TheHasher::HashCode (akey, IntegerLast() ) ); }
const TheKey& Transfer_Mapper::Value () const
{ return theval; }
Standard_Boolean Transfer_Mapper::Equates
(const Handle(Transfer_Finder)& other) const
{
if (other.IsNull()) return Standard_False;
if (GetHashCode() != other->GetHashCode()) return Standard_False;
if (other->DynamicType() != DynamicType()) return Standard_False;
Handle(Transfer_Mapper) another = Handle(Transfer_Mapper)::DownCast(other);
// return (theval == another->Value());
return TheHasher::IsEqual (theval,another->Value());
}
Handle(Standard_Type) Transfer_Mapper::ValueType () const
{ return TheInfo::Type(theval); }
Standard_CString Transfer_Mapper::ValueTypeName () const
{ return TheInfo::TypeName(theval); }

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -18,9 +18,8 @@
#define _Transfer_TransferMapOfProcessForTransient_HeaderFile
#include <NCollection_IndexedDataMap.hxx>
#include <TColStd_MapTransientHasher.hxx>
#include <Transfer_Binder.hxx>
typedef NCollection_IndexedDataMap<Handle(Standard_Transient),Handle(Transfer_Binder),TColStd_MapTransientHasher> Transfer_TransferMapOfProcessForTransient;
typedef NCollection_IndexedDataMap<Handle(Standard_Transient),Handle(Transfer_Binder)> Transfer_TransferMapOfProcessForTransient;
#endif // _Transfer_TransferMapOfProcessForTransient_HeaderFile

File diff suppressed because it is too large Load Diff

View File

@@ -21,7 +21,6 @@
#include <Standard_Type.hxx>
#include <Transfer_Finder.hxx>
#include <TColStd_MapTransientHasher.hxx>
class Standard_Transient;
class Transfer_DataInfo;
class Transfer_Finder;

View File

@@ -17,28 +17,57 @@
#include <Transfer_TransientMapper.hxx>
#include <Standard_Type.hxx>
#include <Standard_Transient.hxx>
#include <Transfer_DataInfo.hxx>
#include <Transfer_Finder.hxx>
//=======================================================================
//function : Transfer_TransientMapper
//purpose :
//=======================================================================
Transfer_TransientMapper::Transfer_TransientMapper(const Handle(Standard_Transient)& akey)
: theval(akey)
{
SetHashCode(std::hash<Handle(Standard_Transient)>{}(akey));
}
//=======================================================================
//function : Value
//purpose :
//=======================================================================
const Handle(Standard_Transient)& Transfer_TransientMapper::Value() const
{
return theval;
}
//=======================================================================
//function : Equates
//purpose :
//=======================================================================
Standard_Boolean Transfer_TransientMapper::Equates
(const Handle(Transfer_Finder)& other) const
{
if (other.IsNull()) return Standard_False;
if (GetHashCode() != other->GetHashCode()) return Standard_False;
if (other->DynamicType() != DynamicType()) return Standard_False;
Handle(Transfer_TransientMapper) another = Handle(Transfer_TransientMapper)::DownCast(other);
return theval == another->Value();
}
//=======================================================================
//function : ValueType
//purpose :
//=======================================================================
Handle(Standard_Type) Transfer_TransientMapper::ValueType() const
{
return Transfer_DataInfo::Type(theval);
}
#define TheKey Handle(Standard_Transient)
#define TheKey_hxx <Standard_Transient.hxx>
#define TheHasher TColStd_MapTransientHasher
#define TheHasher_hxx <TColStd_MapTransientHasher.hxx>
#define TheInfo Transfer_DataInfo
#define TheInfo_hxx <Transfer_DataInfo.hxx>
#define Transfer_Mapper Transfer_TransientMapper
#define Transfer_Mapper_hxx <Transfer_TransientMapper.hxx>
#define Handle_Transfer_Mapper Handle(Transfer_TransientMapper)
#include <Transfer_Mapper.gxx>
//=======================================================================
//function : ValueTypeName
//purpose :
//=======================================================================
Standard_CString Transfer_TransientMapper::ValueTypeName() const
{
return Transfer_DataInfo::TypeName(theval);
}