1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +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

@@ -11,7 +11,6 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Interface_GeneralLib.hxx>
#include <Interface_InterfaceModel.hxx>
#include <Interface_Protocol.hxx>
@@ -23,47 +22,45 @@
#include <Transfer_TransferDispatch.hxx>
#include <Transfer_TransientProcess.hxx>
IMPLEMENT_STANDARD_RTTIEXT(Transfer_ActorDispatch,Transfer_ActorOfTransientProcess)
IMPLEMENT_STANDARD_RTTIEXT(Transfer_ActorDispatch, Transfer_ActorOfTransientProcess)
Transfer_ActorDispatch::Transfer_ActorDispatch
(const Handle(Interface_InterfaceModel)& amodel,
const Interface_GeneralLib& lib)
: thetool (amodel,lib)
Transfer_ActorDispatch::Transfer_ActorDispatch(const Handle(Interface_InterfaceModel)& amodel,
const Interface_GeneralLib& lib)
: thetool(amodel, lib)
{
SetLast(Standard_True); // actor par defaut
SetLast(Standard_True); // actor par defaut
thetool.TransientProcess()->SetActor(this);
}
Transfer_ActorDispatch::Transfer_ActorDispatch
(const Handle(Interface_InterfaceModel)& amodel,
const Handle(Interface_Protocol)& protocol)
: thetool (amodel,protocol)
Transfer_ActorDispatch::Transfer_ActorDispatch(const Handle(Interface_InterfaceModel)& amodel,
const Handle(Interface_Protocol)& protocol)
: thetool(amodel, protocol)
{
SetLast(Standard_True); // actor par defaut
SetLast(Standard_True); // actor par defaut
thetool.TransientProcess()->SetActor(this);
}
Transfer_ActorDispatch::Transfer_ActorDispatch
(const Handle(Interface_InterfaceModel)& amodel)
: thetool (amodel)
Transfer_ActorDispatch::Transfer_ActorDispatch(const Handle(Interface_InterfaceModel)& amodel)
: thetool(amodel)
{
SetLast(Standard_True); // actor par defaut
SetLast(Standard_True); // actor par defaut
thetool.TransientProcess()->SetActor(this);
}
void Transfer_ActorDispatch::AddActor(const Handle(Transfer_ActorOfTransientProcess)& actor)
{
thetool.TransientProcess()->SetActor(actor);
}
void Transfer_ActorDispatch::AddActor
(const Handle(Transfer_ActorOfTransientProcess)& actor)
{ thetool.TransientProcess()->SetActor(actor); }
Transfer_TransferDispatch& Transfer_ActorDispatch::TransferDispatch()
{
return thetool;
}
Transfer_TransferDispatch& Transfer_ActorDispatch::TransferDispatch ()
{ return thetool; }
Handle(Transfer_Binder) Transfer_ActorDispatch::Transfer
(const Handle(Standard_Transient)& start,
const Handle(Transfer_TransientProcess)& /*TP*/,
const Message_ProgressRange&)
Handle(Transfer_Binder) Transfer_ActorDispatch::Transfer(
const Handle(Standard_Transient)& start,
const Handle(Transfer_TransientProcess)& /*TP*/,
const Message_ProgressRange&)
{
thetool.TransferEntity(start);
return thetool.TransientProcess()->Find(start);

View File

@@ -29,7 +29,6 @@ class Transfer_Binder;
class Standard_Transient;
class Transfer_TransientProcess;
class Transfer_ActorDispatch;
DEFINE_STANDARD_HANDLE(Transfer_ActorDispatch, Transfer_ActorOfTransientProcess)
@@ -46,59 +45,42 @@ class Transfer_ActorDispatch : public Transfer_ActorOfTransientProcess
{
public:
//! Creates an ActorDispatch from a Model. Works with a General
//! Service Library, given as an Argument
//! This causes TransferDispatch and its TransientProcess to be
//! created, with default actor <me>
Standard_EXPORT Transfer_ActorDispatch(const Handle(Interface_InterfaceModel)& amodel, const Interface_GeneralLib& lib);
Standard_EXPORT Transfer_ActorDispatch(const Handle(Interface_InterfaceModel)& amodel,
const Interface_GeneralLib& lib);
//! Same as above, but Library is defined through a Protocol
Standard_EXPORT Transfer_ActorDispatch(const Handle(Interface_InterfaceModel)& amodel, const Handle(Interface_Protocol)& protocol);
Standard_EXPORT Transfer_ActorDispatch(const Handle(Interface_InterfaceModel)& amodel,
const Handle(Interface_Protocol)& protocol);
//! Same as above, but works with the Active Protocol
Standard_EXPORT Transfer_ActorDispatch(const Handle(Interface_InterfaceModel)& amodel);
//! Utility which adds an actor to the default <me> (it calls
//! SetActor from the TransientProcess)
Standard_EXPORT void AddActor (const Handle(Transfer_ActorOfTransientProcess)& actor);
Standard_EXPORT void AddActor(const Handle(Transfer_ActorOfTransientProcess)& actor);
//! Returns the TransferDispatch, which does the work, records
//! the intermediate data, etc...
//! See TransferDispatch & CopyTool, to see the available methods
Standard_EXPORT Transfer_TransferDispatch& TransferDispatch();
//! Specific action : it calls the method Transfer from CopyTool
//! i.e. the general service Copy, then returns the Binder
//! produced by the TransientProcess
Standard_EXPORT virtual Handle(Transfer_Binder) Transfer
(const Handle(Standard_Transient)& start,
const Handle(Transfer_TransientProcess)& TP,
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
Standard_EXPORT virtual Handle(Transfer_Binder) Transfer(
const Handle(Standard_Transient)& start,
const Handle(Transfer_TransientProcess)& TP,
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(Transfer_ActorDispatch,Transfer_ActorOfTransientProcess)
DEFINE_STANDARD_RTTIEXT(Transfer_ActorDispatch, Transfer_ActorOfTransientProcess)
protected:
private:
Transfer_TransferDispatch thetool;
};
#endif // _Transfer_ActorDispatch_HeaderFile

View File

@@ -11,7 +11,6 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Standard_Transient.hxx>
#include <Transfer_ActorOfFinderProcess.hxx>
#include <Transfer_Binder.hxx>
@@ -22,47 +21,54 @@
#include <Transfer_TransientMapper.hxx>
#include <XSAlgo_ShapeProcessor.hxx>
IMPLEMENT_STANDARD_RTTIEXT(Transfer_ActorOfFinderProcess,Transfer_ActorOfProcessForFinder)
IMPLEMENT_STANDARD_RTTIEXT(Transfer_ActorOfFinderProcess, Transfer_ActorOfProcessForFinder)
//=============================================================================
Transfer_ActorOfFinderProcess::Transfer_ActorOfFinderProcess () { themodetrans = 0; }
//=============================================================================
Standard_Integer& Transfer_ActorOfFinderProcess::ModeTrans ()
{ return themodetrans; }
//=============================================================================
Handle(Transfer_Binder) Transfer_ActorOfFinderProcess::Transfer
(const Handle(Transfer_Finder)& fnd,
const Handle(Transfer_FinderProcess)& FP,
const Message_ProgressRange& theProgress)
Transfer_ActorOfFinderProcess::Transfer_ActorOfFinderProcess()
{
Handle(Transfer_TransientMapper) tm = Handle(Transfer_TransientMapper)::DownCast (fnd);
if (tm.IsNull()) return NullResult();
Handle(Standard_Transient) res = TransferTransient (tm->Value(),FP, theProgress);
if (res.IsNull()) return NullResult();
return TransientResult (res);
themodetrans = 0;
}
//=============================================================================
Handle(Transfer_Binder) Transfer_ActorOfFinderProcess::Transferring
(const Handle(Transfer_Finder)& ent,
const Handle(Transfer_ProcessForFinder)& TP,
const Message_ProgressRange& theProgress)
Standard_Integer& Transfer_ActorOfFinderProcess::ModeTrans()
{
return Transfer(ent,Handle(Transfer_FinderProcess)::DownCast(TP), theProgress);
return themodetrans;
}
//=============================================================================
Handle(Standard_Transient) Transfer_ActorOfFinderProcess::TransferTransient
(const Handle(Standard_Transient)& /*ent*/,
const Handle(Transfer_FinderProcess)&,
const Message_ProgressRange& )
Handle(Transfer_Binder) Transfer_ActorOfFinderProcess::Transfer(
const Handle(Transfer_Finder)& fnd,
const Handle(Transfer_FinderProcess)& FP,
const Message_ProgressRange& theProgress)
{
Handle(Transfer_TransientMapper) tm = Handle(Transfer_TransientMapper)::DownCast(fnd);
if (tm.IsNull())
return NullResult();
Handle(Standard_Transient) res = TransferTransient(tm->Value(), FP, theProgress);
if (res.IsNull())
return NullResult();
return TransientResult(res);
}
//=============================================================================
Handle(Transfer_Binder) Transfer_ActorOfFinderProcess::Transferring(
const Handle(Transfer_Finder)& ent,
const Handle(Transfer_ProcessForFinder)& TP,
const Message_ProgressRange& theProgress)
{
return Transfer(ent, Handle(Transfer_FinderProcess)::DownCast(TP), theProgress);
}
//=============================================================================
Handle(Standard_Transient) Transfer_ActorOfFinderProcess::TransferTransient(
const Handle(Standard_Transient)& /*ent*/,
const Handle(Transfer_FinderProcess)&,
const Message_ProgressRange&)
{
Handle(Standard_Transient) nulres;
return nulres;
@@ -84,8 +90,9 @@ void Transfer_ActorOfFinderProcess::SetShapeFixParameters(ParameterMap&& thePara
//=============================================================================
void Transfer_ActorOfFinderProcess::SetShapeFixParameters(const DE_ShapeFixParameters& theParameters,
const ParameterMap& theAdditionalParameters)
void Transfer_ActorOfFinderProcess::SetShapeFixParameters(
const DE_ShapeFixParameters& theParameters,
const ParameterMap& theAdditionalParameters)
{
myShapeProcParams.clear();
XSAlgo_ShapeProcessor::FillParameterMap(theParameters, true, myShapeProcParams);
@@ -100,8 +107,9 @@ void Transfer_ActorOfFinderProcess::SetShapeFixParameters(const DE_ShapeFixParam
//=============================================================================
void Transfer_ActorOfFinderProcess::SetShapeProcessFlags(const ShapeProcess::OperationsFlags& theFlags)
void Transfer_ActorOfFinderProcess::SetShapeProcessFlags(
const ShapeProcess::OperationsFlags& theFlags)
{
myShapeProcFlags.first = theFlags;
myShapeProcFlags.first = theFlags;
myShapeProcFlags.second = true;
}

View File

@@ -30,7 +30,6 @@ class Transfer_ProcessForFinder;
class Transfer_FinderProcess;
class Standard_Transient;
class Transfer_ActorOfFinderProcess;
DEFINE_STANDARD_HANDLE(Transfer_ActorOfFinderProcess, Transfer_ActorOfProcessForFinder)
@@ -43,30 +42,30 @@ class Transfer_ActorOfFinderProcess : public Transfer_ActorOfProcessForFinder
public:
using ParameterMap = std::unordered_map<std::string, std::string>;
// Flags defining operations to be performed on shapes. Since there is no std::optional in C++11,
// we use a pair. The first element is the flags, the second element is a boolean value that indicates
// whether the flags were set.
// we use a pair. The first element is the flags, the second element is a boolean value that
// indicates whether the flags were set.
using ProcessingFlags = std::pair<ShapeProcess::OperationsFlags, bool>;
public:
Standard_EXPORT Transfer_ActorOfFinderProcess();
//! Returns the Transfer Mode, modifiable
Standard_EXPORT Standard_Integer& ModeTrans();
Standard_EXPORT virtual Handle(Transfer_Binder) Transferring
(const Handle(Transfer_Finder)& start,
const Handle(Transfer_ProcessForFinder)& TP,
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
Standard_EXPORT virtual Handle(Transfer_Binder) Transfer
(const Handle(Transfer_Finder)& start,
const Handle(Transfer_FinderProcess)& TP,
const Message_ProgressRange& theProgress = Message_ProgressRange());
Standard_EXPORT virtual Handle(Standard_Transient) TransferTransient
(const Handle(Standard_Transient)& start,
const Handle(Transfer_FinderProcess)& TP,
const Message_ProgressRange& theProgress = Message_ProgressRange());
Standard_EXPORT virtual Handle(Transfer_Binder) Transferring(
const Handle(Transfer_Finder)& start,
const Handle(Transfer_ProcessForFinder)& TP,
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
Standard_EXPORT virtual Handle(Transfer_Binder) Transfer(
const Handle(Transfer_Finder)& start,
const Handle(Transfer_FinderProcess)& TP,
const Message_ProgressRange& theProgress = Message_ProgressRange());
Standard_EXPORT virtual Handle(Standard_Transient) TransferTransient(
const Handle(Standard_Transient)& start,
const Handle(Transfer_FinderProcess)& TP,
const Message_ProgressRange& theProgress = Message_ProgressRange());
//! Sets parameters for shape processing.
//! @param theParameters the parameters for shape processing.
@@ -84,7 +83,7 @@ public:
//! @param theParameters the parameters for shape processing.
//! @param theAdditionalParameters the additional parameters for shape processing.
Standard_EXPORT void SetShapeFixParameters(const DE_ShapeFixParameters& theParameters,
const ParameterMap& theAdditionalParameters = {});
const ParameterMap& theAdditionalParameters = {});
//! Returns parameters for shape processing that was set by SetParameters() method.
//! @return the parameters for shape processing. Empty map if no parameters were set.
@@ -99,7 +98,7 @@ public:
//! that indicates whether the flags were set.
inline const ProcessingFlags& GetShapeProcessFlags() const { return myShapeProcFlags; }
DEFINE_STANDARD_RTTIEXT(Transfer_ActorOfFinderProcess,Transfer_ActorOfProcessForFinder)
DEFINE_STANDARD_RTTIEXT(Transfer_ActorOfFinderProcess, Transfer_ActorOfProcessForFinder)
protected:
Standard_Integer themodetrans;
@@ -109,10 +108,4 @@ private:
ProcessingFlags myShapeProcFlags; //!< Flags defining operations to be performed on shapes.
};
#endif // _Transfer_ActorOfFinderProcess_HeaderFile

View File

@@ -35,15 +35,12 @@ class Standard_Transient;
class Transfer_ActorOfProcessForFinder;
DEFINE_STANDARD_HANDLE(Transfer_ActorOfProcessForFinder, Standard_Transient)
class Transfer_ActorOfProcessForFinder : public Standard_Transient
{
public:
Standard_EXPORT Transfer_ActorOfProcessForFinder();
//! Prerequisite for Transfer : the method Transfer is
//! called on a starting object only if Recognize has
//! returned True on it
@@ -55,68 +52,52 @@ public:
//! (afterwards rejection), the next actor is then invoked
//!
//! The provided default returns True, can be redefined
Standard_EXPORT virtual Standard_Boolean Recognize (const Handle(Transfer_Finder)& start);
Standard_EXPORT virtual Standard_Boolean Recognize(const Handle(Transfer_Finder)& start);
//! Specific action of Transfer. The Result is stored in
//! the returned Binder, or a Null Handle for "No result"
//! (Default defined as doing nothing; should be deferred)
//! "mutable" allows the Actor to record intermediate
//! information, in addition to those of TransferProcess
Standard_EXPORT virtual Handle(Transfer_Binder) Transferring
(const Handle(Transfer_Finder)& start,
const Handle(Transfer_ProcessForFinder)& TP,
const Message_ProgressRange& theProgress = Message_ProgressRange());
Standard_EXPORT virtual Handle(Transfer_Binder) Transferring(
const Handle(Transfer_Finder)& start,
const Handle(Transfer_ProcessForFinder)& TP,
const Message_ProgressRange& theProgress = Message_ProgressRange());
//! Prepares and Returns a Binder for a Transient Result
//! Returns a Null Handle if <res> is itself Null
Standard_EXPORT Handle(Transfer_SimpleBinderOfTransient) TransientResult (const Handle(Standard_Transient)& res) const;
Standard_EXPORT Handle(Transfer_SimpleBinderOfTransient) TransientResult(
const Handle(Standard_Transient)& res) const;
//! Returns a Binder for No Result, i.e. a Null Handle
Standard_EXPORT Handle(Transfer_Binder) NullResult() const;
//! If <mode> is True, commands an Actor to be set at the
//! end of the list of Actors (see SetNext)
//! If it is False (creation default), each add Actor is
//! set at the beginning of the list
//! This allows to define default Actors (which are Last)
Standard_EXPORT void SetLast (const Standard_Boolean mode = Standard_True);
Standard_EXPORT void SetLast(const Standard_Boolean mode = Standard_True);
//! Returns the Last status (see SetLast).
Standard_EXPORT Standard_Boolean IsLast() const;
//! Defines a Next Actor : it can then be asked to work if
//! <me> produces no result for a given type of Object.
//! If Next is already set and is not "Last", calls
//! SetNext on it. If Next defined and "Last", the new
//! actor is added before it in the list
Standard_EXPORT void SetNext (const Handle(Transfer_ActorOfProcessForFinder)& next);
Standard_EXPORT void SetNext(const Handle(Transfer_ActorOfProcessForFinder)& next);
//! Returns the Actor defined as Next, or a Null Handle
Standard_EXPORT Handle(Transfer_ActorOfProcessForFinder) Next() const;
DEFINE_STANDARD_RTTI_INLINE(Transfer_ActorOfProcessForFinder,Standard_Transient)
DEFINE_STANDARD_RTTI_INLINE(Transfer_ActorOfProcessForFinder, Standard_Transient)
protected:
private:
Handle(Transfer_ActorOfProcessForFinder) thenext;
Standard_Boolean thelast;
Standard_Boolean thelast;
};
#endif // _Transfer_ActorOfProcessForFinder_HeaderFile

View File

@@ -29,64 +29,52 @@
#include <Transfer_SimpleBinderOfTransient.hxx>
#include <Transfer_TransferMapOfProcessForFinder.hxx>
//=======================================================================
// Function: Transfer_ActorOfProcessForFinder
// Purpose :
//=======================================================================
Transfer_ActorOfProcessForFinder::Transfer_ActorOfProcessForFinder() { }
//=================================================================================================
//=======================================================================
// Function: Recognize
// Purpose :
//=======================================================================
Standard_Boolean Transfer_ActorOfProcessForFinder::Recognize(const Handle(Transfer_Finder)& /*start*/)
Transfer_ActorOfProcessForFinder::Transfer_ActorOfProcessForFinder() {}
//=================================================================================================
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*/)
//=================================================================================================
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) Transfer_ActorOfProcessForFinder::TransientResult(
const Handle(Standard_Transient)& res) const
{
Handle(Transfer_SimpleBinderOfTransient) binder;
if (res.IsNull()) return 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)
//=================================================================================================
void Transfer_ActorOfProcessForFinder::SetNext(const Handle(Transfer_ActorOfProcessForFinder)& next)
{
if (thenext == next)
return;
@@ -101,29 +89,23 @@ void Transfer_ActorOfProcessForFinder::SetNext
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
//=================================================================================================
Standard_Boolean Transfer_ActorOfProcessForFinder::IsLast() const
{
return thelast;
}

View File

@@ -34,15 +34,12 @@ class Transfer_SimpleBinderOfTransient;
class Transfer_ActorOfProcessForTransient;
DEFINE_STANDARD_HANDLE(Transfer_ActorOfProcessForTransient, Standard_Transient)
class Transfer_ActorOfProcessForTransient : public Standard_Transient
{
public:
Standard_EXPORT Transfer_ActorOfProcessForTransient();
//! Prerequisite for Transfer : the method Transfer is
//! called on a starting object only if Recognize has
//! returned True on it
@@ -54,68 +51,52 @@ public:
//! (afterwards rejection), the next actor is then invoked
//!
//! The provided default returns True, can be redefined
Standard_EXPORT virtual Standard_Boolean Recognize (const Handle(Standard_Transient)& start);
Standard_EXPORT virtual Standard_Boolean Recognize(const Handle(Standard_Transient)& start);
//! Specific action of Transfer. The Result is stored in
//! the returned Binder, or a Null Handle for "No result"
//! (Default defined as doing nothing; should be deferred)
//! "mutable" allows the Actor to record intermediate
//! information, in addition to those of TransferProcess
Standard_EXPORT virtual Handle(Transfer_Binder) Transferring
(const Handle(Standard_Transient)& start,
const Handle(Transfer_ProcessForTransient)& TP,
const Message_ProgressRange& theProgress = Message_ProgressRange());
Standard_EXPORT virtual Handle(Transfer_Binder) Transferring(
const Handle(Standard_Transient)& start,
const Handle(Transfer_ProcessForTransient)& TP,
const Message_ProgressRange& theProgress = Message_ProgressRange());
//! Prepares and Returns a Binder for a Transient Result
//! Returns a Null Handle if <res> is itself Null
Standard_EXPORT Handle(Transfer_SimpleBinderOfTransient) TransientResult (const Handle(Standard_Transient)& res) const;
Standard_EXPORT Handle(Transfer_SimpleBinderOfTransient) TransientResult(
const Handle(Standard_Transient)& res) const;
//! Returns a Binder for No Result, i.e. a Null Handle
Standard_EXPORT Handle(Transfer_Binder) NullResult() const;
//! If <mode> is True, commands an Actor to be set at the
//! end of the list of Actors (see SetNext)
//! If it is False (creation default), each add Actor is
//! set at the beginning of the list
//! This allows to define default Actors (which are Last)
Standard_EXPORT void SetLast (const Standard_Boolean mode = Standard_True);
Standard_EXPORT void SetLast(const Standard_Boolean mode = Standard_True);
//! Returns the Last status (see SetLast).
Standard_EXPORT Standard_Boolean IsLast() const;
//! Defines a Next Actor : it can then be asked to work if
//! <me> produces no result for a given type of Object.
//! If Next is already set and is not "Last", calls
//! SetNext on it. If Next defined and "Last", the new
//! actor is added before it in the list
Standard_EXPORT void SetNext (const Handle(Transfer_ActorOfProcessForTransient)& next);
Standard_EXPORT void SetNext(const Handle(Transfer_ActorOfProcessForTransient)& next);
//! Returns the Actor defined as Next, or a Null Handle
Standard_EXPORT Handle(Transfer_ActorOfProcessForTransient) Next() const;
DEFINE_STANDARD_RTTI_INLINE(Transfer_ActorOfProcessForTransient,Standard_Transient)
DEFINE_STANDARD_RTTI_INLINE(Transfer_ActorOfProcessForTransient, Standard_Transient)
protected:
private:
Handle(Transfer_ActorOfProcessForTransient) thenext;
Standard_Boolean thelast;
Standard_Boolean thelast;
};
#endif // _Transfer_ActorOfProcessForTransient_HeaderFile

View File

@@ -26,66 +26,53 @@
#include <Transfer_SimpleBinderOfTransient.hxx>
#include <Transfer_TransferMapOfProcessForTransient.hxx>
//=======================================================================
// Function: Transfer_ActorOfProcessForTransient
// Purpose :
//=======================================================================
Transfer_ActorOfProcessForTransient::Transfer_ActorOfProcessForTransient()
{}
//=================================================================================================
Transfer_ActorOfProcessForTransient::Transfer_ActorOfProcessForTransient() {}
//=======================================================================
// Function: Recognize
// Purpose :
//=======================================================================
Standard_Boolean Transfer_ActorOfProcessForTransient::Recognize(const Handle(Standard_Transient)& /*start*/)
//=================================================================================================
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*/)
//=================================================================================================
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) Transfer_ActorOfProcessForTransient::TransientResult(
const Handle(Standard_Transient)& res) const
{
Handle(Transfer_SimpleBinderOfTransient) binder;
if (res.IsNull()) return 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)
//=================================================================================================
void Transfer_ActorOfProcessForTransient::SetNext(
const Handle(Transfer_ActorOfProcessForTransient)& next)
{
if (thenext == next)
return;
@@ -100,33 +87,23 @@ void Transfer_ActorOfProcessForTransient::SetNext
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
Standard_Boolean Transfer_ActorOfProcessForTransient::IsLast() const
{
return thelast;
}

View File

@@ -11,7 +11,6 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Transfer_ActorOfTransientProcess.hxx>
#include <Transfer_Binder.hxx>
#include <Transfer_ProcessForTransient.hxx>
@@ -19,39 +18,39 @@
#include <Transfer_TransientProcess.hxx>
#include <XSAlgo_ShapeProcessor.hxx>
IMPLEMENT_STANDARD_RTTIEXT(Transfer_ActorOfTransientProcess,Transfer_ActorOfProcessForTransient)
IMPLEMENT_STANDARD_RTTIEXT(Transfer_ActorOfTransientProcess, Transfer_ActorOfProcessForTransient)
Transfer_ActorOfTransientProcess::Transfer_ActorOfTransientProcess()
{}
Transfer_ActorOfTransientProcess::Transfer_ActorOfTransientProcess() {}
//=============================================================================
Handle(Transfer_Binder) Transfer_ActorOfTransientProcess::Transfer
(const Handle(Standard_Transient)& start,
const Handle(Transfer_TransientProcess)& TP,
const Message_ProgressRange& theProgress)
Handle(Transfer_Binder) Transfer_ActorOfTransientProcess::Transfer(
const Handle(Standard_Transient)& start,
const Handle(Transfer_TransientProcess)& TP,
const Message_ProgressRange& theProgress)
{
Handle(Standard_Transient) res = TransferTransient (start,TP, theProgress);
if (res.IsNull()) return NullResult();
return TransientResult (res);
Handle(Standard_Transient) res = TransferTransient(start, TP, theProgress);
if (res.IsNull())
return NullResult();
return TransientResult(res);
}
//=============================================================================
Handle(Transfer_Binder) Transfer_ActorOfTransientProcess::Transferring
(const Handle(Standard_Transient)& ent,
const Handle(Transfer_ProcessForTransient)& TP,
const Message_ProgressRange& theProgress)
Handle(Transfer_Binder) Transfer_ActorOfTransientProcess::Transferring(
const Handle(Standard_Transient)& ent,
const Handle(Transfer_ProcessForTransient)& TP,
const Message_ProgressRange& theProgress)
{
return Transfer(ent,Handle(Transfer_TransientProcess)::DownCast(TP), theProgress);
return Transfer(ent, Handle(Transfer_TransientProcess)::DownCast(TP), theProgress);
}
//=============================================================================
Handle(Standard_Transient) Transfer_ActorOfTransientProcess::TransferTransient
(const Handle(Standard_Transient)& /*ent*/,
const Handle(Transfer_TransientProcess)& /*TP*/,
const Message_ProgressRange& )
Handle(Standard_Transient) Transfer_ActorOfTransientProcess::TransferTransient(
const Handle(Standard_Transient)& /*ent*/,
const Handle(Transfer_TransientProcess)& /*TP*/,
const Message_ProgressRange&)
{
Handle(Standard_Transient) nulres;
return nulres;
@@ -73,8 +72,9 @@ void Transfer_ActorOfTransientProcess::SetShapeFixParameters(ParameterMap&& theP
//=============================================================================
void Transfer_ActorOfTransientProcess::SetShapeFixParameters(const DE_ShapeFixParameters& theParameters,
const ParameterMap& theAdditionalParameters)
void Transfer_ActorOfTransientProcess::SetShapeFixParameters(
const DE_ShapeFixParameters& theParameters,
const ParameterMap& theAdditionalParameters)
{
myShapeProcParams.clear();
XSAlgo_ShapeProcessor::FillParameterMap(theParameters, true, myShapeProcParams);
@@ -89,8 +89,9 @@ void Transfer_ActorOfTransientProcess::SetShapeFixParameters(const DE_ShapeFixPa
//=============================================================================
void Transfer_ActorOfTransientProcess::SetProcessingFlags(const ShapeProcess::OperationsFlags& theFlags)
void Transfer_ActorOfTransientProcess::SetProcessingFlags(
const ShapeProcess::OperationsFlags& theFlags)
{
myShapeProcFlags.first = theFlags;
myShapeProcFlags.first = theFlags;
myShapeProcFlags.second = true;
}

View File

@@ -38,27 +38,27 @@ class Transfer_ActorOfTransientProcess : public Transfer_ActorOfProcessForTransi
public:
using ParameterMap = std::unordered_map<std::string, std::string>;
// Flags defining operations to be performed on shapes. Since there is no std::optional in C++11,
// we use a pair. The first element is the flags, the second element is a boolean value that indicates
// whether the flags were set.
// we use a pair. The first element is the flags, the second element is a boolean value that
// indicates whether the flags were set.
using ProcessingFlags = std::pair<ShapeProcess::OperationsFlags, bool>;
public:
Standard_EXPORT Transfer_ActorOfTransientProcess();
Standard_EXPORT virtual Handle(Transfer_Binder) Transferring
(const Handle(Standard_Transient)& start,
const Handle(Transfer_ProcessForTransient)& TP,
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
Standard_EXPORT virtual Handle(Transfer_Binder) Transfer
(const Handle(Standard_Transient)& start,
const Handle(Transfer_TransientProcess)& TP,
const Message_ProgressRange& theProgress = Message_ProgressRange());
Standard_EXPORT virtual Handle(Standard_Transient) TransferTransient
(const Handle(Standard_Transient)& start,
const Handle(Transfer_TransientProcess)& TP,
const Message_ProgressRange& theProgress = Message_ProgressRange());
Standard_EXPORT virtual Handle(Transfer_Binder) Transferring(
const Handle(Standard_Transient)& start,
const Handle(Transfer_ProcessForTransient)& TP,
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
Standard_EXPORT virtual Handle(Transfer_Binder) Transfer(
const Handle(Standard_Transient)& start,
const Handle(Transfer_TransientProcess)& TP,
const Message_ProgressRange& theProgress = Message_ProgressRange());
Standard_EXPORT virtual Handle(Standard_Transient) TransferTransient(
const Handle(Standard_Transient)& start,
const Handle(Transfer_TransientProcess)& TP,
const Message_ProgressRange& theProgress = Message_ProgressRange());
//! Sets parameters for shape processing.
//! @param theParameters the parameters for shape processing.
@@ -76,7 +76,7 @@ public:
//! @param theParameters the parameters for shape processing.
//! @param theAdditionalParameters the additional parameters for shape processing.
Standard_EXPORT void SetShapeFixParameters(const DE_ShapeFixParameters& theParameters,
const ParameterMap& theAdditionalParameters = {});
const ParameterMap& theAdditionalParameters = {});
//! Returns parameters for shape processing that was set by SetParameters() method.
//! @return the parameters for shape processing. Empty map if no parameters were set.
@@ -87,11 +87,12 @@ public:
Standard_EXPORT void SetProcessingFlags(const ShapeProcess::OperationsFlags& theFlags);
//! Returns flags defining operations to be performed on shapes.
//! @return Pair: the flags defining operations to be performed on shapes and a boolean value that indicates
//! @return Pair: the flags defining operations to be performed on shapes and a boolean value that
//! indicates
//! whether the flags were set.
inline const ProcessingFlags& GetProcessingFlags() const { return myShapeProcFlags; }
DEFINE_STANDARD_RTTIEXT(Transfer_ActorOfTransientProcess,Transfer_ActorOfProcessForTransient)
DEFINE_STANDARD_RTTIEXT(Transfer_ActorOfTransientProcess, Transfer_ActorOfProcessForTransient)
private:
ParameterMap myShapeProcParams; //!< Parameters for shape processing.

View File

@@ -11,7 +11,6 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Geom2d_CartesianPoint.hxx>
#include <Interface_Check.hxx>
#include <Standard_Type.hxx>
@@ -20,65 +19,64 @@
#include <Transfer_TransferFailure.hxx>
#include <Transfer_VoidBinder.hxx>
IMPLEMENT_STANDARD_RTTIEXT(Transfer_Binder,Standard_Transient)
IMPLEMENT_STANDARD_RTTIEXT(Transfer_Binder, Standard_Transient)
//=======================================================================
//function : Transfer_Binder
//purpose :
//=======================================================================
Transfer_Binder::Transfer_Binder ()
{
thestatus = Transfer_StatusVoid;
theexecst = Transfer_StatusInitial;
thecheck = new Interface_Check;
}
//=================================================================================================
//=======================================================================
//function : Merge
//purpose :
//=======================================================================
void Transfer_Binder::Merge (const Handle(Transfer_Binder)& other)
Transfer_Binder::Transfer_Binder()
{
if (other.IsNull()) return;
if ((int) theexecst < (int) other->StatusExec()) theexecst = other->StatusExec();
thecheck->GetMessages (other->Check());
thestatus = Transfer_StatusVoid;
theexecst = Transfer_StatusInitial;
thecheck = new Interface_Check;
}
//=======================================================================
//function : IsMultiple
//purpose :
//=======================================================================
//=================================================================================================
Standard_Boolean Transfer_Binder::IsMultiple () const
void Transfer_Binder::Merge(const Handle(Transfer_Binder)& other)
{
if (thenextr.IsNull()) return Standard_False;
if (!HasResult()) return thenextr->IsMultiple();
if (other.IsNull())
return;
if ((int)theexecst < (int)other->StatusExec())
theexecst = other->StatusExec();
thecheck->GetMessages(other->Check());
}
//=================================================================================================
Standard_Boolean Transfer_Binder::IsMultiple() const
{
if (thenextr.IsNull())
return Standard_False;
if (!HasResult())
return thenextr->IsMultiple();
Handle(Transfer_Binder) next = thenextr;
while (!next.IsNull()) {
if (next->HasResult()) return Standard_True;
while (!next.IsNull())
{
if (next->HasResult())
return Standard_True;
next = next->NextResult();
}
return Standard_False;
}
//=======================================================================
//function : AddResult
//purpose :
//=======================================================================
//=================================================================================================
void Transfer_Binder::AddResult (const Handle(Transfer_Binder)& next)
void Transfer_Binder::AddResult(const Handle(Transfer_Binder)& next)
{
if (next == this || next.IsNull()) return;
if (next == this || next.IsNull())
return;
next->CutResult(this);
if (thenextr.IsNull())
if (thenextr.IsNull())
thenextr = next;
else {
//Modification of recursive to cycle
else
{
// Modification of recursive to cycle
Handle(Transfer_Binder) theBinder = theendr.IsNull() ? thenextr : theendr;
while( theBinder != next ) {
if( theBinder->NextResult().IsNull() ) {
while (theBinder != next)
{
if (theBinder->NextResult().IsNull())
{
theBinder->AddResult(next);
theendr = next;
return;
@@ -89,24 +87,24 @@ void Transfer_Binder::AddResult (const Handle(Transfer_Binder)& next)
}
}
//=======================================================================
//function : CutResult
//purpose :
//=======================================================================
//=================================================================================================
void Transfer_Binder::CutResult (const Handle(Transfer_Binder)& next)
void Transfer_Binder::CutResult(const Handle(Transfer_Binder)& next)
{
if (thenextr.IsNull()) return;
if (thenextr.IsNull())
return;
if (thenextr == next)
{
thenextr.Nullify();
theendr.Nullify();
}
//else thenextr->CutResult (next);
else {
// else thenextr->CutResult (next);
else
{
Handle(Transfer_Binder) currBinder = thenextr, currNext;
while( !( (currNext = currBinder->NextResult()) == next ) ) {
if( currNext.IsNull() )
while (!((currNext = currBinder->NextResult()) == next))
{
if (currNext.IsNull())
return;
currBinder = currNext;
}
@@ -114,119 +112,92 @@ void Transfer_Binder::CutResult (const Handle(Transfer_Binder)& next)
}
}
//=======================================================================
//function : NextResult
//purpose :
//=======================================================================
//=================================================================================================
Handle(Transfer_Binder) Transfer_Binder::NextResult () const
{ return thenextr; }
//=======================================================================
//function : SetResultPresent
//purpose :
//=======================================================================
void Transfer_Binder::SetResultPresent ()
Handle(Transfer_Binder) Transfer_Binder::NextResult() const
{
if (thestatus == Transfer_StatusUsed) throw Transfer_TransferFailure("Binder : SetResult, Result is Already Set and Used");
return thenextr;
}
//=================================================================================================
void Transfer_Binder::SetResultPresent()
{
if (thestatus == Transfer_StatusUsed)
throw Transfer_TransferFailure("Binder : SetResult, Result is Already Set and Used");
theexecst = Transfer_StatusDone;
thestatus = Transfer_StatusDefined;
}
//=======================================================================
//function : HasResult
//purpose :
//=======================================================================
//=================================================================================================
Standard_Boolean Transfer_Binder::HasResult () const
{ return (thestatus != Transfer_StatusVoid); }
Standard_Boolean Transfer_Binder::HasResult() const
{
return (thestatus != Transfer_StatusVoid);
}
//=======================================================================
//function : SetAlreadyUsed
//purpose :
//=======================================================================
//=================================================================================================
void Transfer_Binder::SetAlreadyUsed ()
{ if (thestatus != Transfer_StatusVoid) thestatus = Transfer_StatusUsed; }
void Transfer_Binder::SetAlreadyUsed()
{
if (thestatus != Transfer_StatusVoid)
thestatus = Transfer_StatusUsed;
}
//=================================================================================================
//=======================================================================
//function : Status
//purpose :
//=======================================================================
Transfer_StatusResult Transfer_Binder::Status () const
{ return thestatus; }
Transfer_StatusResult Transfer_Binder::Status() const
{
return thestatus;
}
// ############ Checks ############
//=======================================================================
//function : StatusExec
//purpose :
//=======================================================================
//=================================================================================================
Transfer_StatusExec Transfer_Binder::StatusExec () const
{ return theexecst; }
Transfer_StatusExec Transfer_Binder::StatusExec() const
{
return theexecst;
}
//=======================================================================
//function : SetStatusExec
//purpose :
//=======================================================================
//=================================================================================================
void Transfer_Binder::SetStatusExec (const Transfer_StatusExec stat)
{ theexecst = stat; }
void Transfer_Binder::SetStatusExec(const Transfer_StatusExec stat)
{
theexecst = stat;
}
//=======================================================================
//function : AddFail
//purpose :
//=======================================================================
//=================================================================================================
void Transfer_Binder::AddFail
(const Standard_CString mess, const Standard_CString orig)
void Transfer_Binder::AddFail(const Standard_CString mess, const Standard_CString orig)
{
theexecst = Transfer_StatusError;
thecheck->AddFail(mess,orig);
thecheck->AddFail(mess, orig);
}
//=======================================================================
//function : AddWarning
//purpose :
//=======================================================================
//=================================================================================================
void Transfer_Binder::AddWarning
(const Standard_CString mess, const Standard_CString orig)
void Transfer_Binder::AddWarning(const Standard_CString mess, const Standard_CString orig)
{
// theexecst = Transfer_StatusError;
thecheck->AddWarning(mess,orig);
// theexecst = Transfer_StatusError;
thecheck->AddWarning(mess, orig);
}
//=======================================================================
//function : Check
//purpose :
//=======================================================================
//=================================================================================================
const Handle(Interface_Check) Transfer_Binder::Check () const
const Handle(Interface_Check) Transfer_Binder::Check() const
{
return thecheck;
}
//=======================================================================
//function : CCheck
//purpose :
//=======================================================================
//=================================================================================================
Handle(Interface_Check) Transfer_Binder::CCheck ()
Handle(Interface_Check) Transfer_Binder::CCheck()
{
return thecheck;
}
//=======================================================================
//function : Destructor
//purpose :
//=======================================================================
//=================================================================================================
Transfer_Binder::~Transfer_Binder()
{
@@ -242,7 +213,7 @@ Transfer_Binder::~Transfer_Binder()
while (!aCurr->thenextr.IsNull() && aCurr->thenextr->GetRefCount() == 1)
{
Handle(Transfer_Binder) aPrev = aCurr;
aCurr = aCurr->thenextr;
aCurr = aCurr->thenextr;
aPrev->thenextr.Nullify();
}
}

View File

@@ -59,55 +59,53 @@ class Transfer_Binder : public Standard_Transient
{
public:
//! Merges basic data (Check, ExecStatus) from another Binder but
//! keeps its result. Used when a binder is replaced by another
//! one, this allows to keep messages
Standard_EXPORT void Merge (const Handle(Transfer_Binder)& other);
Standard_EXPORT void Merge(const Handle(Transfer_Binder)& other);
//! Returns True if a Binder has several results, either by itself
//! or because it has next results
//! Can be defined by sub-classes.
Standard_EXPORT virtual Standard_Boolean IsMultiple() const;
//! Returns the Type which characterizes the Result (if known)
Standard_EXPORT virtual Handle(Standard_Type) ResultType() const = 0;
//! Returns the Name of the Type which characterizes the Result
//! Can be returned even if ResultType itself is unknown
Standard_EXPORT virtual Standard_CString ResultTypeName() const = 0;
//! Adds a next result (at the end of the list)
//! Remark : this information is not processed by Merge
Standard_EXPORT void AddResult (const Handle(Transfer_Binder)& next);
Standard_EXPORT void AddResult(const Handle(Transfer_Binder)& next);
//! Returns the next result, Null if none
Standard_EXPORT Handle(Transfer_Binder) NextResult() const;
//! Returns True if a Result is available (StatusResult = Defined)
//! A Unique Result will be gotten by Result (which must be
//! defined in each sub-class according to result type)
//! For a Multiple Result, see class MultipleBinder
//! For other case, specific access has to be forecast
Standard_EXPORT Standard_Boolean HasResult() const;
//! Declares that result is now used by another one, it means that
//! it cannot be modified (by Rebind)
Standard_EXPORT void SetAlreadyUsed();
//! Returns status, which can be Initial (not yet done), Made (a
//! result is recorded, not yet shared), Used (it is shared and
//! cannot be modified)
Standard_EXPORT Transfer_StatusResult Status() const;
//! Returns execution status
Standard_EXPORT Transfer_StatusExec StatusExec() const;
//! Modifies execution status; called by TransferProcess only
//! (for StatusError, rather use SetError, below)
Standard_EXPORT void SetStatusExec (const Transfer_StatusExec stat);
Standard_EXPORT void SetStatusExec(const Transfer_StatusExec stat);
//! Used to declare an individual transfer as being erroneous
//! (Status is set to Void, StatusExec is set to Error, <errmess>
//! is added to Check's list of Fails)
@@ -116,16 +114,16 @@ public:
//! It has same effect for TransferProcess as raising an exception
//! during the operation of Transfer, except the Transfer tries to
//! continue (as if ErrorHandle had been set)
Standard_EXPORT void AddFail (const Standard_CString mess, const Standard_CString orig = "");
Standard_EXPORT void AddFail(const Standard_CString mess, const Standard_CString orig = "");
//! Used to attach a Warning Message to an individual Transfer
//! It has no effect on the Status
Standard_EXPORT void AddWarning (const Standard_CString mess, const Standard_CString orig = "");
Standard_EXPORT void AddWarning(const Standard_CString mess, const Standard_CString orig = "");
//! Returns Check which stores Fail messages
//! Note that no Entity is associated in this Check
Standard_EXPORT const Handle(Interface_Check) Check() const;
//! Returns Check which stores Fail messages, in order to modify
//! it (adding messages, or replacing it)
Standard_EXPORT Handle(Interface_Check) CCheck();
@@ -133,14 +131,12 @@ public:
//! Destructor
Standard_EXPORT ~Transfer_Binder();
DEFINE_STANDARD_RTTIEXT(Transfer_Binder,Standard_Transient)
DEFINE_STANDARD_RTTIEXT(Transfer_Binder, Standard_Transient)
protected:
//! Sets fields at initial values
Standard_EXPORT Transfer_Binder();
//! Used to declare that a result is recorded for an individual
//! transfer (works by setting StatusResult to Defined)
//!
@@ -149,27 +145,15 @@ protected:
//! senseless if called isolately
Standard_EXPORT void SetResultPresent();
private:
//! Called by AddResult, to keep unicity of each item in the list
Standard_EXPORT void CutResult (const Handle(Transfer_Binder)& next);
Standard_EXPORT void CutResult(const Handle(Transfer_Binder)& next);
Transfer_StatusResult thestatus;
Transfer_StatusExec theexecst;
Transfer_StatusResult thestatus;
Transfer_StatusExec theexecst;
Handle(Interface_Check) thecheck;
Handle(Transfer_Binder) thenextr;
Handle(Transfer_Binder) theendr;
};
#endif // _Transfer_Binder_HeaderFile

View File

@@ -11,18 +11,22 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Standard_Type.hxx>
#include <Transfer_BinderOfTransientInteger.hxx>
IMPLEMENT_STANDARD_RTTIEXT(Transfer_BinderOfTransientInteger,Transfer_SimpleBinderOfTransient)
IMPLEMENT_STANDARD_RTTIEXT(Transfer_BinderOfTransientInteger, Transfer_SimpleBinderOfTransient)
Transfer_BinderOfTransientInteger::Transfer_BinderOfTransientInteger ()
: theintval (0) { }
Transfer_BinderOfTransientInteger::Transfer_BinderOfTransientInteger()
: theintval(0)
{
}
void Transfer_BinderOfTransientInteger::SetInteger
(const Standard_Integer val)
{ theintval = val; }
void Transfer_BinderOfTransientInteger::SetInteger(const Standard_Integer val)
{
theintval = val;
}
Standard_Integer Transfer_BinderOfTransientInteger::Integer () const
{ return theintval; }
Standard_Integer Transfer_BinderOfTransientInteger::Integer() const
{
return theintval;
}

View File

@@ -23,7 +23,6 @@
#include <Standard_Integer.hxx>
#include <Transfer_SimpleBinderOfTransient.hxx>
class Transfer_BinderOfTransientInteger;
DEFINE_STANDARD_HANDLE(Transfer_BinderOfTransientInteger, Transfer_SimpleBinderOfTransient)
@@ -37,40 +36,21 @@ class Transfer_BinderOfTransientInteger : public Transfer_SimpleBinderOfTransien
{
public:
//! Creates an empty BinderOfTransientInteger; Default value for
//! the integer part is zero
Standard_EXPORT Transfer_BinderOfTransientInteger();
//! Sets a value for the integer part
Standard_EXPORT void SetInteger (const Standard_Integer value);
Standard_EXPORT void SetInteger(const Standard_Integer value);
//! Returns the value set for the integer part
Standard_EXPORT Standard_Integer Integer() const;
DEFINE_STANDARD_RTTIEXT(Transfer_BinderOfTransientInteger,Transfer_SimpleBinderOfTransient)
DEFINE_STANDARD_RTTIEXT(Transfer_BinderOfTransientInteger, Transfer_SimpleBinderOfTransient)
protected:
private:
Standard_Integer theintval;
};
#endif // _Transfer_BinderOfTransientInteger_HeaderFile

View File

@@ -11,14 +11,15 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Standard_Transient.hxx>
#include <Transfer_DataInfo.hxx>
Handle(Standard_Type) Transfer_DataInfo::Type
(const Handle(Standard_Transient)& ent)
{ return ent->DynamicType(); }
Handle(Standard_Type) Transfer_DataInfo::Type(const Handle(Standard_Transient)& ent)
{
return ent->DynamicType();
}
Standard_CString Transfer_DataInfo::TypeName
(const Handle(Standard_Transient)& ent)
{ return ent->DynamicType()->Name(); }
Standard_CString Transfer_DataInfo::TypeName(const Handle(Standard_Transient)& ent)
{
return ent->DynamicType()->Name();
}

View File

@@ -24,46 +24,24 @@
#include <Standard_Type.hxx>
class Standard_Transient;
//! Gives information on an object
//! Used as template to instantiate Mapper and SimpleBinder
//! This class is for Transient
class Transfer_DataInfo
class Transfer_DataInfo
{
public:
DEFINE_STANDARD_ALLOC
//! Returns the Type attached to an object
//! Here, the Dynamic Type of a Transient. Null Type if unknown
Standard_EXPORT static Handle(Standard_Type) Type (const Handle(Standard_Transient)& ent);
Standard_EXPORT static Handle(Standard_Type) Type(const Handle(Standard_Transient)& ent);
//! Returns Type Name (string)
//! Allows to name type of non-handled objects
Standard_EXPORT static Standard_CString TypeName (const Handle(Standard_Transient)& ent);
Standard_EXPORT static Standard_CString TypeName(const Handle(Standard_Transient)& ent);
protected:
private:
};
#endif // _Transfer_DataInfo_HeaderFile

View File

@@ -11,39 +11,45 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Interface_InterfaceModel.hxx>
#include <Standard_Transient.hxx>
#include <Standard_Type.hxx>
#include <Transfer_DispatchControl.hxx>
#include <Transfer_TransientProcess.hxx>
IMPLEMENT_STANDARD_RTTIEXT(Transfer_DispatchControl,Interface_CopyControl)
IMPLEMENT_STANDARD_RTTIEXT(Transfer_DispatchControl, Interface_CopyControl)
Transfer_DispatchControl::Transfer_DispatchControl
(const Handle(Interface_InterfaceModel)& model,
const Handle(Transfer_TransientProcess)& TP)
{ themodel = model; theTP = TP; }
Transfer_DispatchControl::Transfer_DispatchControl(const Handle(Interface_InterfaceModel)& model,
const Handle(Transfer_TransientProcess)& TP)
{
themodel = model;
theTP = TP;
}
const Handle(Transfer_TransientProcess)& Transfer_DispatchControl::TransientProcess() const
{
return theTP;
}
const Handle(Transfer_TransientProcess)&
Transfer_DispatchControl::TransientProcess () const
{ return theTP; }
const Handle(Interface_InterfaceModel)& Transfer_DispatchControl::StartingModel() const
{
return themodel;
}
const Handle(Interface_InterfaceModel)&
Transfer_DispatchControl::StartingModel () const
{ return themodel; }
void Transfer_DispatchControl::Clear()
{
theTP->Clear();
}
void Transfer_DispatchControl::Clear () { theTP->Clear(); }
void Transfer_DispatchControl::Bind(const Handle(Standard_Transient)& ent,
const Handle(Standard_Transient)& res)
{
theTP->BindTransient(ent, res);
}
void Transfer_DispatchControl::Bind
(const Handle(Standard_Transient)& ent,
const Handle(Standard_Transient)& res)
{ theTP->BindTransient(ent,res); }
Standard_Boolean Transfer_DispatchControl::Search
(const Handle(Standard_Transient)& ent,
Handle(Standard_Transient)&res) const
{ res = theTP->FindTransient(ent); return !res.IsNull(); }
Standard_Boolean Transfer_DispatchControl::Search(const Handle(Standard_Transient)& ent,
Handle(Standard_Transient)& res) const
{
res = theTP->FindTransient(ent);
return !res.IsNull();
}

View File

@@ -25,7 +25,6 @@ class Transfer_TransientProcess;
class Interface_InterfaceModel;
class Standard_Transient;
class Transfer_DispatchControl;
DEFINE_STANDARD_HANDLE(Transfer_DispatchControl, Interface_CopyControl)
@@ -37,52 +36,36 @@ class Transfer_DispatchControl : public Interface_CopyControl
{
public:
//! Creates the DispatchControl, ready for use
Standard_EXPORT Transfer_DispatchControl(const Handle(Interface_InterfaceModel)& model, const Handle(Transfer_TransientProcess)& TP);
Standard_EXPORT Transfer_DispatchControl(const Handle(Interface_InterfaceModel)& model,
const Handle(Transfer_TransientProcess)& TP);
//! Returns the content of the DispatchControl : it can be used
//! for a direct call, if the basic methods do not suffice
Standard_EXPORT const Handle(Transfer_TransientProcess)& TransientProcess() const;
//! Returns the Model from which the transfer is to be done
Standard_EXPORT const Handle(Interface_InterfaceModel)& StartingModel() const;
//! Clears the List of Copied Results
Standard_EXPORT void Clear() Standard_OVERRIDE;
//! Binds a (Transient) Result to a (Transient) Starting Entity
Standard_EXPORT void Bind (const Handle(Standard_Transient)& ent, const Handle(Standard_Transient)& res) Standard_OVERRIDE;
Standard_EXPORT void Bind(const Handle(Standard_Transient)& ent,
const Handle(Standard_Transient)& res) Standard_OVERRIDE;
//! Searches for the Result bound to a Starting Entity
//! If Found, returns True and fills <res>
//! Else, returns False and nullifies <res>
Standard_EXPORT Standard_Boolean Search (const Handle(Standard_Transient)& ent, Handle(Standard_Transient)& res) const Standard_OVERRIDE;
Standard_EXPORT Standard_Boolean Search(const Handle(Standard_Transient)& ent,
Handle(Standard_Transient)& res) const Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(Transfer_DispatchControl,Interface_CopyControl)
DEFINE_STANDARD_RTTIEXT(Transfer_DispatchControl, Interface_CopyControl)
protected:
private:
Handle(Transfer_TransientProcess) theTP;
Handle(Interface_InterfaceModel) themodel;
Handle(Interface_InterfaceModel) themodel;
};
#endif // _Transfer_DispatchControl_HeaderFile

View File

@@ -39,13 +39,12 @@ public:
//! Returns True if two keys are the same.
//! The test does not work on the Finders themselves but by
//! calling their methods Equates
bool operator() (const Handle(Transfer_Finder)& theK1,
const Handle(Transfer_Finder)& theK2) const
bool operator()(const Handle(Transfer_Finder)& theK1, const Handle(Transfer_Finder)& theK2) const
{
if (theK1.IsNull()) return false;
if (theK1.IsNull())
return false;
return theK1->Equates(theK2);
}
};
#endif // _Transfer_FindHasher_HeaderFile

View File

@@ -11,7 +11,6 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Geom2d_CartesianPoint.hxx>
#include <Interface_IntVal.hxx>
#include <Standard_Transient.hxx>
@@ -19,63 +18,82 @@
#include <TCollection_HAsciiString.hxx>
#include <Transfer_Finder.hxx>
IMPLEMENT_STANDARD_RTTIEXT(Transfer_Finder,Standard_Transient)
IMPLEMENT_STANDARD_RTTIEXT(Transfer_Finder, Standard_Transient)
void Transfer_Finder::SetHashCode (const size_t code)
{ thecode = code; }
void Transfer_Finder::SetHashCode(const size_t code)
{
thecode = code;
}
size_t Transfer_Finder::GetHashCode () const
{ return thecode; }
size_t Transfer_Finder::GetHashCode() const
{
return thecode;
}
Handle(Standard_Type) Transfer_Finder::ValueType () const
{ return DynamicType(); }
Standard_CString Transfer_Finder::ValueTypeName () const
{ return "(finder)"; }
Handle(Standard_Type) Transfer_Finder::ValueType() const
{
return DynamicType();
}
Standard_CString Transfer_Finder::ValueTypeName() const
{
return "(finder)";
}
// #### ATTRIBUTES ####
// Integer -> IntVal, Real -> Geom2d_CartesianPoint, CString -> HAsciiString
void Transfer_Finder::SetAttribute
(const Standard_CString name, const Handle(Standard_Transient)& val)
void Transfer_Finder::SetAttribute(const Standard_CString name,
const Handle(Standard_Transient)& val)
{
theattrib.Bind(name,val);
theattrib.Bind(name, val);
}
Standard_Boolean Transfer_Finder::RemoveAttribute
(const Standard_CString name)
Standard_Boolean Transfer_Finder::RemoveAttribute(const Standard_CString name)
{
if (theattrib.IsEmpty()) return Standard_False;
return theattrib.UnBind (name);
if (theattrib.IsEmpty())
return Standard_False;
return theattrib.UnBind(name);
}
Standard_Boolean Transfer_Finder::GetAttribute
(const Standard_CString name, const Handle(Standard_Type)& type,
Handle(Standard_Transient)& val) const
Standard_Boolean Transfer_Finder::GetAttribute(const Standard_CString name,
const Handle(Standard_Type)& type,
Handle(Standard_Transient)& val) const
{
if (theattrib.IsEmpty()) { val.Nullify(); return Standard_False; }
if (!theattrib.Find(name, val)) { val.Nullify(); return Standard_False; }
if (!val->IsKind(type)) { val.Nullify(); return Standard_False; }
if (theattrib.IsEmpty())
{
val.Nullify();
return Standard_False;
}
if (!theattrib.Find(name, val))
{
val.Nullify();
return Standard_False;
}
if (!val->IsKind(type))
{
val.Nullify();
return Standard_False;
}
return Standard_True;
}
Handle(Standard_Transient) Transfer_Finder::Attribute
(const Standard_CString name) const
Handle(Standard_Transient) Transfer_Finder::Attribute(const Standard_CString name) const
{
Handle(Standard_Transient) atr;
if (theattrib.IsEmpty()) return atr;
if (!theattrib.Find(name, atr)) atr.Nullify();
if (theattrib.IsEmpty())
return atr;
if (!theattrib.Find(name, atr))
atr.Nullify();
return atr;
}
Interface_ParamType Transfer_Finder::AttributeType
(const Standard_CString name) const
Interface_ParamType Transfer_Finder::AttributeType(const Standard_CString name) const
{
Handle(Standard_Transient) atr = Attribute(name);
if (atr.IsNull()) return Interface_ParamVoid;
if (atr.IsNull())
return Interface_ParamVoid;
if (atr->DynamicType() == STANDARD_TYPE(Interface_IntVal))
return Interface_ParamInteger;
if (atr->DynamicType() == STANDARD_TYPE(Geom2d_CartesianPoint))
@@ -85,130 +103,148 @@ void Transfer_Finder::SetHashCode (const size_t code)
return Interface_ParamIdent;
}
void Transfer_Finder::SetIntegerAttribute
(const Standard_CString name, const Standard_Integer val)
void Transfer_Finder::SetIntegerAttribute(const Standard_CString name, const Standard_Integer val)
{
Handle(Interface_IntVal) ival = new Interface_IntVal;
ival->CValue() = val;
SetAttribute (name, ival);
ival->CValue() = val;
SetAttribute(name, ival);
}
Standard_Boolean Transfer_Finder::GetIntegerAttribute
(const Standard_CString name, Standard_Integer& val) const
Standard_Boolean Transfer_Finder::GetIntegerAttribute(const Standard_CString name,
Standard_Integer& val) const
{
Handle(Interface_IntVal) ival = Handle(Interface_IntVal)::DownCast
(Attribute(name));
if (ival.IsNull()) { val = 0; return Standard_False; }
Handle(Interface_IntVal) ival = Handle(Interface_IntVal)::DownCast(Attribute(name));
if (ival.IsNull())
{
val = 0;
return Standard_False;
}
val = ival->Value();
return Standard_True;
}
Standard_Integer Transfer_Finder::IntegerAttribute
(const Standard_CString name) const
Standard_Integer Transfer_Finder::IntegerAttribute(const Standard_CString name) const
{
Handle(Interface_IntVal) ival = Handle(Interface_IntVal)::DownCast
(Attribute(name));
if (ival.IsNull()) return 0;
Handle(Interface_IntVal) ival = Handle(Interface_IntVal)::DownCast(Attribute(name));
if (ival.IsNull())
return 0;
return ival->Value();
}
void Transfer_Finder::SetRealAttribute
(const Standard_CString name, const Standard_Real val)
void Transfer_Finder::SetRealAttribute(const Standard_CString name, const Standard_Real val)
{
Handle(Geom2d_CartesianPoint) rval = new Geom2d_CartesianPoint (val,0);
SetAttribute (name,rval);
Handle(Geom2d_CartesianPoint) rval = new Geom2d_CartesianPoint(val, 0);
SetAttribute(name, rval);
}
Standard_Boolean Transfer_Finder::GetRealAttribute
(const Standard_CString name, Standard_Real& val) const
Standard_Boolean Transfer_Finder::GetRealAttribute(const Standard_CString name,
Standard_Real& val) const
{
Handle(Geom2d_CartesianPoint) rval = Handle(Geom2d_CartesianPoint)::DownCast
(Attribute(name));
if (rval.IsNull()) { val = 0.0; return Standard_False; }
Handle(Geom2d_CartesianPoint) rval = Handle(Geom2d_CartesianPoint)::DownCast(Attribute(name));
if (rval.IsNull())
{
val = 0.0;
return Standard_False;
}
val = rval->X();
return Standard_True;
}
Standard_Real Transfer_Finder::RealAttribute (const Standard_CString name) const
Standard_Real Transfer_Finder::RealAttribute(const Standard_CString name) const
{
Handle(Geom2d_CartesianPoint) rval = Handle(Geom2d_CartesianPoint)::DownCast
(Attribute(name));
if (rval.IsNull()) return 0;
Handle(Geom2d_CartesianPoint) rval = Handle(Geom2d_CartesianPoint)::DownCast(Attribute(name));
if (rval.IsNull())
return 0;
return rval->X();
}
void Transfer_Finder::SetStringAttribute
(const Standard_CString name, const Standard_CString val)
void Transfer_Finder::SetStringAttribute(const Standard_CString name, const Standard_CString val)
{
Handle(TCollection_HAsciiString) hval = new TCollection_HAsciiString (val);
SetAttribute (name,hval);
Handle(TCollection_HAsciiString) hval = new TCollection_HAsciiString(val);
SetAttribute(name, hval);
}
Standard_Boolean Transfer_Finder::GetStringAttribute
(const Standard_CString name, Standard_CString& val) const
Standard_Boolean Transfer_Finder::GetStringAttribute(const Standard_CString name,
Standard_CString& val) const
{
Handle(TCollection_HAsciiString) hval = Handle(TCollection_HAsciiString)::DownCast
(Attribute(name));
if (hval.IsNull()) { val = ""; return Standard_False; }
Handle(TCollection_HAsciiString) hval =
Handle(TCollection_HAsciiString)::DownCast(Attribute(name));
if (hval.IsNull())
{
val = "";
return Standard_False;
}
val = hval->ToCString();
return Standard_True;
}
Standard_CString Transfer_Finder::StringAttribute (const Standard_CString name) const
Standard_CString Transfer_Finder::StringAttribute(const Standard_CString name) const
{
Handle(TCollection_HAsciiString) hval = Handle(TCollection_HAsciiString)::DownCast
(Attribute(name));
if (hval.IsNull()) return "";
Handle(TCollection_HAsciiString) hval =
Handle(TCollection_HAsciiString)::DownCast(Attribute(name));
if (hval.IsNull())
return "";
return hval->ToCString();
}
NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)>& Transfer_Finder::AttrList ()
{ return theattrib; }
void Transfer_Finder::SameAttributes (const Handle(Transfer_Finder)& other)
{ if (!other.IsNull()) theattrib = other->AttrList(); }
void Transfer_Finder::GetAttributes
(const Handle(Transfer_Finder)& other,
const Standard_CString fromname, const Standard_Boolean copied)
NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)>& Transfer_Finder::
AttrList()
{
if (other.IsNull()) return;
NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)>& list = other->AttrList();
if (list.IsEmpty()) return;
return theattrib;
}
void Transfer_Finder::SameAttributes(const Handle(Transfer_Finder)& other)
{
if (!other.IsNull())
theattrib = other->AttrList();
}
void Transfer_Finder::GetAttributes(const Handle(Transfer_Finder)& other,
const Standard_CString fromname,
const Standard_Boolean copied)
{
if (other.IsNull())
return;
NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)>& list =
other->AttrList();
if (list.IsEmpty())
return;
NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)>::Iterator iter(list);
for (; iter.More(); iter.Next()) {
for (; iter.More(); iter.Next())
{
const TCollection_AsciiString& name = iter.Key();
if (!name.StartsWith(fromname)) continue;
const Handle(Standard_Transient)& atr = iter.Value();
Handle(Standard_Transient) newatr = atr;
if (!name.StartsWith(fromname))
continue;
const Handle(Standard_Transient)& atr = iter.Value();
Handle(Standard_Transient) newatr = atr;
// Copy ? according type
if (copied) {
// Copy ? according type
if (copied)
{
Handle(Interface_IntVal) ival = Handle(Interface_IntVal)::DownCast(atr);
if (!ival.IsNull()) {
Standard_Integer intval = ival->Value();
ival = new Interface_IntVal;
ival->CValue() = intval;
newatr = ival;
if (!ival.IsNull())
{
Standard_Integer intval = ival->Value();
ival = new Interface_IntVal;
ival->CValue() = intval;
newatr = ival;
}
Handle(Geom2d_CartesianPoint) rval = Handle(Geom2d_CartesianPoint)::DownCast(atr);
if (!rval.IsNull()) {
Standard_Real realval = rval->X();
rval = new Geom2d_CartesianPoint (realval,0);
newatr = rval;
if (!rval.IsNull())
{
Standard_Real realval = rval->X();
rval = new Geom2d_CartesianPoint(realval, 0);
newatr = rval;
}
Handle(TCollection_HAsciiString) hval = Handle(TCollection_HAsciiString)::DownCast(atr);
if (!hval.IsNull()) {
Handle(TCollection_HAsciiString) strval = new TCollection_HAsciiString
(hval->ToCString());
newatr = strval;
if (!hval.IsNull())
{
Handle(TCollection_HAsciiString) strval = new TCollection_HAsciiString(hval->ToCString());
newatr = strval;
}
}
theattrib.Bind(name,newatr);
theattrib.Bind(name, newatr);
}
}

View File

@@ -26,8 +26,6 @@
#include <Interface_ParamType.hxx>
#include <TCollection_AsciiString.hxx>
class Transfer_Finder;
DEFINE_STANDARD_HANDLE(Transfer_Finder, Standard_Transient)
@@ -40,94 +38,99 @@ class Transfer_Finder : public Standard_Transient
{
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 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
//! their contents must be compared
Standard_EXPORT virtual Standard_Boolean Equates (const Handle(Transfer_Finder)& other) const = 0;
Standard_EXPORT virtual Standard_Boolean Equates(const Handle(Transfer_Finder)& other) const = 0;
//! Returns the Type of the Value. By default, returns the
//! DynamicType of <me>, but can be redefined
Standard_EXPORT virtual Handle(Standard_Type) ValueType() const;
//! Returns the name of the Type of the Value. Default is name
//! of ValueType, unless it is for a non-handled object
Standard_EXPORT virtual Standard_CString ValueTypeName() const;
//! Adds an attribute with a given name (replaces the former one
//! with the same name if already exists)
Standard_EXPORT void SetAttribute (const Standard_CString name, const Handle(Standard_Transient)& val);
Standard_EXPORT void SetAttribute(const Standard_CString name,
const Handle(Standard_Transient)& val);
//! Removes an attribute
//! Returns True when done, False if this attribute did not exist
Standard_EXPORT Standard_Boolean RemoveAttribute (const Standard_CString name);
Standard_EXPORT Standard_Boolean RemoveAttribute(const Standard_CString name);
//! Returns an attribute from its name, filtered by a type
//! If no attribute has this name, or if it is not kind of this
//! type, <val> is Null and returned value is False
//! Else, it is True
Standard_EXPORT Standard_Boolean GetAttribute (const Standard_CString name, const Handle(Standard_Type)& type, Handle(Standard_Transient)& val) const;
Standard_EXPORT Standard_Boolean GetAttribute(const Standard_CString name,
const Handle(Standard_Type)& type,
Handle(Standard_Transient)& val) const;
//! Returns an attribute from its name. Null Handle if not recorded
//! (whatever Transient, Integer, Real ...)
Standard_EXPORT Handle(Standard_Transient) Attribute (const Standard_CString name) const;
Standard_EXPORT Handle(Standard_Transient) Attribute(const Standard_CString name) const;
//! Returns the type of an attribute :
//! ParamInt , ParamReal , ParamText (String) , ParamIdent (any)
//! or ParamVoid (not recorded)
Standard_EXPORT Interface_ParamType AttributeType (const Standard_CString name) const;
Standard_EXPORT Interface_ParamType AttributeType(const Standard_CString name) const;
//! Adds an integer value for an attribute
Standard_EXPORT void SetIntegerAttribute (const Standard_CString name, const Standard_Integer val);
Standard_EXPORT void SetIntegerAttribute(const Standard_CString name, const Standard_Integer val);
//! Returns an attribute from its name, as integer
//! If no attribute has this name, or not an integer,
//! <val> is 0 and returned value is False
//! Else, it is True
Standard_EXPORT Standard_Boolean GetIntegerAttribute (const Standard_CString name, Standard_Integer& val) const;
Standard_EXPORT Standard_Boolean GetIntegerAttribute(const Standard_CString name,
Standard_Integer& val) const;
//! Returns an integer attribute from its name. 0 if not recorded
Standard_EXPORT Standard_Integer IntegerAttribute (const Standard_CString name) const;
Standard_EXPORT Standard_Integer IntegerAttribute(const Standard_CString name) const;
//! Adds a real value for an attribute
Standard_EXPORT void SetRealAttribute (const Standard_CString name, const Standard_Real val);
Standard_EXPORT void SetRealAttribute(const Standard_CString name, const Standard_Real val);
//! Returns an attribute from its name, as real
//! If no attribute has this name, or not a real
//! <val> is 0.0 and returned value is False
//! Else, it is True
Standard_EXPORT Standard_Boolean GetRealAttribute (const Standard_CString name, Standard_Real& val) const;
Standard_EXPORT Standard_Boolean GetRealAttribute(const Standard_CString name,
Standard_Real& val) const;
//! Returns a real attribute from its name. 0.0 if not recorded
Standard_EXPORT Standard_Real RealAttribute (const Standard_CString name) const;
Standard_EXPORT Standard_Real RealAttribute(const Standard_CString name) const;
//! Adds a String value for an attribute
Standard_EXPORT void SetStringAttribute (const Standard_CString name, const Standard_CString val);
Standard_EXPORT void SetStringAttribute(const Standard_CString name, const Standard_CString val);
//! Returns an attribute from its name, as String
//! If no attribute has this name, or not a String
//! <val> is 0.0 and returned value is False
//! Else, it is True
Standard_EXPORT Standard_Boolean GetStringAttribute (const Standard_CString name, Standard_CString& val) const;
Standard_EXPORT Standard_Boolean GetStringAttribute(const Standard_CString name,
Standard_CString& val) const;
//! Returns a String attribute from its name. "" if not recorded
Standard_EXPORT Standard_CString StringAttribute (const Standard_CString name) const;
Standard_EXPORT Standard_CString StringAttribute(const Standard_CString name) const;
//! Returns the exhaustive list of attributes
Standard_EXPORT NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)>& AttrList();
Standard_EXPORT NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)>&
AttrList();
//! Gets the list of attributes from <other>, as such, i.e.
//! not copied : attributes are shared, any attribute edited,
//! added, or removed in <other> is also in <me> and vice versa
//! The former list of attributes of <me> is dropped
Standard_EXPORT void SameAttributes (const Handle(Transfer_Finder)& other);
Standard_EXPORT void SameAttributes(const Handle(Transfer_Finder)& other);
//! Gets the list of attributes from <other>, by copying it
//! By default, considers all the attributes from <other>
//! If <fromname> is given, considers only the attributes with
@@ -139,35 +142,20 @@ public:
//!
//! These new attributes are added to the existing ones in <me>,
//! in case of same name, they replace the existing ones
Standard_EXPORT void GetAttributes (const Handle(Transfer_Finder)& other, const Standard_CString fromname = "", const Standard_Boolean copied = Standard_True);
Standard_EXPORT void GetAttributes(const Handle(Transfer_Finder)& other,
const Standard_CString fromname = "",
const Standard_Boolean copied = Standard_True);
DEFINE_STANDARD_RTTIEXT(Transfer_Finder,Standard_Transient)
DEFINE_STANDARD_RTTIEXT(Transfer_Finder, Standard_Transient)
protected:
//! Stores the HashCode which corresponds to the Value given to
//! create the Mapper
Standard_EXPORT void SetHashCode (const size_t code);
Standard_EXPORT void SetHashCode(const size_t code);
private:
size_t thecode;
size_t thecode;
NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)> theattrib;
};
#endif // _Transfer_Finder_HeaderFile

View File

@@ -11,81 +11,97 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Interface_Check.hxx>
#include <Interface_MSG.hxx>
#include <Transfer_FinderProcess.hxx>
#include <Transfer_TransientMapper.hxx>
IMPLEMENT_STANDARD_RTTIEXT(Transfer_FinderProcess,Transfer_ProcessForFinder)
IMPLEMENT_STANDARD_RTTIEXT(Transfer_FinderProcess, Transfer_ProcessForFinder)
Transfer_FinderProcess::Transfer_FinderProcess (const Standard_Integer nb)
: Transfer_ProcessForFinder (nb) { }
void Transfer_FinderProcess::SetModel
(const Handle(Interface_InterfaceModel)& model)
{ themodel = model; }
Handle(Interface_InterfaceModel) Transfer_FinderProcess::Model () const
{ return themodel; }
Transfer_FinderProcess::Transfer_FinderProcess(const Standard_Integer nb)
: Transfer_ProcessForFinder(nb)
{
}
Standard_Integer Transfer_FinderProcess::NextMappedWithAttribute
(const Standard_CString name, const Standard_Integer num0) const
void Transfer_FinderProcess::SetModel(const Handle(Interface_InterfaceModel)& model)
{
themodel = model;
}
Handle(Interface_InterfaceModel) Transfer_FinderProcess::Model() const
{
return themodel;
}
Standard_Integer Transfer_FinderProcess::NextMappedWithAttribute(const Standard_CString name,
const Standard_Integer num0) const
{
Standard_Integer num, nb = NbMapped();
for (num = num0+1; num <= nb; num ++) {
Handle(Transfer_Finder) fnd = Mapped (num);
if (fnd.IsNull()) continue;
if (!fnd->Attribute(name).IsNull()) return num;
for (num = num0 + 1; num <= nb; num++)
{
Handle(Transfer_Finder) fnd = Mapped(num);
if (fnd.IsNull())
continue;
if (!fnd->Attribute(name).IsNull())
return num;
}
return 0;
}
Handle(Transfer_TransientMapper) Transfer_FinderProcess::TransientMapper
(const Handle(Standard_Transient)& obj) const
Handle(Transfer_TransientMapper) Transfer_FinderProcess::TransientMapper(
const Handle(Standard_Transient)& obj) const
{
Handle(Transfer_TransientMapper) mapper = new Transfer_TransientMapper(obj);
Standard_Integer index = MapIndex (mapper);
if (index == 0) return mapper;
Standard_Integer index = MapIndex(mapper);
if (index == 0)
return mapper;
return Handle(Transfer_TransientMapper)::DownCast(Mapped(index));
}
void Transfer_FinderProcess::PrintTrace (const Handle(Transfer_Finder)& start, Standard_OStream& S) const
void Transfer_FinderProcess::PrintTrace(const Handle(Transfer_Finder)& start,
Standard_OStream& S) const
{
if (!start.IsNull()) S << " Type:" << start->ValueTypeName();
if (!start.IsNull())
S << " Type:" << start->ValueTypeName();
}
void Transfer_FinderProcess::PrintStats (const Standard_Integer mode, Standard_OStream& S) const
void Transfer_FinderProcess::PrintStats(const Standard_Integer mode, Standard_OStream& S) const
{
S<<"\n*******************************************************************\n";
if (mode == 1) { // Statistiques de base
S<< "******** Basic Statistics ********"<<std::endl;
S << "\n*******************************************************************\n";
if (mode == 1)
{ // Statistiques de base
S << "******** Basic Statistics ********" << std::endl;
Standard_Integer nbr = 0, nbe = 0, nbw = 0;
Standard_Integer i, max = NbMapped(), nbroots = NbRoots();
S<< "**** Nb Final Results : "<< nbroots <<std::endl;
S << "**** Nb Final Results : " << nbroots << std::endl;
for (i = 1; i <= max; i ++) {
for (i = 1; i <= max; i++)
{
const Handle(Transfer_Binder)& binder = MapItem(i);
if (binder.IsNull()) continue;
const Handle(Interface_Check) ach = binder->Check();
Transfer_StatusExec stat = binder->StatusExec();
if (binder.IsNull())
continue;
const Handle(Interface_Check) ach = binder->Check();
Transfer_StatusExec stat = binder->StatusExec();
if (stat != Transfer_StatusInitial && stat != Transfer_StatusDone)
nbe ++;
else {
if (ach->NbWarnings() > 0) nbw ++;
if (binder->HasResult()) nbr ++;
nbe++;
else
{
if (ach->NbWarnings() > 0)
nbw++;
if (binder->HasResult())
nbr++;
}
}
if (nbr > nbroots)
S<<"**** ( Itermediate Results : "<<nbr-nbroots <<" )\n";
S << "**** ( Itermediate Results : " << nbr - nbroots << " )\n";
if (nbe > 0)
S<<"**** Errors on :"<<Interface_MSG::Blanks(nbe,4)<<nbe<<" Entities\n";
S << "**** Errors on :" << Interface_MSG::Blanks(nbe, 4) << nbe
<< " Entities\n";
if (nbw > 0)
S<<"**** Warnings on : "<<Interface_MSG::Blanks(nbw,4)<<nbw<<" Entities\n";
S<<"*******************************************************************";
S << "**** Warnings on : " << Interface_MSG::Blanks(nbw, 4) << nbw
<< " Entities\n";
S << "*******************************************************************";
}
S<<std::endl;
S << std::endl;
}

View File

@@ -33,18 +33,16 @@ class Transfer_FinderProcess : public Transfer_ProcessForFinder
{
public:
//! Sets FinderProcess at initial state, with an initial size
Standard_EXPORT Transfer_FinderProcess(const Standard_Integer nb = 10000);
//! Sets an InterfaceModel, which can be used during transfer
//! for instance if a context must be managed, it is in the Model
Standard_EXPORT void SetModel (const Handle(Interface_InterfaceModel)& model);
Standard_EXPORT void SetModel(const Handle(Interface_InterfaceModel)& model);
//! Returns the Model which can be used for context
Standard_EXPORT Handle(Interface_InterfaceModel) Model() const;
//! In the list of mapped items (between 1 and NbMapped),
//! searches for the first mapped item which follows <num0>
//! (not included) and which has an attribute named <name>
@@ -59,21 +57,24 @@ public:
//! num = FP->NextMappedWithAttribute(name,num) {
//! .. process mapped item <num>
//! }
Standard_EXPORT Standard_Integer NextMappedWithAttribute (const Standard_CString name, const Standard_Integer num0) const;
Standard_EXPORT Standard_Integer NextMappedWithAttribute(const Standard_CString name,
const Standard_Integer num0) const;
//! Returns a TransientMapper for a given Transient Object
//! Either <obj> is already mapped, then its Mapper is returned
//! Or it is not, then a new one is created then returned, BUT
//! it is not mapped here (use Bind or FindElseBind to do this)
Standard_EXPORT Handle(Transfer_TransientMapper) TransientMapper (const Handle(Standard_Transient)& obj) const;
//! Specific printing to trace a Finder (by its method ValueType)
Standard_EXPORT virtual void PrintTrace (const Handle(Transfer_Finder)& start, Standard_OStream& S) const Standard_OVERRIDE;
//! Prints statistics on a given output, according mode
Standard_EXPORT void PrintStats (const Standard_Integer mode, Standard_OStream& S) const;
Standard_EXPORT Handle(Transfer_TransientMapper) TransientMapper(
const Handle(Standard_Transient)& obj) const;
DEFINE_STANDARD_RTTIEXT(Transfer_FinderProcess,Transfer_ProcessForFinder)
//! Specific printing to trace a Finder (by its method ValueType)
Standard_EXPORT virtual void PrintTrace(const Handle(Transfer_Finder)& start,
Standard_OStream& S) const Standard_OVERRIDE;
//! Prints statistics on a given output, according mode
Standard_EXPORT void PrintStats(const Standard_Integer mode, Standard_OStream& S) const;
DEFINE_STANDARD_RTTIEXT(Transfer_FinderProcess, Transfer_ProcessForFinder)
private:
Handle(Interface_InterfaceModel) themodel;

View File

@@ -22,5 +22,4 @@
DEFINE_HSEQUENCE(Transfer_HSequenceOfBinder, Transfer_SequenceOfBinder)
#endif

View File

@@ -22,5 +22,4 @@
DEFINE_HSEQUENCE(Transfer_HSequenceOfFinder, Transfer_SequenceOfFinder)
#endif

View File

@@ -31,64 +31,45 @@ class Transfer_ProcessForFinder;
class Transfer_ActorOfProcessForFinder;
class Transfer_Binder;
class Transfer_IteratorOfProcessForFinder : public Transfer_TransferIterator
class Transfer_IteratorOfProcessForFinder : public Transfer_TransferIterator
{
public:
DEFINE_STANDARD_ALLOC
//! Creates an empty Iterator
//! if withstarts is True, each Binder to be iterated will
//! be associated to its corresponding Starting Object
Standard_EXPORT Transfer_IteratorOfProcessForFinder(const Standard_Boolean withstarts);
//! Adds a Binder to the iteration list (construction)
//! with no corresponding Starting Object
//! (note that Result is brought by Binder)
Standard_EXPORT void Add (const Handle(Transfer_Binder)& binder);
Standard_EXPORT void Add(const Handle(Transfer_Binder)& binder);
//! Adds a Binder to the iteration list, associated with
//! its corresponding Starting Object "start"
//! Starting Object is ignored if not required at
//! Creation time
Standard_EXPORT void Add (const Handle(Transfer_Binder)& binder, const Handle(Transfer_Finder)& start);
Standard_EXPORT void Add(const Handle(Transfer_Binder)& binder,
const Handle(Transfer_Finder)& start);
//! After having added all items, keeps or rejects items
//! which are attached to starting data given by <only>
//! <keep> = True (D) : keeps. <keep> = False : rejects
//! Does nothing if <withstarts> was False
Standard_EXPORT void Filter (const Handle(Transfer_HSequenceOfFinder)& list, const Standard_Boolean keep = Standard_True);
Standard_EXPORT void Filter(const Handle(Transfer_HSequenceOfFinder)& list,
const Standard_Boolean keep = Standard_True);
//! Returns True if Starting Object is available
//! (defined at Creation Time)
Standard_EXPORT Standard_Boolean HasStarting() const;
//! Returns corresponding Starting Object
Standard_EXPORT const Handle(Transfer_Finder)& Starting() const;
protected:
private:
Handle(Transfer_HSequenceOfFinder) thestarts;
};
#endif // _Transfer_IteratorOfProcessForFinder_HeaderFile

View File

@@ -24,79 +24,76 @@
#include <Transfer_ActorOfProcessForFinder.hxx>
#include <Transfer_Binder.hxx>
//=======================================================================
// Function: Transfer_IteratorOfProcessForFinder
// Purpose :
//=======================================================================
Transfer_IteratorOfProcessForFinder::Transfer_IteratorOfProcessForFinder(const Standard_Boolean withstarts)
: Transfer_TransferIterator()
//=================================================================================================
Transfer_IteratorOfProcessForFinder::Transfer_IteratorOfProcessForFinder(
const Standard_Boolean withstarts)
: Transfer_TransferIterator()
{
if (withstarts) thestarts = new Transfer_HSequenceOfFinder();
if (withstarts)
thestarts = new Transfer_HSequenceOfFinder();
}
//=======================================================================
// Function: Add
// Purpose :
//=======================================================================
void Transfer_IteratorOfProcessForFinder::Add
(const Handle(Transfer_Binder)& binder)
//=================================================================================================
void Transfer_IteratorOfProcessForFinder::Add(const Handle(Transfer_Binder)& binder)
{
if (!thestarts.IsNull()) throw Standard_NoSuchObject("Transfer_IteratorOfProcessForFinder : Add, Starting Object required not provided");
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)
//=================================================================================================
void Transfer_IteratorOfProcessForFinder::Add(const Handle(Transfer_Binder)& binder,
const Handle(Transfer_Finder)& start)
{
AddItem(binder);
if (!thestarts.IsNull()) thestarts->Append(start);
if (!thestarts.IsNull())
thestarts->Append(start);
}
//=======================================================================
// Function: Filter
// Purpose :
//=======================================================================
void Transfer_IteratorOfProcessForFinder::Filter
(const Handle(Transfer_HSequenceOfFinder)& list, const Standard_Boolean keep)
//=================================================================================================
void Transfer_IteratorOfProcessForFinder::Filter(const Handle(Transfer_HSequenceOfFinder)& list,
const Standard_Boolean keep)
{
if (list.IsNull() || thestarts.IsNull()) return;
if (list.IsNull() || thestarts.IsNull())
return;
Standard_Integer i, j, nb = thestarts->Length();
if (nb == 0) return;
Handle(Transfer_Binder) factice;
if (nb == 0)
return;
Handle(Transfer_Binder) factice;
Transfer_TransferMapOfProcessForFinder amap(nb);
for (i = 1; i <= nb; i++) {
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++) {
for (i = 1; i <= nb; i++)
{
j = amap.FindIndex(list->Value(i));
if (j > 0) SelectItem(j, keep);
if (j > 0)
SelectItem(j, keep);
}
}
//=======================================================================
// Function: HasStarting
// Purpose :
//=======================================================================
Standard_Boolean Transfer_IteratorOfProcessForFinder::HasStarting() const
//=================================================================================================
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");
if (thestarts.IsNull())
throw Standard_NoSuchObject("TransferIterator : No Starting defined at all");
return thestarts->Value(thecurr);
}

View File

@@ -31,64 +31,45 @@ class Transfer_ProcessForTransient;
class Transfer_ActorOfProcessForTransient;
class Transfer_Binder;
class Transfer_IteratorOfProcessForTransient : public Transfer_TransferIterator
class Transfer_IteratorOfProcessForTransient : public Transfer_TransferIterator
{
public:
DEFINE_STANDARD_ALLOC
//! Creates an empty Iterator
//! if withstarts is True, each Binder to be iterated will
//! be associated to its corresponding Starting Object
Standard_EXPORT Transfer_IteratorOfProcessForTransient(const Standard_Boolean withstarts);
//! Adds a Binder to the iteration list (construction)
//! with no corresponding Starting Object
//! (note that Result is brought by Binder)
Standard_EXPORT void Add (const Handle(Transfer_Binder)& binder);
Standard_EXPORT void Add(const Handle(Transfer_Binder)& binder);
//! Adds a Binder to the iteration list, associated with
//! its corresponding Starting Object "start"
//! Starting Object is ignored if not required at
//! Creation time
Standard_EXPORT void Add (const Handle(Transfer_Binder)& binder, const Handle(Standard_Transient)& start);
Standard_EXPORT void Add(const Handle(Transfer_Binder)& binder,
const Handle(Standard_Transient)& start);
//! After having added all items, keeps or rejects items
//! which are attached to starting data given by <only>
//! <keep> = True (D) : keeps. <keep> = False : rejects
//! Does nothing if <withstarts> was False
Standard_EXPORT void Filter (const Handle(TColStd_HSequenceOfTransient)& list, const Standard_Boolean keep = Standard_True);
Standard_EXPORT void Filter(const Handle(TColStd_HSequenceOfTransient)& list,
const Standard_Boolean keep = Standard_True);
//! Returns True if Starting Object is available
//! (defined at Creation Time)
Standard_EXPORT Standard_Boolean HasStarting() const;
//! Returns corresponding Starting Object
Standard_EXPORT const Handle(Standard_Transient)& Starting() const;
protected:
private:
Handle(TColStd_HSequenceOfTransient) thestarts;
};
#endif // _Transfer_IteratorOfProcessForTransient_HeaderFile

View File

@@ -23,49 +23,48 @@
#include <Transfer_ActorOfProcessForTransient.hxx>
#include <Transfer_Binder.hxx>
//=======================================================================
//function : Transfer_IteratorOfProcessForTransient
//purpose :
//=======================================================================
Transfer_IteratorOfProcessForTransient::Transfer_IteratorOfProcessForTransient(const Standard_Boolean withstarts)
: Transfer_TransferIterator()
//=================================================================================================
Transfer_IteratorOfProcessForTransient::Transfer_IteratorOfProcessForTransient(
const Standard_Boolean withstarts)
: Transfer_TransferIterator()
{
if (withstarts) thestarts = new TColStd_HSequenceOfTransient();
if (withstarts)
thestarts = new TColStd_HSequenceOfTransient();
}
//=======================================================================
//function : Add
//purpose :
//=======================================================================
void Transfer_IteratorOfProcessForTransient::Add
(const Handle(Transfer_Binder)& binder)
//=================================================================================================
void Transfer_IteratorOfProcessForTransient::Add(const Handle(Transfer_Binder)& binder)
{
if (!thestarts.IsNull()) throw Standard_NoSuchObject("Transfer_IteratorOfProcessForTransient : Add, Starting Object required not provided");
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)
//=================================================================================================
void Transfer_IteratorOfProcessForTransient::Add(const Handle(Transfer_Binder)& binder,
const Handle(Standard_Transient)& start)
{
AddItem(binder);
if (!thestarts.IsNull()) thestarts->Append(start);
if (!thestarts.IsNull())
thestarts->Append(start);
}
//=======================================================================
//function : Filter
//purpose :
//=======================================================================
void Transfer_IteratorOfProcessForTransient::Filter
(const Handle(TColStd_HSequenceOfTransient)& list, const Standard_Boolean keep)
//=================================================================================================
void Transfer_IteratorOfProcessForTransient::Filter(
const Handle(TColStd_HSequenceOfTransient)& list,
const Standard_Boolean keep)
{
if (list.IsNull() || thestarts.IsNull()) return;
if (list.IsNull() || thestarts.IsNull())
return;
Standard_Integer i, j, nb = thestarts->Length();
if (nb == 0) return;
Handle(Transfer_Binder) factice;
if (nb == 0)
return;
Handle(Transfer_Binder) factice;
Transfer_TransferMapOfProcessForTransient amap(nb);
for (i = 1; i <= nb; i++)
{
@@ -78,25 +77,23 @@ void Transfer_IteratorOfProcessForTransient::Filter
for (i = 1; i <= nb; i++)
{
j = amap.FindIndex(list->Value(i));
if (j > 0) SelectItem(j, keep);
if (j > 0)
SelectItem(j, keep);
}
}
//=======================================================================
//function : HasStarting
//purpose :
//=======================================================================
Standard_Boolean Transfer_IteratorOfProcessForTransient::HasStarting() const
//=================================================================================================
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");
if (thestarts.IsNull())
throw Standard_NoSuchObject("TransferIterator : No Starting defined at all");
return thestarts->Value(thecurr);
}

View File

@@ -11,22 +11,19 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Standard_Type.hxx>
#include <Transfer_MapContainer.hxx>
IMPLEMENT_STANDARD_RTTIEXT(Transfer_MapContainer,Standard_Transient)
IMPLEMENT_STANDARD_RTTIEXT(Transfer_MapContainer, Standard_Transient)
Transfer_MapContainer::Transfer_MapContainer()
Transfer_MapContainer::Transfer_MapContainer() {}
void Transfer_MapContainer::SetMapObjects(TColStd_DataMapOfTransientTransient& theMapObjects)
{
myMapObj = theMapObjects;
}
void Transfer_MapContainer::SetMapObjects(TColStd_DataMapOfTransientTransient& theMapObjects)
{
myMapObj= theMapObjects;
}
TColStd_DataMapOfTransientTransient& Transfer_MapContainer::GetMapObjects()
TColStd_DataMapOfTransientTransient& Transfer_MapContainer::GetMapObjects()
{
return myMapObj;
}

View File

@@ -22,47 +22,26 @@
#include <TColStd_DataMapOfTransientTransient.hxx>
#include <Standard_Transient.hxx>
class Transfer_MapContainer;
DEFINE_STANDARD_HANDLE(Transfer_MapContainer, Standard_Transient)
class Transfer_MapContainer : public Standard_Transient
{
public:
Standard_EXPORT Transfer_MapContainer();
//! Set map already translated geometry objects.
Standard_EXPORT void SetMapObjects (TColStd_DataMapOfTransientTransient& theMapObjects);
Standard_EXPORT void SetMapObjects(TColStd_DataMapOfTransientTransient& theMapObjects);
//! Get map already translated geometry objects.
Standard_EXPORT TColStd_DataMapOfTransientTransient& GetMapObjects();
DEFINE_STANDARD_RTTIEXT(Transfer_MapContainer,Standard_Transient)
DEFINE_STANDARD_RTTIEXT(Transfer_MapContainer, Standard_Transient)
protected:
private:
TColStd_DataMapOfTransientTransient myMapObj;
};
#endif // _Transfer_MapContainer_HeaderFile

View File

@@ -11,57 +11,64 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Standard_OutOfRange.hxx>
#include <Standard_Transient.hxx>
#include <Standard_Type.hxx>
#include <Transfer_MultipleBinder.hxx>
#include <Transfer_TransferFailure.hxx>
IMPLEMENT_STANDARD_RTTIEXT(Transfer_MultipleBinder,Transfer_Binder)
IMPLEMENT_STANDARD_RTTIEXT(Transfer_MultipleBinder, Transfer_Binder)
// Resultat Multiple
// Possibilite de definir un Resultat Multiple : plusieurs objets resultant
// d un Transfert, sans pouvoir les distinguer
// N.B. : Pour l heure, tous Transients (pourra evoluer)
Transfer_MultipleBinder::Transfer_MultipleBinder () { }
Transfer_MultipleBinder::Transfer_MultipleBinder() {}
Standard_Boolean Transfer_MultipleBinder::IsMultiple () const
Standard_Boolean Transfer_MultipleBinder::IsMultiple() const
{
if (themulres.IsNull()) return Standard_False;
if (themulres.IsNull())
return Standard_False;
return (themulres->Length() != 1);
}
Handle(Standard_Type) Transfer_MultipleBinder::ResultType () const
{ return STANDARD_TYPE(Standard_Transient); }
Handle(Standard_Type) Transfer_MultipleBinder::ResultType() const
{
return STANDARD_TYPE(Standard_Transient);
}
Standard_CString Transfer_MultipleBinder::ResultTypeName () const
{ return "(list)"; }
Standard_CString Transfer_MultipleBinder::ResultTypeName() const
{
return "(list)";
}
// .... Gestion du Resultat Multiple ....
void Transfer_MultipleBinder::AddResult
(const Handle(Standard_Transient)& res)
void Transfer_MultipleBinder::AddResult(const Handle(Standard_Transient)& res)
{
if (themulres.IsNull()) themulres = new TColStd_HSequenceOfTransient();
if (themulres.IsNull())
themulres = new TColStd_HSequenceOfTransient();
themulres->Append(res);
}
Standard_Integer Transfer_MultipleBinder::NbResults () const
{ return (themulres.IsNull() ? 0 : themulres->Length()); }
Handle(Standard_Transient) Transfer_MultipleBinder::ResultValue
(const Standard_Integer num) const
{ return themulres->Value(num); }
Handle(TColStd_HSequenceOfTransient) Transfer_MultipleBinder::MultipleResult
() const
Standard_Integer Transfer_MultipleBinder::NbResults() const
{
if (!themulres.IsNull()) return themulres;
return (themulres.IsNull() ? 0 : themulres->Length());
}
Handle(Standard_Transient) Transfer_MultipleBinder::ResultValue(const Standard_Integer num) const
{
return themulres->Value(num);
}
Handle(TColStd_HSequenceOfTransient) Transfer_MultipleBinder::MultipleResult() const
{
if (!themulres.IsNull())
return themulres;
return new TColStd_HSequenceOfTransient();
}
void Transfer_MultipleBinder::SetMultipleResult
(const Handle(TColStd_HSequenceOfTransient)& mulres)
{ themulres = mulres; }
void Transfer_MultipleBinder::SetMultipleResult(const Handle(TColStd_HSequenceOfTransient)& mulres)
{
themulres = mulres;
}

View File

@@ -25,7 +25,6 @@
#include <Standard_Integer.hxx>
class Standard_Transient;
class Transfer_MultipleBinder;
DEFINE_STANDARD_HANDLE(Transfer_MultipleBinder, Transfer_Binder)
@@ -51,61 +50,42 @@ class Transfer_MultipleBinder : public Transfer_Binder
{
public:
//! normal standard constructor, creates an empty MultipleBinder
Standard_EXPORT Transfer_MultipleBinder();
//! Returns True if a starting object is bound with SEVERAL
//! results : Here, returns always True
Standard_EXPORT virtual Standard_Boolean IsMultiple() const Standard_OVERRIDE;
//! Returns the Type permitted for Results, i.e. here Transient
Standard_EXPORT Handle(Standard_Type) ResultType() const Standard_OVERRIDE;
//! Returns the Name of the Type which characterizes the Result
//! Here, returns "(list)"
Standard_EXPORT Standard_CString ResultTypeName() const Standard_OVERRIDE;
//! Adds a new Item to the Multiple Result
Standard_EXPORT void AddResult (const Handle(Standard_Transient)& res);
Standard_EXPORT void AddResult(const Handle(Standard_Transient)& res);
//! Returns the actual count of recorded (Transient) results
Standard_EXPORT Standard_Integer NbResults() const;
//! Returns the value of the recorded result n0 <num>
Standard_EXPORT Handle(Standard_Transient) ResultValue (const Standard_Integer num) const;
Standard_EXPORT Handle(Standard_Transient) ResultValue(const Standard_Integer num) const;
//! Returns the Multiple Result, if it is defined (at least one
//! Item). Else, returns a Null Handle
Standard_EXPORT Handle(TColStd_HSequenceOfTransient) MultipleResult() const;
//! Defines a Binding with a Multiple Result, given as a Sequence
//! Error if a Unique Result has yet been defined
Standard_EXPORT void SetMultipleResult (const Handle(TColStd_HSequenceOfTransient)& mulres);
Standard_EXPORT void SetMultipleResult(const Handle(TColStd_HSequenceOfTransient)& mulres);
DEFINE_STANDARD_RTTIEXT(Transfer_MultipleBinder,Transfer_Binder)
DEFINE_STANDARD_RTTIEXT(Transfer_MultipleBinder, Transfer_Binder)
protected:
private:
Handle(TColStd_HSequenceOfTransient) themulres;
};
#endif // _Transfer_MultipleBinder_HeaderFile

View File

@@ -35,102 +35,101 @@ class Interface_Check;
class Standard_Transient;
class Interface_CheckIterator;
class Transfer_ProcessForFinder;
DEFINE_STANDARD_HANDLE(Transfer_ProcessForFinder, Standard_Transient)
class Transfer_ProcessForFinder : public Standard_Transient
{
public:
//! Sets TransferProcess at initial state. Gives an Initial size
//! (indicative) for the Map when known (default is 10000).
//! Sets default trace file as a printer and default trace level
//! (see Message_TraceFile).
Standard_EXPORT Transfer_ProcessForFinder(const Standard_Integer nb = 10000);
//! Sets TransferProcess at initial state. Gives an Initial size
//! (indicative) for the Map when known (default is 10000).
//! Sets a specified printer.
Standard_EXPORT Transfer_ProcessForFinder(const Handle(Message_Messenger)& printer, const Standard_Integer nb = 10000);
Standard_EXPORT Transfer_ProcessForFinder(const Handle(Message_Messenger)& printer,
const Standard_Integer nb = 10000);
//! Resets a TransferProcess as ready for a completely new work.
//! Clears general data (roots) and the Map
Standard_EXPORT void Clear();
//! Rebuilds the Map and the roots to really remove Unbound items
//! Because Unbind keeps the entity in place, even if not bound
//! Hence, working by checking new items is meaningless if a
//! formerly unbound item is rebound
Standard_EXPORT void Clean();
//! Resizes the Map as required (if a new reliable value has been
//! determined). Acts only if <nb> is greater than actual NbMapped
Standard_EXPORT void Resize (const Standard_Integer nb);
Standard_EXPORT void Resize(const Standard_Integer nb);
//! Defines an Actor, which is used for automatic Transfer
//! If already defined, the new Actor is cumulated
//! (see SetNext from Actor)
Standard_EXPORT void SetActor (const Handle(Transfer_ActorOfProcessForFinder)& actor);
Standard_EXPORT void SetActor(const Handle(Transfer_ActorOfProcessForFinder)& actor);
//! Returns the defined Actor. Returns a Null Handle if
//! not set.
Standard_EXPORT Handle(Transfer_ActorOfProcessForFinder) Actor() const;
//! Returns the Binder which is linked with a starting Object
//! It can either bring a Result (Transfer done) or none (for a
//! pre-binding).
//! If no Binder is linked with <start>, returns a Null Handle
//! Considers a category number, by default 0
Standard_EXPORT Handle(Transfer_Binder) Find (const Handle(Transfer_Finder)& start) const;
Standard_EXPORT Handle(Transfer_Binder) Find(const Handle(Transfer_Finder)& start) const;
//! Returns True if a Result (whatever its form) is Bound with
//! a starting Object. I.e., if a Binder with a Result set,
//! is linked with it
//! Considers a category number, by default 0
Standard_EXPORT Standard_Boolean IsBound (const Handle(Transfer_Finder)& start) const;
Standard_EXPORT Standard_Boolean IsBound(const Handle(Transfer_Finder)& start) const;
//! Returns True if the result of the transfer of an object is
//! already used in other ones. If it is, Rebind cannot change it.
//! Considers a category number, by default 0
Standard_EXPORT Standard_Boolean IsAlreadyUsed (const Handle(Transfer_Finder)& start) const;
Standard_EXPORT Standard_Boolean IsAlreadyUsed(const Handle(Transfer_Finder)& start) const;
//! Creates a Link a starting Object with a Binder. This Binder
//! can either bring a Result (effective Binding) or none (it can
//! be set later : pre-binding).
//! Considers a category number, by default 0
Standard_EXPORT void Bind (const Handle(Transfer_Finder)& start, const Handle(Transfer_Binder)& binder);
Standard_EXPORT void Bind(const Handle(Transfer_Finder)& start,
const Handle(Transfer_Binder)& binder);
//! Changes the Binder linked with a starting Object for its
//! unitary transfer. This it can be useful when the exact form
//! of the result is known once the transfer is widely engaged.
//! This can be done only on first transfer.
//! Considers a category number, by default 0
Standard_EXPORT void Rebind (const Handle(Transfer_Finder)& start, const Handle(Transfer_Binder)& binder);
Standard_EXPORT void Rebind(const Handle(Transfer_Finder)& start,
const Handle(Transfer_Binder)& binder);
//! Removes the Binder linked with a starting object
//! If this Binder brings a non-empty Check, it is replaced by
//! a VoidBinder. Also removes from the list of Roots as required.
//! Returns True if done, False if <start> was not bound
//! Considers a category number, by default 0
Standard_EXPORT Standard_Boolean Unbind (const Handle(Transfer_Finder)& start);
Standard_EXPORT Standard_Boolean Unbind(const Handle(Transfer_Finder)& start);
//! Returns a Binder for a starting entity, as follows :
//! Tries to Find the already bound one
//! If none found, creates a VoidBinder and Binds it
Standard_EXPORT Handle(Transfer_Binder) FindElseBind (const Handle(Transfer_Finder)& start);
Standard_EXPORT Handle(Transfer_Binder) FindElseBind(const Handle(Transfer_Finder)& start);
//! Sets Messenger used for outputting messages.
Standard_EXPORT void SetMessenger (const Handle(Message_Messenger)& messenger);
Standard_EXPORT void SetMessenger(const Handle(Message_Messenger)& messenger);
//! Returns Messenger used for outputting messages.
//! The returned object is guaranteed to be non-null;
//! default is Message::Messenger().
Standard_EXPORT Handle(Message_Messenger) Messenger() const;
//! Sets trace level used for outputting messages:
//! <trace> = 0 : no trace at all
//! <trace> = 1 : handled exceptions and calls to AddError
@@ -138,42 +137,48 @@ public:
//! <trace> = 3 : also traces new Roots
//! (uses method ErrorTrace).
//! Default is 1 : Errors traced
Standard_EXPORT void SetTraceLevel (const Standard_Integer tracelev);
Standard_EXPORT void SetTraceLevel(const Standard_Integer tracelev);
//! Returns trace level used for outputting messages.
Standard_EXPORT Standard_Integer TraceLevel() const;
//! New name for AddFail (Msg)
Standard_EXPORT void SendFail (const Handle(Transfer_Finder)& start, const Message_Msg& amsg);
Standard_EXPORT void SendFail(const Handle(Transfer_Finder)& start, const Message_Msg& amsg);
//! New name for AddWarning (Msg)
Standard_EXPORT void SendWarning (const Handle(Transfer_Finder)& start, const Message_Msg& amsg);
Standard_EXPORT void SendWarning(const Handle(Transfer_Finder)& start, const Message_Msg& amsg);
//! Adds an information message
//! Trace is filled if trace level is at least 3
Standard_EXPORT void SendMsg (const Handle(Transfer_Finder)& start, const Message_Msg& amsg);
Standard_EXPORT void SendMsg(const Handle(Transfer_Finder)& start, const Message_Msg& amsg);
//! Adds an Error message to a starting entity (to the check of
//! its Binder of category 0, as a Fail)
Standard_EXPORT void AddFail (const Handle(Transfer_Finder)& start, const Standard_CString mess, const Standard_CString orig = "");
Standard_EXPORT void AddFail(const Handle(Transfer_Finder)& start,
const Standard_CString mess,
const Standard_CString orig = "");
//! (other name of AddFail, maintained for compatibility)
Standard_EXPORT void AddError (const Handle(Transfer_Finder)& start, const Standard_CString mess, const Standard_CString orig = "");
Standard_EXPORT void AddError(const Handle(Transfer_Finder)& start,
const Standard_CString mess,
const Standard_CString orig = "");
//! Adds an Error Message to a starting entity from the definition
//! of a Msg (Original+Value)
Standard_EXPORT void AddFail (const Handle(Transfer_Finder)& start, const Message_Msg& amsg);
Standard_EXPORT void AddFail(const Handle(Transfer_Finder)& start, const Message_Msg& amsg);
//! Adds a Warning message to a starting entity (to the check of
//! its Binder of category 0)
Standard_EXPORT void AddWarning (const Handle(Transfer_Finder)& start, const Standard_CString mess, const Standard_CString orig = "");
Standard_EXPORT void AddWarning(const Handle(Transfer_Finder)& start,
const Standard_CString mess,
const Standard_CString orig = "");
//! Adds a Warning Message to a starting entity from the definition
//! of a Msg (Original+Value)
Standard_EXPORT void AddWarning (const Handle(Transfer_Finder)& start, const Message_Msg& amsg);
Standard_EXPORT void Mend (const Handle(Transfer_Finder)& start, const Standard_CString pref = "");
Standard_EXPORT void AddWarning(const Handle(Transfer_Finder)& start, const Message_Msg& amsg);
Standard_EXPORT void Mend(const Handle(Transfer_Finder)& start, const Standard_CString pref = "");
//! Returns the Check attached to a starting entity. If <start>
//! is unknown, returns an empty Check
//! Adds a case name to a starting entity
@@ -201,32 +206,35 @@ public:
//! By default, considers all the attribute names
//! If <rootname> is given, considers only the attribute names
//! which begin by <rootname>
Standard_EXPORT Handle(Interface_Check) Check (const Handle(Transfer_Finder)& start) const;
Standard_EXPORT Handle(Interface_Check) Check(const Handle(Transfer_Finder)& start) const;
//! Binds a starting object with a Transient Result.
//! Uses a SimpleBinderOfTransient to work. If there is already
//! one but with no Result set, sets its Result.
//! Considers a category number, by default 0
Standard_EXPORT void BindTransient (const Handle(Transfer_Finder)& start, const Handle(Standard_Transient)& res);
Standard_EXPORT void BindTransient(const Handle(Transfer_Finder)& start,
const Handle(Standard_Transient)& res);
//! Returns the Result of the Transfer of an object <start> as a
//! Transient Result.
//! Returns a Null Handle if there is no Transient Result
//! Considers a category number, by default 0
//! Warning : Supposes that Binding is done with a SimpleBinderOfTransient
Standard_EXPORT const Handle(Standard_Transient)& FindTransient (const Handle(Transfer_Finder)& start) const;
Standard_EXPORT const Handle(Standard_Transient)& FindTransient(
const Handle(Transfer_Finder)& start) const;
//! Prepares an object <start> to be bound with several results.
//! If no Binder is yet attached to <obj>, a MultipleBinder
//! is created, empty. If a Binder is already set, it must
//! accept Multiple Binding.
//! Considers a category number, by default 0
Standard_EXPORT void BindMultiple (const Handle(Transfer_Finder)& start);
Standard_EXPORT void BindMultiple(const Handle(Transfer_Finder)& start);
//! Adds an item to a list of results bound to a starting object.
//! Considers a category number, by default 0, for all results
Standard_EXPORT void AddMultiple (const Handle(Transfer_Finder)& start, const Handle(Standard_Transient)& res);
Standard_EXPORT void AddMultiple(const Handle(Transfer_Finder)& start,
const Handle(Standard_Transient)& res);
//! Searches for a transient result attached to a starting object,
//! according to its type, by criterium IsKind(atype)
//!
@@ -238,14 +246,18 @@ public:
//! This syntactic form avoids to do DownCast : if a result is
//! found with the good type, it is loaded in <val> and can be
//! immediately used, well initialised
Standard_EXPORT Standard_Boolean FindTypedTransient (const Handle(Transfer_Finder)& start, const Handle(Standard_Type)& atype, Handle(Standard_Transient)& val) const;
Standard_EXPORT Standard_Boolean FindTypedTransient(const Handle(Transfer_Finder)& start,
const Handle(Standard_Type)& atype,
Handle(Standard_Transient)& val) const;
//! Safe variant for arbitrary type of argument
template <class T>
Standard_Boolean FindTypedTransient (const Handle(Transfer_Finder)& start, const Handle(Standard_Type)& atype, Handle(T)& val) const
template <class T>
Standard_Boolean FindTypedTransient(const Handle(Transfer_Finder)& start,
const Handle(Standard_Type)& atype,
Handle(T)& val) const
{
Handle(Standard_Transient) aVal = val;
return FindTypedTransient (start, atype, aVal) && ! (val = Handle(T)::DownCast(aVal)).IsNull();
return FindTypedTransient(start, atype, aVal) && !(val = Handle(T)::DownCast(aVal)).IsNull();
}
//! Searches for a transient result recorded in a Binder, whatever
@@ -255,35 +267,39 @@ public:
//! from class SimpleBinderOfTransient, but is just lighter to call
//!
//! Apart from this, works as FindTypedTransient
Standard_EXPORT Standard_Boolean GetTypedTransient (const Handle(Transfer_Binder)& binder, const Handle(Standard_Type)& atype, Handle(Standard_Transient)& val) const;
Standard_EXPORT Standard_Boolean GetTypedTransient(const Handle(Transfer_Binder)& binder,
const Handle(Standard_Type)& atype,
Handle(Standard_Transient)& val) const;
//! Safe variant for arbitrary type of argument
template <class T>
Standard_Boolean GetTypedTransient (const Handle(Transfer_Binder)& start, const Handle(Standard_Type)& atype, Handle(T)& val) const
template <class T>
Standard_Boolean GetTypedTransient(const Handle(Transfer_Binder)& start,
const Handle(Standard_Type)& atype,
Handle(T)& val) const
{
Handle(Standard_Transient) aVal = val;
return GetTypedTransient (start, atype, aVal) && ! (val = Handle(T)::DownCast(aVal)).IsNull();
return GetTypedTransient(start, atype, aVal) && !(val = Handle(T)::DownCast(aVal)).IsNull();
}
//! Returns the maximum possible value for Map Index
//! (no result can be bound with a value greater than it)
Standard_EXPORT Standard_Integer NbMapped() const;
//! Returns the Starting Object bound to an Index,
Standard_EXPORT const Handle(Transfer_Finder)& Mapped (const Standard_Integer num) const;
Standard_EXPORT const Handle(Transfer_Finder)& Mapped(const Standard_Integer num) const;
//! Returns the Index value bound to a Starting Object, 0 if none
Standard_EXPORT Standard_Integer MapIndex (const Handle(Transfer_Finder)& start) const;
Standard_EXPORT Standard_Integer MapIndex(const Handle(Transfer_Finder)& start) const;
//! Returns the Binder bound to an Index
//! Considers a category number, by default 0
Standard_EXPORT Handle(Transfer_Binder) MapItem (const Standard_Integer num) const;
Standard_EXPORT Handle(Transfer_Binder) MapItem(const Standard_Integer num) const;
//! Declares <obj> (and its Result) as Root. This status will be
//! later exploited by RootResult, see below (Result can be
//! produced at any time)
Standard_EXPORT void SetRoot (const Handle(Transfer_Finder)& start);
Standard_EXPORT void SetRoot(const Handle(Transfer_Finder)& start);
//! Enable (if <stat> True) or Disables (if <stat> False) Root
//! Management. If it is set, Transfers are considered as stacked
//! (a first Transfer commands other Transfers, and so on) and
@@ -291,173 +307,174 @@ public:
//! Remark : SetRoot can be called whatever this status, on every
//! object.
//! Default is set to True.
Standard_EXPORT void SetRootManagement (const Standard_Boolean stat);
Standard_EXPORT void SetRootManagement(const Standard_Boolean stat);
//! Returns the count of recorded Roots
Standard_EXPORT Standard_Integer NbRoots() const;
//! Returns a Root Entity given its number in the list (1-NbRoots)
Standard_EXPORT const Handle(Transfer_Finder)& Root (const Standard_Integer num) const;
Standard_EXPORT const Handle(Transfer_Finder)& Root(const Standard_Integer num) const;
//! Returns the Binder bound with a Root Entity given its number
//! Considers a category number, by default 0
Standard_EXPORT Handle(Transfer_Binder) RootItem (const Standard_Integer num) const;
Standard_EXPORT Handle(Transfer_Binder) RootItem(const Standard_Integer num) const;
//! Returns the index in the list of roots for a starting item,
//! or 0 if it is not recorded as a root
Standard_EXPORT Standard_Integer RootIndex (const Handle(Transfer_Finder)& start) const;
Standard_EXPORT Standard_Integer RootIndex(const Handle(Transfer_Finder)& start) const;
//! Returns Nesting Level of Transfers (managed by methods
//! TranscriptWith & Co). Starts to zero. If no automatic Transfer
//! is used, it remains to zero. Zero means Root Level.
Standard_EXPORT Standard_Integer NestingLevel() const;
//! Resets Nesting Level of Transfers to Zero (Root Level),
//! whatever its current value.
Standard_EXPORT void ResetNestingLevel();
//! Tells if <start> has been recognized as good candidate for
//! Transfer. i.e. queries the Actor and its Nexts
Standard_EXPORT Standard_Boolean Recognize (const Handle(Transfer_Finder)& start) const;
Standard_EXPORT Standard_Boolean Recognize(const Handle(Transfer_Finder)& start) const;
//! Performs the Transfer of a Starting Object, by calling
//! the method TransferProduct (see below).
//! Mapping and Roots are managed : nothing is done if a Result is
//! already Bound, an exception is raised in case of error.
Standard_EXPORT Handle(Transfer_Binder) Transferring (const Handle(Transfer_Finder)& start,
const Message_ProgressRange& theProgress = Message_ProgressRange());
Standard_EXPORT Handle(Transfer_Binder) Transferring(
const Handle(Transfer_Finder)& start,
const Message_ProgressRange& theProgress = Message_ProgressRange());
//! Same as Transferring but does not return the Binder.
//! Simply returns True in case of success (for user call)
Standard_EXPORT Standard_Boolean Transfer (const Handle(Transfer_Finder)& start,
const Message_ProgressRange& theProgress = Message_ProgressRange());
Standard_EXPORT Standard_Boolean
Transfer(const Handle(Transfer_Finder)& start,
const Message_ProgressRange& theProgress = Message_ProgressRange());
//! Allows controls if exceptions will be handled
//! Transfer Operations
//! <err> False : they are not handled with try {} catch {}
//! <err> True : they are
//! Default is False: no handling performed
Standard_EXPORT void SetErrorHandle (const Standard_Boolean err);
Standard_EXPORT void SetErrorHandle(const Standard_Boolean err);
//! Returns error handling flag
Standard_EXPORT Standard_Boolean ErrorHandle() const;
//! Method called when trace is asked
//! Calls PrintTrace to display information relevant for starting
//! objects (which can be redefined)
//! <level> is Nesting Level of Transfer (0 = root)
//! <mode> controls the way the trace is done :
//! 0 neutral, 1 for Error, 2 for Warning message, 3 for new Root
Standard_EXPORT void StartTrace (const Handle(Transfer_Binder)& binder, const Handle(Transfer_Finder)& start, const Standard_Integer level, const Standard_Integer mode) const;
Standard_EXPORT void StartTrace(const Handle(Transfer_Binder)& binder,
const Handle(Transfer_Finder)& start,
const Standard_Integer level,
const Standard_Integer mode) const;
//! Prints a short information on a starting object. By default
//! prints its Dynamic Type. Can be redefined
Standard_EXPORT virtual void PrintTrace (const Handle(Transfer_Finder)& start, Standard_OStream& S) const;
Standard_EXPORT virtual void PrintTrace(const Handle(Transfer_Finder)& start,
Standard_OStream& S) const;
//! Returns True if we are surely in a DeadLoop. Evaluation is not
//! exact, it is a "majorant" which must be computed fast.
//! This "majorant" is : <alevel> greater than NbMapped.
Standard_EXPORT Standard_Boolean IsLooping (const Standard_Integer alevel) const;
Standard_EXPORT Standard_Boolean IsLooping(const Standard_Integer alevel) const;
//! Returns, as an iterator, the log of root transfer, i.e. the
//! created objects and Binders bound to starting roots
//! If withstart is given True, Starting Objects are also returned
Standard_EXPORT Transfer_IteratorOfProcessForFinder RootResult (const Standard_Boolean withstart = Standard_False) const;
Standard_EXPORT Transfer_IteratorOfProcessForFinder
RootResult(const Standard_Boolean withstart = Standard_False) const;
//! Returns, as an Iterator, the entire log of transfer (list of
//! created objects and Binders which can bring errors)
//! If withstart is given True, Starting Objects are also returned
Standard_EXPORT Transfer_IteratorOfProcessForFinder CompleteResult (const Standard_Boolean withstart = Standard_False) const;
Standard_EXPORT Transfer_IteratorOfProcessForFinder
CompleteResult(const Standard_Boolean withstart = Standard_False) const;
//! Returns Binders which are neither "Done" nor "Initial",
//! that is Error,Loop or Run (abnormal states at end of Transfer)
//! Starting Objects are given in correspondence in the iterator
Standard_EXPORT Transfer_IteratorOfProcessForFinder AbnormalResult() const;
//! Returns a CheckList as a list of Check : each one is for a
//! starting entity which have either check (warning or fail)
//! messages are attached, or are in abnormal state : that case
//! gives a specific message
//! If <erronly> is True, checks with Warnings only are ignored
Standard_EXPORT Interface_CheckIterator CheckList (const Standard_Boolean erronly) const;
Standard_EXPORT Interface_CheckIterator CheckList(const Standard_Boolean erronly) const;
//! Returns, as an Iterator, the log of transfer for one object
//! <level> = 0 : this object only
//! and if <start> is a scope owner (else, <level> is ignored) :
//! <level> = 1 : object plus its immediate scoped ones
//! <level> = 2 : object plus all its scoped ones
Standard_EXPORT Transfer_IteratorOfProcessForFinder ResultOne (const Handle(Transfer_Finder)& start, const Standard_Integer level, const Standard_Boolean withstart = Standard_False) const;
Standard_EXPORT Transfer_IteratorOfProcessForFinder
ResultOne(const Handle(Transfer_Finder)& start,
const Standard_Integer level,
const Standard_Boolean withstart = Standard_False) const;
//! Returns a CheckList for one starting object
//! <level> interpreted as by ResultOne
//! If <erronly> is True, checks with Warnings only are ignored
Standard_EXPORT Interface_CheckIterator CheckListOne (const Handle(Transfer_Finder)& start, const Standard_Integer level, const Standard_Boolean erronly) const;
Standard_EXPORT Interface_CheckIterator CheckListOne(const Handle(Transfer_Finder)& start,
const Standard_Integer level,
const Standard_Boolean erronly) const;
//! Returns True if no check message is attached to a starting
//! object. <level> interpreted as by ResultOne
//! If <erronly> is True, checks with Warnings only are ignored
Standard_EXPORT Standard_Boolean IsCheckListEmpty (const Handle(Transfer_Finder)& start, const Standard_Integer level, const Standard_Boolean erronly) const;
Standard_EXPORT Standard_Boolean IsCheckListEmpty(const Handle(Transfer_Finder)& start,
const Standard_Integer level,
const Standard_Boolean erronly) const;
//! Removes Results attached to (== Unbinds) a given object and,
//! according <level> :
//! <level> = 0 : only it
//! <level> = 1 : it plus its immediately owned sub-results(scope)
//! <level> = 2 : it plus all its owned sub-results(scope)
Standard_EXPORT void RemoveResult (const Handle(Transfer_Finder)& start, const Standard_Integer level, const Standard_Boolean compute = Standard_True);
Standard_EXPORT void RemoveResult(const Handle(Transfer_Finder)& start,
const Standard_Integer level,
const Standard_Boolean compute = Standard_True);
//! Computes a number to be associated to a starting object in
//! a check or a check-list
//! By default, returns 0; can be redefined
Standard_EXPORT virtual Standard_Integer CheckNum (const Handle(Transfer_Finder)& start) const;
Standard_EXPORT virtual Standard_Integer CheckNum(const Handle(Transfer_Finder)& start) const;
DEFINE_STANDARD_RTTI_INLINE(Transfer_ProcessForFinder,Standard_Transient)
DEFINE_STANDARD_RTTI_INLINE(Transfer_ProcessForFinder, Standard_Transient)
protected:
private:
//! Same as Find but stores the last access to the map, for a
//! faster access on next calls (as Bind does too)
//! Considers a category number, by default 0
//! C++ : return const &
Standard_EXPORT Handle(Transfer_Binder) FindAndMask (const Handle(Transfer_Finder)& start);
Standard_EXPORT Handle(Transfer_Binder) FindAndMask(const Handle(Transfer_Finder)& start);
//! Internal action of Transfer, called by Transferring, with or
//! without ErrorHandle. It invokes the Actor to work (set by
//! SetActor), and tries its Nexts if no result is produced,
//! until a Non Null Binder is produced.
//! But keep in mind that a Null Binder can always be returned
//! if a Starting Entity has not been recognized at all.
Standard_EXPORT Handle(Transfer_Binder) TransferProduct (const Handle(Transfer_Finder)& start,
const Message_ProgressRange& theProgress = Message_ProgressRange());
Standard_EXPORT Handle(Transfer_Binder) TransferProduct(
const Handle(Transfer_Finder)& start,
const Message_ProgressRange& theProgress = Message_ProgressRange());
Standard_Boolean theerrh;
Standard_Integer thetrace;
Handle(Message_Messenger) themessenger;
Standard_Integer thelevel;
Standard_Integer therootl;
Standard_Boolean therootm;
TColStd_IndexedMapOfInteger theroots;
Handle(Transfer_Finder) thelastobj;
Handle(Transfer_Binder) thelastbnd;
Standard_Integer theindex;
Standard_Boolean theerrh;
Standard_Integer thetrace;
Handle(Message_Messenger) themessenger;
Standard_Integer thelevel;
Standard_Integer therootl;
Standard_Boolean therootm;
TColStd_IndexedMapOfInteger theroots;
Handle(Transfer_Finder) thelastobj;
Handle(Transfer_Binder) thelastbnd;
Standard_Integer theindex;
Handle(Transfer_ActorOfProcessForFinder) theactor;
Transfer_TransferMapOfProcessForFinder themap;
Transfer_TransferMapOfProcessForFinder themap;
};
#endif // _Transfer_ProcessForFinder_HeaderFile

File diff suppressed because it is too large Load Diff

View File

@@ -31,7 +31,6 @@ class Message_Msg;
class Interface_Check;
class Interface_CheckIterator;
class Transfer_ProcessForTransient;
DEFINE_STANDARD_HANDLE(Transfer_ProcessForTransient, Standard_Transient)
@@ -45,93 +44,94 @@ class Transfer_ProcessForTransient : public Standard_Transient
{
public:
//! Sets TransferProcess at initial state. Gives an Initial size
//! (indicative) for the Map when known (default is 10000).
//! Sets default trace file as a printer and default trace level
//! (see Message_TraceFile).
Standard_EXPORT Transfer_ProcessForTransient(const Standard_Integer nb = 10000);
//! Sets TransferProcess at initial state. Gives an Initial size
//! (indicative) for the Map when known (default is 10000).
//! Sets a specified printer.
Standard_EXPORT Transfer_ProcessForTransient(const Handle(Message_Messenger)& printer, const Standard_Integer nb = 10000);
Standard_EXPORT Transfer_ProcessForTransient(const Handle(Message_Messenger)& printer,
const Standard_Integer nb = 10000);
//! Resets a TransferProcess as ready for a completely new work.
//! Clears general data (roots) and the Map
Standard_EXPORT void Clear();
//! Rebuilds the Map and the roots to really remove Unbound items
//! Because Unbind keeps the entity in place, even if not bound
//! Hence, working by checking new items is meaningless if a
//! formerly unbound item is rebound
Standard_EXPORT void Clean();
//! Resizes the Map as required (if a new reliable value has been
//! determined). Acts only if <nb> is greater than actual NbMapped
Standard_EXPORT void Resize (const Standard_Integer nb);
Standard_EXPORT void Resize(const Standard_Integer nb);
//! Defines an Actor, which is used for automatic Transfer
//! If already defined, the new Actor is cumulated
//! (see SetNext from Actor)
Standard_EXPORT void SetActor (const Handle(Transfer_ActorOfProcessForTransient)& actor);
Standard_EXPORT void SetActor(const Handle(Transfer_ActorOfProcessForTransient)& actor);
//! Returns the defined Actor. Returns a Null Handle if
//! not set.
Standard_EXPORT Handle(Transfer_ActorOfProcessForTransient) Actor() const;
//! Returns the Binder which is linked with a starting Object
//! It can either bring a Result (Transfer done) or none (for a
//! pre-binding).
//! If no Binder is linked with <start>, returns a Null Handle
//! Considers a category number, by default 0
Standard_EXPORT Handle(Transfer_Binder) Find (const Handle(Standard_Transient)& start) const;
Standard_EXPORT Handle(Transfer_Binder) Find(const Handle(Standard_Transient)& start) const;
//! Returns True if a Result (whatever its form) is Bound with
//! a starting Object. I.e., if a Binder with a Result set,
//! is linked with it
//! Considers a category number, by default 0
Standard_EXPORT Standard_Boolean IsBound (const Handle(Standard_Transient)& start) const;
Standard_EXPORT Standard_Boolean IsBound(const Handle(Standard_Transient)& start) const;
//! Returns True if the result of the transfer of an object is
//! already used in other ones. If it is, Rebind cannot change it.
//! Considers a category number, by default 0
Standard_EXPORT Standard_Boolean IsAlreadyUsed (const Handle(Standard_Transient)& start) const;
Standard_EXPORT Standard_Boolean IsAlreadyUsed(const Handle(Standard_Transient)& start) const;
//! Creates a Link a starting Object with a Binder. This Binder
//! can either bring a Result (effective Binding) or none (it can
//! be set later : pre-binding).
//! Considers a category number, by default 0
Standard_EXPORT void Bind (const Handle(Standard_Transient)& start, const Handle(Transfer_Binder)& binder);
Standard_EXPORT void Bind(const Handle(Standard_Transient)& start,
const Handle(Transfer_Binder)& binder);
//! Changes the Binder linked with a starting Object for its
//! unitary transfer. This it can be useful when the exact form
//! of the result is known once the transfer is widely engaged.
//! This can be done only on first transfer.
//! Considers a category number, by default 0
Standard_EXPORT void Rebind (const Handle(Standard_Transient)& start, const Handle(Transfer_Binder)& binder);
Standard_EXPORT void Rebind(const Handle(Standard_Transient)& start,
const Handle(Transfer_Binder)& binder);
//! Removes the Binder linked with a starting object
//! If this Binder brings a non-empty Check, it is replaced by
//! a VoidBinder. Also removes from the list of Roots as required.
//! Returns True if done, False if <start> was not bound
//! Considers a category number, by default 0
Standard_EXPORT Standard_Boolean Unbind (const Handle(Standard_Transient)& start);
Standard_EXPORT Standard_Boolean Unbind(const Handle(Standard_Transient)& start);
//! Returns a Binder for a starting entity, as follows :
//! Tries to Find the already bound one
//! If none found, creates a VoidBinder and Binds it
Standard_EXPORT Handle(Transfer_Binder) FindElseBind (const Handle(Standard_Transient)& start);
Standard_EXPORT Handle(Transfer_Binder) FindElseBind(const Handle(Standard_Transient)& start);
//! Sets Messenger used for outputting messages.
Standard_EXPORT void SetMessenger (const Handle(Message_Messenger)& messenger);
Standard_EXPORT void SetMessenger(const Handle(Message_Messenger)& messenger);
//! Returns Messenger used for outputting messages.
//! The returned object is guaranteed to be non-null;
//! default is Message::Messenger().
Standard_EXPORT Handle(Message_Messenger) Messenger() const;
//! Sets trace level used for outputting messages:
//! <trace> = 0 : no trace at all
//! <trace> = 1 : handled exceptions and calls to AddError
@@ -139,42 +139,50 @@ public:
//! <trace> = 3 : also traces new Roots
//! (uses method ErrorTrace).
//! Default is 1 : Errors traced
Standard_EXPORT void SetTraceLevel (const Standard_Integer tracelev);
Standard_EXPORT void SetTraceLevel(const Standard_Integer tracelev);
//! Returns trace level used for outputting messages.
Standard_EXPORT Standard_Integer TraceLevel() const;
//! New name for AddFail (Msg)
Standard_EXPORT void SendFail (const Handle(Standard_Transient)& start, const Message_Msg& amsg);
Standard_EXPORT void SendFail(const Handle(Standard_Transient)& start, const Message_Msg& amsg);
//! New name for AddWarning (Msg)
Standard_EXPORT void SendWarning (const Handle(Standard_Transient)& start, const Message_Msg& amsg);
Standard_EXPORT void SendWarning(const Handle(Standard_Transient)& start,
const Message_Msg& amsg);
//! Adds an information message
//! Trace is filled if trace level is at least 3
Standard_EXPORT void SendMsg (const Handle(Standard_Transient)& start, const Message_Msg& amsg);
Standard_EXPORT void SendMsg(const Handle(Standard_Transient)& start, const Message_Msg& amsg);
//! Adds an Error message to a starting entity (to the check of
//! its Binder of category 0, as a Fail)
Standard_EXPORT void AddFail (const Handle(Standard_Transient)& start, const Standard_CString mess, const Standard_CString orig = "");
Standard_EXPORT void AddFail(const Handle(Standard_Transient)& start,
const Standard_CString mess,
const Standard_CString orig = "");
//! (other name of AddFail, maintained for compatibility)
Standard_EXPORT void AddError (const Handle(Standard_Transient)& start, const Standard_CString mess, const Standard_CString orig = "");
Standard_EXPORT void AddError(const Handle(Standard_Transient)& start,
const Standard_CString mess,
const Standard_CString orig = "");
//! Adds an Error Message to a starting entity from the definition
//! of a Msg (Original+Value)
Standard_EXPORT void AddFail (const Handle(Standard_Transient)& start, const Message_Msg& amsg);
Standard_EXPORT void AddFail(const Handle(Standard_Transient)& start, const Message_Msg& amsg);
//! Adds a Warning message to a starting entity (to the check of
//! its Binder of category 0)
Standard_EXPORT void AddWarning (const Handle(Standard_Transient)& start, const Standard_CString mess, const Standard_CString orig = "");
Standard_EXPORT void AddWarning(const Handle(Standard_Transient)& start,
const Standard_CString mess,
const Standard_CString orig = "");
//! Adds a Warning Message to a starting entity from the definition
//! of a Msg (Original+Value)
Standard_EXPORT void AddWarning (const Handle(Standard_Transient)& start, const Message_Msg& amsg);
Standard_EXPORT void Mend (const Handle(Standard_Transient)& start, const Standard_CString pref = "");
Standard_EXPORT void AddWarning(const Handle(Standard_Transient)& start, const Message_Msg& amsg);
Standard_EXPORT void Mend(const Handle(Standard_Transient)& start,
const Standard_CString pref = "");
//! Returns the Check attached to a starting entity. If <start>
//! is unknown, returns an empty Check
//! Adds a case name to a starting entity
@@ -202,32 +210,35 @@ public:
//! By default, considers all the attribute names
//! If <rootname> is given, considers only the attribute names
//! which begin by <rootname>
Standard_EXPORT Handle(Interface_Check) Check (const Handle(Standard_Transient)& start) const;
Standard_EXPORT Handle(Interface_Check) Check(const Handle(Standard_Transient)& start) const;
//! Binds a starting object with a Transient Result.
//! Uses a SimpleBinderOfTransient to work. If there is already
//! one but with no Result set, sets its Result.
//! Considers a category number, by default 0
Standard_EXPORT void BindTransient (const Handle(Standard_Transient)& start, const Handle(Standard_Transient)& res);
Standard_EXPORT void BindTransient(const Handle(Standard_Transient)& start,
const Handle(Standard_Transient)& res);
//! Returns the Result of the Transfer of an object <start> as a
//! Transient Result.
//! Returns a Null Handle if there is no Transient Result
//! Considers a category number, by default 0
//! Warning : Supposes that Binding is done with a SimpleBinderOfTransient
Standard_EXPORT const Handle(Standard_Transient)& FindTransient (const Handle(Standard_Transient)& start) const;
Standard_EXPORT const Handle(Standard_Transient)& FindTransient(
const Handle(Standard_Transient)& start) const;
//! Prepares an object <start> to be bound with several results.
//! If no Binder is yet attached to <obj>, a MultipleBinder
//! is created, empty. If a Binder is already set, it must
//! accept Multiple Binding.
//! Considers a category number, by default 0
Standard_EXPORT void BindMultiple (const Handle(Standard_Transient)& start);
Standard_EXPORT void BindMultiple(const Handle(Standard_Transient)& start);
//! Adds an item to a list of results bound to a starting object.
//! Considers a category number, by default 0, for all results
Standard_EXPORT void AddMultiple (const Handle(Standard_Transient)& start, const Handle(Standard_Transient)& res);
Standard_EXPORT void AddMultiple(const Handle(Standard_Transient)& start,
const Handle(Standard_Transient)& res);
//! Searches for a transient result attached to a starting object,
//! according to its type, by criterium IsKind(atype)
//!
@@ -239,8 +250,10 @@ public:
//! This syntactic form avoids to do DownCast : if a result is
//! found with the good type, it is loaded in <val> and can be
//! immediately used, well initialised
Standard_EXPORT Standard_Boolean FindTypedTransient (const Handle(Standard_Transient)& start, const Handle(Standard_Type)& atype, Handle(Standard_Transient)& val) const;
Standard_EXPORT Standard_Boolean FindTypedTransient(const Handle(Standard_Transient)& start,
const Handle(Standard_Type)& atype,
Handle(Standard_Transient)& val) const;
//! Searches for a transient result recorded in a Binder, whatever
//! this Binder is recorded or not in <me>
//!
@@ -248,27 +261,29 @@ public:
//! from class SimpleBinderOfTransient, but is just lighter to call
//!
//! Apart from this, works as FindTypedTransient
Standard_EXPORT Standard_Boolean GetTypedTransient (const Handle(Transfer_Binder)& binder, const Handle(Standard_Type)& atype, Handle(Standard_Transient)& val) const;
Standard_EXPORT Standard_Boolean GetTypedTransient(const Handle(Transfer_Binder)& binder,
const Handle(Standard_Type)& atype,
Handle(Standard_Transient)& val) const;
//! Returns the maximum possible value for Map Index
//! (no result can be bound with a value greater than it)
Standard_EXPORT Standard_Integer NbMapped() const;
//! Returns the Starting Object bound to an Index,
Standard_EXPORT const Handle(Standard_Transient)& Mapped (const Standard_Integer num) const;
Standard_EXPORT const Handle(Standard_Transient)& Mapped(const Standard_Integer num) const;
//! Returns the Index value bound to a Starting Object, 0 if none
Standard_EXPORT Standard_Integer MapIndex (const Handle(Standard_Transient)& start) const;
Standard_EXPORT Standard_Integer MapIndex(const Handle(Standard_Transient)& start) const;
//! Returns the Binder bound to an Index
//! Considers a category number, by default 0
Standard_EXPORT Handle(Transfer_Binder) MapItem (const Standard_Integer num) const;
Standard_EXPORT Handle(Transfer_Binder) MapItem(const Standard_Integer num) const;
//! Declares <obj> (and its Result) as Root. This status will be
//! later exploited by RootResult, see below (Result can be
//! produced at any time)
Standard_EXPORT void SetRoot (const Handle(Standard_Transient)& start);
Standard_EXPORT void SetRoot(const Handle(Standard_Transient)& start);
//! Enable (if <stat> True) or Disables (if <stat> False) Root
//! Management. If it is set, Transfers are considered as stacked
//! (a first Transfer commands other Transfers, and so on) and
@@ -276,172 +291,174 @@ public:
//! Remark : SetRoot can be called whatever this status, on every
//! object.
//! Default is set to True.
Standard_EXPORT void SetRootManagement (const Standard_Boolean stat);
Standard_EXPORT void SetRootManagement(const Standard_Boolean stat);
//! Returns the count of recorded Roots
Standard_EXPORT Standard_Integer NbRoots() const;
//! Returns a Root Entity given its number in the list (1-NbRoots)
Standard_EXPORT const Handle(Standard_Transient)& Root (const Standard_Integer num) const;
Standard_EXPORT const Handle(Standard_Transient)& Root(const Standard_Integer num) const;
//! Returns the Binder bound with a Root Entity given its number
//! Considers a category number, by default 0
Standard_EXPORT Handle(Transfer_Binder) RootItem (const Standard_Integer num) const;
Standard_EXPORT Handle(Transfer_Binder) RootItem(const Standard_Integer num) const;
//! Returns the index in the list of roots for a starting item,
//! or 0 if it is not recorded as a root
Standard_EXPORT Standard_Integer RootIndex (const Handle(Standard_Transient)& start) const;
Standard_EXPORT Standard_Integer RootIndex(const Handle(Standard_Transient)& start) const;
//! Returns Nesting Level of Transfers (managed by methods
//! TranscriptWith & Co). Starts to zero. If no automatic Transfer
//! is used, it remains to zero. Zero means Root Level.
Standard_EXPORT Standard_Integer NestingLevel() const;
//! Resets Nesting Level of Transfers to Zero (Root Level),
//! whatever its current value.
Standard_EXPORT void ResetNestingLevel();
//! Tells if <start> has been recognized as good candidate for
//! Transfer. i.e. queries the Actor and its Nexts
Standard_EXPORT Standard_Boolean Recognize (const Handle(Standard_Transient)& start) const;
Standard_EXPORT Standard_Boolean Recognize(const Handle(Standard_Transient)& start) const;
//! Performs the Transfer of a Starting Object, by calling
//! the method TransferProduct (see below).
//! Mapping and Roots are managed : nothing is done if a Result is
//! already Bound, an exception is raised in case of error.
Standard_EXPORT Handle(Transfer_Binder) Transferring (const Handle(Standard_Transient)& start,
const Message_ProgressRange& theProgress = Message_ProgressRange());
Standard_EXPORT Handle(Transfer_Binder) Transferring(
const Handle(Standard_Transient)& start,
const Message_ProgressRange& theProgress = Message_ProgressRange());
//! Same as Transferring but does not return the Binder.
//! Simply returns True in case of success (for user call)
Standard_EXPORT Standard_Boolean Transfer (const Handle(Standard_Transient)& start,
const Message_ProgressRange& theProgress = Message_ProgressRange());
Standard_EXPORT Standard_Boolean
Transfer(const Handle(Standard_Transient)& start,
const Message_ProgressRange& theProgress = Message_ProgressRange());
//! Allows controls if exceptions will be handled
//! Transfer Operations
//! <err> False : they are not handled with try {} catch {}
//! <err> True : they are
//! Default is False: no handling performed
Standard_EXPORT void SetErrorHandle (const Standard_Boolean err);
Standard_EXPORT void SetErrorHandle(const Standard_Boolean err);
//! Returns error handling flag
Standard_EXPORT Standard_Boolean ErrorHandle() const;
//! Method called when trace is asked
//! Calls PrintTrace to display information relevant for starting
//! objects (which can be redefined)
//! <level> is Nesting Level of Transfer (0 = root)
//! <mode> controls the way the trace is done :
//! 0 neutral, 1 for Error, 2 for Warning message, 3 for new Root
Standard_EXPORT void StartTrace (const Handle(Transfer_Binder)& binder, const Handle(Standard_Transient)& start, const Standard_Integer level, const Standard_Integer mode) const;
Standard_EXPORT void StartTrace(const Handle(Transfer_Binder)& binder,
const Handle(Standard_Transient)& start,
const Standard_Integer level,
const Standard_Integer mode) const;
//! Prints a short information on a starting object. By default
//! prints its Dynamic Type. Can be redefined
Standard_EXPORT virtual void PrintTrace (const Handle(Standard_Transient)& start, Standard_OStream& S) const;
Standard_EXPORT virtual void PrintTrace(const Handle(Standard_Transient)& start,
Standard_OStream& S) const;
//! Returns True if we are surely in a DeadLoop. Evaluation is not
//! exact, it is a "majorant" which must be computed fast.
//! This "majorant" is : <alevel> greater than NbMapped.
Standard_EXPORT Standard_Boolean IsLooping (const Standard_Integer alevel) const;
Standard_EXPORT Standard_Boolean IsLooping(const Standard_Integer alevel) const;
//! Returns, as an iterator, the log of root transfer, i.e. the
//! created objects and Binders bound to starting roots
//! If withstart is given True, Starting Objects are also returned
Standard_EXPORT Transfer_IteratorOfProcessForTransient RootResult (const Standard_Boolean withstart = Standard_False) const;
Standard_EXPORT Transfer_IteratorOfProcessForTransient
RootResult(const Standard_Boolean withstart = Standard_False) const;
//! Returns, as an Iterator, the entire log of transfer (list of
//! created objects and Binders which can bring errors)
//! If withstart is given True, Starting Objects are also returned
Standard_EXPORT Transfer_IteratorOfProcessForTransient CompleteResult (const Standard_Boolean withstart = Standard_False) const;
Standard_EXPORT Transfer_IteratorOfProcessForTransient
CompleteResult(const Standard_Boolean withstart = Standard_False) const;
//! Returns Binders which are neither "Done" nor "Initial",
//! that is Error,Loop or Run (abnormal states at end of Transfer)
//! Starting Objects are given in correspondence in the iterator
Standard_EXPORT Transfer_IteratorOfProcessForTransient AbnormalResult() const;
//! Returns a CheckList as a list of Check : each one is for a
//! starting entity which have either check (warning or fail)
//! messages are attached, or are in abnormal state : that case
//! gives a specific message
//! If <erronly> is True, checks with Warnings only are ignored
Standard_EXPORT Interface_CheckIterator CheckList (const Standard_Boolean erronly) const;
Standard_EXPORT Interface_CheckIterator CheckList(const Standard_Boolean erronly) const;
//! Returns, as an Iterator, the log of transfer for one object
//! <level> = 0 : this object only
//! and if <start> is a scope owner (else, <level> is ignored) :
//! <level> = 1 : object plus its immediate scoped ones
//! <level> = 2 : object plus all its scoped ones
Standard_EXPORT Transfer_IteratorOfProcessForTransient ResultOne (const Handle(Standard_Transient)& start, const Standard_Integer level, const Standard_Boolean withstart = Standard_False) const;
Standard_EXPORT Transfer_IteratorOfProcessForTransient
ResultOne(const Handle(Standard_Transient)& start,
const Standard_Integer level,
const Standard_Boolean withstart = Standard_False) const;
//! Returns a CheckList for one starting object
//! <level> interpreted as by ResultOne
//! If <erronly> is True, checks with Warnings only are ignored
Standard_EXPORT Interface_CheckIterator CheckListOne (const Handle(Standard_Transient)& start, const Standard_Integer level, const Standard_Boolean erronly) const;
Standard_EXPORT Interface_CheckIterator CheckListOne(const Handle(Standard_Transient)& start,
const Standard_Integer level,
const Standard_Boolean erronly) const;
//! Returns True if no check message is attached to a starting
//! object. <level> interpreted as by ResultOne
//! If <erronly> is True, checks with Warnings only are ignored
Standard_EXPORT Standard_Boolean IsCheckListEmpty (const Handle(Standard_Transient)& start, const Standard_Integer level, const Standard_Boolean erronly) const;
Standard_EXPORT Standard_Boolean IsCheckListEmpty(const Handle(Standard_Transient)& start,
const Standard_Integer level,
const Standard_Boolean erronly) const;
//! Removes Results attached to (== Unbinds) a given object and,
//! according <level> :
//! <level> = 0 : only it
//! <level> = 1 : it plus its immediately owned sub-results(scope)
//! <level> = 2 : it plus all its owned sub-results(scope)
Standard_EXPORT void RemoveResult (const Handle(Standard_Transient)& start, const Standard_Integer level, const Standard_Boolean compute = Standard_True);
Standard_EXPORT void RemoveResult(const Handle(Standard_Transient)& start,
const Standard_Integer level,
const Standard_Boolean compute = Standard_True);
//! Computes a number to be associated to a starting object in
//! a check or a check-list
//! By default, returns 0; can be redefined
Standard_EXPORT virtual Standard_Integer CheckNum (const Handle(Standard_Transient)& start) const;
Standard_EXPORT virtual Standard_Integer CheckNum(const Handle(Standard_Transient)& start) const;
DEFINE_STANDARD_RTTI_INLINE(Transfer_ProcessForTransient,Standard_Transient)
DEFINE_STANDARD_RTTI_INLINE(Transfer_ProcessForTransient, Standard_Transient)
protected:
private:
//! Same as Find but stores the last access to the map, for a
//! faster access on next calls (as Bind does too)
//! Considers a category number, by default 0
//! C++ : return const &
Standard_EXPORT Handle(Transfer_Binder) FindAndMask (const Handle(Standard_Transient)& start);
Standard_EXPORT Handle(Transfer_Binder) FindAndMask(const Handle(Standard_Transient)& start);
//! Internal action of Transfer, called by Transferring, with or
//! without ErrorHandle. It invokes the Actor to work (set by
//! SetActor), and tries its Nexts if no result is produced,
//! until a Non Null Binder is produced.
//! But keep in mind that a Null Binder can always be returned
//! if a Starting Entity has not been recognized at all.
Standard_EXPORT Handle(Transfer_Binder) TransferProduct (const Handle(Standard_Transient)& start,
const Message_ProgressRange& theProgress = Message_ProgressRange());
Standard_EXPORT Handle(Transfer_Binder) TransferProduct(
const Handle(Standard_Transient)& start,
const Message_ProgressRange& theProgress = Message_ProgressRange());
Standard_Boolean theerrh;
Standard_Integer thetrace;
Handle(Message_Messenger) themessenger;
Standard_Integer thelevel;
Standard_Integer therootl;
Standard_Boolean therootm;
TColStd_IndexedMapOfInteger theroots;
Handle(Standard_Transient) thelastobj;
Handle(Transfer_Binder) thelastbnd;
Standard_Integer theindex;
Standard_Boolean theerrh;
Standard_Integer thetrace;
Handle(Message_Messenger) themessenger;
Standard_Integer thelevel;
Standard_Integer therootl;
Standard_Boolean therootm;
TColStd_IndexedMapOfInteger theroots;
Handle(Standard_Transient) thelastobj;
Handle(Transfer_Binder) thelastbnd;
Standard_Integer theindex;
Handle(Transfer_ActorOfProcessForTransient) theactor;
Transfer_TransferMapOfProcessForTransient themap;
Transfer_TransferMapOfProcessForTransient themap;
};
#endif // _Transfer_ProcessForTransient_HeaderFile

File diff suppressed because it is too large Load Diff

View File

@@ -11,7 +11,6 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Interface_Check.hxx>
#include <Interface_CheckIterator.hxx>
#include <Interface_InterfaceModel.hxx>
@@ -24,187 +23,225 @@
#include <Transfer_ResultFromTransient.hxx>
#include <Transfer_TransientProcess.hxx>
IMPLEMENT_STANDARD_RTTIEXT(Transfer_ResultFromModel,Standard_Transient)
IMPLEMENT_STANDARD_RTTIEXT(Transfer_ResultFromModel, Standard_Transient)
Transfer_ResultFromModel::Transfer_ResultFromModel ()
{ themnum = 0; themchk = Interface_CheckAny; }
void Transfer_ResultFromModel::SetModel
(const Handle(Interface_InterfaceModel)& model)
{ themodel = model; }
void Transfer_ResultFromModel::SetFileName
(const Standard_CString filename)
{ thename.Clear(); thename.AssignCat(filename); }
Handle(Interface_InterfaceModel) Transfer_ResultFromModel::Model () const
{ return themodel; }
Standard_CString Transfer_ResultFromModel::FileName () const
{ return thename.ToCString(); }
Standard_Boolean Transfer_ResultFromModel::Fill
(const Handle(Transfer_TransientProcess)& TP,
const Handle(Standard_Transient)& ent)
Transfer_ResultFromModel::Transfer_ResultFromModel()
{
if (TP.IsNull() || ent.IsNull()) return Standard_False;
Handle(Transfer_Binder) binder = TP->Find (ent);
if (binder.IsNull()) return Standard_False;
themnum = 0;
themchk = Interface_CheckAny;
}
void Transfer_ResultFromModel::SetModel(const Handle(Interface_InterfaceModel)& model)
{
themodel = model;
}
void Transfer_ResultFromModel::SetFileName(const Standard_CString filename)
{
thename.Clear();
thename.AssignCat(filename);
}
Handle(Interface_InterfaceModel) Transfer_ResultFromModel::Model() const
{
return themodel;
}
Standard_CString Transfer_ResultFromModel::FileName() const
{
return thename.ToCString();
}
Standard_Boolean Transfer_ResultFromModel::Fill(const Handle(Transfer_TransientProcess)& TP,
const Handle(Standard_Transient)& ent)
{
if (TP.IsNull() || ent.IsNull())
return Standard_False;
Handle(Transfer_Binder) binder = TP->Find(ent);
if (binder.IsNull())
return Standard_False;
themain = new Transfer_ResultFromTransient;
themain->SetStart (ent);
themain->SetBinder (binder);
themain->Fill (TP);
// Substitution de resultat pour la Shape (-> HShape) : pas ici, on est
// dans le pk Transfer qui est general et ne sait pas ce qu est une Shape ...
if (!TP->Model().IsNull()) themodel = TP->Model();
if (themodel.IsNull()) return Standard_True;
themnum = themodel->Number (ent);
themain->SetStart(ent);
themain->SetBinder(binder);
themain->Fill(TP);
// Substitution de resultat pour la Shape (-> HShape) : pas ici, on est
// dans le pk Transfer qui est general et ne sait pas ce qu est une Shape ...
if (!TP->Model().IsNull())
themodel = TP->Model();
if (themodel.IsNull())
return Standard_True;
themnum = themodel->Number(ent);
themlab.Clear();
if (themnum > 0)
themlab.AssignCat (themodel->StringLabel(ent)->ToCString());
themlab.AssignCat(themodel->StringLabel(ent)->ToCString());
return Standard_True;
}
void Transfer_ResultFromModel::Strip (const Standard_Integer mode)
void Transfer_ResultFromModel::Strip(const Standard_Integer mode)
{
if (themain.IsNull()) return;
if (themain.IsNull())
return;
themain->Strip();
if (mode >= 10) {
themchk = ComputeCheckStatus (Standard_False);
if (mode >= 10)
{
themchk = ComputeCheckStatus(Standard_False);
themodel.Nullify();
themain->ClearSubs();
Handle(Standard_Transient) nulh; themain->SetStart(nulh);
if (mode > 10) themain.Nullify();
Handle(Standard_Transient) nulh;
themain->SetStart(nulh);
if (mode > 10)
themain.Nullify();
}
}
void Transfer_ResultFromModel::FillBack
(const Handle(Transfer_TransientProcess)& TP) const
void Transfer_ResultFromModel::FillBack(const Handle(Transfer_TransientProcess)& TP) const
{
if (!themodel.IsNull()) TP->SetModel(themodel);
themain->FillBack (TP);
if (!themodel.IsNull())
TP->SetModel(themodel);
themain->FillBack(TP);
}
Standard_Boolean Transfer_ResultFromModel::HasResult() const
{
return (themain.IsNull() ? Standard_False : themain->HasResult());
}
Standard_Boolean Transfer_ResultFromModel::HasResult () const
{ return (themain.IsNull() ? Standard_False : themain->HasResult()); }
Handle(Transfer_ResultFromTransient) Transfer_ResultFromModel::MainResult() const
{
return themain;
}
Handle(Transfer_ResultFromTransient) Transfer_ResultFromModel::MainResult
() const
{ return themain; }
void Transfer_ResultFromModel::SetMainResult
(const Handle(Transfer_ResultFromTransient)& amain)
void Transfer_ResultFromModel::SetMainResult(const Handle(Transfer_ResultFromTransient)& amain)
{
themchk = Interface_CheckAny;
themain = amain;
if (themodel.IsNull() || themain.IsNull()) return;
themnum = themodel->Number (themain->Start());
if (themodel.IsNull() || themain.IsNull())
return;
themnum = themodel->Number(themain->Start());
themlab.Clear();
if (themnum > 0)
themlab.AssignCat (themodel->StringLabel(themain->Start())->ToCString());
themlab.AssignCat(themodel->StringLabel(themain->Start())->ToCString());
}
Standard_CString Transfer_ResultFromModel::MainLabel () const
{ return themlab.ToCString(); }
Standard_Integer Transfer_ResultFromModel::MainNumber () const
{ return themnum; }
Standard_CString Transfer_ResultFromModel::MainLabel() const
{
return themlab.ToCString();
}
Standard_Integer Transfer_ResultFromModel::MainNumber() const
{
return themnum;
}
// ############ INFORMATIONS GLOBALES ###########
Handle(Transfer_ResultFromTransient) Transfer_ResultFromModel::ResultFromKey
(const Handle(Standard_Transient)& start) const
{ return themain->ResultFromKey (start); }
Handle(TColStd_HSequenceOfTransient) Transfer_ResultFromModel::Results
(const Standard_Integer level) const
Handle(Transfer_ResultFromTransient) Transfer_ResultFromModel::ResultFromKey(
const Handle(Standard_Transient)& start) const
{
Standard_Integer i,nb;
return themain->ResultFromKey(start);
}
Handle(TColStd_HSequenceOfTransient) Transfer_ResultFromModel::Results(
const Standard_Integer level) const
{
Standard_Integer i, nb;
Handle(TColStd_HSequenceOfTransient) list = new TColStd_HSequenceOfTransient();
if (level > 1) {
TColStd_IndexedMapOfTransient map (themodel.IsNull() ? 1000 : themodel->NbEntities());
if (level > 1)
{
TColStd_IndexedMapOfTransient map(themodel.IsNull() ? 1000 : themodel->NbEntities());
map.Add(themain);
themain->FillMap(map);
nb = map.Extent();
for (i = 1; i <= nb; i ++) list->Append(map.FindKey(i));
for (i = 1; i <= nb; i++)
list->Append(map.FindKey(i));
}
else list->Append(themain);
if (level == 1) {
else
list->Append(themain);
if (level == 1)
{
nb = themain->NbSubResults();
for (i = 1; i <= nb; i ++) list->Append(themain->SubResult(i));
for (i = 1; i <= nb; i++)
list->Append(themain->SubResult(i));
list->Append(themain);
}
return list;
}
Handle(TColStd_HSequenceOfTransient) Transfer_ResultFromModel::TransferredList
(const Standard_Integer level) const
Handle(TColStd_HSequenceOfTransient) Transfer_ResultFromModel::TransferredList(
const Standard_Integer level) const
{
Standard_Integer i,nb;
Standard_Integer i, nb;
Handle(TColStd_HSequenceOfTransient) list = new TColStd_HSequenceOfTransient();
Handle(TColStd_HSequenceOfTransient) res = Results(level);
nb = res->Length();
for (i = 1; i <= nb; i ++) {
DeclareAndCast(Transfer_ResultFromTransient,unres,res->Value(i));
if (unres.IsNull()) continue;
if (unres->HasResult()) list->Append (unres->Start());
nb = res->Length();
for (i = 1; i <= nb; i++)
{
DeclareAndCast(Transfer_ResultFromTransient, unres, res->Value(i));
if (unres.IsNull())
continue;
if (unres->HasResult())
list->Append(unres->Start());
}
return list;
}
Handle(TColStd_HSequenceOfTransient) Transfer_ResultFromModel::CheckedList
(const Interface_CheckStatus check, const Standard_Boolean result) const
Handle(TColStd_HSequenceOfTransient) Transfer_ResultFromModel::CheckedList(
const Interface_CheckStatus check,
const Standard_Boolean result) const
{
Standard_Integer i,nb;
Standard_Integer i, nb;
Handle(TColStd_HSequenceOfTransient) list = new TColStd_HSequenceOfTransient();
Handle(TColStd_HSequenceOfTransient) res = Results(2);
nb = res->Length();
for (i = 1; i <= nb; i ++) {
DeclareAndCast(Transfer_ResultFromTransient,unres,res->Value(i));
if (unres.IsNull()) continue;
if (result && !unres->HasResult()) continue;
nb = res->Length();
for (i = 1; i <= nb; i++)
{
DeclareAndCast(Transfer_ResultFromTransient, unres, res->Value(i));
if (unres.IsNull())
continue;
if (result && !unres->HasResult())
continue;
const Handle(Interface_Check) ach = unres->Check();
if (ach->Complies(check)) list->Append (unres->Start());
if (ach->Complies(check))
list->Append(unres->Start());
}
return list;
}
Interface_CheckIterator Transfer_ResultFromModel::CheckList
(const Standard_Boolean erronly, const Standard_Integer level) const
Interface_CheckIterator Transfer_ResultFromModel::CheckList(const Standard_Boolean erronly,
const Standard_Integer level) const
{
Interface_CheckIterator chl;
Standard_Integer i,nb;
Interface_CheckIterator chl;
Standard_Integer i, nb;
Handle(TColStd_HSequenceOfTransient) list = new TColStd_HSequenceOfTransient();
Handle(TColStd_HSequenceOfTransient) res = Results(level);
nb = res->Length();
for (i = 1; i <= nb; i ++) {
DeclareAndCast(Transfer_ResultFromTransient,unres,res->Value(i));
if (unres.IsNull()) continue;
nb = res->Length();
for (i = 1; i <= nb; i++)
{
DeclareAndCast(Transfer_ResultFromTransient, unres, res->Value(i));
if (unres.IsNull())
continue;
Interface_CheckStatus stat = unres->CheckStatus();
if ( stat == Interface_CheckOK ||
(stat == Interface_CheckWarning && erronly)) continue;
if (stat == Interface_CheckOK || (stat == Interface_CheckWarning && erronly))
continue;
Handle(Transfer_Binder) binder = unres->Binder();
Handle(Interface_Check) bch = binder->Check();
Handle(Interface_Check) bch = binder->Check();
bch->SetEntity(unres->Start());
chl.Add(bch, (themodel.IsNull() ? 0 : themodel->Number(unres->Start())) );
chl.Add(bch, (themodel.IsNull() ? 0 : themodel->Number(unres->Start())));
}
return chl;
}
Interface_CheckStatus Transfer_ResultFromModel::CheckStatus () const
Interface_CheckStatus Transfer_ResultFromModel::CheckStatus() const
{
if (themchk != Interface_CheckAny) return themchk;
Interface_CheckIterator chl = CheckList (Standard_False,2);
if (themchk != Interface_CheckAny)
return themchk;
Interface_CheckIterator chl = CheckList(Standard_False, 2);
return chl.Status();
}
Interface_CheckStatus Transfer_ResultFromModel::ComputeCheckStatus
(const Standard_Boolean enforce)
Interface_CheckStatus Transfer_ResultFromModel::ComputeCheckStatus(const Standard_Boolean enforce)
{
if (themchk == Interface_CheckAny || enforce) themchk = CheckStatus();
if (themchk == Interface_CheckAny || enforce)
themchk = CheckStatus();
return themchk;
}

View File

@@ -30,7 +30,6 @@ class Transfer_ResultFromTransient;
class Transfer_TransientProcess;
class Interface_CheckIterator;
class Transfer_ResultFromModel;
DEFINE_STANDARD_HANDLE(Transfer_ResultFromModel, Standard_Transient)
@@ -53,31 +52,30 @@ class Transfer_ResultFromModel : public Standard_Transient
{
public:
//! Creates a ResultFromModel, empty
Standard_EXPORT Transfer_ResultFromModel();
//! Sets starting Model
Standard_EXPORT void SetModel (const Handle(Interface_InterfaceModel)& model);
Standard_EXPORT void SetModel(const Handle(Interface_InterfaceModel)& model);
//! Sets starting File Name
Standard_EXPORT void SetFileName (const Standard_CString filename);
Standard_EXPORT void SetFileName(const Standard_CString filename);
//! Returns starting Model (null if not set)
Standard_EXPORT Handle(Interface_InterfaceModel) Model() const;
//! Returns starting File Name (empty if not set)
Standard_EXPORT Standard_CString FileName() const;
//! Fills from a TransientProcess, with the result attached to
//! a starting entity. Considers its Model if it is set.
//! This action produces a structured set of ResultFromTransient,
//! considering scopes, starting by that of <ent>.
//! If <ent> has no recorded result, it remains empty
//! Returns True if a result is recorded, False else
Standard_EXPORT Standard_Boolean Fill (const Handle(Transfer_TransientProcess)& TP, const Handle(Standard_Transient)& ent);
Standard_EXPORT Standard_Boolean Fill(const Handle(Transfer_TransientProcess)& TP,
const Handle(Standard_Transient)& ent);
//! Clears some data attached to binders used by TransientProcess,
//! which become useless once the transfer has been done,
//! by calling Strip on its ResultFromTransient
@@ -86,43 +84,45 @@ public:
//! mode = 10 : just keeps file name, label, check status ...,
//! and MainResult but only the result (Binder)
//! mode = 11 : also clears MainResult (status and names remain)
Standard_EXPORT void Strip (const Standard_Integer mode);
Standard_EXPORT void Strip(const Standard_Integer mode);
//! Fills back a TransientProcess from the structured set of
//! binders. Also sets the Model.
Standard_EXPORT void FillBack (const Handle(Transfer_TransientProcess)& TP) const;
Standard_EXPORT void FillBack(const Handle(Transfer_TransientProcess)& TP) const;
//! Returns True if a Result is recorded
Standard_EXPORT Standard_Boolean HasResult() const;
//! Returns the main recorded ResultFromTransient, or a null
Standard_EXPORT Handle(Transfer_ResultFromTransient) MainResult() const;
//! Sets a new value for the main recorded ResultFromTransient
Standard_EXPORT void SetMainResult (const Handle(Transfer_ResultFromTransient)& amain);
Standard_EXPORT void SetMainResult(const Handle(Transfer_ResultFromTransient)& amain);
//! Returns the label in starting model attached to main entity
//! (updated by Fill or SetMainResult, if Model is known)
Standard_EXPORT Standard_CString MainLabel() const;
//! Returns the label in starting model attached to main entity
Standard_EXPORT Standard_Integer MainNumber() const;
//! Searches for a key (starting entity) and returns its result
//! Returns a null handle if not found
Standard_EXPORT Handle(Transfer_ResultFromTransient) ResultFromKey (const Handle(Standard_Transient)& start) const;
Standard_EXPORT Handle(Transfer_ResultFromTransient) ResultFromKey(
const Handle(Standard_Transient)& start) const;
//! Internal method which returns the list of ResultFromTransient,
//! according level (2:complete; 1:sub-level 1; 0:main only)
Standard_EXPORT Handle(TColStd_HSequenceOfTransient) Results (const Standard_Integer level) const;
Standard_EXPORT Handle(TColStd_HSequenceOfTransient) Results(const Standard_Integer level) const;
//! Returns the list of recorded starting entities, ending by the
//! root. Entities with check but no transfer result are ignored
//! <level> = 2 (D), considers the complete list
//! <level> = 1 considers the main result plus immediate subs
//! <level> = 0 just the main result
Standard_EXPORT Handle(TColStd_HSequenceOfTransient) TransferredList (const Standard_Integer level = 2) const;
Standard_EXPORT Handle(TColStd_HSequenceOfTransient) TransferredList(
const Standard_Integer level = 2) const;
//! Returns the list of starting entities to which a check status
//! is attached.
//! <check> = -2 , all entities whatever the check (see result)
@@ -132,53 +132,39 @@ public:
//! <check> = 2 , entities with fail
//! <result> : if True, only entities with an attached result
//! Remark : result True and check=0 will give an empty list
Standard_EXPORT Handle(TColStd_HSequenceOfTransient) CheckedList (const Interface_CheckStatus check, const Standard_Boolean result) const;
Standard_EXPORT Handle(TColStd_HSequenceOfTransient) CheckedList(
const Interface_CheckStatus check,
const Standard_Boolean result) const;
//! Returns the check-list of this set of results
//! <erronly> true : only fails are considered
//! <level> = 0 : considers only main binder
//! <level> = 1 : considers main binder plus immediate subs
//! <level> = 2 (D) : considers all checks
Standard_EXPORT Interface_CheckIterator CheckList (const Standard_Boolean erronly, const Standard_Integer level = 2) const;
Standard_EXPORT Interface_CheckIterator CheckList(const Standard_Boolean erronly,
const Standard_Integer level = 2) const;
//! Returns the check status with corresponds to the content
//! of this ResultFromModel; considers all levels of transfer
//! (worst status). Returns CheckAny if not yet computed
//! Reads it from recorded status if already computed, else
//! recomputes one
Standard_EXPORT Interface_CheckStatus CheckStatus() const;
//! Computes and records check status (see CheckStatus)
//! Does not computes it if already done and <enforce> False
Standard_EXPORT Interface_CheckStatus ComputeCheckStatus (const Standard_Boolean enforce);
Standard_EXPORT Interface_CheckStatus ComputeCheckStatus(const Standard_Boolean enforce);
DEFINE_STANDARD_RTTIEXT(Transfer_ResultFromModel,Standard_Transient)
DEFINE_STANDARD_RTTIEXT(Transfer_ResultFromModel, Standard_Transient)
protected:
private:
Handle(Interface_InterfaceModel) themodel;
TCollection_AsciiString thename;
Handle(Interface_InterfaceModel) themodel;
TCollection_AsciiString thename;
Handle(Transfer_ResultFromTransient) themain;
TCollection_AsciiString themlab;
Standard_Integer themnum;
Interface_CheckStatus themchk;
TCollection_AsciiString themlab;
Standard_Integer themnum;
Interface_CheckStatus themchk;
};
#endif // _Transfer_ResultFromModel_HeaderFile

View File

@@ -11,112 +11,129 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Interface_Check.hxx>
#include <Standard_Transient.hxx>
#include <Standard_Type.hxx>
#include <Transfer_ResultFromTransient.hxx>
#include <Transfer_TransientProcess.hxx>
IMPLEMENT_STANDARD_RTTIEXT(Transfer_ResultFromTransient,Standard_Transient)
IMPLEMENT_STANDARD_RTTIEXT(Transfer_ResultFromTransient, Standard_Transient)
static Handle(Interface_Check) voidcheck = new Interface_Check;
Transfer_ResultFromTransient::Transfer_ResultFromTransient () { }
Transfer_ResultFromTransient::Transfer_ResultFromTransient() {}
void Transfer_ResultFromTransient::SetStart
(const Handle(Standard_Transient)& start)
{ thestart = start; }
void Transfer_ResultFromTransient::SetBinder
(const Handle(Transfer_Binder)& binder)
{ thebinder = binder; }
Handle(Standard_Transient) Transfer_ResultFromTransient::Start () const
{ return thestart; }
Handle(Transfer_Binder) Transfer_ResultFromTransient::Binder () const
{ return thebinder; }
Standard_Boolean Transfer_ResultFromTransient::HasResult () const
{ return (thebinder.IsNull() ? Standard_False : thebinder->HasResult()); }
const Handle(Interface_Check) Transfer_ResultFromTransient::Check () const
void Transfer_ResultFromTransient::SetStart(const Handle(Standard_Transient)& start)
{
if (thebinder.IsNull()) return voidcheck;
thestart = start;
}
void Transfer_ResultFromTransient::SetBinder(const Handle(Transfer_Binder)& binder)
{
thebinder = binder;
}
Handle(Standard_Transient) Transfer_ResultFromTransient::Start() const
{
return thestart;
}
Handle(Transfer_Binder) Transfer_ResultFromTransient::Binder() const
{
return thebinder;
}
Standard_Boolean Transfer_ResultFromTransient::HasResult() const
{
return (thebinder.IsNull() ? Standard_False : thebinder->HasResult());
}
const Handle(Interface_Check) Transfer_ResultFromTransient::Check() const
{
if (thebinder.IsNull())
return voidcheck;
return thebinder->Check();
}
Interface_CheckStatus Transfer_ResultFromTransient::CheckStatus () const
Interface_CheckStatus Transfer_ResultFromTransient::CheckStatus() const
{
if (thebinder.IsNull()) return Interface_CheckOK;
if (thebinder.IsNull())
return Interface_CheckOK;
const Handle(Interface_Check) ach = thebinder->Check();
return ach->Status();
}
Handle(Transfer_ResultFromTransient) Transfer_ResultFromTransient::ResultFromKey
(const Handle(Standard_Transient)& key) const
Handle(Transfer_ResultFromTransient) Transfer_ResultFromTransient::ResultFromKey(
const Handle(Standard_Transient)& key) const
{
Handle(Transfer_ResultFromTransient) res;
if (key == thestart) return this;
if (key == thestart)
return this;
Standard_Integer i, nb = NbSubResults();
for (i = 1; i <= nb; i ++) {
for (i = 1; i <= nb; i++)
{
res = SubResult(i)->ResultFromKey(key);
if (!res.IsNull()) return res;
if (!res.IsNull())
return res;
}
return res;
}
void Transfer_ResultFromTransient::FillMap
(TColStd_IndexedMapOfTransient& map) const
void Transfer_ResultFromTransient::FillMap(TColStd_IndexedMapOfTransient& map) const
{
if (thesubs.IsNull()) return;
if (thesubs.IsNull())
return;
Standard_Integer i, nb = thesubs->Length();
for (i = 1; i <= nb; i ++) map.Add (thesubs->Value(i));
for (i = 1; i <= nb; i ++) SubResult(i)->FillMap(map);
for (i = 1; i <= nb; i++)
map.Add(thesubs->Value(i));
for (i = 1; i <= nb; i++)
SubResult(i)->FillMap(map);
}
// ##### SUBS #####
void Transfer_ResultFromTransient::ClearSubs ()
{ thesubs.Nullify(); }
void Transfer_ResultFromTransient::AddSubResult
(const Handle(Transfer_ResultFromTransient)& sub)
void Transfer_ResultFromTransient::ClearSubs()
{
if (sub.IsNull()) return;
if (thesubs.IsNull()) thesubs = new TColStd_HSequenceOfTransient();
thesubs->Append (sub);
thesubs.Nullify();
}
Standard_Integer Transfer_ResultFromTransient::NbSubResults () const
{ return (thesubs.IsNull() ? 0 : thesubs->Length()); }
void Transfer_ResultFromTransient::AddSubResult(const Handle(Transfer_ResultFromTransient)& sub)
{
if (sub.IsNull())
return;
if (thesubs.IsNull())
thesubs = new TColStd_HSequenceOfTransient();
thesubs->Append(sub);
}
Handle(Transfer_ResultFromTransient) Transfer_ResultFromTransient::SubResult
(const Standard_Integer num) const
Standard_Integer Transfer_ResultFromTransient::NbSubResults() const
{
return (thesubs.IsNull() ? 0 : thesubs->Length());
}
Handle(Transfer_ResultFromTransient) Transfer_ResultFromTransient::SubResult(
const Standard_Integer num) const
{
Handle(Transfer_ResultFromTransient) sub;
if (thesubs.IsNull()) return sub;
if (num < 1 || num > thesubs->Length()) return sub;
if (thesubs.IsNull())
return sub;
if (num < 1 || num > thesubs->Length())
return sub;
return Handle(Transfer_ResultFromTransient)::DownCast(thesubs->Value(num));
}
void Transfer_ResultFromTransient::Fill
(const Handle(Transfer_TransientProcess)& /*TP*/)
void Transfer_ResultFromTransient::Fill(const Handle(Transfer_TransientProcess)& /*TP*/)
{
//abv: WARNING: to be removed (scopes)
// abv: WARNING: to be removed (scopes)
return;
}
void Transfer_ResultFromTransient::Strip ()
void Transfer_ResultFromTransient::Strip()
{
//abv: WARNING: to be removed (scopes)
// abv: WARNING: to be removed (scopes)
}
void Transfer_ResultFromTransient::FillBack
(const Handle(Transfer_TransientProcess)& /*TP*/) const
void Transfer_ResultFromTransient::FillBack(const Handle(Transfer_TransientProcess)& /*TP*/) const
{
//abv: WARNING: to be removed (scopes)
// abv: WARNING: to be removed (scopes)
}

View File

@@ -29,7 +29,6 @@ class Transfer_Binder;
class Interface_Check;
class Transfer_TransientProcess;
class Transfer_ResultFromTransient;
DEFINE_STANDARD_HANDLE(Transfer_ResultFromTransient, Standard_Transient)
@@ -45,93 +44,75 @@ class Transfer_ResultFromTransient : public Standard_Transient
{
public:
//! Creates a ResultFromTransient, empty
Standard_EXPORT Transfer_ResultFromTransient();
//! Sets starting entity
Standard_EXPORT void SetStart (const Handle(Standard_Transient)& start);
Standard_EXPORT void SetStart(const Handle(Standard_Transient)& start);
//! Sets Binder (for result plus individual check)
Standard_EXPORT void SetBinder (const Handle(Transfer_Binder)& binder);
Standard_EXPORT void SetBinder(const Handle(Transfer_Binder)& binder);
//! Returns the starting entity
Standard_EXPORT Handle(Standard_Transient) Start() const;
//! Returns the binder
Standard_EXPORT Handle(Transfer_Binder) Binder() const;
//! Returns True if a result is recorded
Standard_EXPORT Standard_Boolean HasResult() const;
//! Returns the check (or an empty one if no binder)
Standard_EXPORT const Handle(Interface_Check) Check() const;
//! Returns the check status
Standard_EXPORT Interface_CheckStatus CheckStatus() const;
//! Clears the list of (immediate) sub-results
Standard_EXPORT void ClearSubs();
//! Adds a sub-result
Standard_EXPORT void AddSubResult (const Handle(Transfer_ResultFromTransient)& sub);
Standard_EXPORT void AddSubResult(const Handle(Transfer_ResultFromTransient)& sub);
//! Returns the count of recorded sub-results
Standard_EXPORT Standard_Integer NbSubResults() const;
//! Returns a sub-result, given its rank
Standard_EXPORT Handle(Transfer_ResultFromTransient) SubResult (const Standard_Integer num) const;
Standard_EXPORT Handle(Transfer_ResultFromTransient) SubResult(const Standard_Integer num) const;
//! Returns the ResultFromTransient attached to a given starting
//! entity (the key). Returns a null handle if not found
Standard_EXPORT Handle(Transfer_ResultFromTransient) ResultFromKey (const Handle(Standard_Transient)& key) const;
Standard_EXPORT Handle(Transfer_ResultFromTransient) ResultFromKey(
const Handle(Standard_Transient)& key) const;
//! This method is used by ResultFromModel to collate the list of
//! ResultFromTransient, avoiding duplications with a map
//! Remark : <me> is already in the map and has not to be bound
Standard_EXPORT void FillMap (TColStd_IndexedMapOfTransient& map) const;
Standard_EXPORT void FillMap(TColStd_IndexedMapOfTransient& map) const;
//! Fills from a TransientProcess, with the starting entity which
//! must have been set before. It works with scopes, calls Fill
//! on each of its sub-results
Standard_EXPORT void Fill (const Handle(Transfer_TransientProcess)& TP);
Standard_EXPORT void Fill(const Handle(Transfer_TransientProcess)& TP);
//! Clears some data attached to binders used by TransientProcess,
//! which become useless once the transfer has been done :
//! the list of sub-scoped binders, which is now recorded as
//! sub-results
Standard_EXPORT void Strip();
//! Fills back a TransientProcess with definition of a
//! ResultFromTransient, respectfully to its structuration in
//! scopes
Standard_EXPORT void FillBack (const Handle(Transfer_TransientProcess)& TP) const;
Standard_EXPORT void FillBack(const Handle(Transfer_TransientProcess)& TP) const;
DEFINE_STANDARD_RTTIEXT(Transfer_ResultFromTransient,Standard_Transient)
DEFINE_STANDARD_RTTIEXT(Transfer_ResultFromTransient, Standard_Transient)
protected:
private:
Handle(Standard_Transient) thestart;
Handle(Transfer_Binder) thebinder;
Handle(Standard_Transient) thestart;
Handle(Transfer_Binder) thebinder;
Handle(TColStd_HSequenceOfTransient) thesubs;
};
#endif // _Transfer_ResultFromTransient_HeaderFile

View File

@@ -22,5 +22,4 @@
typedef NCollection_Sequence<Handle(Transfer_Binder)> Transfer_SequenceOfBinder;
#endif

View File

@@ -22,5 +22,4 @@
typedef NCollection_Sequence<Handle(Transfer_Finder)> Transfer_SequenceOfFinder;
#endif

View File

@@ -11,60 +11,64 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Standard_Transient.hxx>
#include <Standard_Type.hxx>
#include <Transfer_SimpleBinderOfTransient.hxx>
#include <Transfer_TransferFailure.hxx>
IMPLEMENT_STANDARD_RTTIEXT(Transfer_SimpleBinderOfTransient,Transfer_Binder)
IMPLEMENT_STANDARD_RTTIEXT(Transfer_SimpleBinderOfTransient, Transfer_Binder)
// "Handle(Standard_Transient)" : la classe de base pour le Resultat
Transfer_SimpleBinderOfTransient::Transfer_SimpleBinderOfTransient () { }
Transfer_SimpleBinderOfTransient::Transfer_SimpleBinderOfTransient() {}
// Standard_Boolean Transfer_SimpleBinderOfTransient::IsMultiple() const
// { return Standard_False; }
Handle(Standard_Type) Transfer_SimpleBinderOfTransient::ResultType () const
Handle(Standard_Type) Transfer_SimpleBinderOfTransient::ResultType() const
{
if (!HasResult() || theres.IsNull()) return STANDARD_TYPE(Standard_Transient);
if (!HasResult() || theres.IsNull())
return STANDARD_TYPE(Standard_Transient);
return Result()->DynamicType();
}
Standard_CString Transfer_SimpleBinderOfTransient::ResultTypeName () const
Standard_CString Transfer_SimpleBinderOfTransient::ResultTypeName() const
{
if (!HasResult() || theres.IsNull()) return "(void)";
if (!HasResult() || theres.IsNull())
return "(void)";
return Result()->DynamicType()->Name();
}
void Transfer_SimpleBinderOfTransient::SetResult
(const Handle(Standard_Transient)& res)
void Transfer_SimpleBinderOfTransient::SetResult(const Handle(Standard_Transient)& res)
{
SetResultPresent();
theres = res;
}
const Handle(Standard_Transient)& Transfer_SimpleBinderOfTransient::Result () const
{ return theres; }
Standard_Boolean Transfer_SimpleBinderOfTransient::GetTypedResult
(const Handle(Transfer_Binder)& bnd, const Handle(Standard_Type)& atype,
Handle(Standard_Transient)& res)
const Handle(Standard_Transient)& Transfer_SimpleBinderOfTransient::Result() const
{
if (atype.IsNull()) return Standard_False;
return theres;
}
Standard_Boolean Transfer_SimpleBinderOfTransient::GetTypedResult(
const Handle(Transfer_Binder)& bnd,
const Handle(Standard_Type)& atype,
Handle(Standard_Transient)& res)
{
if (atype.IsNull())
return Standard_False;
Handle(Transfer_Binder) bn = bnd;
while (!bn.IsNull()) {
while (!bn.IsNull())
{
Handle(Transfer_SimpleBinderOfTransient) trb =
Handle(Transfer_SimpleBinderOfTransient)::DownCast(bn);
bn = bn->NextResult();
if (trb.IsNull()) continue;
if (trb.IsNull())
continue;
const Handle(Standard_Transient)& rs = trb->Result();
if (rs.IsNull()) continue;
if (!rs->IsKind(atype)) continue;
if (rs.IsNull())
continue;
if (!rs->IsKind(atype))
continue;
res = rs;
return Standard_True;
}

View File

@@ -22,7 +22,6 @@
#include <Transfer_Binder.hxx>
class Transfer_SimpleBinderOfTransient;
DEFINE_STANDARD_HANDLE(Transfer_SimpleBinderOfTransient, Transfer_Binder)
@@ -33,28 +32,26 @@ class Transfer_SimpleBinderOfTransient : public Transfer_Binder
{
public:
//! Creates an empty SimpleBinderOfTransient
//! Returns True if a starting object is bound with SEVERAL
//! results : Here, returns always False
//! See Binder itself
Standard_EXPORT Transfer_SimpleBinderOfTransient();
//! Returns the Effective (Dynamic) Type of the Result
//! (Standard_Transient if no Result is defined)
Standard_EXPORT Handle(Standard_Type) ResultType() const Standard_OVERRIDE;
//! Returns the Effective Name of (Dynamic) Type of the Result
//! (void) if no result is defined
Standard_EXPORT Standard_CString ResultTypeName() const Standard_OVERRIDE;
//! Defines the Result
Standard_EXPORT void SetResult (const Handle(Standard_Transient)& res);
Standard_EXPORT void SetResult(const Handle(Standard_Transient)& res);
//! Returns the defined Result, if there is one
Standard_EXPORT const Handle(Standard_Transient)& Result() const;
//! Returns a transient result according to its type (IsKind)
//! i.e. the result itself if IsKind(atype), else searches in
//! NextResult, until first found, then returns True
@@ -63,30 +60,15 @@ public:
//! This syntactic form avoids to do DownCast : if a result is
//! found with the good type, it is loaded in <res> and can be
//! immediately used, well initialised
Standard_EXPORT static Standard_Boolean GetTypedResult (const Handle(Transfer_Binder)& bnd, const Handle(Standard_Type)& atype, Handle(Standard_Transient)& res);
Standard_EXPORT static Standard_Boolean GetTypedResult(const Handle(Transfer_Binder)& bnd,
const Handle(Standard_Type)& atype,
Handle(Standard_Transient)& res);
DEFINE_STANDARD_RTTIEXT(Transfer_SimpleBinderOfTransient,Transfer_Binder)
DEFINE_STANDARD_RTTIEXT(Transfer_SimpleBinderOfTransient, Transfer_Binder)
protected:
private:
Handle(Standard_Transient) theres;
};
#endif // _Transfer_SimpleBinderOfTransient_HeaderFile

View File

@@ -20,11 +20,11 @@
//! execution status of an individual transfer (see Transcriptor)
enum Transfer_StatusExec
{
Transfer_StatusInitial,
Transfer_StatusRun,
Transfer_StatusDone,
Transfer_StatusError,
Transfer_StatusLoop
Transfer_StatusInitial,
Transfer_StatusRun,
Transfer_StatusDone,
Transfer_StatusError,
Transfer_StatusLoop
};
#endif // _Transfer_StatusExec_HeaderFile

View File

@@ -20,9 +20,9 @@
//! result status of transferring an entity (see Transcriptor)
enum Transfer_StatusResult
{
Transfer_StatusVoid,
Transfer_StatusDefined,
Transfer_StatusUsed
Transfer_StatusVoid,
Transfer_StatusDefined,
Transfer_StatusUsed
};
#endif // _Transfer_StatusResult_HeaderFile

View File

@@ -25,8 +25,9 @@ class Transfer_TransferDeadLoop;
DEFINE_STANDARD_HANDLE(Transfer_TransferDeadLoop, Transfer_TransferFailure)
#if !defined No_Exception && !defined No_Transfer_TransferDeadLoop
#define Transfer_TransferDeadLoop_Raise_if(CONDITION, MESSAGE) \
if (CONDITION) throw Transfer_TransferDeadLoop(MESSAGE);
#define Transfer_TransferDeadLoop_Raise_if(CONDITION, MESSAGE) \
if (CONDITION) \
throw Transfer_TransferDeadLoop(MESSAGE);
#else
#define Transfer_TransferDeadLoop_Raise_if(CONDITION, MESSAGE)
#endif

View File

@@ -11,7 +11,6 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Interface_GeneralLib.hxx>
#include <Interface_InterfaceModel.hxx>
#include <Interface_Macros.hxx>
@@ -22,45 +21,45 @@
#include <Transfer_TransferDispatch.hxx>
#include <Transfer_TransientProcess.hxx>
Transfer_TransferDispatch::Transfer_TransferDispatch
(const Handle(Interface_InterfaceModel)& amodel,
const Interface_GeneralLib& lib)
: Interface_CopyTool (amodel,lib)
{ SetControl (new Transfer_DispatchControl
(amodel, new Transfer_TransientProcess(amodel->NbEntities()))); }
Transfer_TransferDispatch::Transfer_TransferDispatch(const Handle(Interface_InterfaceModel)& amodel,
const Interface_GeneralLib& lib)
: Interface_CopyTool(amodel, lib)
{
SetControl(
new Transfer_DispatchControl(amodel, new Transfer_TransientProcess(amodel->NbEntities())));
}
Transfer_TransferDispatch::Transfer_TransferDispatch(const Handle(Interface_InterfaceModel)& amodel,
const Handle(Interface_Protocol)& protocol)
: Interface_CopyTool(amodel, protocol)
{
SetControl(
new Transfer_DispatchControl(amodel, new Transfer_TransientProcess(amodel->NbEntities())));
}
Transfer_TransferDispatch::Transfer_TransferDispatch
(const Handle(Interface_InterfaceModel)& amodel,
const Handle(Interface_Protocol)& protocol)
: Interface_CopyTool (amodel,protocol)
{ SetControl (new Transfer_DispatchControl
(amodel,new Transfer_TransientProcess(amodel->NbEntities()))); }
Transfer_TransferDispatch::Transfer_TransferDispatch(const Handle(Interface_InterfaceModel)& amodel)
: Interface_CopyTool(amodel)
{
SetControl(
new Transfer_DispatchControl(amodel, new Transfer_TransientProcess(amodel->NbEntities())));
}
Handle(Transfer_TransientProcess) Transfer_TransferDispatch::TransientProcess() const
{
return Handle(Transfer_DispatchControl)::DownCast(Control())->TransientProcess();
}
Transfer_TransferDispatch::Transfer_TransferDispatch
(const Handle(Interface_InterfaceModel)& amodel)
: Interface_CopyTool (amodel)
{ SetControl (new Transfer_DispatchControl
(amodel,new Transfer_TransientProcess(amodel->NbEntities()))); }
Handle(Transfer_TransientProcess) Transfer_TransferDispatch::TransientProcess
() const
{ return Handle(Transfer_DispatchControl)::DownCast(Control())->TransientProcess(); }
Standard_Boolean Transfer_TransferDispatch::Copy
(const Handle(Standard_Transient)& entfrom,
Handle(Standard_Transient)& entto,
const Standard_Boolean mapped, const Standard_Boolean errstat)
Standard_Boolean Transfer_TransferDispatch::Copy(const Handle(Standard_Transient)& entfrom,
Handle(Standard_Transient)& entto,
const Standard_Boolean mapped,
const Standard_Boolean errstat)
{
Handle(Transfer_Binder) result = TransientProcess()->Transferring(entfrom);
if (result.IsNull())
return Interface_CopyTool::Copy(entfrom,entto,mapped,errstat);
return Interface_CopyTool::Copy(entfrom, entto, mapped, errstat);
if (!result->IsKind(STANDARD_TYPE(Transfer_SimpleBinderOfTransient)))
return Standard_False; // Produit qq chose, mais quoi ?
entto = GetCasted(Transfer_SimpleBinderOfTransient,result)->Result();
return Standard_False; // Produit qq chose, mais quoi ?
entto = GetCasted(Transfer_SimpleBinderOfTransient, result)->Result();
return Standard_True;
}

View File

@@ -28,7 +28,6 @@ class Interface_Protocol;
class Transfer_TransientProcess;
class Standard_Transient;
//! A TransferDispatch is aimed to dispatch Entities between two
//! Interface Models, by default by copying them, as CopyTool, but
//! with more capabilities of adapting : Copy is redefined to
@@ -42,54 +41,38 @@ class Standard_Transient;
//! For these reasons, TransferDispatch is basically a CopyTool,
//! but uses a more sophiscated control, which is TransferProcess,
//! and its method Copy is redefined
class Transfer_TransferDispatch : public Interface_CopyTool
class Transfer_TransferDispatch : public Interface_CopyTool
{
public:
DEFINE_STANDARD_ALLOC
//! Creates a TransferDispatch from a Model. Works with a General
//! Service Library, given as an Argument
//! A TransferDispatch is created as a CopyTool in which the
//! Control is set to TransientProcess
Standard_EXPORT Transfer_TransferDispatch(const Handle(Interface_InterfaceModel)& amodel, const Interface_GeneralLib& lib);
Standard_EXPORT Transfer_TransferDispatch(const Handle(Interface_InterfaceModel)& amodel,
const Interface_GeneralLib& lib);
//! Same as above, but Library is defined through a Protocol
Standard_EXPORT Transfer_TransferDispatch(const Handle(Interface_InterfaceModel)& amodel, const Handle(Interface_Protocol)& protocol);
Standard_EXPORT Transfer_TransferDispatch(const Handle(Interface_InterfaceModel)& amodel,
const Handle(Interface_Protocol)& protocol);
//! Same as above, but works with the Active Protocol
Standard_EXPORT Transfer_TransferDispatch(const Handle(Interface_InterfaceModel)& amodel);
//! Returns the content of Control Object, as a TransientProcess
Standard_EXPORT Handle(Transfer_TransientProcess) TransientProcess() const;
//! Copies an Entity by calling the method Transferring from the
//! TransferProcess. If this called produces a Null Binder, then
//! the standard, inherited Copy is called
Standard_EXPORT virtual Standard_Boolean Copy (const Handle(Standard_Transient)& entfrom, Handle(Standard_Transient)& entto, const Standard_Boolean mapped, const Standard_Boolean errstat) Standard_OVERRIDE;
Standard_EXPORT virtual Standard_Boolean Copy(const Handle(Standard_Transient)& entfrom,
Handle(Standard_Transient)& entto,
const Standard_Boolean mapped,
const Standard_Boolean errstat) Standard_OVERRIDE;
protected:
private:
};
#endif // _Transfer_TransferDispatch_HeaderFile

View File

@@ -26,8 +26,9 @@ class Transfer_TransferFailure;
DEFINE_STANDARD_HANDLE(Transfer_TransferFailure, Interface_InterfaceError)
#if !defined No_Exception && !defined No_Transfer_TransferFailure
#define Transfer_TransferFailure_Raise_if(CONDITION, MESSAGE) \
if (CONDITION) throw Transfer_TransferFailure(MESSAGE);
#define Transfer_TransferFailure_Raise_if(CONDITION, MESSAGE) \
if (CONDITION) \
throw Transfer_TransferFailure(MESSAGE);
#else
#define Transfer_TransferFailure_Raise_if(CONDITION, MESSAGE)
#endif

View File

@@ -11,7 +11,6 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Interface_EntityIterator.hxx>
#include <Interface_Macros.hxx>
#include <Interface_Protocol.hxx>
@@ -27,82 +26,87 @@
#include <Transfer_TransientProcess.hxx>
#include <Transfer_VoidBinder.hxx>
Transfer_TransferInput::Transfer_TransferInput () { }
Transfer_TransferInput::Transfer_TransferInput() {}
// Resultats : Pour le Modele ...
Interface_EntityIterator Transfer_TransferInput::Entities
(Transfer_TransferIterator& list) const
Interface_EntityIterator Transfer_TransferInput::Entities(Transfer_TransferIterator& list) const
{
Interface_EntityIterator iter;
for (list.Start(); list.More(); list.Next()) {
for (list.Start(); list.More(); list.Next())
{
const Handle(Transfer_Binder)& binder = list.Value();
if (binder.IsNull()) continue;
if (binder->IsKind(STANDARD_TYPE(Transfer_VoidBinder))) continue;
if (binder.IsNull())
continue;
if (binder->IsKind(STANDARD_TYPE(Transfer_VoidBinder)))
continue;
// Vrai resultat : doit etre transient (simple ou liste)
DeclareAndCast(Transfer_SimpleBinderOfTransient,transb,binder);
DeclareAndCast(Transfer_MultipleBinder,multi,binder);
if (!transb.IsNull()) {
if (transb->HasResult()) iter.AddItem(transb->Result());
// Vrai resultat : doit etre transient (simple ou liste)
DeclareAndCast(Transfer_SimpleBinderOfTransient, transb, binder);
DeclareAndCast(Transfer_MultipleBinder, multi, binder);
if (!transb.IsNull())
{
if (transb->HasResult())
iter.AddItem(transb->Result());
}
else if (!multi.IsNull()) {
else if (!multi.IsNull())
{
Handle(TColStd_HSequenceOfTransient) mulres = multi->MultipleResult();
Standard_Integer nbres = 0;
if (!mulres.IsNull()) nbres = mulres->Length();
for (Standard_Integer i = 1; i <= nbres; i ++)
iter.AddItem(mulres->Value(i));
Standard_Integer nbres = 0;
if (!mulres.IsNull())
nbres = mulres->Length();
for (Standard_Integer i = 1; i <= nbres; i++)
iter.AddItem(mulres->Value(i));
}
else throw Transfer_TransferFailure("TransferInput : Entities, one of the Results is not Transient Handle");
else
throw Transfer_TransferFailure(
"TransferInput : Entities, one of the Results is not Transient Handle");
}
return iter;
}
void Transfer_TransferInput::FillModel
(const Handle(Transfer_TransientProcess)& proc,
const Handle(Interface_InterfaceModel)& amodel) const
void Transfer_TransferInput::FillModel(const Handle(Transfer_TransientProcess)& proc,
const Handle(Interface_InterfaceModel)& amodel) const
{
Transfer_TransferIterator list = proc->CompleteResult();
Interface_EntityIterator iter = Entities (list);
Interface_EntityIterator iter = Entities(list);
amodel->GetFromTransfer(iter);
}
void Transfer_TransferInput::FillModel
(const Handle(Transfer_TransientProcess)& proc,
const Handle(Interface_InterfaceModel)& amodel,
const Handle(Interface_Protocol)& proto,
const Standard_Boolean roots) const
void Transfer_TransferInput::FillModel(const Handle(Transfer_TransientProcess)& proc,
const Handle(Interface_InterfaceModel)& amodel,
const Handle(Interface_Protocol)& proto,
const Standard_Boolean roots) const
{
Transfer_TransferIterator list;
if (roots) list = proc->RootResult();
else list = proc->CompleteResult();
Interface_EntityIterator iter = Entities (list);
if (roots)
list = proc->RootResult();
else
list = proc->CompleteResult();
Interface_EntityIterator iter = Entities(list);
for (iter.Start(); iter.More(); iter.Next())
amodel->AddWithRefs (iter.Value(), proto);
amodel->AddWithRefs(iter.Value(), proto);
}
void Transfer_TransferInput::FillModel
(const Handle(Transfer_FinderProcess)& proc,
const Handle(Interface_InterfaceModel)& amodel) const
void Transfer_TransferInput::FillModel(const Handle(Transfer_FinderProcess)& proc,
const Handle(Interface_InterfaceModel)& amodel) const
{
Transfer_TransferIterator list = proc->CompleteResult();
Interface_EntityIterator iter = Entities (list);
Interface_EntityIterator iter = Entities(list);
amodel->GetFromTransfer(iter);
}
void Transfer_TransferInput::FillModel
(const Handle(Transfer_FinderProcess)& proc,
const Handle(Interface_InterfaceModel)& amodel,
const Handle(Interface_Protocol)& proto,
const Standard_Boolean roots) const
void Transfer_TransferInput::FillModel(const Handle(Transfer_FinderProcess)& proc,
const Handle(Interface_InterfaceModel)& amodel,
const Handle(Interface_Protocol)& proto,
const Standard_Boolean roots) const
{
Transfer_TransferIterator list;
if (roots) list = proc->RootResult();
else list = proc->CompleteResult();
Interface_EntityIterator iter = Entities (list);
if (roots)
list = proc->RootResult();
else
list = proc->CompleteResult();
Interface_EntityIterator iter = Entities(list);
for (iter.Start(); iter.More(); iter.Next())
amodel->AddWithRefs (iter.Value(), proto);
amodel->AddWithRefs(iter.Value(), proto);
}

View File

@@ -28,70 +28,56 @@ class Interface_InterfaceModel;
class Interface_Protocol;
class Transfer_FinderProcess;
//! A TransferInput is a Tool which fills an InterfaceModel with
//! the result of the Transfer of CasCade Objects, once determined
//! The Result comes from a TransferProcess, either from
//! Transient (the Complete Result is considered, it must contain
//! only Transient Objects)
class Transfer_TransferInput
class Transfer_TransferInput
{
public:
DEFINE_STANDARD_ALLOC
//! Creates a TransferInput ready to use
Standard_EXPORT Transfer_TransferInput();
//! Takes the transient items stored in a TransferIterator
Standard_EXPORT Interface_EntityIterator Entities (Transfer_TransferIterator& list) const;
Standard_EXPORT Interface_EntityIterator Entities(Transfer_TransferIterator& list) const;
//! Fills an InterfaceModel with the Complete Result of a Transfer
//! stored in a TransientProcess (Starting Objects are Transient)
//! The complete result is exactly added to the model
Standard_EXPORT void FillModel (const Handle(Transfer_TransientProcess)& proc, const Handle(Interface_InterfaceModel)& amodel) const;
Standard_EXPORT void FillModel(const Handle(Transfer_TransientProcess)& proc,
const Handle(Interface_InterfaceModel)& amodel) const;
//! Fills an InterfaceModel with results of the Transfer recorded
//! in a TransientProcess (Starting Objects are Transient) :
//! Root Result if <roots> is True (Default), Complete Result else
//! The entities added to the model are determined from the result
//! by by adding the referenced entities
Standard_EXPORT void FillModel (const Handle(Transfer_TransientProcess)& proc, const Handle(Interface_InterfaceModel)& amodel, const Handle(Interface_Protocol)& proto, const Standard_Boolean roots = Standard_True) const;
Standard_EXPORT void FillModel(const Handle(Transfer_TransientProcess)& proc,
const Handle(Interface_InterfaceModel)& amodel,
const Handle(Interface_Protocol)& proto,
const Standard_Boolean roots = Standard_True) const;
//! Fills an InterfaceModel with the Complete Result of a Transfer
//! stored in a TransientProcess (Starting Objects are Transient)
//! The complete result is exactly added to the model
Standard_EXPORT void FillModel (const Handle(Transfer_FinderProcess)& proc, const Handle(Interface_InterfaceModel)& amodel) const;
Standard_EXPORT void FillModel(const Handle(Transfer_FinderProcess)& proc,
const Handle(Interface_InterfaceModel)& amodel) const;
//! Fills an InterfaceModel with results of the Transfer recorded
//! in a TransientProcess (Starting Objects are Transient) :
//! Root Result if <roots> is True (Default), Complete Result else
//! The entities added to the model are determined from the result
//! by by adding the referenced entities
Standard_EXPORT void FillModel (const Handle(Transfer_FinderProcess)& proc, const Handle(Interface_InterfaceModel)& amodel, const Handle(Interface_Protocol)& proto, const Standard_Boolean roots = Standard_True) const;
Standard_EXPORT void FillModel(const Handle(Transfer_FinderProcess)& proc,
const Handle(Interface_InterfaceModel)& amodel,
const Handle(Interface_Protocol)& proto,
const Standard_Boolean roots = Standard_True) const;
protected:
private:
};
#endif // _Transfer_TransferInput_HeaderFile

View File

@@ -11,183 +11,207 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Interface_Check.hxx>
#include <Standard_NoSuchObject.hxx>
#include <Standard_Transient.hxx>
#include <Transfer_SimpleBinderOfTransient.hxx>
#include <Transfer_TransferIterator.hxx>
static Handle(Standard_Transient) nultrans; // pour retour const&(Null)
static Handle(Standard_Transient) nultrans; // pour retour const&(Null)
Transfer_TransferIterator::Transfer_TransferIterator ()
Transfer_TransferIterator::Transfer_TransferIterator()
{
theitems = new Transfer_HSequenceOfBinder();
theselect = new TColStd_HSequenceOfInteger();
themaxi = 0;
thecurr = 1;
themaxi = 0;
thecurr = 1;
}
void Transfer_TransferIterator::AddItem
(const Handle(Transfer_Binder)& atr)
void Transfer_TransferIterator::AddItem(const Handle(Transfer_Binder)& atr)
{
theitems->Append(atr);
theselect->Append(1);
themaxi = theselect->Length();
}
void Transfer_TransferIterator::SelectBinder
(const Handle(Standard_Type)& atype, const Standard_Boolean keep)
void Transfer_TransferIterator::SelectBinder(const Handle(Standard_Type)& atype,
const Standard_Boolean keep)
{
for (Standard_Integer i = theitems->Length(); i > 0; i --) {
if (theitems->Value(i)->IsKind(atype) != keep) {
theselect->SetValue(i,0);
if (themaxi == i) themaxi = i-1;
for (Standard_Integer i = theitems->Length(); i > 0; i--)
{
if (theitems->Value(i)->IsKind(atype) != keep)
{
theselect->SetValue(i, 0);
if (themaxi == i)
themaxi = i - 1;
}
}
}
void Transfer_TransferIterator::SelectResult
(const Handle(Standard_Type)& atype, const Standard_Boolean keep)
void Transfer_TransferIterator::SelectResult(const Handle(Standard_Type)& atype,
const Standard_Boolean keep)
{
Standard_Integer casetype = 0;
if (atype->SubType(STANDARD_TYPE(Standard_Transient))) casetype = 2;
if (atype->SubType(STANDARD_TYPE(Standard_Transient)))
casetype = 2;
for (Standard_Integer i = theitems->Length(); i > 0; i --) {
Handle(Transfer_Binder) atr = theitems->Value(i);
Handle(Standard_Type) btype = ResultType();
Standard_Boolean matchtype;
if (!atr->HasResult()) matchtype = Standard_False;
else if (atr->IsMultiple()) matchtype = Standard_False;
else if (casetype == 0) matchtype = (atype == btype); // Type fixe
else matchtype = (btype->SubType(atype)); // Dynamique
if (matchtype != keep) {
theselect->SetValue(i,0);
if (themaxi == i) themaxi = i-1;
for (Standard_Integer i = theitems->Length(); i > 0; i--)
{
Handle(Transfer_Binder) atr = theitems->Value(i);
Handle(Standard_Type) btype = ResultType();
Standard_Boolean matchtype;
if (!atr->HasResult())
matchtype = Standard_False;
else if (atr->IsMultiple())
matchtype = Standard_False;
else if (casetype == 0)
matchtype = (atype == btype); // Type fixe
else
matchtype = (btype->SubType(atype)); // Dynamique
if (matchtype != keep)
{
theselect->SetValue(i, 0);
if (themaxi == i)
themaxi = i - 1;
}
}
}
void Transfer_TransferIterator::SelectUnique
(const Standard_Boolean keep)
void Transfer_TransferIterator::SelectUnique(const Standard_Boolean keep)
{
for (Standard_Integer i = theitems->Length(); i > 0; i --) {
for (Standard_Integer i = theitems->Length(); i > 0; i--)
{
Handle(Transfer_Binder) atr = theitems->Value(i);
if (atr->IsMultiple() == keep) {
theselect->SetValue(i,0);
if (themaxi == i) themaxi = i-1;
if (atr->IsMultiple() == keep)
{
theselect->SetValue(i, 0);
if (themaxi == i)
themaxi = i - 1;
}
}
}
void Transfer_TransferIterator::SelectItem
(const Standard_Integer num, const Standard_Boolean keep)
void Transfer_TransferIterator::SelectItem(const Standard_Integer num, const Standard_Boolean keep)
{
if (num < 1 || num > theselect->Length()) return;
if (keep) theselect->SetValue (num,1);
else theselect->SetValue (num,0);
if (num < 1 || num > theselect->Length())
return;
if (keep)
theselect->SetValue(num, 1);
else
theselect->SetValue(num, 0);
}
// .... Iteration-Interrogations ....
Standard_Integer Transfer_TransferIterator::Number () const
Standard_Integer Transfer_TransferIterator::Number() const
{
Standard_Integer numb,i; numb = 0;
for (i = 1; i <= themaxi; i ++) {
if (theselect->Value(i) != 0) numb ++;
Standard_Integer numb, i;
numb = 0;
for (i = 1; i <= themaxi; i++)
{
if (theselect->Value(i) != 0)
numb++;
}
return numb;
}
void Transfer_TransferIterator::Start ()
{ thecurr = 0; Next(); }
Standard_Boolean Transfer_TransferIterator::More ()
void Transfer_TransferIterator::Start()
{
if (thecurr > themaxi) return Standard_False;
if (theselect->Value(thecurr) == 0) Next();
if (thecurr > themaxi) return Standard_False;
thecurr = 0;
Next();
}
Standard_Boolean Transfer_TransferIterator::More()
{
if (thecurr > themaxi)
return Standard_False;
if (theselect->Value(thecurr) == 0)
Next();
if (thecurr > themaxi)
return Standard_False;
return (theselect->Value(thecurr) > 0);
}
void Transfer_TransferIterator::Next ()
void Transfer_TransferIterator::Next()
{
thecurr ++;
if (thecurr > themaxi) return;
if (theselect->Value(thecurr) == 0) Next();
thecurr++;
if (thecurr > themaxi)
return;
if (theselect->Value(thecurr) == 0)
Next();
}
const Handle(Transfer_Binder)& Transfer_TransferIterator::Value () const
const Handle(Transfer_Binder)& Transfer_TransferIterator::Value() const
{
if (thecurr == 0 || thecurr > themaxi) throw Standard_NoSuchObject("TransferIterator : Value");
if (theselect->Value(thecurr) == 0) throw Standard_NoSuchObject("TransferIterator : Value");
if (thecurr == 0 || thecurr > themaxi)
throw Standard_NoSuchObject("TransferIterator : Value");
if (theselect->Value(thecurr) == 0)
throw Standard_NoSuchObject("TransferIterator : Value");
return theitems->Value(thecurr);
}
// .... Acces aux Donnees du Binder Courant ....
Standard_Boolean Transfer_TransferIterator::HasResult () const
Standard_Boolean Transfer_TransferIterator::HasResult() const
{
Handle(Transfer_Binder) atr = Value();
return atr->HasResult();
}
Standard_Boolean Transfer_TransferIterator::HasUniqueResult () const
Standard_Boolean Transfer_TransferIterator::HasUniqueResult() const
{
Handle(Transfer_Binder) atr = Value();
if (atr->IsMultiple()) return Standard_False;
if (atr->IsMultiple())
return Standard_False;
return atr->HasResult();
}
Handle(Standard_Type) Transfer_TransferIterator::ResultType () const
Handle(Standard_Type) Transfer_TransferIterator::ResultType() const
{
Handle(Standard_Type) btype;
Handle(Standard_Type) btype;
Handle(Transfer_Binder) atr = Value();
if (!atr->IsMultiple()) btype = atr->ResultType();
// ResultType de Binder prend en compte le Type Dynamique pour les Handle
if (!atr->IsMultiple())
btype = atr->ResultType();
// ResultType de Binder prend en compte le Type Dynamique pour les Handle
return btype;
}
Standard_Boolean Transfer_TransferIterator::HasTransientResult () const
Standard_Boolean Transfer_TransferIterator::HasTransientResult() const
{
Handle(Standard_Type) btype = ResultType();
if (btype.IsNull()) return Standard_False;
if (btype.IsNull())
return Standard_False;
return btype->SubType(STANDARD_TYPE(Standard_Transient));
}
const Handle(Standard_Transient)&
Transfer_TransferIterator::TransientResult () const
const Handle(Standard_Transient)& Transfer_TransferIterator::TransientResult() const
{
Handle(Transfer_SimpleBinderOfTransient) atr =
Handle(Transfer_SimpleBinderOfTransient) atr =
Handle(Transfer_SimpleBinderOfTransient)::DownCast(Value());
if (!atr.IsNull()) return atr->Result();
if (!atr.IsNull())
return atr->Result();
return nultrans;
}
Transfer_StatusExec Transfer_TransferIterator::Status () const
Transfer_StatusExec Transfer_TransferIterator::Status() const
{
Handle(Transfer_Binder) atr = Value();
return atr->StatusExec();
}
Standard_Boolean Transfer_TransferIterator::HasFails () const
Standard_Boolean Transfer_TransferIterator::HasFails() const
{
Handle(Transfer_Binder) atr = Value();
return atr->Check()->HasFailed();
}
Standard_Boolean Transfer_TransferIterator::HasWarnings () const
Standard_Boolean Transfer_TransferIterator::HasWarnings() const
{
Handle(Transfer_Binder) atr = Value();
return atr->Check()->HasWarnings();
}
const Handle(Interface_Check) Transfer_TransferIterator::Check () const
const Handle(Interface_Check) Transfer_TransferIterator::Check() const
{
Handle(Transfer_Binder) atr = Value();
return atr->Check();

View File

@@ -39,124 +39,106 @@ class Interface_Check;
//! Available for Normal Results or not (Erroneous Transfer)
//! It gives several kinds of Information, and allows to consider
//! various criteria (criteria are cumulative)
class Transfer_TransferIterator
class Transfer_TransferIterator
{
public:
DEFINE_STANDARD_ALLOC
//! Creates an empty Iterator
Standard_EXPORT Transfer_TransferIterator();
//! Adds a Binder to the iteration list (construction)
Standard_EXPORT void AddItem (const Handle(Transfer_Binder)& atr);
Standard_EXPORT void AddItem(const Handle(Transfer_Binder)& atr);
//! Selects Items on the Type of Binder : keep only
//! Binders which are of a given Type (if keep is True) or
//! reject only them (if keep is False)
Standard_EXPORT void SelectBinder (const Handle(Standard_Type)& atype, const Standard_Boolean keep);
Standard_EXPORT void SelectBinder(const Handle(Standard_Type)& atype,
const Standard_Boolean keep);
//! Selects Items on the Type of Result. Considers only Unique
//! Results. Considers Dynamic Type for Transient Result,
//! Static Type (the one given to define the Binder) else.
//!
//! Results which are of a given Type (if keep is True) or reject
//! only them (if keep is False)
Standard_EXPORT void SelectResult (const Handle(Standard_Type)& atype, const Standard_Boolean keep);
Standard_EXPORT void SelectResult(const Handle(Standard_Type)& atype,
const Standard_Boolean keep);
//! Select Items according Unicity : keep only Unique Results (if
//! keep is True) or keep only Multiple Results (if keep is False)
Standard_EXPORT void SelectUnique (const Standard_Boolean keep);
Standard_EXPORT void SelectUnique(const Standard_Boolean keep);
//! Selects/Unselect (according to <keep> an item designated by
//! its rank <num> in the list
//! Used by sub-classes which have specific criteria
Standard_EXPORT void SelectItem (const Standard_Integer num, const Standard_Boolean keep);
Standard_EXPORT void SelectItem(const Standard_Integer num, const Standard_Boolean keep);
//! Returns count of Binders to be iterated
Standard_EXPORT Standard_Integer Number() const;
//! Clears Iteration in progress, to allow it to be restarted
Standard_EXPORT void Start();
//! Returns True if there are other Items to iterate
Standard_EXPORT Standard_Boolean More();
//! Sets Iteration to the next Item
Standard_EXPORT void Next();
//! Returns the current Binder
Standard_EXPORT const Handle(Transfer_Binder)& Value() const;
//! Returns True if current Item brings a Result, Transient
//! (Handle) or not or Multiple. That is to say, if it corresponds
//! to a normally achieved Transfer, Transient Result is read by
//! specific TransientResult below.
//! Other kind of Result must be read specifically from its Binder
Standard_EXPORT Standard_Boolean HasResult() const;
//! Returns True if Current Item has a Unique Result
Standard_EXPORT Standard_Boolean HasUniqueResult() const;
//! Returns the Type of the Result of the current Item, if Unique.
//! If No Unique Result (Error Transfer or Multiple Result),
//! returns a Null Handle
//! The Type is : the Dynamic Type for a Transient Result,
//! the Type defined by the Binder Class else
Standard_EXPORT Handle(Standard_Type) ResultType() const;
//! Returns True if the current Item has a Transient Unique
//! Result (if yes, use TransientResult to get it)
Standard_EXPORT Standard_Boolean HasTransientResult() const;
//! Returns the Transient Result of the current Item if there is
//! (else, returns a null Handle)
//! Supposes that Binding is done by a SimpleBinderOfTransient
Standard_EXPORT const Handle(Standard_Transient)& TransientResult() const;
//! Returns Execution Status of current Binder
//! Normal transfer corresponds to StatusDone
Standard_EXPORT Transfer_StatusExec Status() const;
//! Returns True if Fail Messages are recorded with the current
//! Binder. They can then be read through Check (see below)
Standard_EXPORT Standard_Boolean HasFails() const;
//! Returns True if Warning Messages are recorded with the current
//! Binder. They can then be read through Check (see below)
Standard_EXPORT Standard_Boolean HasWarnings() const;
//! Returns Check associated to current Binder
//! (in case of error, it brings Fail messages)
//! (in case of warnings, it brings Warning messages)
Standard_EXPORT const Handle(Interface_Check) Check() const;
protected:
Standard_Integer thecurr;
private:
Handle(Transfer_HSequenceOfBinder) theitems;
Handle(TColStd_HSequenceOfInteger) theselect;
Standard_Integer themaxi;
Standard_Integer themaxi;
};
#endif // _Transfer_TransferIterator_HeaderFile

View File

@@ -22,6 +22,9 @@
#include <Transfer_Finder.hxx>
#include <Transfer_FindHasher.hxx>
typedef NCollection_IndexedDataMap<Handle(Transfer_Finder),Handle(Transfer_Binder),Transfer_FindHasher> Transfer_TransferMapOfProcessForFinder;
typedef NCollection_IndexedDataMap<Handle(Transfer_Finder),
Handle(Transfer_Binder),
Transfer_FindHasher>
Transfer_TransferMapOfProcessForFinder;
#endif // _Transfer_TransferMapOfProcessForFinder_HeaderFile

View File

@@ -20,6 +20,7 @@
#include <NCollection_IndexedDataMap.hxx>
#include <Transfer_Binder.hxx>
typedef NCollection_IndexedDataMap<Handle(Standard_Transient),Handle(Transfer_Binder)> Transfer_TransferMapOfProcessForTransient;
typedef NCollection_IndexedDataMap<Handle(Standard_Transient), Handle(Transfer_Binder)>
Transfer_TransferMapOfProcessForTransient;
#endif // _Transfer_TransferMapOfProcessForTransient_HeaderFile

View File

@@ -11,7 +11,7 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
//szv#4 S4163
// szv#4 S4163
#include <Interface_EntityIterator.hxx>
#include <Interface_Graph.hxx>
@@ -26,126 +26,139 @@
#include <Transfer_TransientProcess.hxx>
#include <Message_ProgressScope.hxx>
Transfer_TransferOutput::Transfer_TransferOutput (const Handle(Transfer_ActorOfTransientProcess)& actor,
const Handle(Interface_InterfaceModel)& amodel)
Transfer_TransferOutput::Transfer_TransferOutput(
const Handle(Transfer_ActorOfTransientProcess)& actor,
const Handle(Interface_InterfaceModel)& amodel)
{
theproc = new Transfer_TransientProcess (amodel->NbEntities());
theproc = new Transfer_TransientProcess(amodel->NbEntities());
theproc->SetActor(actor);
themodel = amodel;
// thescope = Standard_False;
// theundef = Transfer_UndefIgnore;
// thescope = Standard_False;
// theundef = Transfer_UndefIgnore;
}
Transfer_TransferOutput::Transfer_TransferOutput (const Handle(Transfer_TransientProcess)& proc,
const Handle(Interface_InterfaceModel)& amodel)
Transfer_TransferOutput::Transfer_TransferOutput(const Handle(Transfer_TransientProcess)& proc,
const Handle(Interface_InterfaceModel)& amodel)
{
theproc = proc;
themodel = amodel;
// thescope = Standard_False; //szv#4:S4163:12Mar99 initialization needed
// theundef = Transfer_UndefIgnore;
// thescope = Standard_False; //szv#4:S4163:12Mar99 initialization needed
// theundef = Transfer_UndefIgnore;
}
//Standard_Boolean& Transfer_TransferOutput::ScopeMode ()
// Standard_Boolean& Transfer_TransferOutput::ScopeMode ()
//{ return thescope; }
Handle(Interface_InterfaceModel) Transfer_TransferOutput::Model () const
{ return themodel; }
Handle(Transfer_TransientProcess) Transfer_TransferOutput::TransientProcess () const
{ return theproc; }
void Transfer_TransferOutput::Transfer (const Handle(Standard_Transient)& obj,
const Message_ProgressRange& theProgress)
Handle(Interface_InterfaceModel) Transfer_TransferOutput::Model() const
{
if (themodel->Number(obj) == 0) throw Transfer_TransferFailure("TransferOutput : Transfer, entities do not come from same initial model");
// Standard_Integer scope = 0;
// if (thescope) scope = theproc->NewScope (obj);
//:1 modified by ABV 5 Nov 97
//:1 if (!theproc->Transfer(obj)) return; // auparavant, traitement Undefined
// Standard_Boolean ok =
theproc->Transfer ( obj, theProgress );
// if (scope > 0) theproc->EndScope (scope);
// if ( ! ok ) return;
/* switch (theundef) {
case Transfer_UndefIgnore : return;
case Transfer_UndefFailure : throw Transfer_TransferFailure("TransferOutput : Transfer Undefined as Failure");
case Transfer_UndefContent : break; // on ne sait pas traiter ...
case Transfer_UndefUser : break; // idem
}
*/
return themodel;
}
Handle(Transfer_TransientProcess) Transfer_TransferOutput::TransientProcess() const
{
return theproc;
}
void Transfer_TransferOutput::Transfer(const Handle(Standard_Transient)& obj,
const Message_ProgressRange& theProgress)
{
if (themodel->Number(obj) == 0)
throw Transfer_TransferFailure(
"TransferOutput : Transfer, entities do not come from same initial model");
// Standard_Integer scope = 0;
// if (thescope) scope = theproc->NewScope (obj);
//: 1 modified by ABV 5 Nov 97
//: 1 if (!theproc->Transfer(obj)) return; // auparavant, traitement Undefined
// Standard_Boolean ok =
theproc->Transfer(obj, theProgress);
// if (scope > 0) theproc->EndScope (scope);
// if ( ! ok ) return;
/* switch (theundef) {
case Transfer_UndefIgnore : return;
case Transfer_UndefFailure : throw Transfer_TransferFailure("TransferOutput : Transfer
Undefined as Failure"); case Transfer_UndefContent : break; // on ne sait pas traiter ... case
Transfer_UndefUser : break; // idem
}
*/
}
// Resultats :
// Pour transferer tout simplement toutes les racines d'un modele d'interface
// Chacune est notee "Root" dans le Process final
void Transfer_TransferOutput::TransferRoots (const Message_ProgressRange& theProgress)
{ TransferRoots(Interface_Protocol::Active(), theProgress); }
void Transfer_TransferOutput::TransferRoots (const Handle(Interface_Protocol)& protocol,
const Message_ProgressRange& theProgress)
void Transfer_TransferOutput::TransferRoots(const Message_ProgressRange& theProgress)
{
theproc->SetRootManagement (Standard_False);
Interface_ShareFlags tool(themodel,protocol);
TransferRoots(Interface_Protocol::Active(), theProgress);
}
void Transfer_TransferOutput::TransferRoots(const Handle(Interface_Protocol)& protocol,
const Message_ProgressRange& theProgress)
{
theproc->SetRootManagement(Standard_False);
Interface_ShareFlags tool(themodel, protocol);
Interface_EntityIterator list = tool.RootEntities();
Message_ProgressScope aPS(theProgress, NULL, list.NbEntities());
for (list.Start(); list.More() && aPS.More(); list.Next()) {
Message_ProgressScope aPS(theProgress, NULL, list.NbEntities());
for (list.Start(); list.More() && aPS.More(); list.Next())
{
const Handle(Standard_Transient)& ent = list.Value();
// Standard_Integer scope = 0;
// if (thescope) scope = theproc->NewScope (ent);
if (theproc->Transfer (ent, aPS.Next())) theproc->SetRoot(ent);
// if (scope > 0) theproc->EndScope (scope);
// Standard_Integer scope = 0;
// if (thescope) scope = theproc->NewScope (ent);
if (theproc->Transfer(ent, aPS.Next()))
theproc->SetRoot(ent);
// if (scope > 0) theproc->EndScope (scope);
}
}
void Transfer_TransferOutput::TransferRoots (const Interface_Graph& G,
const Message_ProgressRange& theProgress)
void Transfer_TransferOutput::TransferRoots(const Interface_Graph& G,
const Message_ProgressRange& theProgress)
{
theproc->SetRootManagement (Standard_False);
theproc->SetRootManagement(Standard_False);
Interface_ShareFlags tool(G);
theproc->SetModel (G.Model());
theproc->SetModel(G.Model());
Interface_EntityIterator list = tool.RootEntities();
Message_ProgressScope aPS(theProgress, NULL, list.NbEntities());
for (list.Start(); list.More() && aPS.More(); list.Next()) {
Message_ProgressScope aPS(theProgress, NULL, list.NbEntities());
for (list.Start(); list.More() && aPS.More(); list.Next())
{
const Handle(Standard_Transient)& ent = list.Value();
// Standard_Integer scope = 0;
// if (thescope) scope = theproc->NewScope (ent);
if (theproc->Transfer (ent, aPS.Next())) theproc->SetRoot(ent);
// if (scope > 0) theproc->EndScope (scope);
// Standard_Integer scope = 0;
// if (thescope) scope = theproc->NewScope (ent);
if (theproc->Transfer(ent, aPS.Next()))
theproc->SetRoot(ent);
// if (scope > 0) theproc->EndScope (scope);
}
}
Interface_EntityIterator Transfer_TransferOutput::ListForStatus (const Standard_Boolean normal,
const Standard_Boolean roots) const
Interface_EntityIterator Transfer_TransferOutput::ListForStatus(const Standard_Boolean normal,
const Standard_Boolean roots) const
{
Interface_EntityIterator list;
Standard_Integer max = (roots ? theproc->NbRoots() : theproc->NbMapped());
for (Standard_Integer i = 1; i <= max; i ++) {
const Handle(Transfer_Binder)& binder =
(roots ? theproc->RootItem(i) : theproc->MapItem(i));
if (binder.IsNull()) continue;
Standard_Integer max = (roots ? theproc->NbRoots() : theproc->NbMapped());
for (Standard_Integer i = 1; i <= max; i++)
{
const Handle(Transfer_Binder)& binder = (roots ? theproc->RootItem(i) : theproc->MapItem(i));
if (binder.IsNull())
continue;
Transfer_StatusExec statex = binder->StatusExec();
Standard_Boolean ok =
(statex == Transfer_StatusInitial || statex == Transfer_StatusDone);
if (ok == normal) list.AddItem
( (roots ? theproc->Root(i) : theproc->Mapped(i)) );
Standard_Boolean ok = (statex == Transfer_StatusInitial || statex == Transfer_StatusDone);
if (ok == normal)
list.AddItem((roots ? theproc->Root(i) : theproc->Mapped(i)));
}
return list;
}
Handle(Interface_InterfaceModel) Transfer_TransferOutput::ModelForStatus
(const Handle(Interface_Protocol)& protocol,
const Standard_Boolean normal, const Standard_Boolean roots) const
Handle(Interface_InterfaceModel) Transfer_TransferOutput::ModelForStatus(
const Handle(Interface_Protocol)& protocol,
const Standard_Boolean normal,
const Standard_Boolean roots) const
{
Handle(Interface_InterfaceModel) newmod;
if (themodel.IsNull()) return newmod;
newmod = themodel->NewEmptyModel();
Interface_EntityIterator list = ListForStatus (normal, roots);
if (themodel.IsNull())
return newmod;
newmod = themodel->NewEmptyModel();
Interface_EntityIterator list = ListForStatus(normal, roots);
for (list.Start(); list.More(); list.Next())
newmod->AddWithRefs (list.Value(),protocol);
newmod->AddWithRefs(list.Value(), protocol);
return newmod;
}

View File

@@ -38,52 +38,55 @@ class Interface_EntityIterator;
//! A default action is available to get all roots of the Model
//! Result is given as a TransferIterator (see TransferProcess)
//! Also, it is possible to pilot directly the TransientProcess
class Transfer_TransferOutput
class Transfer_TransferOutput
{
public:
DEFINE_STANDARD_ALLOC
//! Creates a TransferOutput ready to use, with a TransientProcess
Standard_EXPORT Transfer_TransferOutput(const Handle(Transfer_ActorOfTransientProcess)& actor, const Handle(Interface_InterfaceModel)& amodel);
Standard_EXPORT Transfer_TransferOutput(const Handle(Transfer_ActorOfTransientProcess)& actor,
const Handle(Interface_InterfaceModel)& amodel);
//! Creates a TransferOutput from an already existing
//! TransientProcess, and a Model
//! Returns (by Reference, hence can be changed) the Mode for
//! Scope Management. False (D) means Scope is ignored.
//! True means that each individual Transfer (direct or through
//! TransferRoots) is regarded as one Scope
Standard_EXPORT Transfer_TransferOutput(const Handle(Transfer_TransientProcess)& proc, const Handle(Interface_InterfaceModel)& amodel);
Standard_EXPORT Transfer_TransferOutput(const Handle(Transfer_TransientProcess)& proc,
const Handle(Interface_InterfaceModel)& amodel);
//! Returns the Starting Model
Standard_EXPORT Handle(Interface_InterfaceModel) Model() const;
//! Returns the TransientProcess used to work
Standard_EXPORT Handle(Transfer_TransientProcess) TransientProcess() const;
//! Transfer checks that all taken Entities come from the same
//! Model, then calls Transfer from TransientProcess
Standard_EXPORT void Transfer (const Handle(Standard_Transient)& obj,
const Message_ProgressRange& theProgress = Message_ProgressRange());
Standard_EXPORT void Transfer(const Handle(Standard_Transient)& obj,
const Message_ProgressRange& theProgress = Message_ProgressRange());
//! Runs transfer on the roots of the Interface Model
//! The Roots are computed with a ShareFlags created from a
//! Protocol given as Argument
Standard_EXPORT void TransferRoots (const Handle(Interface_Protocol)& protocol,
const Message_ProgressRange& theProgress = Message_ProgressRange());
Standard_EXPORT void TransferRoots(
const Handle(Interface_Protocol)& protocol,
const Message_ProgressRange& theProgress = Message_ProgressRange());
//! Runs transfer on the roots defined by a Graph of dependences
//! (which detains also a Model and its Entities)
//! Roots are computed with a ShareFlags created from the Graph
Standard_EXPORT void TransferRoots (const Interface_Graph& G,
const Message_ProgressRange& theProgress = Message_ProgressRange());
Standard_EXPORT void TransferRoots(
const Interface_Graph& G,
const Message_ProgressRange& theProgress = Message_ProgressRange());
//! Runs transfer on the roots of the Interface Model
//! Remark : the Roots are computed with a ShareFlags created
//! from the Active Protocol
Standard_EXPORT void TransferRoots(const Message_ProgressRange& theProgress = Message_ProgressRange());
Standard_EXPORT void TransferRoots(
const Message_ProgressRange& theProgress = Message_ProgressRange());
//! Returns the list of Starting Entities with these criteria :
//! - <normal> False, gives the entities bound with ABNORMAL STATUS
//! (e.g. : Fail recorded, Exception raised during Transfer)
@@ -94,8 +97,10 @@ public:
//! - <roots> True (Default), considers only roots of Transfer
//! (the Entities recorded at highest level)
//! This method is based on AbnormalResult from TransferProcess
Standard_EXPORT Interface_EntityIterator ListForStatus (const Standard_Boolean normal, const Standard_Boolean roots = Standard_True) const;
Standard_EXPORT Interface_EntityIterator
ListForStatus(const Standard_Boolean normal,
const Standard_Boolean roots = Standard_True) const;
//! Fills a Model with the list determined by ListForStatus
//! This model starts from scratch (made by NewEmptyModel from the
//! current Model), then is filled by AddWithRefs
@@ -104,31 +109,15 @@ public:
//! have caused problem, in order to furtherly analyse them (with
//! normal = False), or the "good" entities, to obtain a data set
//! "which works well" (with normal = True)
Standard_EXPORT Handle(Interface_InterfaceModel) ModelForStatus (const Handle(Interface_Protocol)& protocol, const Standard_Boolean normal, const Standard_Boolean roots = Standard_True) const;
Standard_EXPORT Handle(Interface_InterfaceModel) ModelForStatus(
const Handle(Interface_Protocol)& protocol,
const Standard_Boolean normal,
const Standard_Boolean roots = Standard_True) const;
protected:
private:
Handle(Transfer_TransientProcess) theproc;
Handle(Interface_InterfaceModel) themodel;
Handle(Interface_InterfaceModel) themodel;
};
#endif // _Transfer_TransferOutput_HeaderFile

View File

@@ -11,95 +11,83 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Standard_OutOfRange.hxx>
#include <Standard_Transient.hxx>
#include <Standard_Type.hxx>
#include <Transfer_TransientListBinder.hxx>
IMPLEMENT_STANDARD_RTTIEXT(Transfer_TransientListBinder,Transfer_Binder)
IMPLEMENT_STANDARD_RTTIEXT(Transfer_TransientListBinder, Transfer_Binder)
//#include <TColStd.hxx>
//=======================================================================
//function : Constructor
//purpose :
//=======================================================================
Transfer_TransientListBinder::Transfer_TransientListBinder ()
{ theres = new TColStd_HSequenceOfTransient(); }
// #include <TColStd.hxx>
//=================================================================================================
//=======================================================================
//function : Constructor
//purpose :
//=======================================================================
Transfer_TransientListBinder::Transfer_TransientListBinder()
{
theres = new TColStd_HSequenceOfTransient();
}
Transfer_TransientListBinder::Transfer_TransientListBinder
(const Handle(TColStd_HSequenceOfTransient)& list)
{ theres = list; }
//=================================================================================================
//=======================================================================
//function : IsMultiple
//purpose :
//=======================================================================
Transfer_TransientListBinder::Transfer_TransientListBinder(
const Handle(TColStd_HSequenceOfTransient)& list)
{
theres = list;
}
Standard_Boolean Transfer_TransientListBinder::IsMultiple () const
{ return (NbTransients() > 1); }
//=================================================================================================
//=======================================================================
//function : ResultType
//purpose :
//=======================================================================
Standard_Boolean Transfer_TransientListBinder::IsMultiple() const
{
return (NbTransients() > 1);
}
Handle(Standard_Type) Transfer_TransientListBinder::ResultType () const
{ return STANDARD_TYPE(Transfer_TransientListBinder); }
//=================================================================================================
//=======================================================================
//function : ResultTypeName
//purpose :
//=======================================================================
Handle(Standard_Type) Transfer_TransientListBinder::ResultType() const
{
return STANDARD_TYPE(Transfer_TransientListBinder);
}
Standard_CString Transfer_TransientListBinder::ResultTypeName () const
{ return "list(Standard_Transient)"; }
//=================================================================================================
Standard_CString Transfer_TransientListBinder::ResultTypeName() const
{
return "list(Standard_Transient)";
}
//=======================================================================
//function : AddResult
//purpose :
//=======================================================================
//=================================================================================================
void Transfer_TransientListBinder::AddResult (const Handle(Standard_Transient)& Transient)
{ theres->Append(Transient); }
void Transfer_TransientListBinder::AddResult(const Handle(Standard_Transient)& Transient)
{
theres->Append(Transient);
}
//=======================================================================
//function : Result
//purpose :
//=======================================================================
//=================================================================================================
Handle(TColStd_HSequenceOfTransient) Transfer_TransientListBinder::Result () const
{ return theres; }
Handle(TColStd_HSequenceOfTransient) Transfer_TransientListBinder::Result() const
{
return theres;
}
//=======================================================================
//function : SetResult
//purpose :
//=======================================================================
//=================================================================================================
void Transfer_TransientListBinder::SetResult
(const Standard_Integer num, const Handle(Standard_Transient)& Transient)
{ theres->SetValue(num,Transient); }
void Transfer_TransientListBinder::SetResult(const Standard_Integer num,
const Handle(Standard_Transient)& Transient)
{
theres->SetValue(num, Transient);
}
//=======================================================================
//function : NbTransients
//purpose :
//=======================================================================
//=================================================================================================
Standard_Integer Transfer_TransientListBinder::NbTransients () const
{ return theres->Length(); }
Standard_Integer Transfer_TransientListBinder::NbTransients() const
{
return theres->Length();
}
//=======================================================================
//function : Transient
//purpose :
//=======================================================================
const Handle(Standard_Transient)&
Transfer_TransientListBinder::Transient (const Standard_Integer num) const
{ return theres->Value(num); }
//=================================================================================================
const Handle(Standard_Transient)& Transfer_TransientListBinder::Transient(
const Standard_Integer num) const
{
return theres->Value(num);
}

View File

@@ -25,7 +25,6 @@
#include <Standard_Integer.hxx>
class Standard_Transient;
class Transfer_TransientListBinder;
DEFINE_STANDARD_HANDLE(Transfer_TransientListBinder, Transfer_Binder)
@@ -37,52 +36,33 @@ class Transfer_TransientListBinder : public Transfer_Binder
{
public:
Standard_EXPORT Transfer_TransientListBinder();
Standard_EXPORT Transfer_TransientListBinder(const Handle(TColStd_HSequenceOfTransient)& list);
Standard_EXPORT virtual Standard_Boolean IsMultiple() const Standard_OVERRIDE;
Standard_EXPORT Handle(Standard_Type) ResultType() const Standard_OVERRIDE;
Standard_EXPORT Standard_CString ResultTypeName() const Standard_OVERRIDE;
//! Adds an item to the result list
Standard_EXPORT void AddResult (const Handle(Standard_Transient)& res);
Standard_EXPORT void AddResult(const Handle(Standard_Transient)& res);
Standard_EXPORT Handle(TColStd_HSequenceOfTransient) Result() const;
//! Changes an already defined sub-result
Standard_EXPORT void SetResult (const Standard_Integer num, const Handle(Standard_Transient)& res);
Standard_EXPORT void SetResult(const Standard_Integer num, const Handle(Standard_Transient)& res);
Standard_EXPORT Standard_Integer NbTransients() const;
Standard_EXPORT const Handle(Standard_Transient)& Transient (const Standard_Integer num) const;
Standard_EXPORT const Handle(Standard_Transient)& Transient(const Standard_Integer num) const;
DEFINE_STANDARD_RTTIEXT(Transfer_TransientListBinder,Transfer_Binder)
DEFINE_STANDARD_RTTIEXT(Transfer_TransientListBinder, Transfer_Binder)
protected:
private:
Handle(TColStd_HSequenceOfTransient) theres;
};
#endif // _Transfer_TransientListBinder_HeaderFile

View File

@@ -25,60 +25,40 @@ class Standard_Transient;
class Transfer_DataInfo;
class Transfer_Finder;
class Transfer_TransientMapper;
DEFINE_STANDARD_HANDLE(Transfer_TransientMapper, Transfer_Finder)
class Transfer_TransientMapper : public Transfer_Finder
{
public:
//! Creates a Mapper with a Value. This Value can then not be
//! changed. It is used by the Hasher to compute the HashCode,
//! which will then be stored for an immediate reading.
Standard_EXPORT Transfer_TransientMapper(const Handle(Standard_Transient)& akey);
//! Returns the contained value
Standard_EXPORT const Handle(Standard_Transient)& Value() const;
//! Specific testof equality : defined as False if <other> has
//! not the same true Type, else contents are compared (by
//! C++ operator ==)
Standard_EXPORT Standard_Boolean Equates (const Handle(Transfer_Finder)& other) const Standard_OVERRIDE;
Standard_EXPORT Standard_Boolean
Equates(const Handle(Transfer_Finder)& other) const Standard_OVERRIDE;
//! Returns the Type of the Value. By default, returns the
//! DynamicType of <me>, but can be redefined
Standard_EXPORT virtual Handle(Standard_Type) ValueType() const Standard_OVERRIDE;
//! Returns the name of the Type of the Value. Default is name
//! of ValueType, unless it is for a non-handled object
Standard_EXPORT virtual Standard_CString ValueTypeName() const Standard_OVERRIDE;
DEFINE_STANDARD_RTTI_INLINE(Transfer_TransientMapper,Transfer_Finder)
DEFINE_STANDARD_RTTI_INLINE(Transfer_TransientMapper, Transfer_Finder)
protected:
private:
Handle(Standard_Transient) theval;
};
#endif // _Transfer_TransientMapper_HeaderFile

View File

@@ -21,53 +21,45 @@
#include <Transfer_DataInfo.hxx>
#include <Transfer_Finder.hxx>
//=======================================================================
//function : Transfer_TransientMapper
//purpose :
//=======================================================================
//=================================================================================================
Transfer_TransientMapper::Transfer_TransientMapper(const Handle(Standard_Transient)& akey)
: theval(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
//=================================================================================================
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;
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
//=================================================================================================
Handle(Standard_Type) Transfer_TransientMapper::ValueType() const
{
return Transfer_DataInfo::Type(theval);
}
//=======================================================================
//function : ValueTypeName
//purpose :
//=======================================================================
Standard_CString Transfer_TransientMapper::ValueTypeName() const
//=================================================================================================
Standard_CString Transfer_TransientMapper::ValueTypeName() const
{
return Transfer_DataInfo::TypeName(theval);
}

View File

@@ -11,7 +11,6 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Interface_Check.hxx>
#include <Interface_EntityIterator.hxx>
#include <Interface_HGraph.hxx>
@@ -22,42 +21,30 @@
#include <TColStd_HSequenceOfTransient.hxx>
#include <Transfer_TransientProcess.hxx>
IMPLEMENT_STANDARD_RTTIEXT(Transfer_TransientProcess,Transfer_ProcessForTransient)
IMPLEMENT_STANDARD_RTTIEXT(Transfer_TransientProcess, Transfer_ProcessForTransient)
//=======================================================================
//function : Transfer_TransientProcess
//purpose :
//=======================================================================
Transfer_TransientProcess::Transfer_TransientProcess
(const Standard_Integer nb) : Transfer_ProcessForTransient (nb)
{
//=================================================================================================
Transfer_TransientProcess::Transfer_TransientProcess(const Standard_Integer nb)
: Transfer_ProcessForTransient(nb)
{
thetrroots = new TColStd_HSequenceOfTransient;
}
//=================================================================================================
//=======================================================================
//function : SetModel
//purpose :
//=======================================================================
void Transfer_TransientProcess::SetModel
(const Handle(Interface_InterfaceModel)& model)
void Transfer_TransientProcess::SetModel(const Handle(Interface_InterfaceModel)& model)
{
themodel = model;
}
//=================================================================================================
//=======================================================================
//function : Model
//purpose :
//=======================================================================
Handle(Interface_InterfaceModel) Transfer_TransientProcess::Model () const
Handle(Interface_InterfaceModel) Transfer_TransientProcess::Model() const
{
return themodel;
}
void Transfer_TransientProcess::SetGraph(const Handle(Interface_HGraph)& HG)
{
thegraph = HG;
@@ -67,215 +54,185 @@ void Transfer_TransientProcess::SetGraph(const Handle(Interface_HGraph)& HG)
themodel.Nullify();
}
//=================================================================================================
//=======================================================================
//function : HasGraph
//purpose :
//=======================================================================
Standard_Boolean Transfer_TransientProcess::HasGraph () const
Standard_Boolean Transfer_TransientProcess::HasGraph() const
{
return !thegraph.IsNull();
}
//=================================================================================================
//=======================================================================
//function : HGraph
//purpose :
//=======================================================================
Handle(Interface_HGraph) Transfer_TransientProcess::HGraph () const
Handle(Interface_HGraph) Transfer_TransientProcess::HGraph() const
{
return thegraph;
}
//=================================================================================================
//=======================================================================
//function : Graph
//purpose :
//=======================================================================
const Interface_Graph& Transfer_TransientProcess::Graph () const
const Interface_Graph& Transfer_TransientProcess::Graph() const
{
return thegraph->Graph();
}
//=================================================================================================
//=======================================================================
//function : SetContext
//purpose :
//=======================================================================
void Transfer_TransientProcess::SetContext(const Standard_CString name,
void Transfer_TransientProcess::SetContext(const Standard_CString name,
const Handle(Standard_Transient)& ctx)
{
thectx.Bind(name,ctx);
thectx.Bind(name, ctx);
}
//=================================================================================================
//=======================================================================
//function : GetContext
//purpose :
//=======================================================================
Standard_Boolean Transfer_TransientProcess::GetContext
(const Standard_CString name, const Handle(Standard_Type)& type,
Handle(Standard_Transient)& ctx) const
Standard_Boolean Transfer_TransientProcess::GetContext(const Standard_CString name,
const Handle(Standard_Type)& type,
Handle(Standard_Transient)& ctx) const
{
if (thectx.IsEmpty()) return Standard_False;
if (thectx.IsEmpty())
return Standard_False;
if (!thectx.Find(name, ctx))
ctx.Nullify();
if (ctx.IsNull()) return Standard_False;
if (type.IsNull()) return Standard_True;
if (!ctx->IsKind(type)) ctx.Nullify();
if (ctx.IsNull())
return Standard_False;
if (type.IsNull())
return Standard_True;
if (!ctx->IsKind(type))
ctx.Nullify();
return !ctx.IsNull();
}
//=================================================================================================
//=======================================================================
//function : Context
//purpose :
//=======================================================================
NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)>& Transfer_TransientProcess::Context ()
NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)>&
Transfer_TransientProcess::Context()
{
return thectx;
}
//=================================================================================================
//=======================================================================
//function : PrintTrace
//purpose :
//=======================================================================
void Transfer_TransientProcess::PrintTrace
(const Handle(Standard_Transient)& start, Standard_OStream& S) const
void Transfer_TransientProcess::PrintTrace(const Handle(Standard_Transient)& start,
Standard_OStream& S) const
{
if (!start.IsNull()) {
if (!themodel.IsNull()) {
if (!start.IsNull())
{
if (!themodel.IsNull())
{
S << "Entity ";
themodel->Print (start, S, 1);
// S<<"id "; themodel->Print (start,S);
// S<<" Type:"<<themodel->TypeName (start);
themodel->Print(start, S, 1);
// S<<"id "; themodel->Print (start,S);
// S<<" Type:"<<themodel->TypeName (start);
}
else S<<"Entity Type:"<< Interface_InterfaceModel::ClassName(start->DynamicType()->Name());
// << start (handle) ??
else
S << "Entity Type:" << Interface_InterfaceModel::ClassName(start->DynamicType()->Name());
// << start (handle) ??
}
}
//=================================================================================================
//=======================================================================
//function : CheckNum
//purpose :
//=======================================================================
Standard_Integer Transfer_TransientProcess::CheckNum
(const Handle(Standard_Transient)& start) const
Standard_Integer Transfer_TransientProcess::CheckNum(const Handle(Standard_Transient)& start) const
{
return (themodel.IsNull() ? 0 : themodel->Number(start));
}
//=================================================================================================
//=======================================================================
//function : TypedSharings
//purpose :
//=======================================================================
Interface_EntityIterator Transfer_TransientProcess::TypedSharings
(const Handle(Standard_Transient)& start,
const Handle(Standard_Type)& type) const
Interface_EntityIterator Transfer_TransientProcess::TypedSharings(
const Handle(Standard_Transient)& start,
const Handle(Standard_Type)& type) const
{
Interface_EntityIterator iter;
if (thegraph.IsNull()) return iter;
return thegraph->Graph().TypedSharings (start,type);
if (thegraph.IsNull())
return iter;
return thegraph->Graph().TypedSharings(start, type);
}
//=================================================================================================
//=======================================================================
//function : IsDataLoaded
//purpose :
//=======================================================================
Standard_Boolean Transfer_TransientProcess::IsDataLoaded
(const Handle(Standard_Transient)& start) const
Standard_Boolean Transfer_TransientProcess::IsDataLoaded(
const Handle(Standard_Transient)& start) const
{
if (themodel.IsNull()) return Standard_True;
if (themodel.IsNull())
return Standard_True;
Standard_Integer num = themodel->Number(start);
if (num == 0) return Standard_True;
if (themodel->IsUnknownEntity(num)) return Standard_False;
if (num == 0)
return Standard_True;
if (themodel->IsUnknownEntity(num))
return Standard_False;
return !themodel->IsRedefinedContent(num);
}
//=================================================================================================
//=======================================================================
//function : IsDataFail
//purpose :
//=======================================================================
Standard_Boolean Transfer_TransientProcess::IsDataFail
(const Handle(Standard_Transient)& start) const
Standard_Boolean Transfer_TransientProcess::IsDataFail(
const Handle(Standard_Transient)& start) const
{
if (themodel.IsNull()) return Standard_False;
if (themodel.IsNull())
return Standard_False;
Standard_Integer num = themodel->Number(start);
if (num == 0) return Standard_False;
if (themodel->IsErrorEntity(num)) return Standard_True;
const Handle(Interface_Check) ach = themodel->Check(num,Standard_False); // semantic
if (num == 0)
return Standard_False;
if (themodel->IsErrorEntity(num))
return Standard_True;
const Handle(Interface_Check) ach = themodel->Check(num, Standard_False); // semantic
return ach->HasFailed();
}
//=======================================================================
//function : PrintStats
//purpose :
//=======================================================================
//=================================================================================================
void Transfer_TransientProcess::PrintStats(const Standard_Integer /*mode*/,
Standard_OStream& S) const
{
S<<"\n*******************************************************************\n";
// if (mode == 1) { // Statistiques de base
S<< "******** Basic Statistics ********"<<std::endl;
S << "\n*******************************************************************\n";
// if (mode == 1) { // Statistiques de base
S << "******** Basic Statistics ********" << std::endl;
Handle(Interface_InterfaceModel) model = Model();
if (model.IsNull()) S<<"**** Model unknown"<<std::endl;
Handle(Interface_InterfaceModel) model = Model();
if (model.IsNull())
S << "**** Model unknown" << std::endl;
else
S << "**** Nb Entities : " << model->NbEntities() << std::endl;
Standard_Integer nbr = 0, nbe = 0, nbw = 0;
Standard_Integer i, max = NbMapped(), nbroots = NbRoots();
S << "**** Nb Final Results : " << nbroots << std::endl;
for (i = 1; i <= max; i++)
{
const Handle(Transfer_Binder)& binder = MapItem(i);
if (binder.IsNull())
continue;
const Handle(Interface_Check) ach = binder->Check();
Transfer_StatusExec stat = binder->StatusExec();
if (stat != Transfer_StatusInitial && stat != Transfer_StatusDone)
nbe++;
else
S<<"**** Nb Entities : "<<model->NbEntities()<<std::endl;
Standard_Integer nbr = 0, nbe = 0, nbw = 0;
Standard_Integer i, max = NbMapped(), nbroots = NbRoots();
S<< "**** Nb Final Results : "<<nbroots<<std::endl;
for (i = 1; i <= max; i ++) {
const Handle(Transfer_Binder)& binder = MapItem(i);
if (binder.IsNull()) continue;
const Handle(Interface_Check) ach = binder->Check();
Transfer_StatusExec stat = binder->StatusExec();
if (stat != Transfer_StatusInitial && stat != Transfer_StatusDone)
nbe ++;
else {
if (ach->NbWarnings() > 0) nbw ++;
if (binder->HasResult()) nbr ++;
}
{
if (ach->NbWarnings() > 0)
nbw++;
if (binder->HasResult())
nbr++;
}
if (nbr > nbroots)
S<<"**** ( Itermediate Results : "<<nbr-nbroots<<" )\n";
if (nbe > 0)
S<<"**** Errors on : "<<Interface_MSG::Blanks(nbe,4)<<nbe<<" Entities\n";
if (nbw > 0)
S<<"**** Warnings on : "<<Interface_MSG::Blanks(nbw,4)<<nbw<<" Entities\n";
S<<"*******************************************************************";
// }
S<<std::endl;
}
if (nbr > nbroots)
S << "**** ( Itermediate Results : " << nbr - nbroots << " )\n";
if (nbe > 0)
S << "**** Errors on : " << Interface_MSG::Blanks(nbe, 4) << nbe
<< " Entities\n";
if (nbw > 0)
S << "**** Warnings on : " << Interface_MSG::Blanks(nbw, 4) << nbw
<< " Entities\n";
S << "*******************************************************************";
// }
S << std::endl;
}
//=================================================================================================
//=======================================================================
//function : RootsForTransfer
//purpose :
//=======================================================================
Handle(TColStd_HSequenceOfTransient) Transfer_TransientProcess::RootsForTransfer()
Handle(TColStd_HSequenceOfTransient) Transfer_TransientProcess::RootsForTransfer()
{
return thetrroots;
}

View File

@@ -45,96 +45,84 @@ class Transfer_TransientProcess : public Transfer_ProcessForTransient
{
public:
//! Sets TransientProcess at initial state, with an initial size
Standard_EXPORT Transfer_TransientProcess(const Standard_Integer nb = 10000);
//! Sets an InterfaceModel, used by StartTrace, CheckList, queries
//! on Integrity, to give information significant for each norm.
Standard_EXPORT void SetModel (const Handle(Interface_InterfaceModel)& model);
Standard_EXPORT void SetModel(const Handle(Interface_InterfaceModel)& model);
//! Returns the Model used for StartTrace
Standard_EXPORT Handle(Interface_InterfaceModel) Model() const;
//! Sets a Graph : supersedes SetModel if already done
Standard_EXPORT void SetGraph (const Handle(Interface_HGraph)& HG);
Standard_EXPORT void SetGraph(const Handle(Interface_HGraph)& HG);
Standard_EXPORT Standard_Boolean HasGraph() const;
Standard_EXPORT Handle(Interface_HGraph) HGraph() const;
Standard_EXPORT const Interface_Graph& Graph() const;
//! Sets a Context : according to receiving appli, to be
//! interpreted by the Actor
Standard_EXPORT void SetContext (const Standard_CString name, const Handle(Standard_Transient)& ctx);
Standard_EXPORT void SetContext(const Standard_CString name,
const Handle(Standard_Transient)& ctx);
//! Returns the Context attached to a name, if set and if it is
//! Kind of the type, else a Null Handle
//! Returns True if OK, False if no Context
Standard_EXPORT Standard_Boolean GetContext (const Standard_CString name, const Handle(Standard_Type)& type, Handle(Standard_Transient)& ctx) const;
Standard_EXPORT Standard_Boolean GetContext(const Standard_CString name,
const Handle(Standard_Type)& type,
Handle(Standard_Transient)& ctx) const;
//! Returns (modifiable) the whole definition of Context
//! Rather for internal use (ex.: preparing and setting in once)
Standard_EXPORT NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)>& Context();
Standard_EXPORT NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)>&
Context();
//! Specific printing to trace an entity : prints label and type
//! (if model is set)
Standard_EXPORT virtual void PrintTrace (const Handle(Standard_Transient)& start, Standard_OStream& S) const Standard_OVERRIDE;
Standard_EXPORT virtual void PrintTrace(const Handle(Standard_Transient)& start,
Standard_OStream& S) const Standard_OVERRIDE;
//! Specific number of a starting object for check-list : Number
//! in model
Standard_EXPORT virtual Standard_Integer CheckNum (const Handle(Standard_Transient)& ent) const Standard_OVERRIDE;
Standard_EXPORT virtual Standard_Integer CheckNum(const Handle(Standard_Transient)& ent) const
Standard_OVERRIDE;
//! Returns the list of sharings entities, AT ANY LEVEL, which are
//! kind of a given type. Calls TypedSharings from Graph
//! Returns an empty list if the Graph has not been acknowledged
Standard_EXPORT Interface_EntityIterator TypedSharings (const Handle(Standard_Transient)& start, const Handle(Standard_Type)& type) const;
Standard_EXPORT Interface_EntityIterator TypedSharings(const Handle(Standard_Transient)& start,
const Handle(Standard_Type)& type) const;
//! Tells if an entity is well loaded from file (even if its data
//! fail on checking, they are present). Mostly often, answers
//! True. Else, there was a syntactic error in the file.
//! A non-loaded entity MAY NOT BE transferred, unless its Report
//! (in the model) is interpreted
Standard_EXPORT Standard_Boolean IsDataLoaded (const Handle(Standard_Transient)& ent) const;
Standard_EXPORT Standard_Boolean IsDataLoaded(const Handle(Standard_Transient)& ent) const;
//! Tells if an entity fails on data checking (load time,
//! syntactic, or semantic check). Normally, should answer False.
//! It is not prudent to try transferring an entity which fails on
//! data checking
Standard_EXPORT Standard_Boolean IsDataFail (const Handle(Standard_Transient)& ent) const;
Standard_EXPORT Standard_Boolean IsDataFail(const Handle(Standard_Transient)& ent) const;
//! Prints statistics on a given output, according mode
Standard_EXPORT void PrintStats (const Standard_Integer mode, Standard_OStream& S) const;
Standard_EXPORT void PrintStats(const Standard_Integer mode, Standard_OStream& S) const;
Standard_EXPORT Handle(TColStd_HSequenceOfTransient) RootsForTransfer();
DEFINE_STANDARD_RTTIEXT(Transfer_TransientProcess,Transfer_ProcessForTransient)
DEFINE_STANDARD_RTTIEXT(Transfer_TransientProcess, Transfer_ProcessForTransient)
protected:
private:
Handle(Interface_InterfaceModel) themodel;
Handle(Interface_HGraph) thegraph;
Handle(Interface_InterfaceModel) themodel;
Handle(Interface_HGraph) thegraph;
NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)> thectx;
Handle(TColStd_HSequenceOfTransient) thetrroots;
Handle(TColStd_HSequenceOfTransient) thetrroots;
};
#endif // _Transfer_TransientProcess_HeaderFile

View File

@@ -20,10 +20,10 @@
//! used on processing Undefined Entities (see TransferOutput)
enum Transfer_UndefMode
{
Transfer_UndefIgnore,
Transfer_UndefFailure,
Transfer_UndefContent,
Transfer_UndefUser
Transfer_UndefIgnore,
Transfer_UndefFailure,
Transfer_UndefContent,
Transfer_UndefUser
};
#endif // _Transfer_UndefMode_HeaderFile

View File

@@ -19,16 +19,19 @@
#include <Standard_Type.hxx>
#include <Transfer_VoidBinder.hxx>
IMPLEMENT_STANDARD_RTTIEXT(Transfer_VoidBinder,Transfer_Binder)
IMPLEMENT_STANDARD_RTTIEXT(Transfer_VoidBinder, Transfer_Binder)
Transfer_VoidBinder::Transfer_VoidBinder () { }
Transfer_VoidBinder::Transfer_VoidBinder() {}
// Standard_Boolean Transfer_VoidBinder::IsMultiple () const
// { return Standard_False; }
Handle(Standard_Type) Transfer_VoidBinder::ResultType() const
{
return DynamicType();
}
Handle(Standard_Type) Transfer_VoidBinder::ResultType () const
{ return DynamicType(); }
Standard_CString Transfer_VoidBinder::ResultTypeName () const
{ return "(void)"; }
Standard_CString Transfer_VoidBinder::ResultTypeName() const
{
return "(void)";
}

View File

@@ -22,7 +22,6 @@
#include <Transfer_Binder.hxx>
class Transfer_VoidBinder;
DEFINE_STANDARD_HANDLE(Transfer_VoidBinder, Transfer_Binder)
@@ -35,40 +34,21 @@ class Transfer_VoidBinder : public Transfer_Binder
{
public:
//! a VoidBinder is not Multiple (Remark : it is not Simple too)
//! But it can bring next results ...
Standard_EXPORT Transfer_VoidBinder();
//! while a VoidBinder admits no Result, its ResultType returns
//! the type of <me>
Standard_EXPORT Handle(Standard_Type) ResultType() const Standard_OVERRIDE;
//! Returns "(void)"
Standard_EXPORT Standard_CString ResultTypeName() const Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(Transfer_VoidBinder,Transfer_Binder)
DEFINE_STANDARD_RTTIEXT(Transfer_VoidBinder, Transfer_Binder)
protected:
private:
};
#endif // _Transfer_VoidBinder_HeaderFile