mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
Integration of OCCT 6.5.0 from SVN
This commit is contained in:
97
src/Transfer/Transfer.cdl
Executable file
97
src/Transfer/Transfer.cdl
Executable file
@@ -0,0 +1,97 @@
|
||||
-- File: Transfer.cdl
|
||||
-- Created: Mon Feb 3 10:34:50 1992
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@phobox>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
|
||||
package Transfer
|
||||
|
||||
---Purpose : Defines general Transfer engine, which provides tools and
|
||||
-- workframe for all kinds of file (non-direct) Interfaces.
|
||||
-- Works on the basis of data provided by package Interface
|
||||
-- (especially InterfaceModel).
|
||||
|
||||
uses TCollection, TColStd, MMgt, Standard, Dico, MoniTool, Interface, Message
|
||||
|
||||
is
|
||||
|
||||
class DataInfo; -- used in Mapper
|
||||
|
||||
deferred class Finder;
|
||||
generic class Mapper;
|
||||
class TransientMapper instantiates Mapper
|
||||
(Transient, MapTransientHasher from TColStd, DataInfo);
|
||||
class FindHasher;
|
||||
|
||||
deferred class Binder;
|
||||
class VoidBinder;
|
||||
generic class SimpleBinder;
|
||||
class SimpleBinderOfTransient;
|
||||
class BinderOfTransientInteger;
|
||||
class TransientListBinder;
|
||||
class MultipleBinder;
|
||||
|
||||
class ResultFromTransient;
|
||||
class ResultFromModel;
|
||||
|
||||
class TransferIterator;
|
||||
generic class TransferProcess;
|
||||
generic class TransferMap;
|
||||
generic class Iterator;
|
||||
generic class Actor;
|
||||
|
||||
class ProcessForTransient instantiates TransferProcess
|
||||
(Transient, MapTransientHasher from TColStd,
|
||||
HSequenceOfTransient from TColStd);
|
||||
---Purpose : Manages Transfer of Transient Objects. Produces also
|
||||
-- ActorOfTransientProcess (deferred class),
|
||||
-- IteratorOfTransientProcess (for Results),
|
||||
-- TransferMapOfTransientProcess (internally used)
|
||||
-- Normally uses as TransientProcess, which adds some specifics
|
||||
|
||||
class TransientProcess; -- inherits TransferForTransient
|
||||
class ActorOfTransientProcess;
|
||||
|
||||
class SequenceOfFinder instantiates
|
||||
Sequence from TCollection (Finder);
|
||||
class HSequenceOfFinder instantiates
|
||||
HSequence from TCollection (Finder,SequenceOfFinder);
|
||||
|
||||
class ProcessForFinder instantiates TransferProcess
|
||||
(Finder, FindHasher, HSequenceOfFinder);
|
||||
|
||||
class FinderProcess;
|
||||
class ActorOfFinderProcess;
|
||||
|
||||
class TransferOutput;
|
||||
class TransferInput;
|
||||
|
||||
class DispatchControl;
|
||||
class TransferDispatch;
|
||||
class ActorDispatch;
|
||||
|
||||
class MapContainer;
|
||||
|
||||
class SequenceOfBinder instantiates
|
||||
Sequence from TCollection (Binder);
|
||||
class HSequenceOfBinder instantiates
|
||||
HSequence from TCollection (Binder,SequenceOfBinder);
|
||||
|
||||
enumeration StatusResult is StatusVoid, StatusDefined, StatusUsed;
|
||||
---Purpose : result status of transferring an entity (see Transcriptor)
|
||||
|
||||
enumeration StatusExec is
|
||||
StatusInitial, StatusRun, StatusDone, StatusError,StatusLoop;
|
||||
---Purpose : execution status of an individual transfer (see Transcriptor)
|
||||
|
||||
enumeration UndefMode is
|
||||
UndefIgnore, UndefFailure, UndefContent, UndefUser;
|
||||
---Purpose : used on processing Undefined Entities (see TransferOutput)
|
||||
|
||||
-- -- Exceptions -- --
|
||||
|
||||
exception TransferFailure inherits InterfaceError from Interface;
|
||||
exception TransferDeadLoop inherits TransferFailure from Transfer;
|
||||
|
||||
end Transfer;
|
55
src/Transfer/Transfer_Actor.gxx
Executable file
55
src/Transfer/Transfer_Actor.gxx
Executable file
@@ -0,0 +1,55 @@
|
||||
//#include <Transfer_Actor.ixx>
|
||||
|
||||
// TheStart : Handle(Standard_Transient) ou (Transfer_Finder)
|
||||
|
||||
|
||||
|
||||
Transfer_Actor::Transfer_Actor () { }
|
||||
|
||||
|
||||
Standard_Boolean Transfer_Actor::Recognize (const TheStart& /*start*/)
|
||||
{ return Standard_True; }
|
||||
|
||||
Handle(Transfer_Binder) Transfer_Actor::Transferring
|
||||
(const TheStart& /*start*/,
|
||||
const Handle(Transfer_TransferProcess)& /*TP*/)
|
||||
{ return NullResult(); }
|
||||
|
||||
|
||||
Handle(Transfer_SimpleBinderOfTransient)
|
||||
Transfer_Actor::TransientResult
|
||||
(const Handle(Standard_Transient)& res) const
|
||||
{
|
||||
Handle(Transfer_SimpleBinderOfTransient) binder;
|
||||
if (res.IsNull()) return binder;
|
||||
binder = new Transfer_SimpleBinderOfTransient;
|
||||
binder->SetResult (res);
|
||||
return binder;
|
||||
}
|
||||
|
||||
|
||||
Handle(Transfer_Binder) Transfer_Actor::NullResult () const
|
||||
{
|
||||
Handle(Transfer_Binder) binder;
|
||||
return binder;
|
||||
}
|
||||
|
||||
|
||||
void Transfer_Actor::SetNext
|
||||
(const Handle(Transfer_Actor)& next)
|
||||
{
|
||||
if (thenext == next) return;
|
||||
if (thenext.IsNull()) thenext = next;
|
||||
else if (thenext->IsLast()) { next->SetNext(thenext); thenext = next; }
|
||||
else thenext->SetNext(next);
|
||||
}
|
||||
|
||||
Handle(Transfer_Actor) Transfer_Actor::Next () const
|
||||
{ return thenext; }
|
||||
|
||||
void Transfer_Actor::SetLast (const Standard_Boolean mode)
|
||||
{ thelast = mode; }
|
||||
|
||||
|
||||
Standard_Boolean Transfer_Actor::IsLast () const
|
||||
{ return thelast; }
|
64
src/Transfer/Transfer_ActorDispatch.cdl
Executable file
64
src/Transfer/Transfer_ActorDispatch.cdl
Executable file
@@ -0,0 +1,64 @@
|
||||
-- File: Transfer_ActorDispatch.cdl
|
||||
-- Created: Tue May 24 13:44:29 1994
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@bravox>
|
||||
---Copyright: Matra Datavision 1994
|
||||
|
||||
|
||||
class ActorDispatch from Transfer inherits ActorOfTransientProcess
|
||||
|
||||
---Purpose : This class allows to work with a TransferDispatch, i.e. to
|
||||
-- transfer entities from a data set to another one defined by
|
||||
-- the same interface norm, with the following features :
|
||||
-- - ActorDispatch itself acts as a default actor, i.e. it copies
|
||||
-- entities with the general service Copy, as CopyTool does
|
||||
-- - it allows to add other actors for specific ways of transfer,
|
||||
-- which may include data modifications, conversions ...
|
||||
-- - and other features from TransferDispatch (such as mapping
|
||||
-- other than one-one)
|
||||
|
||||
uses Transient, InterfaceModel, GeneralLib, Protocol from Interface,
|
||||
TransferDispatch, TransientProcess, Binder
|
||||
|
||||
raises InterfaceError
|
||||
|
||||
is
|
||||
|
||||
Create (amodel : InterfaceModel; lib : GeneralLib)
|
||||
returns mutable ActorDispatch;
|
||||
---Purpose : 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>
|
||||
|
||||
Create (amodel : InterfaceModel; protocol : Protocol from Interface)
|
||||
returns mutable ActorDispatch;
|
||||
---Purpose : Same as above, but Library is defined through a Protocol
|
||||
|
||||
Create (amodel : InterfaceModel) returns mutable ActorDispatch
|
||||
---Purpose : Same as above, but works with the Active Protocol
|
||||
raises InterfaceError;
|
||||
-- Error if no Active Protocol is defined
|
||||
|
||||
AddActor (me : mutable; actor : mutable ActorOfTransientProcess from Transfer);
|
||||
---Purpose : Utility which adds an actor to the default <me> (it calls
|
||||
-- SetActor from the TransientProcess)
|
||||
|
||||
TransferDispatch (me : mutable) returns TransferDispatch;
|
||||
---Purpose : Returns the TransferDispatch, which does the work, records
|
||||
-- the intermediate data, etc...
|
||||
-- See TransferDispatch & CopyTool, to see the available methods
|
||||
---C++ : return &
|
||||
|
||||
|
||||
Transfer (me : mutable; start : Transient; TP : mutable TransientProcess)
|
||||
returns mutable Binder is redefined;
|
||||
---Purpose : Specific action : it calls the method Transfer from CopyTool
|
||||
-- i.e. the general service Copy, then returns the Binder
|
||||
-- produced by the TransientProcess
|
||||
|
||||
fields
|
||||
|
||||
thetool : TransferDispatch;
|
||||
|
||||
end ActorDispatch;
|
46
src/Transfer/Transfer_ActorDispatch.cxx
Executable file
46
src/Transfer/Transfer_ActorDispatch.cxx
Executable file
@@ -0,0 +1,46 @@
|
||||
#include <Transfer_ActorDispatch.ixx>
|
||||
#include <Transfer_TransientProcess.hxx>
|
||||
|
||||
|
||||
Transfer_ActorDispatch::Transfer_ActorDispatch
|
||||
(const Handle(Interface_InterfaceModel)& amodel,
|
||||
const Interface_GeneralLib& lib)
|
||||
: thetool (amodel,lib)
|
||||
{
|
||||
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)
|
||||
{
|
||||
SetLast(Standard_True); // actor par defaut
|
||||
thetool.TransientProcess()->SetActor(this);
|
||||
}
|
||||
|
||||
Transfer_ActorDispatch::Transfer_ActorDispatch
|
||||
(const Handle(Interface_InterfaceModel)& amodel)
|
||||
: thetool (amodel)
|
||||
{
|
||||
SetLast(Standard_True); // actor par defaut
|
||||
thetool.TransientProcess()->SetActor(this);
|
||||
}
|
||||
|
||||
|
||||
void Transfer_ActorDispatch::AddActor
|
||||
(const Handle(Transfer_ActorOfTransientProcess)& actor)
|
||||
{ thetool.TransientProcess()->SetActor(actor); }
|
||||
|
||||
Transfer_TransferDispatch& Transfer_ActorDispatch::TransferDispatch ()
|
||||
{ return thetool; }
|
||||
|
||||
|
||||
Handle(Transfer_Binder) Transfer_ActorDispatch::Transfer
|
||||
(const Handle(Standard_Transient)& start,
|
||||
const Handle(Transfer_TransientProcess)& /*TP*/)
|
||||
{
|
||||
thetool.TransferEntity(start);
|
||||
return thetool.TransientProcess()->Find(start);
|
||||
}
|
45
src/Transfer/Transfer_ActorOfFinderProcess.cdl
Executable file
45
src/Transfer/Transfer_ActorOfFinderProcess.cdl
Executable file
@@ -0,0 +1,45 @@
|
||||
-- File: Transfer_ActorOfFinderProcess.cdl
|
||||
-- Created: Wed Sep 4 17:44:43 1996
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@fidox.paris1.matra-dtv.fr>
|
||||
---Copyright: Matra Datavision 1996
|
||||
|
||||
|
||||
class ActorOfFinderProcess from Transfer inherits ActorOfProcessForFinder
|
||||
|
||||
---Purpose : The original class was renamed. Compatibility only
|
||||
--
|
||||
-- ModeTrans : a simple way of transmitting a transfer mode from
|
||||
-- a user. To be interpreted for each norm
|
||||
|
||||
uses Finder, FinderProcess, ProcessForFinder, Binder
|
||||
|
||||
is
|
||||
|
||||
Create returns mutable ActorOfFinderProcess;
|
||||
|
||||
ModeTrans (me : mutable) returns Integer;
|
||||
---Purpose : Returns the Transfer Mode, modifiable
|
||||
---C++ : return &
|
||||
|
||||
Transferring (me : mutable; start : Finder; TP : mutable ProcessForFinder)
|
||||
returns mutable Binder is redefined;
|
||||
-- calls the one below
|
||||
|
||||
Transfer (me : mutable; start : Finder; TP : mutable FinderProcess)
|
||||
returns mutable Binder is virtual;
|
||||
-- default calls TransferTransient if <start> is a TransientMapper,
|
||||
-- i.e. does nothing, to be redefined
|
||||
|
||||
TransferTransient (me : mutable; start : Transient;
|
||||
TP : mutable FinderProcess)
|
||||
returns mutable Transient is virtual;
|
||||
-- default does nothing, can be redefined
|
||||
-- usefull when a result is Transient, simpler to define than Transfer with
|
||||
-- a Finder
|
||||
|
||||
fields
|
||||
|
||||
themodetrans : Integer is protected;
|
||||
|
||||
end ActorOfFinderProcess;
|
33
src/Transfer/Transfer_ActorOfFinderProcess.cxx
Executable file
33
src/Transfer/Transfer_ActorOfFinderProcess.cxx
Executable file
@@ -0,0 +1,33 @@
|
||||
#include <Transfer_ActorOfFinderProcess.ixx>
|
||||
#include <Transfer_TransientMapper.hxx>
|
||||
|
||||
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)
|
||||
{
|
||||
Handle(Transfer_TransientMapper) tm = Handle(Transfer_TransientMapper)::DownCast (fnd);
|
||||
if (tm.IsNull()) return NullResult();
|
||||
Handle(Standard_Transient) res = TransferTransient (tm->Value(),FP);
|
||||
if (res.IsNull()) return NullResult();
|
||||
return TransientResult (res);
|
||||
}
|
||||
|
||||
Handle(Transfer_Binder) Transfer_ActorOfFinderProcess::Transferring
|
||||
(const Handle(Transfer_Finder)& ent,
|
||||
const Handle(Transfer_ProcessForFinder)& TP)
|
||||
{
|
||||
return Transfer(ent,Handle(Transfer_FinderProcess)::DownCast(TP));
|
||||
}
|
||||
|
||||
Handle(Standard_Transient) Transfer_ActorOfFinderProcess::TransferTransient
|
||||
(const Handle(Standard_Transient)& /*ent*/,
|
||||
const Handle(Transfer_FinderProcess)& )
|
||||
{
|
||||
Handle(Standard_Transient) nulres;
|
||||
return nulres;
|
||||
}
|
33
src/Transfer/Transfer_ActorOfTransientProcess.cdl
Executable file
33
src/Transfer/Transfer_ActorOfTransientProcess.cdl
Executable file
@@ -0,0 +1,33 @@
|
||||
-- File: Transfer_ActorOfTransientProcess.cdl
|
||||
-- Created: Wed Sep 4 17:42:46 1996
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@fidox.paris1.matra-dtv.fr>
|
||||
---Copyright: Matra Datavision 1996
|
||||
|
||||
|
||||
class ActorOfTransientProcess from Transfer inherits ActorOfProcessForTransient from Transfer
|
||||
|
||||
---Purpose : The original class was renamed. Compatibility only
|
||||
|
||||
uses Transient, TransientProcess, ProcessForTransient, Binder
|
||||
|
||||
is
|
||||
|
||||
Create returns mutable ActorOfTransientProcess;
|
||||
|
||||
Transferring (me : mutable; start : Transient; TP : mutable ProcessForTransient)
|
||||
returns mutable Binder is redefined;
|
||||
-- calls the one below
|
||||
|
||||
Transfer (me : mutable; start : Transient; TP : mutable TransientProcess)
|
||||
returns mutable Binder is virtual;
|
||||
-- default calls TransferTransient i.e. does nothing, to be redefined
|
||||
|
||||
TransferTransient (me : mutable; start : Transient;
|
||||
TP : mutable TransientProcess)
|
||||
returns mutable Transient is virtual;
|
||||
-- default does nothing, can be redefined
|
||||
-- usefull when a result is Transient, simpler to define than Transfer with
|
||||
-- a Binder
|
||||
|
||||
end ActorOfTransientProcess;
|
27
src/Transfer/Transfer_ActorOfTransientProcess.cxx
Executable file
27
src/Transfer/Transfer_ActorOfTransientProcess.cxx
Executable file
@@ -0,0 +1,27 @@
|
||||
#include <Transfer_ActorOfTransientProcess.ixx>
|
||||
|
||||
Transfer_ActorOfTransientProcess::Transfer_ActorOfTransientProcess () { }
|
||||
|
||||
Handle(Transfer_Binder) Transfer_ActorOfTransientProcess::Transfer
|
||||
(const Handle(Standard_Transient)& start,
|
||||
const Handle(Transfer_TransientProcess)& TP)
|
||||
{
|
||||
Handle(Standard_Transient) res = TransferTransient (start,TP);
|
||||
if (res.IsNull()) return NullResult();
|
||||
return TransientResult (res);
|
||||
}
|
||||
|
||||
Handle(Transfer_Binder) Transfer_ActorOfTransientProcess::Transferring
|
||||
(const Handle(Standard_Transient)& ent,
|
||||
const Handle(Transfer_ProcessForTransient)& TP)
|
||||
{
|
||||
return Transfer(ent,Handle(Transfer_TransientProcess)::DownCast(TP));
|
||||
}
|
||||
|
||||
Handle(Standard_Transient) Transfer_ActorOfTransientProcess::TransferTransient
|
||||
(const Handle(Standard_Transient)& /*ent*/,
|
||||
const Handle(Transfer_TransientProcess)& /*TP*/)
|
||||
{
|
||||
Handle(Standard_Transient) nulres;
|
||||
return nulres;
|
||||
}
|
141
src/Transfer/Transfer_Binder.cdl
Executable file
141
src/Transfer/Transfer_Binder.cdl
Executable file
@@ -0,0 +1,141 @@
|
||||
-- File: Transfer_Binder.cdl
|
||||
-- Created: Wed Jun 9 10:41:08 1993
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@bravox>
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
|
||||
deferred class Binder from Transfer inherits TShared
|
||||
|
||||
---Purpose : A Binder is an auxiliary object to Map the Result of the
|
||||
-- Transfer of a given Object : it records the Result of the
|
||||
-- Unitary Transfer (Resulting Object), status of progress and
|
||||
-- error (if any) of the Process
|
||||
--
|
||||
-- The class Binder itself makes no definition for the Result :
|
||||
-- it is defined by sub-classes : it can be either Simple (and
|
||||
-- has to be typed : see generic class SimpleBinder) or Multiple
|
||||
-- (see class MultipleBinder).
|
||||
--
|
||||
-- In principle, for a Transfer in progress, Result cannot be
|
||||
-- accessed : this would cause an exception raising.
|
||||
-- This is controlled by the value if StatusResult : if it is
|
||||
-- "Used", the Result cannot be changed. This status is normally
|
||||
-- controlled by TransferProcess but can be directly (see method
|
||||
-- SetAlreadyUsed)
|
||||
--
|
||||
-- Checks can be completed by a record of cases, as string which
|
||||
-- can be used as codes, but not to be printed
|
||||
--
|
||||
-- In addition to the Result, a Binder can bring a list of
|
||||
-- Attributes, which are additional data, each of them has a name
|
||||
|
||||
uses CString, Type, HArray1OfInteger,
|
||||
HSequenceOfTransient from TColStd, DictionaryOfTransient from Dico,
|
||||
Check, ParamType, StatusResult, StatusExec
|
||||
|
||||
raises TransferFailure
|
||||
|
||||
is
|
||||
|
||||
Initialize;
|
||||
---Purpose : Sets fields at initial values
|
||||
|
||||
Merge (me : mutable; other : Binder);
|
||||
---Purpose : 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
|
||||
|
||||
IsMultiple (me) returns Boolean is virtual;
|
||||
---Purpose : Returns True if a Binder has several results, either by itself
|
||||
-- or because it has next results
|
||||
-- Can be defined by sub-classes.
|
||||
|
||||
ResultType (me) returns Type is deferred;
|
||||
---Purpose : Returns the Type which characterizes the Result (if known)
|
||||
|
||||
ResultTypeName (me) returns CString is deferred;
|
||||
---Purpose : Returns the Name of the Type which characterizes the Result
|
||||
-- Can be returned even if ResultType itself is unknown
|
||||
|
||||
AddResult (me : mutable; next : Binder);
|
||||
---Purpose : Adds a next result (at the end of the list)
|
||||
-- Remark : this information is not processed by Merge
|
||||
|
||||
CutResult (me : mutable; next : Binder) is private;
|
||||
---Purpose : Called by AddResult, to keep unicity of each item in the list
|
||||
|
||||
NextResult (me) returns Binder;
|
||||
---Purpose : Returns the next result, Null if none
|
||||
|
||||
-- -- Mapping management internal services -- --
|
||||
|
||||
SetResultPresent (me : mutable)
|
||||
---Purpose : Used to declare that a result is recorded for an individual
|
||||
-- transfer (works by setting StatusResult to Defined)
|
||||
--
|
||||
-- This Method is to be called once a Result is really recorded
|
||||
-- (see sub-classes of Binder, especially SimpleBinder) : it is
|
||||
-- senseless if called isolately
|
||||
raises TransferFailure is protected;
|
||||
-- Error if Result is already set and used
|
||||
|
||||
HasResult (me) returns Boolean;
|
||||
---Purpose : 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
|
||||
|
||||
SetAlreadyUsed (me : mutable);
|
||||
---Purpose : Declares that result is now used by another one, it means that
|
||||
-- it cannot be modified (by Rebind)
|
||||
|
||||
Status (me) returns StatusResult;
|
||||
---Purpose : 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)
|
||||
|
||||
-- -- Check Management -- --
|
||||
|
||||
StatusExec (me) returns StatusExec;
|
||||
---Purpose : Returns execution status
|
||||
|
||||
SetStatusExec (me : mutable; stat : StatusExec);
|
||||
---Purpose : Modifies execution status; called by TransferProcess only
|
||||
-- (for StatusError, rather use SetError, below)
|
||||
|
||||
AddFail (me : mutable; mess : CString; orig : CString = "");
|
||||
---Purpose : Used to declare an individual transfer as beeing erroneous
|
||||
-- (Status is set to Void, StatusExec is set to Error, <errmess>
|
||||
-- is added to Check's list of Fails)
|
||||
-- It is possible to record several messages of error
|
||||
--
|
||||
-- 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)
|
||||
|
||||
AddWarning (me : mutable; mess : CString; orig : CString = "");
|
||||
---Purpose : Used to attach a Warning Message to an individual Transfer
|
||||
-- It has no effect on the Status
|
||||
|
||||
Check (me) returns Check;
|
||||
---Purpose : Returns Check which stores Fail messages
|
||||
-- Note that no Entity is associated in this Check
|
||||
---C++ : return const
|
||||
|
||||
CCheck (me : mutable) returns Check;
|
||||
---Purpose : Returns Check which stores Fail messages, in order to modify
|
||||
-- it (adding messages, or replacing it)
|
||||
|
||||
|
||||
fields
|
||||
|
||||
-- REMEMBER : The Result itself is brought by sub-classes of Binder
|
||||
-- (specific to each kind of Result)
|
||||
thestatus : StatusResult; -- enum : Void, Defined, Used
|
||||
theexecst : StatusExec; -- enum : Initial, Run, Done, Error, Loop
|
||||
thecheck : Check;
|
||||
thenextr : Binder;
|
||||
|
||||
end Binder;
|
202
src/Transfer/Transfer_Binder.cxx
Executable file
202
src/Transfer/Transfer_Binder.cxx
Executable file
@@ -0,0 +1,202 @@
|
||||
#include <Transfer_Binder.ixx>
|
||||
#include <Transfer_VoidBinder.hxx>
|
||||
#include <Transfer_TransferFailure.hxx>
|
||||
|
||||
#include <TCollection_HAsciiString.hxx>
|
||||
#include <Interface_IntVal.hxx>
|
||||
#include <Geom2d_CartesianPoint.hxx>
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//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)
|
||||
{
|
||||
if (other.IsNull()) return;
|
||||
if ((int) theexecst < (int) other->StatusExec()) theexecst = other->StatusExec();
|
||||
thecheck->GetMessages (other->Check());
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsMultiple
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
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;
|
||||
next = next->NextResult();
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : AddResult
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Transfer_Binder::AddResult (const Handle(Transfer_Binder)& next)
|
||||
{
|
||||
if (next == this || next.IsNull()) return;
|
||||
next->CutResult(this);
|
||||
if (thenextr.IsNull())
|
||||
thenextr = next;
|
||||
else {
|
||||
//Modification of requrcive to cycle
|
||||
Handle(Transfer_Binder) theBinder = thenextr;
|
||||
while( theBinder != next ) {
|
||||
if( theBinder->NextResult().IsNull() ) {
|
||||
theBinder->AddResult(next);
|
||||
return;
|
||||
}
|
||||
else
|
||||
theBinder = theBinder->NextResult();
|
||||
}
|
||||
}
|
||||
//former requrcive
|
||||
// if (thenextr.IsNull()) thenextr = next;
|
||||
// else if (thenextr == next) return;
|
||||
// else thenextr->AddResult (next);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : CutResult
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Transfer_Binder::CutResult (const Handle(Transfer_Binder)& next)
|
||||
{
|
||||
if (thenextr.IsNull()) return;
|
||||
if (thenextr == next) thenextr.Nullify();
|
||||
else thenextr->CutResult (next);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NextResult
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(Transfer_Binder) Transfer_Binder::NextResult () const
|
||||
{ return thenextr; }
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : SetResultPresent
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Transfer_Binder::SetResultPresent ()
|
||||
{
|
||||
if (thestatus == Transfer_StatusUsed) Transfer_TransferFailure::Raise
|
||||
("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); }
|
||||
|
||||
//=======================================================================
|
||||
//function : SetAlreadyUsed
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Transfer_Binder::SetAlreadyUsed ()
|
||||
{ if (thestatus != Transfer_StatusVoid) thestatus = Transfer_StatusUsed; }
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Status
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Transfer_StatusResult Transfer_Binder::Status () const
|
||||
{ return thestatus; }
|
||||
|
||||
|
||||
// ############ Checks ############
|
||||
|
||||
//=======================================================================
|
||||
//function : StatusExec
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Transfer_StatusExec Transfer_Binder::StatusExec () const
|
||||
{ return theexecst; }
|
||||
|
||||
//=======================================================================
|
||||
//function : SetStatusExec
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
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)
|
||||
{
|
||||
theexecst = Transfer_StatusError;
|
||||
thecheck->AddFail(mess,orig);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : AddWarning
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Transfer_Binder::AddWarning
|
||||
(const Standard_CString mess, const Standard_CString orig)
|
||||
{
|
||||
// theexecst = Transfer_StatusError;
|
||||
thecheck->AddWarning(mess,orig);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Check
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const Handle(Interface_Check) Transfer_Binder::Check () const
|
||||
{
|
||||
return thecheck;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : CCheck
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(Interface_Check) Transfer_Binder::CCheck ()
|
||||
{
|
||||
return thecheck;
|
||||
}
|
||||
|
35
src/Transfer/Transfer_BinderOfTransientInteger.cdl
Executable file
35
src/Transfer/Transfer_BinderOfTransientInteger.cdl
Executable file
@@ -0,0 +1,35 @@
|
||||
-- File: Transfer_BinderOfTransientInteger.cdl
|
||||
-- Created: Mon Feb 27 15:06:40 1995
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@anion>
|
||||
---Copyright: Matra Datavision 1995
|
||||
|
||||
|
||||
class BinderOfTransientInteger from Transfer inherits SimpleBinderOfTransient
|
||||
|
||||
---Purpose : This type of Binder allows to attach as result, besides a
|
||||
-- Transient Object, an Integer Value, which can be an Index
|
||||
-- in the Object if it defines a List, for instance
|
||||
--
|
||||
-- This Binder is otherwise a kind of SimpleBinderOfTransient,
|
||||
-- i.e. its basic result (for iterators, etc) is the Transient
|
||||
|
||||
uses Integer
|
||||
|
||||
is
|
||||
|
||||
Create returns mutable BinderOfTransientInteger;
|
||||
---Purpose : Creates an empty BinderOfTransientInteger; Default value for
|
||||
-- the integer part is zero
|
||||
|
||||
SetInteger (me : mutable; value : Integer);
|
||||
---Purpose : Sets a value for the integer part
|
||||
|
||||
Integer (me) returns Integer;
|
||||
---Purpose : Returns the value set for the integer part
|
||||
|
||||
fields
|
||||
|
||||
theintval : Integer;
|
||||
|
||||
end BinderOfTransientInteger;
|
11
src/Transfer/Transfer_BinderOfTransientInteger.cxx
Executable file
11
src/Transfer/Transfer_BinderOfTransientInteger.cxx
Executable file
@@ -0,0 +1,11 @@
|
||||
#include <Transfer_BinderOfTransientInteger.ixx>
|
||||
|
||||
Transfer_BinderOfTransientInteger::Transfer_BinderOfTransientInteger ()
|
||||
: theintval (0) { }
|
||||
|
||||
void Transfer_BinderOfTransientInteger::SetInteger
|
||||
(const Standard_Integer val)
|
||||
{ theintval = val; }
|
||||
|
||||
Standard_Integer Transfer_BinderOfTransientInteger::Integer () const
|
||||
{ return theintval; }
|
26
src/Transfer/Transfer_DataInfo.cdl
Executable file
26
src/Transfer/Transfer_DataInfo.cdl
Executable file
@@ -0,0 +1,26 @@
|
||||
-- File: Transfer_DataInfo.cdl
|
||||
-- Created: Wed Sep 4 10:47:02 1996
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@fidox.paris1.matra-dtv.fr>
|
||||
---Copyright: Matra Datavision 1996
|
||||
|
||||
|
||||
class DataInfo from Transfer
|
||||
|
||||
---Purpose : Gives informations on an object
|
||||
-- Used as template to instantiate Mapper and SimpleBinder
|
||||
-- This class is for Transient
|
||||
|
||||
uses CString, Transient, Type
|
||||
|
||||
is
|
||||
|
||||
Type (myclass; ent : Transient) returns Type;
|
||||
---Purpose : Returns the Type attached to an object
|
||||
-- Here, the Dynamic Type of a Transient. Null Type if unknown
|
||||
|
||||
TypeName (myclass; ent : Transient) returns CString;
|
||||
---Purpose : Returns Type Name (string)
|
||||
-- Allows to name type of non-handled objects
|
||||
|
||||
end DataInfo;
|
9
src/Transfer/Transfer_DataInfo.cxx
Executable file
9
src/Transfer/Transfer_DataInfo.cxx
Executable file
@@ -0,0 +1,9 @@
|
||||
#include <Transfer_DataInfo.ixx>
|
||||
|
||||
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(); }
|
55
src/Transfer/Transfer_DispatchControl.cdl
Executable file
55
src/Transfer/Transfer_DispatchControl.cdl
Executable file
@@ -0,0 +1,55 @@
|
||||
-- File: Transfer_DispatchControl.cdl
|
||||
-- Created: Thu Jun 17 15:44:03 1993
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@bravox>
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
|
||||
class DispatchControl from Transfer inherits CopyControl from Interface
|
||||
|
||||
---Purpose : This is an auxiliary class for TransferDispatch, which allows
|
||||
-- to record simple copies, as CopyControl from Interface, but
|
||||
-- based on a TransientProcess. Hence, it allows in addition
|
||||
-- more actions (such as recording results of adaptations)
|
||||
|
||||
uses Transient, TransientProcess, InterfaceModel
|
||||
|
||||
raises InterfaceError
|
||||
|
||||
is
|
||||
|
||||
Create (model : InterfaceModel; TP : mutable TransientProcess)
|
||||
returns mutable DispatchControl;
|
||||
---Purpose : Creates the DispatchControl, ready for use
|
||||
|
||||
TransientProcess (me) returns mutable TransientProcess;
|
||||
---Purpose : Returns the content of the DispatchControl : it can be used
|
||||
-- for a direct call, if the basic methods do not suffice
|
||||
---C++ : return const &
|
||||
|
||||
StartingModel (me) returns any InterfaceModel;
|
||||
---Purpose : Returns the Model from which the transfer is to be done
|
||||
---C++ : return const &
|
||||
|
||||
-- Now, inherited methods used for Copy (the minimum set)
|
||||
|
||||
Clear (me : mutable);
|
||||
---Purpose : Clears the List of Copied Results
|
||||
|
||||
Bind (me : mutable; ent : Transient; res : mutable Transient)
|
||||
---Purpose : Binds a (Transient) Result to a (Transient) Starting Entity
|
||||
raises InterfaceError;
|
||||
-- Error if <ent> is already bound
|
||||
|
||||
Search (me; ent : Transient; res : out mutable Transient)
|
||||
returns Boolean;
|
||||
---Purpose : Searches for the Result bound to a Starting Entity
|
||||
-- If Found, returns True and fills <res>
|
||||
-- Else, returns False and nullifies <res>
|
||||
|
||||
fields
|
||||
|
||||
theTP : TransientProcess;
|
||||
themodel : InterfaceModel;
|
||||
|
||||
end DispatchControl;
|
31
src/Transfer/Transfer_DispatchControl.cxx
Executable file
31
src/Transfer/Transfer_DispatchControl.cxx
Executable file
@@ -0,0 +1,31 @@
|
||||
#include <Transfer_DispatchControl.ixx>
|
||||
|
||||
|
||||
|
||||
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(Interface_InterfaceModel)&
|
||||
Transfer_DispatchControl::StartingModel () const
|
||||
{ return themodel; }
|
||||
|
||||
void Transfer_DispatchControl::Clear () { theTP->Clear(); }
|
||||
|
||||
|
||||
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(); }
|
31
src/Transfer/Transfer_FindHasher.cdl
Executable file
31
src/Transfer/Transfer_FindHasher.cdl
Executable file
@@ -0,0 +1,31 @@
|
||||
-- File: Transfer_FindHasher.cdl
|
||||
-- Created: Fri Nov 4 11:06:49 1994
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@anion>
|
||||
---Copyright: Matra Datavision 1994
|
||||
|
||||
|
||||
class FindHasher from Transfer
|
||||
|
||||
---Purpose : FindHasher defines HashCode for Finder, which is : ask a
|
||||
-- Finder its HashCode ! Because this is the Finder itself which
|
||||
-- brings the HashCode for its Key
|
||||
--
|
||||
-- This class complies to the template given in TCollection by
|
||||
-- MapHasher itself
|
||||
|
||||
uses Finder
|
||||
|
||||
is
|
||||
|
||||
HashCode (myclass; K : Finder; Upper : Integer) returns Integer;
|
||||
---Purpose : Returns a HashCode in the range <0,Upper> for a Finder :
|
||||
-- asks the Finder its HashCode then transforms it to be in the
|
||||
-- required range
|
||||
|
||||
IsEqual (myclass; K1, K2 : Finder) returns Boolean;
|
||||
---Purpose : Returns True if two keys are the same.
|
||||
-- The test does not work on the Finders themselves but by
|
||||
-- calling their methods Equates
|
||||
|
||||
end FindHasher;
|
15
src/Transfer/Transfer_FindHasher.cxx
Executable file
15
src/Transfer/Transfer_FindHasher.cxx
Executable file
@@ -0,0 +1,15 @@
|
||||
#include <Transfer_FindHasher.ixx>
|
||||
|
||||
|
||||
Standard_Integer Transfer_FindHasher::HashCode
|
||||
(const Handle(Transfer_Finder)& K, const Standard_Integer Upper)
|
||||
{
|
||||
return ((K->GetHashCode() - 1) % Upper) + 1;
|
||||
}
|
||||
|
||||
Standard_Boolean Transfer_FindHasher::IsEqual
|
||||
(const Handle(Transfer_Finder)& K1, const Handle(Transfer_Finder)& K2)
|
||||
{
|
||||
if (K1.IsNull()) return Standard_False;
|
||||
return K1->Equates(K2);
|
||||
}
|
135
src/Transfer/Transfer_Finder.cdl
Executable file
135
src/Transfer/Transfer_Finder.cdl
Executable file
@@ -0,0 +1,135 @@
|
||||
-- File: Transfer_Finder.cdl
|
||||
-- Created: Fri Nov 4 10:59:26 1994
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@anion>
|
||||
---Copyright: Matra Datavision 1994
|
||||
|
||||
|
||||
deferred class Finder from Transfer inherits TShared
|
||||
|
||||
---Purpose : a Finder allows to map any kind of object as a Key for a Map.
|
||||
-- This works by defining, for a Hash Code, that of the real Key,
|
||||
-- not of the Finder which acts only as an intermediate.
|
||||
-- When a Map asks for the HashCode of a Finder, this one returns
|
||||
-- the code it has determined at creation time
|
||||
|
||||
uses CString, Type, Transient,
|
||||
DictionaryOfTransient from Dico, ParamType from Interface
|
||||
|
||||
is
|
||||
|
||||
SetHashCode (me : mutable; code : Integer) is static protected;
|
||||
---Purpose : Stores the HashCode which corresponds to the Value given to
|
||||
-- create the Mapper
|
||||
|
||||
GetHashCode (me) returns Integer is static;
|
||||
---Purpose : 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)
|
||||
|
||||
Equates (me; other : Finder) returns Boolean is deferred;
|
||||
---Purpose : Specific testof equallity : to be defined by each sub-class,
|
||||
-- must be False if Finders have not the same true Type, else
|
||||
-- their contents must be compared
|
||||
|
||||
ValueType (me) returns Type is virtual;
|
||||
---Purpose : Returns the Type of the Value. By default, returns the
|
||||
-- DynamicType of <me>, but can be redefined
|
||||
|
||||
ValueTypeName (me) returns CString is virtual;
|
||||
---Purpose : Returns the name of the Type of the Value. Default is name
|
||||
-- of ValueType, unless it is for a non-handled object
|
||||
|
||||
-- -- Attributes
|
||||
|
||||
|
||||
SetAttribute (me : mutable; name : CString; val : Transient);
|
||||
---Purpose : Adds an attribute with a given name (replaces the former one
|
||||
-- with the same name if already exists)
|
||||
|
||||
RemoveAttribute (me : mutable; name : CString) returns Boolean;
|
||||
---Purpose : Removes an attribute
|
||||
-- Returns True when done, False if this attribute did not exist
|
||||
|
||||
GetAttribute (me; name : CString; type : Type from Standard;
|
||||
val : out mutable Transient) returns Boolean;
|
||||
---Purpose : 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
|
||||
|
||||
Attribute (me; name : CString) returns Transient;
|
||||
---Purpose : Returns an attribute from its name. Null Handle if not recorded
|
||||
-- (whatever Transient, Integer, Real ...)
|
||||
|
||||
AttributeType (me; name : CString) returns ParamType from Interface;
|
||||
---Purpose : Returns the type of an attribute :
|
||||
-- ParamInt , ParamReal , ParamText (String) , ParamIdent (any)
|
||||
-- or ParamVoid (not recorded)
|
||||
|
||||
|
||||
SetIntegerAttribute (me : mutable; name : CString; val : Integer);
|
||||
---Purpose : Adds an integer value for an attribute
|
||||
|
||||
GetIntegerAttribute (me; name : CString; val : out Integer) returns Boolean;
|
||||
---Purpose : 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
|
||||
|
||||
IntegerAttribute (me; name : CString) returns Integer;
|
||||
---Purpose : Returns an integer attribute from its name. 0 if not recorded
|
||||
|
||||
SetRealAttribute (me : mutable; name : CString; val : Real);
|
||||
---Purpose : Adds a real value for an attribute
|
||||
|
||||
GetRealAttribute (me; name : CString; val : out Real) returns Boolean;
|
||||
---Purpose : 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
|
||||
|
||||
RealAttribute (me; name : CString) returns Real;
|
||||
---Purpose : Returns a real attribute from its name. 0.0 if not recorded
|
||||
|
||||
SetStringAttribute (me : mutable; name : CString; val : CString);
|
||||
---Purpose : Adds a String value for an attribute
|
||||
|
||||
GetStringAttribute (me; name : CString; val : out CString) returns Boolean;
|
||||
---Purpose : 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
|
||||
|
||||
StringAttribute (me; name : CString) returns CString;
|
||||
---Purpose : Returns a String attribute from its name. "" if not recorded
|
||||
|
||||
AttrList (me) returns DictionaryOfTransient;
|
||||
---Purpose : Returns the exhaustive list of attributes
|
||||
|
||||
SameAttributes (me : mutable; other : Finder);
|
||||
---Purpose : 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
|
||||
|
||||
GetAttributes (me : mutable; other : Finder;
|
||||
fromname : CString = ""; copied : Boolean = Standard_True);
|
||||
---Purpose : 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
|
||||
-- name beginning by <fromname>
|
||||
--
|
||||
-- For each attribute, if <copied> is True (D), its value is also
|
||||
-- copied if it is a basic type (Integer,Real,String), else it
|
||||
-- remains shared between <other> and <me>
|
||||
--
|
||||
-- These new attributes are added to the existing ones in <me>,
|
||||
-- in case of same name, they replace the existing ones
|
||||
|
||||
fields
|
||||
|
||||
thecode : Integer;
|
||||
theattrib : DictionaryOfTransient;
|
||||
|
||||
end Finder;
|
199
src/Transfer/Transfer_Finder.cxx
Executable file
199
src/Transfer/Transfer_Finder.cxx
Executable file
@@ -0,0 +1,199 @@
|
||||
#include <Transfer_Finder.ixx>
|
||||
#include <Interface_IntVal.hxx>
|
||||
#include <Geom2d_CartesianPoint.hxx>
|
||||
#include <TCollection_HAsciiString.hxx>
|
||||
#include <Dico_IteratorOfDictionaryOfTransient.hxx>
|
||||
|
||||
|
||||
void Transfer_Finder::SetHashCode (const Standard_Integer code)
|
||||
{ thecode = code; }
|
||||
|
||||
Standard_Integer Transfer_Finder::GetHashCode () const
|
||||
{ return thecode; }
|
||||
|
||||
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)
|
||||
{
|
||||
if (theattrib.IsNull()) theattrib = new Dico_DictionaryOfTransient;
|
||||
theattrib->SetItem (name,val);
|
||||
}
|
||||
|
||||
Standard_Boolean Transfer_Finder::RemoveAttribute
|
||||
(const Standard_CString name)
|
||||
{
|
||||
if (theattrib.IsNull()) return Standard_False;
|
||||
return theattrib->RemoveItem (name);
|
||||
}
|
||||
|
||||
Standard_Boolean Transfer_Finder::GetAttribute
|
||||
(const Standard_CString name, const Handle(Standard_Type)& type,
|
||||
Handle(Standard_Transient)& val) const
|
||||
{
|
||||
if (theattrib.IsNull()) { val.Nullify(); return Standard_False; }
|
||||
if (!theattrib->GetItem (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) atr;
|
||||
if (theattrib.IsNull()) return atr;
|
||||
if (!theattrib->GetItem (name,atr)) atr.Nullify();
|
||||
return atr;
|
||||
}
|
||||
|
||||
Interface_ParamType Transfer_Finder::AttributeType
|
||||
(const Standard_CString name) const
|
||||
{
|
||||
Handle(Standard_Transient) atr = Attribute(name);
|
||||
if (atr.IsNull()) return Interface_ParamVoid;
|
||||
if (atr->DynamicType() == STANDARD_TYPE(Interface_IntVal))
|
||||
return Interface_ParamInteger;
|
||||
if (atr->DynamicType() == STANDARD_TYPE(Geom2d_CartesianPoint))
|
||||
return Interface_ParamReal;
|
||||
if (atr->DynamicType() == STANDARD_TYPE(TCollection_HAsciiString))
|
||||
return Interface_ParamText;
|
||||
return Interface_ParamIdent;
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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; }
|
||||
val = ival->Value();
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
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;
|
||||
return ival->Value();
|
||||
}
|
||||
|
||||
void Transfer_Finder::SetRealAttribute
|
||||
(const Standard_CString name, const Standard_Real val)
|
||||
{
|
||||
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
|
||||
{
|
||||
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
|
||||
{
|
||||
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)
|
||||
{
|
||||
Handle(TCollection_HAsciiString) hval = new TCollection_HAsciiString (val);
|
||||
SetAttribute (name,hval);
|
||||
}
|
||||
|
||||
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; }
|
||||
val = hval->ToCString();
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
Standard_CString Transfer_Finder::StringAttribute (const Standard_CString name) const
|
||||
{
|
||||
Handle(TCollection_HAsciiString) hval = Handle(TCollection_HAsciiString)::DownCast
|
||||
(Attribute(name));
|
||||
if (hval.IsNull()) return "";
|
||||
return hval->ToCString();
|
||||
}
|
||||
|
||||
Handle(Dico_DictionaryOfTransient) Transfer_Finder::AttrList () const
|
||||
{ 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;
|
||||
Handle(Dico_DictionaryOfTransient) list = other->AttrList();
|
||||
if (list.IsNull()) return;
|
||||
if (theattrib.IsNull()) theattrib = new Dico_DictionaryOfTransient;
|
||||
|
||||
for (Dico_IteratorOfDictionaryOfTransient iter (list,fromname);
|
||||
iter.More(); iter.Next()) {
|
||||
TCollection_AsciiString name = iter.Name();
|
||||
Handle(Standard_Transient) atr = iter.Value();
|
||||
Handle(Standard_Transient) newatr = atr;
|
||||
|
||||
// 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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
Handle(TCollection_HAsciiString) hval = Handle(TCollection_HAsciiString)::DownCast(atr);
|
||||
if (!hval.IsNull()) {
|
||||
Handle(TCollection_HAsciiString) strval = new TCollection_HAsciiString
|
||||
(hval->ToCString());
|
||||
newatr = strval;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
theattrib->SetItem (name.ToCString(),newatr);
|
||||
|
||||
}
|
||||
}
|
62
src/Transfer/Transfer_FinderProcess.cdl
Executable file
62
src/Transfer/Transfer_FinderProcess.cdl
Executable file
@@ -0,0 +1,62 @@
|
||||
-- File: Transfer_FinderProcess.cdl
|
||||
-- Created: Wed Sep 4 10:20:27 1996
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@helioxfidox.paris1.matra-dtv.fr>
|
||||
---Copyright: Matra Datavision 1996
|
||||
|
||||
|
||||
class FinderProcess from Transfer inherits ProcessForFinder
|
||||
|
||||
---Purpose : Adds specific features to the generic definition :
|
||||
-- PrintTrace is adapted
|
||||
|
||||
uses InterfaceModel from Interface,
|
||||
Messenger from Message,
|
||||
Finder, TransientMapper
|
||||
|
||||
is
|
||||
|
||||
Create (nb : Integer = 10000) returns mutable FinderProcess;
|
||||
---Purpose : Sets FinderProcess at initial state, with an initial size
|
||||
|
||||
SetModel (me : mutable; model : InterfaceModel);
|
||||
---Purpose : Sets an InterfaceModel, which can be used during transfer
|
||||
-- for instance if a context must be managed, it is in the Model
|
||||
|
||||
Model (me) returns InterfaceModel;
|
||||
---Purpose : Returns the Model which can be used for context
|
||||
|
||||
NextMappedWithAttribute (me; name : CString; num0 : Integer) returns Integer;
|
||||
---Purpose : 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>
|
||||
-- The considered Attributes are those brought by Finders,i.e.
|
||||
-- by Input data.
|
||||
-- While NextItemWithAttribute works on Result data (Binders)
|
||||
--
|
||||
-- Hence, allows such an iteration
|
||||
--
|
||||
-- for (num = FP->NextMappedWithAttribute(name,0);
|
||||
-- num > 0;
|
||||
-- num = FP->NextMappedWithAttribute(name,num) {
|
||||
-- .. process mapped item <num>
|
||||
-- }
|
||||
|
||||
TransientMapper (me; obj : Transient) returns TransientMapper;
|
||||
---Purpose : 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)
|
||||
|
||||
|
||||
PrintTrace (me; start : Finder; S : Messenger from Message) is redefined;
|
||||
---Purpose : Specific printing to trace a Finder (by its method ValueType)
|
||||
|
||||
PrintStats (me; mode : Integer; S : Messenger from Message);
|
||||
---Purpose : Prints statistics on a given output, according mode
|
||||
|
||||
fields
|
||||
|
||||
themodel : InterfaceModel;
|
||||
|
||||
end FinderProcess;
|
76
src/Transfer/Transfer_FinderProcess.cxx
Executable file
76
src/Transfer/Transfer_FinderProcess.cxx
Executable file
@@ -0,0 +1,76 @@
|
||||
#include <Transfer_FinderProcess.ixx>
|
||||
#include <Interface_MSG.hxx>
|
||||
#include <Transfer_Binder.hxx>
|
||||
#include <Interface_Check.hxx>
|
||||
|
||||
|
||||
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; }
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
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;
|
||||
return Handle(Transfer_TransientMapper)::DownCast(Mapped(index));
|
||||
}
|
||||
|
||||
|
||||
void Transfer_FinderProcess::PrintTrace
|
||||
(const Handle(Transfer_Finder)& start, const Handle(Message_Messenger)& S) const
|
||||
{ if (!start.IsNull()) S<<" Type:"<<start->ValueTypeName(); }
|
||||
|
||||
void Transfer_FinderProcess::PrintStats
|
||||
(const Standard_Integer mode, const Handle(Message_Messenger)& S) const
|
||||
{
|
||||
S<<"\n*******************************************************************\n";
|
||||
if (mode == 1) { // Statistiques de base
|
||||
S << "******** Basic Statistics ********"<<endl;
|
||||
|
||||
Standard_Integer nbr = 0, nbe = 0, nbw = 0;
|
||||
Standard_Integer i, max = NbMapped(), nbroots = NbRoots();
|
||||
S << "**** Nb Final Results : "<<nbroots<<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 (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<<endl;
|
||||
}
|
62
src/Transfer/Transfer_Iterator.gxx
Executable file
62
src/Transfer/Transfer_Iterator.gxx
Executable file
@@ -0,0 +1,62 @@
|
||||
// Transfer_Iterator.gxx
|
||||
#include <Standard_NoSuchObject.hxx>
|
||||
|
||||
|
||||
// TheStart est suppose Handle(Standard_Transient) ou (Transfer_Finder)
|
||||
// Il a servi a instancier TheList qui est une HSequence
|
||||
|
||||
|
||||
Transfer_Iterator::Transfer_Iterator (const Standard_Boolean withstarts)
|
||||
: Transfer_TransferIterator ()
|
||||
{ if (withstarts) thestarts = new TheList(); }
|
||||
|
||||
|
||||
void Transfer_Iterator::Add
|
||||
(const Handle(Transfer_Binder)& binder)
|
||||
{
|
||||
if (!thestarts.IsNull()) Standard_NoSuchObject::Raise
|
||||
("Transfer_Iterator : Add, Starting Object required not provided");
|
||||
AddItem(binder);
|
||||
}
|
||||
|
||||
void Transfer_Iterator::Add
|
||||
(const Handle(Transfer_Binder)& binder, const TheStart& start)
|
||||
{
|
||||
AddItem(binder);
|
||||
if (!thestarts.IsNull()) thestarts->Append(start);
|
||||
}
|
||||
|
||||
void Transfer_Iterator::Filter
|
||||
(const Handle(TheList)& list, const Standard_Boolean keep)
|
||||
{
|
||||
if (list.IsNull() || thestarts.IsNull()) return;
|
||||
Standard_Integer i, j, nb = thestarts->Length();
|
||||
if (nb == 0) return;
|
||||
Handle(Transfer_Binder) factice;
|
||||
Transfer_TransferMap amap (nb);
|
||||
for (i = 1; i <= nb; i ++) {
|
||||
j = amap.Add (thestarts->Value(i),factice);
|
||||
SelectItem (j,!keep);
|
||||
}
|
||||
|
||||
// Comparaison
|
||||
nb = list->Length();
|
||||
for (i = 1; i <= nb; i ++) {
|
||||
j = amap.FindIndex (list->Value(i));
|
||||
if (j > 0) SelectItem (j,keep);
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Boolean Transfer_Iterator::HasStarting () const
|
||||
{ return (!thestarts.IsNull()); }
|
||||
|
||||
const TheStart& Transfer_Iterator::Starting () const
|
||||
{
|
||||
// if (thecurr == 0 || thecurr > themaxi) Standard_NoSuchObject::Raise
|
||||
// ("TransferIterator : Starting");
|
||||
// if (theselect->Value(thecurr) == 0) Standard_NoSuchObject::Raise
|
||||
// ("TransferIterator : Starting");
|
||||
if (thestarts.IsNull()) Standard_NoSuchObject::Raise
|
||||
("TransferIterator : No Starting defined at all");
|
||||
return thestarts->Value(thecurr);
|
||||
}
|
30
src/Transfer/Transfer_MapContainer.cdl
Executable file
30
src/Transfer/Transfer_MapContainer.cdl
Executable file
@@ -0,0 +1,30 @@
|
||||
-- File: Transfer_MapContainer.cdl
|
||||
-- Created: Mon Sep 10 14:52:25 2001
|
||||
-- Author: Sergey KUUL
|
||||
-- <skl@polox.nnov.matra-dtv.fr>
|
||||
---Copyright: Matra Datavision 2001
|
||||
|
||||
|
||||
class MapContainer from Transfer inherits TShared from MMgt
|
||||
|
||||
---Purpose:
|
||||
|
||||
uses
|
||||
|
||||
DataMapOfTransientTransient from TColStd
|
||||
|
||||
is
|
||||
|
||||
Create returns mutable MapContainer from Transfer;
|
||||
|
||||
SetMapObjects(me : mutable; theMapObjects : in out DataMapOfTransientTransient from TColStd);
|
||||
---Purposes:Set map already translated geometry objects.
|
||||
|
||||
GetMapObjects(me: mutable) returns DataMapOfTransientTransient from TColStd;
|
||||
---Purposes:Get map already translated geometry objects.
|
||||
---C++:return &
|
||||
fields
|
||||
|
||||
myMapObj : DataMapOfTransientTransient from TColStd;
|
||||
|
||||
end MapContainer;
|
15
src/Transfer/Transfer_MapContainer.cxx
Executable file
15
src/Transfer/Transfer_MapContainer.cxx
Executable file
@@ -0,0 +1,15 @@
|
||||
#include <Transfer_MapContainer.ixx>
|
||||
|
||||
Transfer_MapContainer::Transfer_MapContainer()
|
||||
{
|
||||
}
|
||||
|
||||
void Transfer_MapContainer::SetMapObjects(TColStd_DataMapOfTransientTransient& theMapObjects)
|
||||
{
|
||||
myMapObj= theMapObjects;
|
||||
}
|
||||
|
||||
TColStd_DataMapOfTransientTransient& Transfer_MapContainer::GetMapObjects()
|
||||
{
|
||||
return myMapObj;
|
||||
}
|
53
src/Transfer/Transfer_Mapper.cdl
Executable file
53
src/Transfer/Transfer_Mapper.cdl
Executable file
@@ -0,0 +1,53 @@
|
||||
-- File: Transfer_Mapper.cdl
|
||||
-- Created: Fri Nov 4 10:47:55 1994
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@anion>
|
||||
---Copyright: Matra Datavision 1994
|
||||
|
||||
|
||||
generic class Mapper from Transfer
|
||||
(TheKey as any;
|
||||
TheHasher as any;
|
||||
TheInfo as any)
|
||||
inherits Finder
|
||||
|
||||
---Purpose : a Mapper defines a Finder for a specific input class
|
||||
-- its definition includes the value of the Key to be mapped,
|
||||
-- and the HashCoder associated to the class of the Key
|
||||
--
|
||||
-- TheKey defines the class to be keyed
|
||||
-- TheHasher is the associated Hasher
|
||||
-- TheInfo is an additionnal class which helps to provide
|
||||
-- informations on the value (template : see DataInfo)
|
||||
|
||||
uses CString
|
||||
|
||||
is
|
||||
|
||||
Create (akey : any TheKey) returns mutable Mapper;
|
||||
---Purpose : 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.
|
||||
|
||||
Value (me) returns any TheKey is static;
|
||||
---Purpose : Returns the contained value
|
||||
---C++ : return const &
|
||||
|
||||
Equates (me; other : Finder) returns Boolean;
|
||||
---Purpose : Specific testof equallity : defined as False if <other> has
|
||||
-- not the same true Type, else contents are compared (by
|
||||
-- C++ operator ==)
|
||||
|
||||
ValueType (me) returns Type is redefined;
|
||||
---Purpose : Returns the Type of the Value. By default, returns the
|
||||
-- DynamicType of <me>, but can be redefined
|
||||
|
||||
ValueTypeName (me) returns CString is redefined;
|
||||
---Purpose : Returns the name of the Type of the Value. Default is name
|
||||
-- of ValueType, unless it is for a non-handled object
|
||||
|
||||
fields
|
||||
|
||||
theval : TheKey;
|
||||
|
||||
end Mapper;
|
28
src/Transfer/Transfer_Mapper.gxx
Executable file
28
src/Transfer/Transfer_Mapper.gxx
Executable file
@@ -0,0 +1,28 @@
|
||||
//#include <Transfer_Mapper.ixx>
|
||||
#include <Standard_Integer.hxx>
|
||||
|
||||
|
||||
Transfer_Mapper::Transfer_Mapper (const TheKey& akey)
|
||||
: theval (akey)
|
||||
{ SetHashCode ( TheHasher::HashCode (akey, IntegerLast() ) ); }
|
||||
|
||||
|
||||
const TheKey& Transfer_Mapper::Value () const
|
||||
{ return theval; }
|
||||
|
||||
Standard_Boolean Transfer_Mapper::Equates
|
||||
(const Handle(Transfer_Finder)& other) const
|
||||
{
|
||||
if (other.IsNull()) return Standard_False;
|
||||
if (GetHashCode() != other->GetHashCode()) return Standard_False;
|
||||
if (other->DynamicType() != DynamicType()) return Standard_False;
|
||||
Handle(Transfer_Mapper) another = Handle(Transfer_Mapper)::DownCast(other);
|
||||
// return (theval == another->Value());
|
||||
return TheHasher::IsEqual (theval,another->Value());
|
||||
}
|
||||
|
||||
Handle(Standard_Type) Transfer_Mapper::ValueType () const
|
||||
{ return TheInfo::Type(theval); }
|
||||
|
||||
Standard_CString Transfer_Mapper::ValueTypeName () const
|
||||
{ return TheInfo::TypeName(theval); }
|
75
src/Transfer/Transfer_MultipleBinder.cdl
Executable file
75
src/Transfer/Transfer_MultipleBinder.cdl
Executable file
@@ -0,0 +1,75 @@
|
||||
-- File: Transfer_MultipleBinder.cdl
|
||||
-- Created: Wed Apr 7 19:13:46 1993
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@sdsun2>
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
|
||||
class MultipleBinder from Transfer inherits Binder
|
||||
|
||||
---Purpose : Allows direct binding between a starting Object and the Result
|
||||
-- of its transfer, when it can be made of several Transient
|
||||
-- Objects. Compared to a Transcriptor, it has no Transfer Action
|
||||
--
|
||||
-- Result is a list of Transient Results. Unique Result is not
|
||||
-- available : SetResult is redefined to start the list on the
|
||||
-- first call, and refuse the other times.
|
||||
--
|
||||
-- rr
|
||||
--
|
||||
-- Remark : MultipleBinder itself is intended to be created and
|
||||
-- filled by TransferProcess itself (method Bind). In particular,
|
||||
-- conflicts between Unique (Standard) result and Multiple result
|
||||
-- are avoided through management made by TransferProcess.
|
||||
--
|
||||
-- Also, a Transcriptor (with an effective Transfer Method) which
|
||||
-- can produce a Multiple Result, may be defined as a sub-class
|
||||
-- of MultipleBinder by redefining method Transfer.
|
||||
|
||||
uses CString, Transient, Type, HSequenceOfTransient from TColStd
|
||||
|
||||
raises TransferFailure, OutOfRange
|
||||
|
||||
is
|
||||
|
||||
Create returns mutable MultipleBinder;
|
||||
---Purpose : normal standard constructor, creates an empty MultipleBinder
|
||||
|
||||
IsMultiple (me) returns Boolean is redefined;
|
||||
---Purpose : Returns True if a starting object is bound with SEVERAL
|
||||
-- results : Here, returns allways True
|
||||
|
||||
ResultType (me) returns Type;
|
||||
---Purpose : Returns the Type permitted for Results, i.e. here Transient
|
||||
|
||||
ResultTypeName (me) returns CString;
|
||||
---Purpose : Returns the Name of the Type which characterizes the Result
|
||||
-- Here, returns "(list)"
|
||||
|
||||
|
||||
AddResult (me : mutable; res : mutable Transient);
|
||||
---Purpose : Adds a new Item to the Multiple Result
|
||||
|
||||
NbResults (me) returns Integer;
|
||||
---Purpose : Returns the actual count of recorded (Transient) results
|
||||
|
||||
ResultValue (me; num : Integer) returns mutable Transient
|
||||
---Purpose : Returns the value of the recorded result n0 <num>
|
||||
raises OutOfRange;
|
||||
-- Error if <num> is out of range
|
||||
|
||||
MultipleResult (me) returns HSequenceOfTransient from TColStd;
|
||||
---Purpose : Returns the Multiple Result, if it is defined (at least one
|
||||
-- Item). Else, returns a Null Handle
|
||||
|
||||
SetMultipleResult (me : mutable;
|
||||
mulres : mutable HSequenceOfTransient from TColStd)
|
||||
raises TransferFailure;
|
||||
---Purpose : Defines a Binding with a Multiple Result, given as a Sequence
|
||||
-- Error if a Unique Result has yet been defined
|
||||
|
||||
fields
|
||||
|
||||
themulres : HSequenceOfTransient from TColStd;
|
||||
|
||||
end MultipleBinder;
|
53
src/Transfer/Transfer_MultipleBinder.cxx
Executable file
53
src/Transfer/Transfer_MultipleBinder.cxx
Executable file
@@ -0,0 +1,53 @@
|
||||
#include <Transfer_MultipleBinder.ixx>
|
||||
#include <Transfer_TransferFailure.hxx>
|
||||
|
||||
|
||||
|
||||
// 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 () { }
|
||||
|
||||
|
||||
Standard_Boolean Transfer_MultipleBinder::IsMultiple () const
|
||||
{
|
||||
if (themulres.IsNull()) return Standard_False;
|
||||
return (themulres->Length() != 1);
|
||||
}
|
||||
|
||||
Handle(Standard_Type) Transfer_MultipleBinder::ResultType () const
|
||||
{ return STANDARD_TYPE(Standard_Transient); }
|
||||
|
||||
Standard_CString Transfer_MultipleBinder::ResultTypeName () const
|
||||
{ return "(list)"; }
|
||||
|
||||
// .... Gestion du Resultat Multiple ....
|
||||
|
||||
void Transfer_MultipleBinder::AddResult
|
||||
(const Handle(Standard_Transient)& res)
|
||||
{
|
||||
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
|
||||
{
|
||||
if (!themulres.IsNull()) return themulres;
|
||||
return new TColStd_HSequenceOfTransient();
|
||||
}
|
||||
|
||||
void Transfer_MultipleBinder::SetMultipleResult
|
||||
(const Handle(TColStd_HSequenceOfTransient)& mulres)
|
||||
{ themulres = mulres; }
|
143
src/Transfer/Transfer_ResultFromModel.cdl
Executable file
143
src/Transfer/Transfer_ResultFromModel.cdl
Executable file
@@ -0,0 +1,143 @@
|
||||
-- File: Transfer_ResultFromModel.cdl
|
||||
-- Created: Thu Nov 16 10:07:40 1995
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@fidox>
|
||||
---Copyright: Matra Datavision 1995
|
||||
|
||||
|
||||
class ResultFromModel from Transfer inherits TShared
|
||||
|
||||
---Purpose : ResultFromModel is used to store a final result stored in a
|
||||
-- TransientProcess, respectfully to its structuration in scopes
|
||||
-- by using a set of ResultFromTransient
|
||||
-- Hence, it can be regarded as a passive equivalent of the
|
||||
-- stored data in the TransientProcess, while an Iterator gives
|
||||
-- a flat view of it.
|
||||
--
|
||||
-- A ResultFromModel is intended to be attached to the transfer
|
||||
-- of one entity (typically root entity but it is not mandatory)
|
||||
--
|
||||
-- It is then possible to :
|
||||
-- - Create and fill a ResultFromModel from a TransientProcess,
|
||||
-- by designating a starting entity
|
||||
-- - Fill back the TransientProcess from a ResultFromModel, as it
|
||||
-- were filled by the operation which filled it the first time
|
||||
|
||||
uses CString, AsciiString, HSequenceOfTransient from TColStd,
|
||||
InterfaceModel, CheckIterator, CheckStatus,
|
||||
ResultFromTransient, TransientProcess
|
||||
|
||||
is
|
||||
|
||||
Create returns mutable ResultFromModel;
|
||||
---Purpose : Creates a ResultFromModel, empty
|
||||
|
||||
SetModel (me : mutable; model : InterfaceModel);
|
||||
---Purpose : Sets starting Model
|
||||
|
||||
SetFileName (me : mutable; filename : CString);
|
||||
---Purpose : Sets starting File Name
|
||||
|
||||
Model (me) returns InterfaceModel;
|
||||
---Purpose : Returns starting Model (null if not set)
|
||||
|
||||
FileName (me) returns CString;
|
||||
---Purpose : Returns starting File Name (empty if not set)
|
||||
|
||||
Fill (me : mutable; TP : TransientProcess; ent : Transient) returns Boolean;
|
||||
---Purpose : 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
|
||||
|
||||
Strip (me : mutable; mode : Integer);
|
||||
---Purpose : Clears some data attached to binders used by TransientProcess,
|
||||
-- which become useless once the transfer has been done,
|
||||
-- by calling Strip on its ResultFromTransient
|
||||
--
|
||||
-- mode = 0 : minimum, clears data remaining from TransferProcess
|
||||
-- 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)
|
||||
|
||||
FillBack (me; TP : mutable TransientProcess);
|
||||
---Purpose : Fills back a TransientProcess from the structured set of
|
||||
-- binders. Also sets the Model.
|
||||
|
||||
|
||||
HasResult (me) returns Boolean;
|
||||
---Purpose : Returns True if a Result is recorded
|
||||
|
||||
MainResult (me) returns ResultFromTransient;
|
||||
---Purpose : Returns the main recorded ResultFromTransient, or a null
|
||||
|
||||
SetMainResult (me : mutable; amain : ResultFromTransient);
|
||||
---Purpose : Sets a new value for the main recorded ResultFromTransient
|
||||
|
||||
MainLabel (me) returns CString;
|
||||
---Purpose : Returns the label in starting model attached to main entity
|
||||
-- (updated by Fill or SetMainResult, if Model is known)
|
||||
|
||||
MainNumber (me) returns Integer;
|
||||
---Purpose : Returns the label in starting model attached to main entity
|
||||
|
||||
-- Global Queries --
|
||||
|
||||
ResultFromKey (me; start : Transient) returns ResultFromTransient;
|
||||
---Purpose : Searches for a key (starting entity) and returns its result
|
||||
-- Returns a null handle if not found
|
||||
|
||||
Results (me; level : Integer) returns HSequenceOfTransient;
|
||||
---Purpose : Internal method which returns the list of ResultFromTransient,
|
||||
-- according level (2:complete; 1:sub-level 1; 0:main only)
|
||||
|
||||
TransferredList (me; level : Integer = 2) returns HSequenceOfTransient;
|
||||
---Purpose : 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
|
||||
|
||||
CheckedList (me; check : CheckStatus; result : Boolean)
|
||||
returns HSequenceOfTransient;
|
||||
---Purpose : Returns the list of starting entities to which a check status
|
||||
-- is attached.
|
||||
-- <check> = -2 , all entities whatever the check (see result)
|
||||
-- <check> = -1 , entities with no fail (warning allowed)
|
||||
-- <check> = 0 , entities with no check at all
|
||||
-- <check> = 1 , entities with warning but no fail
|
||||
-- <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
|
||||
|
||||
CheckList (me; erronly : Boolean; level : Integer = 2)
|
||||
returns CheckIterator;
|
||||
---Purpose : 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
|
||||
|
||||
CheckStatus (me) returns CheckStatus;
|
||||
---Purpose : 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
|
||||
|
||||
ComputeCheckStatus (me : mutable; enforce : Boolean) returns CheckStatus;
|
||||
---Purpose : Computes and records check status (see CheckStatus)
|
||||
-- Does not computes it if already done and <enforce> False
|
||||
|
||||
fields
|
||||
|
||||
themodel : InterfaceModel;
|
||||
thename : AsciiString;
|
||||
themain : ResultFromTransient;
|
||||
themlab : AsciiString;
|
||||
themnum : Integer;
|
||||
themchk : CheckStatus;
|
||||
|
||||
end ResultFromModel;
|
190
src/Transfer/Transfer_ResultFromModel.cxx
Executable file
190
src/Transfer/Transfer_ResultFromModel.cxx
Executable file
@@ -0,0 +1,190 @@
|
||||
#include <Transfer_ResultFromModel.ixx>
|
||||
#include <TColStd_IndexedMapOfTransient.hxx>
|
||||
#include <Interface_Check.hxx>
|
||||
#include <Interface_Macros.hxx>
|
||||
#include <Transfer_Binder.hxx>
|
||||
#include <TCollection_HAsciiString.hxx>
|
||||
|
||||
|
||||
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)
|
||||
{
|
||||
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);
|
||||
themlab.Clear();
|
||||
if (themnum > 0)
|
||||
themlab.AssignCat (themodel->StringLabel(ent)->ToCString());
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
void Transfer_ResultFromModel::Strip (const Standard_Integer mode)
|
||||
{
|
||||
if (themain.IsNull()) return;
|
||||
themain->Strip();
|
||||
if (mode >= 10) {
|
||||
themchk = ComputeCheckStatus (Standard_False);
|
||||
themodel.Nullify();
|
||||
themain->ClearSubs();
|
||||
Handle(Standard_Transient) nulh; themain->SetStart(nulh);
|
||||
if (mode > 10) themain.Nullify();
|
||||
}
|
||||
}
|
||||
|
||||
void Transfer_ResultFromModel::FillBack
|
||||
(const Handle(Transfer_TransientProcess)& TP) const
|
||||
{
|
||||
if (!themodel.IsNull()) TP->SetModel(themodel);
|
||||
themain->FillBack (TP);
|
||||
}
|
||||
|
||||
|
||||
Standard_Boolean Transfer_ResultFromModel::HasResult () const
|
||||
{ return (themain.IsNull() ? Standard_False : themain->HasResult()); }
|
||||
|
||||
Handle(Transfer_ResultFromTransient) Transfer_ResultFromModel::MainResult
|
||||
() const
|
||||
{ return themain; }
|
||||
|
||||
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());
|
||||
themlab.Clear();
|
||||
if (themnum > 0)
|
||||
themlab.AssignCat (themodel->StringLabel(themain->Start())->ToCString());
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
Standard_Integer i,nb;
|
||||
Handle(TColStd_HSequenceOfTransient) list = new TColStd_HSequenceOfTransient();
|
||||
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));
|
||||
}
|
||||
else list->Append(themain);
|
||||
if (level == 1) {
|
||||
nb = themain->NbSubResults();
|
||||
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
|
||||
{
|
||||
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());
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
Handle(TColStd_HSequenceOfTransient) Transfer_ResultFromModel::CheckedList
|
||||
(const Interface_CheckStatus check, const Standard_Boolean result) const
|
||||
{
|
||||
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;
|
||||
const Handle(Interface_Check) ach = unres->Check();
|
||||
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 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;
|
||||
Interface_CheckStatus stat = unres->CheckStatus();
|
||||
if ( stat == Interface_CheckOK ||
|
||||
(stat == Interface_CheckWarning && erronly)) continue;
|
||||
Handle(Transfer_Binder) binder = unres->Binder();
|
||||
Handle(Interface_Check) bch = binder->Check();
|
||||
bch->SetEntity(unres->Start());
|
||||
chl.Add(bch, (themodel.IsNull() ? 0 : themodel->Number(unres->Start())) );
|
||||
}
|
||||
return chl;
|
||||
}
|
||||
|
||||
Interface_CheckStatus Transfer_ResultFromModel::CheckStatus () const
|
||||
{
|
||||
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)
|
||||
{
|
||||
if (themchk == Interface_CheckAny || enforce) themchk = CheckStatus();
|
||||
return themchk;
|
||||
}
|
94
src/Transfer/Transfer_ResultFromTransient.cdl
Executable file
94
src/Transfer/Transfer_ResultFromTransient.cdl
Executable file
@@ -0,0 +1,94 @@
|
||||
-- File: Transfer_ResultFromTransient.cdl
|
||||
-- Created: Thu Nov 16 09:55:56 1995
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@fidox>
|
||||
---Copyright: Matra Datavision 1995
|
||||
|
||||
|
||||
class ResultFromTransient from Transfer inherits TShared
|
||||
|
||||
---Purpose : This class, in conjunction with ResultFromModel, allows to
|
||||
-- record the result of a transfer initially stored in a
|
||||
-- TransientProcess.
|
||||
--
|
||||
-- A ResultFromTransient records a couple (Transient,Binder for
|
||||
-- the result and checks) plus a list of "sub-results", which
|
||||
-- have been recorded in the TrabsientProcess, under scope
|
||||
-- attached to the starting transient.
|
||||
|
||||
uses Transient, HSequenceOfTransient, IndexedMapOfTransient,
|
||||
Check, CheckStatus, Binder, TransientProcess
|
||||
|
||||
is
|
||||
|
||||
Create returns mutable ResultFromTransient;
|
||||
---Purpose : Creates a ResultFromTransient, empty
|
||||
|
||||
SetStart (me : mutable; start : any Transient);
|
||||
---Purpose : Sets starting entity
|
||||
|
||||
SetBinder (me : mutable; binder : any Binder);
|
||||
---Purpose : Sets Binder (for result plus individual check)
|
||||
|
||||
Start (me) returns any Transient;
|
||||
---Purpose : Returns the starting entity
|
||||
|
||||
Binder (me) returns any Binder;
|
||||
---Purpose : Returns the binder
|
||||
|
||||
HasResult (me) returns Boolean;
|
||||
---Purpose : Returns True if a result is recorded
|
||||
|
||||
Check (me) returns Check;
|
||||
---Purpose : Returns the check (or an empty one if no binder)
|
||||
---C++ : return const
|
||||
|
||||
CheckStatus (me) returns CheckStatus;
|
||||
---Purpose : Returns the check status
|
||||
|
||||
|
||||
ClearSubs (me : mutable);
|
||||
---Purpose : Clears the list of (immediate) sub-results
|
||||
|
||||
AddSubResult (me : mutable; sub : mutable ResultFromTransient);
|
||||
---Purpose : Adds a sub-result
|
||||
|
||||
NbSubResults (me) returns Integer;
|
||||
---Purpose : Returns the count of recorded sub-results
|
||||
|
||||
SubResult (me; num : Integer) returns mutable ResultFromTransient;
|
||||
---Purpose : Returns a sub-result, given its rank
|
||||
|
||||
ResultFromKey (me; key : Transient) returns ResultFromTransient;
|
||||
---Purpose : Returns the ResultFromTransient attached to a given starting
|
||||
-- entity (the key). Returns a null handle if not found
|
||||
|
||||
FillMap (me; map : in out IndexedMapOfTransient);
|
||||
---Purpose : 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
|
||||
|
||||
|
||||
Fill (me : mutable; TP : TransientProcess);
|
||||
---Purpose : 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
|
||||
|
||||
Strip (me : mutable);
|
||||
---Purpose : 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
|
||||
|
||||
FillBack (me; TP : mutable TransientProcess);
|
||||
---Purpose : Fills back a TransientProcess with definition of a
|
||||
-- ResultFromTransient, respectfully to its structuration in
|
||||
-- scopes
|
||||
|
||||
fields
|
||||
|
||||
thestart : Transient;
|
||||
thebinder : Binder;
|
||||
thesubs : HSequenceOfTransient;
|
||||
|
||||
end ResultFromTransient;
|
104
src/Transfer/Transfer_ResultFromTransient.cxx
Executable file
104
src/Transfer/Transfer_ResultFromTransient.cxx
Executable file
@@ -0,0 +1,104 @@
|
||||
#include <Transfer_ResultFromTransient.ixx>
|
||||
#include <TColStd_HArray1OfInteger.hxx>
|
||||
|
||||
|
||||
static Handle(Interface_Check) voidcheck = new Interface_Check;
|
||||
|
||||
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
|
||||
{
|
||||
if (thebinder.IsNull()) return voidcheck;
|
||||
return thebinder->Check();
|
||||
}
|
||||
|
||||
Interface_CheckStatus Transfer_ResultFromTransient::CheckStatus () const
|
||||
{
|
||||
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) res;
|
||||
if (key == thestart) return this;
|
||||
Standard_Integer i, nb = NbSubResults();
|
||||
for (i = 1; i <= nb; i ++) {
|
||||
res = SubResult(i)->ResultFromKey(key);
|
||||
if (!res.IsNull()) return res;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
void Transfer_ResultFromTransient::FillMap
|
||||
(TColStd_IndexedMapOfTransient& map) const
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
// ##### SUBS #####
|
||||
|
||||
void Transfer_ResultFromTransient::ClearSubs ()
|
||||
{ thesubs.Nullify(); }
|
||||
|
||||
void Transfer_ResultFromTransient::AddSubResult
|
||||
(const Handle(Transfer_ResultFromTransient)& sub)
|
||||
{
|
||||
if (sub.IsNull()) return;
|
||||
if (thesubs.IsNull()) thesubs = new TColStd_HSequenceOfTransient();
|
||||
thesubs->Append (sub);
|
||||
}
|
||||
|
||||
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;
|
||||
return Handle(Transfer_ResultFromTransient)::DownCast(thesubs->Value(num));
|
||||
}
|
||||
|
||||
void Transfer_ResultFromTransient::Fill
|
||||
(const Handle(Transfer_TransientProcess)& /*TP*/)
|
||||
{
|
||||
//abv: WARNING: to be removed (scopes)
|
||||
return;
|
||||
}
|
||||
|
||||
void Transfer_ResultFromTransient::Strip ()
|
||||
{
|
||||
//abv: WARNING: to be removed (scopes)
|
||||
}
|
||||
|
||||
void Transfer_ResultFromTransient::FillBack
|
||||
(const Handle(Transfer_TransientProcess)& /*TP*/) const
|
||||
{
|
||||
//abv: WARNING: to be removed (scopes)
|
||||
}
|
72
src/Transfer/Transfer_SimpleBinder.cdl
Executable file
72
src/Transfer/Transfer_SimpleBinder.cdl
Executable file
@@ -0,0 +1,72 @@
|
||||
-- File: SimpleBinder.cdl
|
||||
-- Created: Mon Feb 17 11:39:12 1992
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@phobox>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
|
||||
generic class SimpleBinder from Transfer
|
||||
|
||||
(TheResult as any; -- any : avoid Transient classes
|
||||
TheInfo as any) -- template : DataInfo
|
||||
|
||||
inherits Binder
|
||||
|
||||
---Purpose : Allows direct binding between a starting Object and the Result
|
||||
-- of its transfer when it is Unique.
|
||||
-- The Result itself is defined as a formal parameter <TheResult>
|
||||
-- Warning : While it is possible to instantiate SimpleBinder with any Type
|
||||
-- for the Result, it is not advisable to instantiate it with
|
||||
-- Transient Classes, because such Results are directly known and
|
||||
-- managed by TransferProcess & Co, through
|
||||
-- SimpleBinderOfTransient : this class looks like instantiation
|
||||
-- of SimpleBinder, but its method ResultType
|
||||
-- is adapted (reads DynamicType of the Result)
|
||||
|
||||
uses CString, Type
|
||||
|
||||
raises TransferFailure
|
||||
|
||||
is
|
||||
|
||||
Create returns mutable SimpleBinder;
|
||||
---Purpose : normal standard constructor, creates an empty SimpleBinder
|
||||
|
||||
Create (res : any TheResult) returns mutable SimpleBinder;
|
||||
---Purpose : constructor which in the same time defines the result
|
||||
|
||||
-- IsMultiple (me) returns Boolean;
|
||||
---Purpose : Returns True if a starting object is bound with SEVERAL
|
||||
-- results : Here, returns allways False
|
||||
-- But it can have next results
|
||||
|
||||
ResultType (me) returns Type;
|
||||
---Purpose : Returns the Type permitted for the Result, i.e. the Type
|
||||
-- of the Parameter Class <TheResult> (statically defined)
|
||||
|
||||
ResultTypeName (me) returns CString;
|
||||
---Purpose : Returns the Type Name computed for the Result (dynamic)
|
||||
|
||||
SetResult (me : mutable; res : any TheResult)
|
||||
---Purpose : Defines the Result
|
||||
raises TransferFailure;
|
||||
-- Error if the Result is already used (see class Binder)
|
||||
|
||||
Result (me) returns any TheResult
|
||||
---Purpose : Returns the defined Result, if there is one
|
||||
raises TransferFailure;
|
||||
-- Error if the Result is not defined (see class Binder)
|
||||
---C++ : return const &
|
||||
|
||||
CResult (me : mutable) returns any TheResult;
|
||||
---Purpose : Returns the defined Result, if there is one, and allows to
|
||||
-- change it (avoids Result + SetResult).
|
||||
-- Admits that Result can be not yet defined
|
||||
-- Warning : a call to CResult causes Result to be known as defined
|
||||
---C++ : return &
|
||||
|
||||
fields
|
||||
|
||||
theres : TheResult;
|
||||
|
||||
end SimpleBinder;
|
35
src/Transfer/Transfer_SimpleBinder.gxx
Executable file
35
src/Transfer/Transfer_SimpleBinder.gxx
Executable file
@@ -0,0 +1,35 @@
|
||||
//#include <Transfer_SimpleBinder.ixx> classe generique
|
||||
|
||||
|
||||
// "TheResult" identifie la classe donnee en parametre du Resultat
|
||||
|
||||
|
||||
Transfer_SimpleBinder::Transfer_SimpleBinder () { }
|
||||
|
||||
Transfer_SimpleBinder::Transfer_SimpleBinder (const TheResult& res)
|
||||
: theres (res)
|
||||
{ SetResultPresent(); }
|
||||
|
||||
|
||||
// Standard_Boolean Transfer_SimpleBinder::IsMultiple() const
|
||||
// { return Standard_False; }
|
||||
|
||||
|
||||
Handle(Standard_Type) Transfer_SimpleBinder::ResultType () const
|
||||
{ return TheInfo::Type (theres); } // correspond a "STANDARD_TYPE(TheResult)"
|
||||
|
||||
Standard_CString Transfer_SimpleBinder::ResultTypeName () const
|
||||
{ return TheInfo::TypeName (theres); } // correspond a "STANDARD_TYPE(TheResult)"
|
||||
|
||||
|
||||
void Transfer_SimpleBinder::SetResult (const TheResult& res)
|
||||
{
|
||||
SetResultPresent();
|
||||
theres = res;
|
||||
}
|
||||
|
||||
const TheResult& Transfer_SimpleBinder::Result () const
|
||||
{ return theres; }
|
||||
|
||||
TheResult& Transfer_SimpleBinder::CResult ()
|
||||
{ SetResultPresent(); return theres; }
|
62
src/Transfer/Transfer_SimpleBinderOfTransient.cdl
Executable file
62
src/Transfer/Transfer_SimpleBinderOfTransient.cdl
Executable file
@@ -0,0 +1,62 @@
|
||||
-- File: Transfer_SimpleBinderOfTransient.cdl
|
||||
-- Created: Thu Jun 10 09:54:01 1993
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@bravox>
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
|
||||
class SimpleBinderOfTransient from Transfer inherits Binder
|
||||
|
||||
---Purpose : An adapted instantiation of SimpleBinder for Transient Result,
|
||||
-- i.e. ResultType can be computed from the Result itself,
|
||||
-- instead of being static
|
||||
|
||||
uses CString, Type, Transient
|
||||
|
||||
raises TransferFailure
|
||||
|
||||
is
|
||||
|
||||
Create returns mutable SimpleBinderOfTransient;
|
||||
---Purpose : Creates an empty SimpleBinderOfTransient
|
||||
|
||||
-- IsMultiple (me) returns Boolean;
|
||||
---Purpose : Returns True if a starting object is bound with SEVERAL
|
||||
-- results : Here, returns allways False
|
||||
-- See Binder itself
|
||||
|
||||
ResultType (me) returns Type;
|
||||
---Purpose : Returns the Effective (Dynamic) Type of the Result
|
||||
-- (Standard_Transient if no Result is defined)
|
||||
|
||||
ResultTypeName (me) returns CString;
|
||||
---Purpose : Returns the Effective Name of (Dynamic) Type of the Result
|
||||
-- (void) if no result is defined
|
||||
|
||||
SetResult (me : mutable; res : any Transient)
|
||||
---Purpose : Defines the Result
|
||||
raises TransferFailure;
|
||||
-- Error if the Result is already used (see class Binder)
|
||||
|
||||
Result (me) returns any Transient
|
||||
---Purpose : Returns the defined Result, if there is one
|
||||
raises TransferFailure;
|
||||
-- Error if the Result is not defined (see class Binder)
|
||||
---C++ : return const &
|
||||
|
||||
GetTypedResult (myclass; bnd : Binder; atype : Type;
|
||||
res : out Transient) returns Boolean;
|
||||
---Purpose : 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
|
||||
-- If not found, returns False (res is NOT touched)
|
||||
--
|
||||
-- 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
|
||||
|
||||
fields
|
||||
|
||||
theres : Transient;
|
||||
|
||||
end SimpleBinderOfTransient;
|
55
src/Transfer/Transfer_SimpleBinderOfTransient.cxx
Executable file
55
src/Transfer/Transfer_SimpleBinderOfTransient.cxx
Executable file
@@ -0,0 +1,55 @@
|
||||
#include <Transfer_SimpleBinderOfTransient.ixx>
|
||||
|
||||
// "Handle(Standard_Transient)" : la classe de base pour le Resultat
|
||||
|
||||
|
||||
Transfer_SimpleBinderOfTransient::Transfer_SimpleBinderOfTransient () { }
|
||||
|
||||
|
||||
// Standard_Boolean Transfer_SimpleBinderOfTransient::IsMultiple() const
|
||||
// { return Standard_False; }
|
||||
|
||||
|
||||
Handle(Standard_Type) Transfer_SimpleBinderOfTransient::ResultType () const
|
||||
{
|
||||
if (!HasResult() || theres.IsNull()) return STANDARD_TYPE(Standard_Transient);
|
||||
return Result()->DynamicType();
|
||||
}
|
||||
|
||||
Standard_CString Transfer_SimpleBinderOfTransient::ResultTypeName () const
|
||||
{
|
||||
if (!HasResult() || theres.IsNull()) return "(void)";
|
||||
return Result()->DynamicType()->Name();
|
||||
}
|
||||
|
||||
|
||||
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)
|
||||
{
|
||||
if (atype.IsNull()) return Standard_False;
|
||||
Handle(Transfer_Binder) bn = bnd;
|
||||
while (!bn.IsNull()) {
|
||||
Handle(Transfer_SimpleBinderOfTransient) trb =
|
||||
Handle(Transfer_SimpleBinderOfTransient)::DownCast(bn);
|
||||
bn = bn->NextResult();
|
||||
if (trb.IsNull()) continue;
|
||||
Handle(Standard_Transient) rs = trb->Result();
|
||||
if (rs.IsNull()) continue;
|
||||
if (!rs->IsKind(atype)) continue;
|
||||
res = rs;
|
||||
return Standard_True;
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
57
src/Transfer/Transfer_TransferDispatch.cdl
Executable file
57
src/Transfer/Transfer_TransferDispatch.cdl
Executable file
@@ -0,0 +1,57 @@
|
||||
-- File: TransferDispatch.cdl
|
||||
-- Created: Fri Feb 7 11:19:53 1992
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@phobox>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
|
||||
class TransferDispatch from Transfer inherits CopyTool
|
||||
|
||||
---Purpose : 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
|
||||
-- firstly pass the hand to a TransferProcess. If this gives no
|
||||
-- result, standard Copy is called.
|
||||
--
|
||||
-- This allow, for instance, to modify the copied Entity (such as
|
||||
-- changing a Name for a VDA Entity), or to do a deeper work
|
||||
-- (such as Substituting a kind of Entity to another one).
|
||||
--
|
||||
-- For these reasons, TransferDispatch is basically a CopyTool,
|
||||
-- but uses a more sophiscated control, which is TransferProcess,
|
||||
-- and its method Copy is redefined
|
||||
|
||||
uses Transient, InterfaceModel, GeneralLib, Protocol from Interface,
|
||||
TransientProcess
|
||||
|
||||
raises InterfaceError
|
||||
|
||||
is
|
||||
|
||||
Create (amodel : InterfaceModel; lib : GeneralLib) returns TransferDispatch;
|
||||
---Purpose : 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
|
||||
|
||||
Create (amodel : InterfaceModel; protocol : Protocol from Interface)
|
||||
returns TransferDispatch;
|
||||
---Purpose : Same as above, but Library is defined through a Protocol
|
||||
|
||||
Create (amodel : InterfaceModel) returns TransferDispatch
|
||||
---Purpose : Same as above, but works with the Active Protocol
|
||||
raises InterfaceError;
|
||||
-- Error if no Active Protocol is defined
|
||||
|
||||
TransientProcess (me) returns mutable TransientProcess;
|
||||
---Purpose : Returns the content of Control Object, as a TransientProcess
|
||||
|
||||
|
||||
Copy (me : in out; entfrom : Transient; entto : out mutable Transient;
|
||||
mapped : Boolean; errstat : Boolean)
|
||||
returns Boolean is redefined;
|
||||
---Purpose : 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
|
||||
|
||||
end TransferDispatch;
|
49
src/Transfer/Transfer_TransferDispatch.cxx
Executable file
49
src/Transfer/Transfer_TransferDispatch.cxx
Executable file
@@ -0,0 +1,49 @@
|
||||
#include <Transfer_TransferDispatch.ixx>
|
||||
#include <Transfer_DispatchControl.hxx>
|
||||
#include <Transfer_SimpleBinderOfTransient.hxx>
|
||||
#include <Interface_Macros.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 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(); }
|
||||
|
||||
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);
|
||||
|
||||
if (!result->IsKind(STANDARD_TYPE(Transfer_SimpleBinderOfTransient)))
|
||||
return Standard_False; // Produit qq chose, mais quoi ?
|
||||
entto = GetCasted(Transfer_SimpleBinderOfTransient,result)->Result();
|
||||
return Standard_True;
|
||||
}
|
73
src/Transfer/Transfer_TransferInput.cdl
Executable file
73
src/Transfer/Transfer_TransferInput.cdl
Executable file
@@ -0,0 +1,73 @@
|
||||
-- File: TransferInput.cdl
|
||||
-- Created: Tue Feb 4 14:57:17 1992
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@phobox>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
|
||||
class TransferInput from Transfer
|
||||
|
||||
---Purpose : 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)
|
||||
|
||||
uses InterfaceModel, EntityIterator, Protocol from Interface,
|
||||
TransferIterator, TransientProcess, FinderProcess
|
||||
|
||||
raises TransferFailure
|
||||
|
||||
is
|
||||
|
||||
Create returns TransferInput;
|
||||
---Purpose : Creates a TransferInput ready to use
|
||||
|
||||
Entities (me; list : in out TransferIterator) returns EntityIterator
|
||||
---Purpose : Takes the transient items stored in a TransferIterator
|
||||
raises TransferFailure;
|
||||
-- Error if one of the Resulting Objects is defined not Transient
|
||||
|
||||
|
||||
FillModel (me; proc : TransientProcess;
|
||||
amodel : mutable InterfaceModel)
|
||||
---Purpose : 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
|
||||
raises TransferFailure;
|
||||
-- Error if one of the Resulting Objects is defined not Transient
|
||||
|
||||
FillModel (me; proc : TransientProcess;
|
||||
amodel : mutable InterfaceModel;
|
||||
proto : Protocol from Interface;
|
||||
roots : Boolean = Standard_True)
|
||||
---Purpose : 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
|
||||
raises TransferFailure;
|
||||
-- Error if one of the Resulting Objects is defined not Transient
|
||||
|
||||
|
||||
FillModel (me; proc : FinderProcess;
|
||||
amodel : mutable InterfaceModel)
|
||||
---Purpose : 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
|
||||
raises TransferFailure;
|
||||
-- Error if one of the Resulting Objects is defined not Transient
|
||||
|
||||
FillModel (me; proc : FinderProcess;
|
||||
amodel : mutable InterfaceModel;
|
||||
proto : Protocol from Interface;
|
||||
roots : Boolean = Standard_True)
|
||||
---Purpose : 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
|
||||
raises TransferFailure;
|
||||
-- Error if one of the Resulting Objects is defined not Transient
|
||||
|
||||
end TransferInput;
|
93
src/Transfer/Transfer_TransferInput.cxx
Executable file
93
src/Transfer/Transfer_TransferInput.cxx
Executable file
@@ -0,0 +1,93 @@
|
||||
#include <Transfer_TransferInput.ixx>
|
||||
#include <Transfer_Binder.hxx>
|
||||
#include <Transfer_IteratorOfProcessForTransient.hxx>
|
||||
#include <Transfer_IteratorOfProcessForFinder.hxx>
|
||||
#include <Transfer_VoidBinder.hxx>
|
||||
#include <Transfer_SimpleBinderOfTransient.hxx>
|
||||
#include <Transfer_MultipleBinder.hxx>
|
||||
#include <TColStd_HSequenceOfTransient.hxx>
|
||||
#include <Interface_Macros.hxx>
|
||||
|
||||
|
||||
Transfer_TransferInput::Transfer_TransferInput () { }
|
||||
|
||||
|
||||
// Resultats : Pour le Modele ...
|
||||
|
||||
Interface_EntityIterator Transfer_TransferInput::Entities
|
||||
(Transfer_TransferIterator& list) const
|
||||
{
|
||||
Interface_EntityIterator iter;
|
||||
for (list.Start(); list.More(); list.Next()) {
|
||||
Handle(Transfer_Binder) binder = list.Value();
|
||||
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);
|
||||
Standard_Boolean OK = Standard_False;
|
||||
if (!transb.IsNull()) {
|
||||
OK = Standard_True;
|
||||
if (transb->HasResult()) iter.AddItem(transb->Result());
|
||||
}
|
||||
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));
|
||||
}
|
||||
else Transfer_TransferFailure::Raise
|
||||
("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
|
||||
{
|
||||
Transfer_TransferIterator list = proc->CompleteResult();
|
||||
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
|
||||
{
|
||||
Transfer_TransferIterator 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);
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
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
|
||||
{
|
||||
Transfer_TransferIterator 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);
|
||||
}
|
129
src/Transfer/Transfer_TransferIterator.cdl
Executable file
129
src/Transfer/Transfer_TransferIterator.cdl
Executable file
@@ -0,0 +1,129 @@
|
||||
-- File: TransferIterator.cdl
|
||||
-- Created: Wed Oct 28 14:31:19 1992
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@topsn2>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
|
||||
class TransferIterator from Transfer
|
||||
|
||||
---Purpose : Defines an Iterator on the result of a Transfer
|
||||
-- Available for Normal Results or not (Erroneous Transfer)
|
||||
-- It gives several kinds of Informations, and allows to consider
|
||||
-- various criteria (criteria are cumulative)
|
||||
|
||||
uses Integer, Boolean, Transient, Type,
|
||||
HSequenceOfInteger,
|
||||
Check, Binder, StatusExec, HSequenceOfBinder
|
||||
|
||||
raises NoSuchObject
|
||||
|
||||
is
|
||||
|
||||
-- -- Building the Iterator -- --
|
||||
|
||||
Create returns TransferIterator;
|
||||
---Purpose : Creates an empty Iterator
|
||||
|
||||
AddItem (me : in out; atr : Binder) is static;
|
||||
---Purpose : Adds a Binder to the iteration list (construction)
|
||||
|
||||
SelectBinder (me : in out; atype : Type; keep : Boolean) is static;
|
||||
---Purpose : 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)
|
||||
|
||||
SelectResult (me : in out; atype : Type; keep : Boolean) is static;
|
||||
---Purpose : 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)
|
||||
|
||||
SelectUnique (me : in out; keep : Boolean) is static;
|
||||
---Purpose : Select Items according Unicity : keep only Unique Results (if
|
||||
-- keep is True) or keep only Multiple Results (if keep is False)
|
||||
|
||||
SelectItem (me : in out; num : Integer; keep : Boolean);
|
||||
---Purpose : Selects/Unselect (according to <keep> an item designated by
|
||||
-- its rank <num> in the list
|
||||
-- Used by sub-classes which have specific criteria
|
||||
|
||||
-- -- Queries (Iteration, etc...) -- --
|
||||
|
||||
Number (me) returns Integer is static;
|
||||
---Purpose : Returns count of Binders to be iterated
|
||||
|
||||
Start (me : in out) is static;
|
||||
---Purpose : Clears Iteration in progress, to allow it to be restarted
|
||||
|
||||
More (me : in out) returns Boolean is static;
|
||||
---Purpose : Returns True if there are other Items to iterate
|
||||
|
||||
Next (me : in out) is static;
|
||||
---Purpose : Sets Iteration to the next Item
|
||||
|
||||
Value (me) returns Binder
|
||||
---Purpose : Returns the current Binder
|
||||
raises NoSuchObject is static;
|
||||
-- Error if Iteration has ended
|
||||
-- Some remarkable data can be accessed by following methods :
|
||||
---C++ : return const &
|
||||
|
||||
|
||||
HasResult (me) returns Boolean raises NoSuchObject is static;
|
||||
---Purpose : Returns True if current Item brings a Result, Transient
|
||||
-- (Handle) or not or Multiple. That is to say, if it corresponds
|
||||
-- to a normally acheived Transfer, Transient Result is read by
|
||||
-- specific TransientResult below.
|
||||
-- Other kind of Result must be read specifically from its Binder
|
||||
|
||||
HasUniqueResult (me) returns Boolean raises NoSuchObject is static;
|
||||
---Purpose : Returns True if Current Item has a Unique Result
|
||||
|
||||
ResultType (me) returns Type raises NoSuchObject is static;
|
||||
---Purpose : Returns the Type of the Result of the current Item, if Unique.
|
||||
-- If No Unique Result (Error Transfert 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
|
||||
|
||||
HasTransientResult (me) returns Boolean raises NoSuchObject is static;
|
||||
---Purpose : Returns True if the current Item has a Transient Unique
|
||||
-- Result (if yes, use TransientResult to get it)
|
||||
|
||||
TransientResult (me) returns any Transient
|
||||
raises NoSuchObject is static;
|
||||
---Purpose : Returns the Transient Result of the current Item if there is
|
||||
-- (else, returns a null Handle)
|
||||
-- Supposes that Binding is done by a SimpleBinderOfTransient
|
||||
---C++ : return const &
|
||||
|
||||
|
||||
Status (me) returns StatusExec is static;
|
||||
---Purpose : Returns Execution Status of current Binder
|
||||
-- Normal transfer corresponds to StatusDone
|
||||
|
||||
HasFails (me) returns Boolean is static;
|
||||
---Purpose : Returns True if Fail Messages are recorded with the current
|
||||
-- Binder. They can then be read through Check (see below)
|
||||
|
||||
HasWarnings (me) returns Boolean is static;
|
||||
---Purpose : Returns True if Warning Messages are recorded with the current
|
||||
-- Binder. They can then be read through Check (see below)
|
||||
|
||||
Check (me) returns Check is static;
|
||||
---Purpose : Returns Check associated to current Binder
|
||||
-- (in case of error, it brings Fail messages)
|
||||
-- (in case of warnings, it brings Warning messages)
|
||||
---C++ : return const
|
||||
|
||||
fields
|
||||
|
||||
theitems : HSequenceOfBinder;
|
||||
theselect : HSequenceOfInteger;
|
||||
themaxi : Integer;
|
||||
thecurr : Integer is protected; -- for read by sub-classes
|
||||
|
||||
end TransferIterator;
|
180
src/Transfer/Transfer_TransferIterator.cxx
Executable file
180
src/Transfer/Transfer_TransferIterator.cxx
Executable file
@@ -0,0 +1,180 @@
|
||||
#include <Transfer_TransferIterator.ixx>
|
||||
#include <Transfer_SimpleBinderOfTransient.hxx>
|
||||
#include <Standard_NoSuchObject.hxx>
|
||||
|
||||
static Handle(Standard_Transient) nultrans; // pour retour const&(Null)
|
||||
|
||||
|
||||
Transfer_TransferIterator::Transfer_TransferIterator ()
|
||||
{
|
||||
theitems = new Transfer_HSequenceOfBinder();
|
||||
theselect = new TColStd_HSequenceOfInteger();
|
||||
themaxi = 0;
|
||||
thecurr = 1;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
Standard_Integer casetype = 0;
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Transfer_TransferIterator::SelectUnique
|
||||
(const Standard_Boolean keep)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
// .... Iteration-Interrogations ....
|
||||
|
||||
Standard_Integer Transfer_TransferIterator::Number () const
|
||||
{
|
||||
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 ()
|
||||
{
|
||||
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 ()
|
||||
{
|
||||
thecurr ++;
|
||||
if (thecurr > themaxi) return;
|
||||
if (theselect->Value(thecurr) == 0) Next();
|
||||
}
|
||||
|
||||
const Handle(Transfer_Binder)& Transfer_TransferIterator::Value () const
|
||||
{
|
||||
if (thecurr == 0 || thecurr > themaxi) Standard_NoSuchObject::Raise
|
||||
("TransferIterator : Value");
|
||||
if (theselect->Value(thecurr) == 0) Standard_NoSuchObject::Raise
|
||||
("TransferIterator : Value");
|
||||
return theitems->Value(thecurr);
|
||||
}
|
||||
|
||||
// .... Acces aux Donnees du Binder Courant ....
|
||||
|
||||
Standard_Boolean Transfer_TransferIterator::HasResult () const
|
||||
{
|
||||
Handle(Transfer_Binder) atr = Value();
|
||||
return atr->HasResult();
|
||||
}
|
||||
|
||||
Standard_Boolean Transfer_TransferIterator::HasUniqueResult () const
|
||||
{
|
||||
Handle(Transfer_Binder) atr = Value();
|
||||
if (atr->IsMultiple()) return Standard_False;
|
||||
return atr->HasResult();
|
||||
}
|
||||
|
||||
|
||||
Handle(Standard_Type) Transfer_TransferIterator::ResultType () const
|
||||
{
|
||||
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
|
||||
return btype;
|
||||
}
|
||||
|
||||
|
||||
Standard_Boolean Transfer_TransferIterator::HasTransientResult () const
|
||||
{
|
||||
Handle(Standard_Type) btype = ResultType();
|
||||
if (btype.IsNull()) return Standard_False;
|
||||
return btype->SubType(STANDARD_TYPE(Standard_Transient));
|
||||
}
|
||||
|
||||
const Handle(Standard_Transient)&
|
||||
Transfer_TransferIterator::TransientResult () const
|
||||
{
|
||||
Handle(Transfer_SimpleBinderOfTransient) atr =
|
||||
Handle(Transfer_SimpleBinderOfTransient)::DownCast(Value());
|
||||
if (!atr.IsNull()) return atr->Result();
|
||||
return nultrans;
|
||||
}
|
||||
|
||||
|
||||
Transfer_StatusExec Transfer_TransferIterator::Status () const
|
||||
{
|
||||
Handle(Transfer_Binder) atr = Value();
|
||||
return atr->StatusExec();
|
||||
}
|
||||
|
||||
|
||||
Standard_Boolean Transfer_TransferIterator::HasFails () const
|
||||
{
|
||||
Handle(Transfer_Binder) atr = Value();
|
||||
return atr->Check()->HasFailed();
|
||||
}
|
||||
|
||||
Standard_Boolean Transfer_TransferIterator::HasWarnings () const
|
||||
{
|
||||
Handle(Transfer_Binder) atr = Value();
|
||||
return atr->Check()->HasWarnings();
|
||||
}
|
||||
|
||||
const Handle(Interface_Check) Transfer_TransferIterator::Check () const
|
||||
{
|
||||
Handle(Transfer_Binder) atr = Value();
|
||||
return atr->Check();
|
||||
}
|
104
src/Transfer/Transfer_TransferOutput.cdl
Executable file
104
src/Transfer/Transfer_TransferOutput.cdl
Executable file
@@ -0,0 +1,104 @@
|
||||
-- File: TransferOutput.cdl
|
||||
-- Created: Tue Feb 4 15:12:05 1992
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@phobox>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
|
||||
class TransferOutput from Transfer
|
||||
|
||||
---Purpose : A TransferOutput is a Tool which manages the transfer of
|
||||
-- entities created by an Interface, stored in an InterfaceModel,
|
||||
-- into a set of Objects suitable for an Application
|
||||
-- Objects to be transferred are given, by method Transfer
|
||||
-- (which calls Transfer from TransientProcess)
|
||||
-- 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
|
||||
|
||||
uses Transient, HSequenceOfTransient,
|
||||
InterfaceModel, Protocol from Interface, Graph, EntityIterator,
|
||||
TransientProcess, ActorOfTransientProcess
|
||||
|
||||
raises NoSuchObject, TransferFailure
|
||||
|
||||
is
|
||||
|
||||
Create (actor : mutable ActorOfTransientProcess; amodel : InterfaceModel)
|
||||
returns TransferOutput;
|
||||
---Purpose : Creates a TransferOutput ready to use, with a TransientProcess
|
||||
|
||||
Create (proc : mutable TransientProcess; amodel : InterfaceModel)
|
||||
returns TransferOutput;
|
||||
---Purpose : Creates a TransferOutput from an already existing
|
||||
-- TransientProcess, and a Model
|
||||
|
||||
-- ScopeMode (me : in out) returns Boolean;
|
||||
---Purpose : 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
|
||||
---C++ : return &
|
||||
|
||||
Model (me) returns InterfaceModel;
|
||||
---Purpose : Returns the Starting Model
|
||||
|
||||
TransientProcess (me) returns mutable TransientProcess;
|
||||
---Purpose : Returns the TransientProcess used to work
|
||||
|
||||
Transfer (me : in out; obj : Transient)
|
||||
---Purpose : Transfer checks that all taken Entities come from the same
|
||||
-- Model, then calls Transfer from TransientProcess
|
||||
raises TransferFailure;
|
||||
-- Error if <obj> does not come from starting Model
|
||||
|
||||
|
||||
TransferRoots (me : in out; protocol : Protocol from Interface);
|
||||
---Purpose : Runs transfer on the roots of the Interface Model
|
||||
-- The Roots are computed with a ShareFlags created from a
|
||||
-- Protocol given as Argument
|
||||
|
||||
TransferRoots (me : in out; G : Graph from Interface);
|
||||
---Purpose : 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
|
||||
|
||||
TransferRoots (me : in out);
|
||||
---Purpose : Runs transfer on the roots of the Interface Model
|
||||
-- Remark : the Roots are computed with a ShareFlags created
|
||||
-- from the Active Protocol
|
||||
|
||||
-- Helping Extractions --
|
||||
|
||||
ListForStatus (me; normal : Boolean; roots : Boolean = Standard_True)
|
||||
returns EntityIterator;
|
||||
---Purpose : 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)
|
||||
-- - <normal> True, gives Entities with or without a Result, but
|
||||
-- with no Fail, no Exception (Warnings are not counted)
|
||||
-- - <roots> False, considers all entities recorded (either for
|
||||
-- Result, or for at least one Fail or Warning message)
|
||||
-- - <roots> True (Default), considers only roots of Transfer
|
||||
-- (the Entities recorded at highest level)
|
||||
-- This method is based on AbnormalResult from TransferProcess
|
||||
|
||||
ModelForStatus (me; protocol : Protocol;
|
||||
normal : Boolean; roots : Boolean = Standard_True)
|
||||
returns mutable InterfaceModel;
|
||||
---Purpose : 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
|
||||
--
|
||||
-- Useful to get separately from a transfer, the entities which
|
||||
-- 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)
|
||||
|
||||
fields
|
||||
|
||||
theproc : TransientProcess;
|
||||
themodel : InterfaceModel;
|
||||
-- thescope : Boolean;
|
||||
|
||||
end TransferOutput;
|
129
src/Transfer/Transfer_TransferOutput.cxx
Executable file
129
src/Transfer/Transfer_TransferOutput.cxx
Executable file
@@ -0,0 +1,129 @@
|
||||
//szv#4 S4163
|
||||
#include <Transfer_TransferOutput.ixx>
|
||||
#include <Transfer_Binder.hxx>
|
||||
#include <Interface_ShareFlags.hxx>
|
||||
#include <Interface_EntityIterator.hxx>
|
||||
#include <Transfer_TransferFailure.hxx>
|
||||
|
||||
|
||||
|
||||
Transfer_TransferOutput::Transfer_TransferOutput (const Handle(Transfer_ActorOfTransientProcess)& actor,
|
||||
const Handle(Interface_InterfaceModel)& amodel)
|
||||
{
|
||||
theproc = new Transfer_TransientProcess (amodel->NbEntities());
|
||||
theproc->SetActor(actor);
|
||||
themodel = amodel;
|
||||
// thescope = Standard_False;
|
||||
// theundef = Transfer_UndefIgnore;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
//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)
|
||||
{
|
||||
if (themodel->Number(obj) == 0) Transfer_TransferFailure::Raise
|
||||
("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 );
|
||||
// if (scope > 0) theproc->EndScope (scope);
|
||||
// if ( ! ok ) return;
|
||||
|
||||
/* switch (theundef) {
|
||||
case Transfer_UndefIgnore : return;
|
||||
case Transfer_UndefFailure : Transfer_TransferFailure::Raise
|
||||
("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 ()
|
||||
{ TransferRoots(Interface_Protocol::Active()); }
|
||||
|
||||
void Transfer_TransferOutput::TransferRoots (const Handle(Interface_Protocol)& protocol)
|
||||
{
|
||||
theproc->SetRootManagement (Standard_False);
|
||||
Interface_ShareFlags tool(themodel,protocol);
|
||||
Interface_EntityIterator list = tool.RootEntities();
|
||||
for (list.Start(); list.More(); list.Next()) {
|
||||
Handle(Standard_Transient) ent = list.Value();
|
||||
// Standard_Integer scope = 0;
|
||||
// if (thescope) scope = theproc->NewScope (ent);
|
||||
if (theproc->Transfer(ent)) theproc->SetRoot(ent);
|
||||
// if (scope > 0) theproc->EndScope (scope);
|
||||
}
|
||||
}
|
||||
|
||||
void Transfer_TransferOutput::TransferRoots (const Interface_Graph& G)
|
||||
{
|
||||
theproc->SetRootManagement (Standard_False);
|
||||
Interface_ShareFlags tool(G);
|
||||
theproc->SetModel (G.Model());
|
||||
Interface_EntityIterator list = tool.RootEntities();
|
||||
for (list.Start(); list.More(); list.Next()) {
|
||||
Handle(Standard_Transient) ent = list.Value();
|
||||
// Standard_Integer scope = 0;
|
||||
// if (thescope) scope = theproc->NewScope (ent);
|
||||
if (theproc->Transfer(ent)) 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 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;
|
||||
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)) );
|
||||
}
|
||||
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) newmod;
|
||||
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);
|
||||
return newmod;
|
||||
}
|
724
src/Transfer/Transfer_TransferProcess.cdl
Executable file
724
src/Transfer/Transfer_TransferProcess.cdl
Executable file
@@ -0,0 +1,724 @@
|
||||
-- File: TransferProcess.cdl
|
||||
-- Created: Mon Feb 3 17:54:43 1992
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@phobox>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
|
||||
generic class TransferProcess from Transfer
|
||||
(TheStart as any; -- either Transient or Finder
|
||||
TheMapHasher as any;
|
||||
TheList as Transient) -- HSequence from TCollection(TheStart)
|
||||
-- TheStart as Handle (i.e. Finder-Transient only)
|
||||
-- TheMapMasher : only for the Map
|
||||
-- TheList : for Starting Objects in Iterator (a HSequence from TColStd)
|
||||
inherits TShared
|
||||
|
||||
---Purpose : This class gives the frame for doing a direct transfer : it
|
||||
-- provides required basic tools, such as a Map, and automatisms
|
||||
-- which simplify work, while their use is not mandatory.
|
||||
--
|
||||
-- Starting Objects managed by Mapping can be Transient or any
|
||||
-- (by two instantiations provided by the package,
|
||||
-- TransientProcess and FinderProcess, see class Finder).
|
||||
--
|
||||
-- A direct Transfer must maintain data sharing whenever possible
|
||||
-- (that is, when described by both sides) : this is managed by a
|
||||
-- Map. It works with intermediate Objects, the Binders. Hence it
|
||||
-- allows a binding, one/several-one/several, and it controls
|
||||
-- that a Resulting Data can be used by another one only
|
||||
-- if its creation has been ended. Also it keeps error status.
|
||||
--
|
||||
-- Several results can be bound to a starting object, identified
|
||||
-- by a category number. The default one (the only one considered
|
||||
-- for final analysis) is zero. But mapping accesses allow to
|
||||
-- precise a category number different from zero
|
||||
--
|
||||
-- In order to work more easily in most cases, automatisms are
|
||||
-- offered. Classically, to transfer an object, its result is
|
||||
-- computed then bound. This applies recursively for referenced
|
||||
-- objects. Each Transfer of a kind of object can be performed
|
||||
-- by a specific Tool, which can use TransferProcess to work.
|
||||
--
|
||||
--
|
||||
-- Many often, a specific Transfer can work as : "Search the good
|
||||
-- Tool to Perform the Transfer (if not provided), run the Tool,
|
||||
-- then Bind the Result", where "Perform" is seen as a black box.
|
||||
--
|
||||
-- This way of working is assumed through automatisms which use
|
||||
-- two types of auxiliary objects :
|
||||
-- - An Actor acts as a Library of Transfer Actions :
|
||||
-- it recognizes the operation to perform on a starting object,
|
||||
-- then runs it (see class Actor)
|
||||
-- - it produces a Binder, which is then recorded in the Map
|
||||
-- - of course, if the Transfer has been already done, it is not
|
||||
-- run once more : the first Result is available
|
||||
-- - it is possible to re-evaluate the Result if required (i.e.
|
||||
-- if the definitive Result is known only once other Transfers
|
||||
-- have been engaged)
|
||||
-- - in the case of a second (or more) ask for Transfer, the
|
||||
-- Result is considered as "AlreadyUsed", hence it may not be
|
||||
-- changed (in the Binder itself or by Rebinding another one)
|
||||
--
|
||||
-- This gives a top-down process, in which first object to be
|
||||
-- transferred asks for another one it references to be, etc...
|
||||
-- This allows automatic management of Roots : only first
|
||||
-- transfers (asked by the user) can be Root Transfers.
|
||||
--
|
||||
--
|
||||
-- Other features are : Management of Root Entities (the Entities
|
||||
-- by which the Transfer has started, and their Results, can be
|
||||
-- identified as Roots, by the user or by automatisms); Error
|
||||
-- Handling (if automatisms are used);
|
||||
-- Returning Results, which can be specialized for
|
||||
-- Roots, or Erroneous Data, or complete/partial (for one entity)
|
||||
--
|
||||
-- Finally, TransferProcess inherits TShared : this allows to
|
||||
-- run successive steps on the same set of data attached to a
|
||||
-- given Transfer, by easily transmitting this set.
|
||||
|
||||
uses Integer, Boolean, Transient, Type,
|
||||
IndexedMapOfInteger,SequenceOfInteger,HArray1OfInteger, SequenceOfTransient,
|
||||
HSequenceOfTransient, DictionaryOfInteger from Dico,
|
||||
Msg from Message, Messenger from Message,
|
||||
ParamType from Interface,
|
||||
Check from Interface, CheckIterator from Interface, Binder from Transfer,
|
||||
ProgressIndicator from Message
|
||||
-- also : parameter TheStart; nested Actor, Iterator, TransferMap
|
||||
|
||||
raises InterfaceError, TransferFailure
|
||||
|
||||
|
||||
-- -- Nested Classes -- --
|
||||
|
||||
class TransferMap instantiates IndexedDataMap from TCollection
|
||||
(TheStart,Binder,TheMapHasher);
|
||||
---Purpose : This is the Map used by TransferProcess
|
||||
|
||||
|
||||
class Iterator inherits TransferIterator
|
||||
---Purpose : This is a TransferIterator PLUS the capability to access
|
||||
-- the Starting Objects. It is given as a Result from
|
||||
-- TransferProcess. It can be used when a TransferIterator
|
||||
-- is required
|
||||
---See also : TransferIterator, for more information
|
||||
|
||||
uses Boolean, Binder -- , TheStart, TheList
|
||||
|
||||
raises NoSuchObject
|
||||
|
||||
is
|
||||
|
||||
Create (withstarts : Boolean) returns Iterator;
|
||||
---Purpose : Creates an empty Iterator
|
||||
-- if withstarts is True, each Binder to be iterated will
|
||||
-- be associated to its corresponding Starting Object
|
||||
|
||||
Add (me : in out; binder : Binder)
|
||||
---Purpose : Adds a Binder to the iteration list (construction)
|
||||
-- with no corresponding Starting Object
|
||||
-- (note that Result is brought by Binder)
|
||||
raises NoSuchObject is static;
|
||||
-- Error if Starting Objects were required at Creation
|
||||
-- time
|
||||
|
||||
Add (me : in out; binder : Binder; start : TheStart) is static;
|
||||
---Purpose : Adds a Binder to the iteration list, associated with
|
||||
-- its corresponding Starting Object "start"
|
||||
-- Starting Object is ignored if not required at
|
||||
-- Creation time
|
||||
|
||||
Filter (me : in out; list : TheList; keep : Boolean = Standard_True);
|
||||
---Purpose : 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
|
||||
|
||||
HasStarting (me) returns Boolean is static;
|
||||
---Purpose : Returns True if Starting Object is available
|
||||
-- (defined at Creation Time)
|
||||
|
||||
Starting (me) returns TheStart
|
||||
---Purpose : Returns corresponding Starting Object
|
||||
raises NoSuchObject is static;
|
||||
-- Error if the Iterator was not created with Starting
|
||||
-- Objects (Create called with <withstarts> = True)
|
||||
---C++ : return const &
|
||||
|
||||
fields
|
||||
|
||||
thestarts : TheList;
|
||||
|
||||
end Iterator;
|
||||
|
||||
|
||||
-- (should be deferred, not allowed for a nested class)
|
||||
class Actor inherits TShared
|
||||
---Purpose : An Actor performs the effective Transfer of a Starting
|
||||
-- Object, piloted by a TransferProcess. That is :
|
||||
-- - It recognizes, for a Starting Object, the case to be run
|
||||
-- - Then, it performs the Transfer : the recommanded way to
|
||||
-- work is to define for each Type of Object to Transfer, a
|
||||
-- specific Transfer Tool, then to call it by the Actor
|
||||
-- - It assumes that the Result of Transfer is stored in a
|
||||
-- Binder, it creates it if the Tool does not do
|
||||
-- It can use the TransferProcess for intermediate Results
|
||||
-- - It returns the Binder which stores the Result
|
||||
-- It no Result can be produced, it returns a Null Handle
|
||||
-- It may bind this Binder to <start> but is not obliged :
|
||||
-- TransferProcess controls this point.
|
||||
--
|
||||
-- Remark about the kind of returned Binder :
|
||||
-- - for a Transient Result, use the method TransientResult
|
||||
-- - else, cast and query the Binder itself
|
||||
--
|
||||
-- An Actor can be built by combination : this allows to
|
||||
-- gather several Actors, each one processing a set of cases.
|
||||
|
||||
uses Transient, Binder,
|
||||
SimpleBinderOfTransient
|
||||
-- TransferProcess, TheStart
|
||||
|
||||
raises DomainError
|
||||
|
||||
is
|
||||
|
||||
Create returns mutable Actor;
|
||||
|
||||
Recognize (me : mutable; start : TheStart)
|
||||
returns Boolean is virtual;
|
||||
---Purpose : Prerequesite for Transfer : the method Transfer is
|
||||
-- called on a starting object only if Recognize has
|
||||
-- returned True on it
|
||||
-- This allows to define a list of Actors, each one
|
||||
-- processing a definite kind of data
|
||||
-- TransferProcess calls Recognize on each one before
|
||||
-- calling Transfer. But even if Recognize has returned
|
||||
-- True, Transfer can reject by returning a Null Binder
|
||||
-- (afterwards rejection), the next actor is then invoked
|
||||
--
|
||||
-- The provided default returns True, can be redefined
|
||||
|
||||
Transferring (me : mutable;
|
||||
start : TheStart; TP : mutable TransferProcess)
|
||||
returns mutable Binder
|
||||
---Purpose : 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 deffered)
|
||||
-- "mutable" allows the Actor to record intermediate
|
||||
-- information, in addition to those of TransferProcess
|
||||
raises DomainError is virtual; -- should be deferred;
|
||||
-- In case of Error during a Transfer, any kind of
|
||||
-- exception can be raised
|
||||
|
||||
TransientResult (me; res : any Transient)
|
||||
returns mutable SimpleBinderOfTransient;
|
||||
---Purpose : Prepares and Returns a Binder for a Transient Result
|
||||
-- Returns a Null Handle if <res> is itself Null
|
||||
|
||||
NullResult (me) returns mutable Binder;
|
||||
---Purpose : Returns a Binder for No Result, i.e. a Null Handle
|
||||
|
||||
|
||||
SetLast (me : mutable; mode : Boolean = Standard_True);
|
||||
---Purpose : 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)
|
||||
|
||||
IsLast (me) returns Boolean;
|
||||
---Purpose : Returns the Last status (see SetLast).
|
||||
|
||||
SetNext (me : mutable; next : mutable Actor);
|
||||
---Purpose : 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
|
||||
|
||||
Next (me) returns mutable Actor;
|
||||
---Purpose : Returns the Actor defined as Next, or a Null Handle
|
||||
|
||||
fields
|
||||
|
||||
thenext : Actor;
|
||||
thelast : Boolean;
|
||||
|
||||
end Actor;
|
||||
|
||||
-- -- The class TransferProcess itself -- --
|
||||
|
||||
is
|
||||
|
||||
Create (nb : Integer = 10000) returns mutable TransferProcess from Transfer;
|
||||
---Purpose : 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).
|
||||
|
||||
Create (printer: Messenger from Message; nb: Integer = 10000)
|
||||
returns mutable TransferProcess from Transfer;
|
||||
---Purpose : Sets TransferProcess at initial state. Gives an Initial size
|
||||
-- (indicative) for the Map when known (default is 10000).
|
||||
-- Sets a specified printer.
|
||||
|
||||
Clear (me : mutable);
|
||||
---Purpose : Resets a TransferProcess as ready for a completely new work.
|
||||
-- Clears general data (roots) and the Map
|
||||
|
||||
Clean (me : mutable);
|
||||
---Purpose : 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
|
||||
|
||||
Resize (me : mutable; nb : Integer);
|
||||
---Purpose : Resizes the Map as required (if a new reliable value has been
|
||||
-- determined). Acts only if <nb> is greater than actual NbMapped
|
||||
|
||||
SetActor (me : mutable; actor : mutable Actor);
|
||||
---Purpose : Defines an Actor, which is used for automatic Transfer
|
||||
-- If already defined, the new Actor is cumulated
|
||||
-- (see SetNext from Actor)
|
||||
|
||||
Actor (me) returns mutable Actor;
|
||||
---Purpose : Returns the defined Actor. Returns a Null Handle if
|
||||
-- not set.
|
||||
|
||||
-- -- Fine Access to Map -- --
|
||||
-- This access works on : Binder (default), or Handle Result
|
||||
-- (Transient,Finder) as privileged kinds of Result
|
||||
|
||||
Find (me; start : TheStart) returns mutable Binder;
|
||||
---Purpose : 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
|
||||
---Warning : it is not equivalent to IsBound, which demands a Result
|
||||
-- C++ : return const &
|
||||
|
||||
IsBound (me; start : TheStart) returns Boolean;
|
||||
---Purpose : 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
|
||||
|
||||
IsAlreadyUsed (me; start : TheStart) returns Boolean;
|
||||
---Purpose : 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
|
||||
|
||||
FindAndMask (me : mutable; start : TheStart)
|
||||
returns mutable Binder is private;
|
||||
---Purpose : 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 &
|
||||
|
||||
Bind (me : mutable; start : TheStart; binder : mutable Binder)
|
||||
---Purpose : 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
|
||||
raises TransferFailure;
|
||||
-- Error if a Binder with a Result set is already linked with
|
||||
-- this Object (Binder with StatusResult not Initial)
|
||||
|
||||
Rebind (me : mutable; start : TheStart; binder : mutable Binder)
|
||||
---Purpose : 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
|
||||
raises TransferFailure;
|
||||
-- Error if : - the Result is known as Already Used
|
||||
-- or if - No Result is bound to <start>
|
||||
-- or if - <binder> brings No result
|
||||
|
||||
Unbind (me : mutable; start : TheStart) returns Boolean
|
||||
---Purpose : 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
|
||||
raises TransferFailure;
|
||||
-- Error if : - the Result is known as Already Used
|
||||
|
||||
FindElseBind (me : mutable; start : TheStart)
|
||||
returns mutable Binder;
|
||||
---Purpose : 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
|
||||
|
||||
-- Check management (uses Binder's Check)
|
||||
|
||||
SetMessenger (me: mutable; messenger: Messenger from Message);
|
||||
---Purpose : Sets Messenger used for outputting messages.
|
||||
|
||||
Messenger (me) returns Messenger from Message;
|
||||
---Purpose : Returns Messenger used for outputting messages.
|
||||
-- The returned object is guaranteed to be non-null;
|
||||
-- default is Message::Messenger().
|
||||
|
||||
SetTraceLevel (me: mutable; tracelev: Integer);
|
||||
---Purpose : Sets trace level used for outputting messages:
|
||||
-- <trace> = 0 : no trace at all
|
||||
-- <trace> = 1 : handled exceptions and calls to AddError
|
||||
-- <trace> = 2 : also calls to AddWarning
|
||||
-- <trace> = 3 : also traces new Roots
|
||||
-- (uses method ErrorTrace).
|
||||
-- Default is 1 : Errors traced
|
||||
|
||||
TraceLevel (me) returns Integer;
|
||||
---Purpose : Returns trace level used for outputting messages.
|
||||
|
||||
SendFail (me : mutable; start : TheStart; amsg : Msg from Message);
|
||||
---Purpose : New name for AddFail (Msg)
|
||||
|
||||
SendWarning (me : mutable; start : TheStart; amsg : Msg from Message);
|
||||
---Purpose : New name for AddWarning (Msg)
|
||||
|
||||
SendMsg (me : mutable; start : TheStart; amsg : Msg from Message);
|
||||
---Purpose : Adds an information message
|
||||
-- Trace is filled if trace level is at least 3
|
||||
|
||||
AddFail (me : mutable; start : TheStart; mess : CString; orig : CString = "");
|
||||
---Purpose : Adds an Error message to a starting entity (to the check of
|
||||
-- its Binder of category 0, as a Fail)
|
||||
|
||||
AddError (me : mutable; start : TheStart; mess : CString; orig : CString = "");
|
||||
---Purpose : (other name of AddFail, maintained for compatibility)
|
||||
|
||||
AddFail (me : mutable; start : TheStart; amsg : Msg from Message);
|
||||
---Purpose : Adds an Error Message to a starting entity from the definition
|
||||
-- of a Msg (Original+Value)
|
||||
|
||||
AddWarning (me : mutable; start : TheStart; mess : CString; orig : CString = "");
|
||||
---Purpose : Adds a Warning message to a starting entity (to the check of
|
||||
-- its Binder of category 0)
|
||||
|
||||
AddWarning (me : mutable; start : TheStart; amsg : Msg from Message);
|
||||
---Purpose : Adds a Warning Message to a starting entity from the definition
|
||||
-- of a Msg (Original+Value)
|
||||
|
||||
|
||||
Mend (me : mutable; start : TheStart; pref : CString = "");
|
||||
---Pirpose : Mends messages bound to a starting entity, if there are some
|
||||
-- <pref> as for Check from Interface :
|
||||
-- Default converts all fails to warnings and that's all
|
||||
|
||||
Check (me; start : TheStart) returns Check;
|
||||
---Purpose : Returns the Check attached to a starting entity. If <start>
|
||||
-- is unknown, returns an empty Check
|
||||
|
||||
-- AddCaseName (me : mutable; start : TheStart; casename : CString);
|
||||
---Purpose : Adds a case name to a starting entity
|
||||
|
||||
-- AddCaseValue (me : mutable; start : TheStart; caseval : Transient);
|
||||
---Purpose : Adds a case value to a starting entity
|
||||
|
||||
-- CaseList (me; start : TheStart) returns HSequenceOfTransient;
|
||||
---Purpose : Returns the complete case list for an entity. Null Handle if empty
|
||||
|
||||
-- NextItemWithAttribute (me; name : CString; num0 : Integer) returns Integer;
|
||||
---Purpose : In the list of mapped items (between 1 and NbMapped),
|
||||
-- searches for the first item which follows <num0>(not included)
|
||||
-- and which has an attribute named <name>
|
||||
-- Attributes are brought by Binders
|
||||
-- Hence, allows such an iteration
|
||||
--
|
||||
-- for (num = TP->NextItemWithAttribute(name,0);
|
||||
-- num > 0;
|
||||
-- num = TP->NextItemWithAttribute(name,num) {
|
||||
-- .. process mapped item <num>
|
||||
-- }
|
||||
|
||||
-- AttributeType (me; name : CString) returns ParamType;
|
||||
---Purpose : Returns the type of an Attribute attached to binders
|
||||
-- If this name gives no Attribute, returns ParamVoid
|
||||
-- If this name gives several different types, returns ParamMisc
|
||||
-- Else, returns the effective type (ParamInteger, ParamReal,
|
||||
-- ParamIdent, or ParamText)
|
||||
|
||||
-- Attributes (me; rootname : CString = "") returns DictionaryOfInteger;
|
||||
---Purpose : Returns the list of recorded Attribute Names, as a Dictionary
|
||||
-- of Integer : each value gives the count of items which bring
|
||||
-- this attribute name
|
||||
-- By default, considers all the attribute names
|
||||
-- If <rootname> is given, considers only the attribute names
|
||||
-- which begin by <rootname>
|
||||
|
||||
-- Most Useful Specific Bindings --
|
||||
|
||||
BindTransient (me : mutable; start : TheStart; res : any Transient)
|
||||
---Purpose : 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
|
||||
raises TransferFailure;
|
||||
-- Error if a result is already bound (Binder not Initial)
|
||||
|
||||
FindTransient (me; start : TheStart)
|
||||
returns any Transient;
|
||||
---Purpose : 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
|
||||
---C++ : return const &
|
||||
|
||||
|
||||
BindMultiple (me : mutable; start : TheStart)
|
||||
---Purpose : 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
|
||||
raises TransferFailure;
|
||||
-- Error if a UNIQUE result is already bound (if a Multiple
|
||||
-- Result is, nothing is done)
|
||||
|
||||
AddMultiple (me : mutable; start : TheStart; res : mutable Transient)
|
||||
---Purpose : Adds an item to a list of results bound to a starting object.
|
||||
-- Considers a category number, by default 0, for all results
|
||||
raises TransferFailure;
|
||||
-- Error if no Binder accepting Multiple Binding is attached
|
||||
-- to <start> (none at all, or for a unique result)
|
||||
|
||||
FindTypedTransient (me; start : TheStart; atype : Type from Standard;
|
||||
val : out mutable Transient) returns Boolean;
|
||||
---Purpose : Searches for a transient result attached to a starting object,
|
||||
-- according to its type, by criterium IsKind(atype)
|
||||
--
|
||||
-- In case of multiple result, explores the list and gives in
|
||||
-- <val> the first transient result IsKind(atype)
|
||||
-- Returns True and fills <val> if found
|
||||
-- Else, returns False (<val> is not touched, not even nullified)
|
||||
--
|
||||
-- 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
|
||||
|
||||
GetTypedTransient (me; binder : Binder; atype : Type from Standard;
|
||||
val : out mutable Transient) returns Boolean;
|
||||
---Purpose : Searches for a transient result recorded in a Binder, whatever
|
||||
-- this Binder is recorded or not in <me>
|
||||
--
|
||||
-- This is strictly equivalent to the class method GetTypedResult
|
||||
-- from class SimpleBinderOfTransient, but is just lighter to call
|
||||
--
|
||||
-- Apart from this, works as FindTypedTransient
|
||||
|
||||
|
||||
-- -- Atomic access to Map -- --
|
||||
|
||||
NbMapped (me) returns Integer;
|
||||
---Purpose : Returns the maximum possible value for Map Index
|
||||
-- (no result can be bound with a value greater than it)
|
||||
|
||||
Mapped (me; num : Integer) returns any TheStart;
|
||||
---Purpose : Returns the Starting Object bound to an Index,
|
||||
---C++ : return const &
|
||||
|
||||
MapIndex (me; start : TheStart) returns Integer;
|
||||
---Purpose : Returns the Index value bound to a Starting Object, 0 if none
|
||||
|
||||
MapItem (me; num : Integer) returns mutable Binder;
|
||||
---Purpose : Returns the Binder bound to an Index
|
||||
-- Considers a category number, by default 0
|
||||
|
||||
-- -- Root Management -- --
|
||||
|
||||
SetRoot (me : mutable; start : TheStart)
|
||||
---Purpose : Declares <obj> (and its Result) as Root. This status will be
|
||||
-- later exploited by RootResult, see below (Result can be
|
||||
-- produced at any time)
|
||||
raises TransferFailure;
|
||||
-- Error if <obj> is not bound before calling to SetRoot
|
||||
|
||||
SetRootManagement (me : mutable; stat : Boolean);
|
||||
---Purpose : 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
|
||||
-- the Transfers commanded by an external caller are "Root".
|
||||
-- Remark : SetRoot can be called whatever this status, on every
|
||||
-- object.
|
||||
-- Default is set to True.
|
||||
|
||||
NbRoots (me) returns Integer;
|
||||
---Purpose : Returns the count of recorded Roots
|
||||
|
||||
Root (me; num : Integer) returns any TheStart;
|
||||
---Purpose : Returns a Root Entity given its number in the list (1-NbRoots)
|
||||
---C++ : return const &
|
||||
|
||||
RootItem (me; num : Integer) returns mutable Binder;
|
||||
---Purpose : Returns the Binder bound with a Root Entity given its number
|
||||
-- Considers a category number, by default 0
|
||||
|
||||
RootIndex (me; start : TheStart) returns Integer;
|
||||
---Purpose : Returns the index in the list of roots for a starting item,
|
||||
-- or 0 if it is not recorded as a root
|
||||
|
||||
NestingLevel (me) returns Integer;
|
||||
---Purpose : 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.
|
||||
|
||||
ResetNestingLevel (me : mutable);
|
||||
---Purpose : Resets Nesting Level of Transfers to Zero (Root Level),
|
||||
-- whatever its current value.
|
||||
|
||||
-- -- The Transfer Operations themselves -- --
|
||||
|
||||
Recognize (me; start : TheStart) returns Boolean;
|
||||
---Purpose : Tells if <start> has been recognized as good candidate for
|
||||
-- Transfer. i.e. queries the Actor and its Nexts
|
||||
|
||||
Transferring (me : mutable; start : TheStart) returns mutable Binder
|
||||
---Purpose : 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.
|
||||
raises TransferFailure;
|
||||
-- Error : if the Transfer falls in a loop, or asks to Rebind an
|
||||
-- Object already Bound AND Used or reads a non computed Result
|
||||
--
|
||||
-- Remark : if ErrorHandle is set, no exception is raised : see
|
||||
-- the method SetErrorHandle for more details
|
||||
-- C++ : return const &
|
||||
|
||||
TransferProduct (me : mutable; start : TheStart) returns mutable Binder
|
||||
---Purpose : 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 allways be returned
|
||||
-- if a Starting Entity has not been recognized at all.
|
||||
raises TransferFailure
|
||||
is private;
|
||||
-- Error if the Transfer Action does any bad use of the Bindings
|
||||
|
||||
Transfer (me : mutable; start : TheStart) returns Boolean
|
||||
--- Purpose : Same as Transferring but does not return the Binder.
|
||||
-- Simply returns True in case of success (for user call)
|
||||
raises TransferFailure;
|
||||
-- Error : from Transferring.
|
||||
|
||||
-- -- Error Control on run-time -- --
|
||||
|
||||
SetErrorHandle (me : mutable; err : Boolean);
|
||||
---Purpose : 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
|
||||
|
||||
ErrorHandle (me) returns Boolean;
|
||||
---Purpose : Returns error handling flag
|
||||
|
||||
StartTrace (me; binder : Binder; start : TheStart; level,mode : Integer);
|
||||
---Purpose : 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
|
||||
|
||||
PrintTrace (me; start : TheStart; S : Messenger from Message) is virtual;
|
||||
---Purpose : Prints a short information on a starting object. By default
|
||||
-- prints its Dynamic Type. Can be redefined
|
||||
|
||||
IsLooping (me; alevel : Integer) returns Boolean;
|
||||
---Purpose : 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.
|
||||
|
||||
-- -- Results and Error Log -- --
|
||||
-- The Map can be consulted term by term (as being indexed),
|
||||
-- or through an Iterator
|
||||
|
||||
|
||||
RootResult (me; withstart : Boolean = Standard_False) returns Iterator;
|
||||
---Purpose : 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 Objets are also returned
|
||||
|
||||
CompleteResult (me; withstart : Boolean = Standard_False) returns Iterator;
|
||||
---Purpose : 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 Objets are also returned
|
||||
|
||||
AbnormalResult (me) returns Iterator;
|
||||
---Purpose : 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 correspondance in the iterator
|
||||
|
||||
CheckList (me; erronly : Boolean) returns CheckIterator;
|
||||
---Purpose : 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
|
||||
|
||||
ResultOne (me; start : TheStart; level : Integer;
|
||||
withstart : Boolean = Standard_False) returns Iterator;
|
||||
---Purpose : 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
|
||||
|
||||
CheckListOne (me; start : TheStart; level : Integer;
|
||||
erronly : Boolean) returns CheckIterator;
|
||||
---Purpose : Returns a CheckList for one starting object
|
||||
-- <level> interpreted as by ResultOne
|
||||
-- If <erronly> is True, checks with Warnings only are ignored
|
||||
|
||||
IsCheckListEmpty (me; start : TheStart; level : Integer;
|
||||
erronly : Boolean) returns Boolean;
|
||||
---Purpose : 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
|
||||
|
||||
RemoveResult (me : mutable; start : TheStart; level : Integer;
|
||||
compute : Boolean = Standard_True);
|
||||
---Purpose : 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)
|
||||
|
||||
CheckNum (me; start : TheStart) returns Integer is virtual;
|
||||
---Purpose : Computes a number to be associated to a starting object in
|
||||
-- a check or a check-list
|
||||
-- By default, returns 0; can be redefined
|
||||
|
||||
SetProgress(me : mutable; theProgress : ProgressIndicator from Message);
|
||||
---Purpose: Sets Progress indicator
|
||||
|
||||
GetProgress(me) returns ProgressIndicator from Message;
|
||||
---Purpose: Gets Progress indicator
|
||||
|
||||
fields
|
||||
|
||||
theerrh : Boolean; -- to handle or not exception raisings
|
||||
thetrace : Integer; -- trace level (exceptions,errors, etc...)
|
||||
themessenger : Messenger from Message; -- messenger for sending messages
|
||||
|
||||
thelevel : Integer;
|
||||
therootl : Integer; -- level of root at each time (not allways 1)
|
||||
therootm : Boolean; -- Flag for Root Management set or not
|
||||
theroots : IndexedMapOfInteger; -- indices of roots in the map
|
||||
|
||||
thelastobj : TheStart; -- Last Starting Object Bound
|
||||
thelastbnd : Binder; -- Its attached Binder (noted to optimize)
|
||||
theindex : Integer; -- And Index
|
||||
theactor : Actor;
|
||||
themap : TransferMap;
|
||||
|
||||
myProgress : ProgressIndicator from Message; -- Progress indicator
|
||||
|
||||
end TransferProcess;
|
1555
src/Transfer/Transfer_TransferProcess.gxx
Executable file
1555
src/Transfer/Transfer_TransferProcess.gxx
Executable file
File diff suppressed because it is too large
Load Diff
55
src/Transfer/Transfer_TransientListBinder.cdl
Executable file
55
src/Transfer/Transfer_TransientListBinder.cdl
Executable file
@@ -0,0 +1,55 @@
|
||||
-- File: Transfer_ShapeListBinder.cdl
|
||||
-- Created: Mon Oct 3 10:50:11 1994
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@stylox>
|
||||
---Copyright: Matra Datavision 1994
|
||||
|
||||
|
||||
class TransientListBinder from Transfer inherits Binder from Transfer
|
||||
|
||||
---Purpose : This binder binds several (a list of) Transients with a starting
|
||||
-- entity, when this entity itself corresponds to a simple list
|
||||
-- of Transients. Each part is not seen as a sub-result of an
|
||||
-- independant componant, but as an item of a built-in list
|
||||
|
||||
uses CString, Type,
|
||||
HSequenceOfTransient from TColStd
|
||||
|
||||
raises TypeMismatch, OutOfRange
|
||||
|
||||
is
|
||||
|
||||
Create returns mutable TransientListBinder;
|
||||
|
||||
Create (list : mutable HSequenceOfTransient from TColStd)
|
||||
returns mutable TransientListBinder;
|
||||
|
||||
IsMultiple (me) returns Boolean is redefined;
|
||||
-- returns True if more than one result
|
||||
|
||||
ResultType (me) returns Type;
|
||||
-- returns Standard_Transient
|
||||
|
||||
ResultTypeName (me) returns CString;
|
||||
-- returns list(Standard_Transient)
|
||||
|
||||
AddResult (me : mutable; res : Transient);
|
||||
---Purpose : Adds an item to the result list
|
||||
|
||||
Result (me) returns HSequenceOfTransient from TColStd;
|
||||
|
||||
SetResult (me : mutable; num : Integer; res : Transient);
|
||||
---Purpose : Changes an already defined sub-result
|
||||
|
||||
NbTransients (me) returns Integer;
|
||||
|
||||
Transient (me; num : Integer) returns Transient
|
||||
raises OutOfRange;
|
||||
---C++ : return const &
|
||||
|
||||
|
||||
fields
|
||||
|
||||
theres : HSequenceOfTransient from TColStd;
|
||||
|
||||
end TransientListBinder;
|
87
src/Transfer/Transfer_TransientListBinder.cxx
Executable file
87
src/Transfer/Transfer_TransientListBinder.cxx
Executable file
@@ -0,0 +1,87 @@
|
||||
#include <Transfer_TransientListBinder.ixx>
|
||||
//#include <TColStd.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : Constructor
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Transfer_TransientListBinder::Transfer_TransientListBinder ()
|
||||
{ theres = new TColStd_HSequenceOfTransient(); }
|
||||
|
||||
//=======================================================================
|
||||
//function : Constructor
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Transfer_TransientListBinder::Transfer_TransientListBinder
|
||||
(const Handle(TColStd_HSequenceOfTransient)& list)
|
||||
{ theres = list; }
|
||||
|
||||
//=======================================================================
|
||||
//function : IsMultiple
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean Transfer_TransientListBinder::IsMultiple () const
|
||||
{ return (NbTransients() > 1); }
|
||||
|
||||
//=======================================================================
|
||||
//function : ResultType
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(Standard_Type) Transfer_TransientListBinder::ResultType () const
|
||||
{ return STANDARD_TYPE(Transfer_TransientListBinder); }
|
||||
|
||||
//=======================================================================
|
||||
//function : ResultTypeName
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
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); }
|
||||
|
||||
//=======================================================================
|
||||
//function : Result
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
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); }
|
||||
|
||||
//=======================================================================
|
||||
//function : NbTransients
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
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); }
|
||||
|
93
src/Transfer/Transfer_TransientProcess.cdl
Executable file
93
src/Transfer/Transfer_TransientProcess.cdl
Executable file
@@ -0,0 +1,93 @@
|
||||
-- File: Transfer_TransientProcess.cdl
|
||||
-- Created: Wed Sep 4 09:08:47 1996
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@helioxfidox.paris1.matra-dtv.fr>
|
||||
---Copyright: Matra Datavision 1996
|
||||
|
||||
|
||||
class TransientProcess from Transfer inherits ProcessForTransient
|
||||
|
||||
---Purpose : Adds specific features to the generic definition :
|
||||
-- TransientProcess is intended to work from an InterfaceModel
|
||||
-- to a set of application objects.
|
||||
--
|
||||
-- Hence, some informations about starting entities can be gotten
|
||||
-- from the model : for Trace, CheckList, Integrity Status
|
||||
|
||||
uses Transient, Type,
|
||||
DictionaryOfTransient,
|
||||
InterfaceModel, HGraph, Graph, EntityIterator,
|
||||
HSequenceOfTransient from TColStd,
|
||||
Messenger from Message
|
||||
|
||||
is
|
||||
|
||||
Create (nb : Integer = 10000) returns mutable TransientProcess;
|
||||
---Purpose : Sets TransientProcess at initial state, with an initial size
|
||||
|
||||
SetModel (me : mutable; model : InterfaceModel);
|
||||
---Purpose : Sets an InterfaceModel, used by StartTrace, CheckList, queries
|
||||
-- on Integrity, to give informations significant for each norm.
|
||||
|
||||
Model (me) returns InterfaceModel;
|
||||
---Purpose : Returns the Model used for StartTrace
|
||||
|
||||
SetGraph (me : mutable; HG : HGraph);
|
||||
---Purpose : Sets a Graph : superseedes SetModel if already done
|
||||
|
||||
HasGraph (me) returns Boolean;
|
||||
HGraph (me) returns HGraph;
|
||||
Graph (me) returns Graph;
|
||||
---C++ : return const &
|
||||
|
||||
SetContext (me : mutable; name : CString; ctx : Transient);
|
||||
---Purpose : Sets a Context : according to receiving appli, to be
|
||||
-- interpreted by the Actor
|
||||
|
||||
GetContext (me; name : CString; type : Type; ctx : out Transient)
|
||||
returns Boolean;
|
||||
---Purpose : 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
|
||||
|
||||
Context (me : mutable) returns DictionaryOfTransient;
|
||||
---Purpose : Returns (modifiable) the whole definition of Context
|
||||
-- Rather for internal use (ex.: preparing and setting in once)
|
||||
---C++ : return &
|
||||
|
||||
PrintTrace (me; start : Transient; S : Messenger from Message) is redefined;
|
||||
---Purpose : Specific printing to trace an entity : prints label and type
|
||||
-- (if model is set)
|
||||
|
||||
CheckNum (me; ent : Transient) returns Integer is redefined;
|
||||
---Purpose : Specific number of a starting object for check-list : Number
|
||||
-- in model
|
||||
|
||||
TypedSharings (me; start : Transient; type : Type) returns EntityIterator;
|
||||
---Purpose : 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 aknowledged
|
||||
|
||||
IsDataLoaded (me; ent : Transient) returns Boolean;
|
||||
---Purpose : 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
|
||||
|
||||
IsDataFail (me; ent : Transient) returns Boolean;
|
||||
---Purpose : 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
|
||||
|
||||
PrintStats (me; mode : Integer; S : Messenger from Message);
|
||||
---Purpose : Prints statistics on a given output, according mode
|
||||
RootsForTransfer(me : mutable) returns HSequenceOfTransient from TColStd;
|
||||
fields
|
||||
|
||||
themodel : InterfaceModel;
|
||||
thegraph : HGraph;
|
||||
thectx : DictionaryOfTransient;
|
||||
thetrroots : HSequenceOfTransient from TColStd;
|
||||
end TransientProcess;
|
260
src/Transfer/Transfer_TransientProcess.cxx
Executable file
260
src/Transfer/Transfer_TransientProcess.cxx
Executable file
@@ -0,0 +1,260 @@
|
||||
#include <Transfer_TransientProcess.ixx>
|
||||
#include <Interface_Check.hxx>
|
||||
#include <Interface_MSG.hxx>
|
||||
#include <Transfer_Binder.hxx>
|
||||
#include <TColStd_HSequenceOfTransient.hxx>
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Transfer_TransientProcess
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
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)
|
||||
{
|
||||
themodel = model;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Model
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(Interface_InterfaceModel) Transfer_TransientProcess::Model () const
|
||||
{
|
||||
return themodel;
|
||||
}
|
||||
|
||||
|
||||
void Transfer_TransientProcess::SetGraph(const Handle(Interface_HGraph)& HG)
|
||||
{
|
||||
thegraph = HG;
|
||||
if (!thegraph.IsNull())
|
||||
SetModel(thegraph->Graph().Model());
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : HasGraph
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean Transfer_TransientProcess::HasGraph () const
|
||||
{
|
||||
return !thegraph.IsNull();
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : HGraph
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(Interface_HGraph) Transfer_TransientProcess::HGraph () const
|
||||
{
|
||||
return thegraph;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Graph
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const Interface_Graph& Transfer_TransientProcess::Graph () const
|
||||
{
|
||||
return thegraph->Graph();
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : SetContext
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Transfer_TransientProcess::SetContext(const Standard_CString name,
|
||||
const Handle(Standard_Transient)& ctx)
|
||||
{
|
||||
if (thectx.IsNull()) thectx = new Dico_DictionaryOfTransient;
|
||||
thectx->SetItem (name,ctx);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : GetContext
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean Transfer_TransientProcess::GetContext
|
||||
(const Standard_CString name, const Handle(Standard_Type)& type,
|
||||
Handle(Standard_Transient)& ctx) const
|
||||
{
|
||||
if (thectx.IsNull()) return Standard_False;
|
||||
if (!thectx->GetItem (name,ctx)) 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 :
|
||||
//=======================================================================
|
||||
|
||||
Handle(Dico_DictionaryOfTransient)& Transfer_TransientProcess::Context ()
|
||||
{
|
||||
return thectx;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : PrintTrace
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Transfer_TransientProcess::PrintTrace
|
||||
(const Handle(Standard_Transient)& start, const Handle(Message_Messenger)& S) const
|
||||
{
|
||||
if (!start.IsNull()) {
|
||||
S << "Entity ";
|
||||
if (!themodel.IsNull()) {
|
||||
themodel->Print (start,S,1);
|
||||
// S<<"id "; themodel->Print (start,S);
|
||||
// S<<" Type:"<<themodel->TypeName (start);
|
||||
}
|
||||
else S<<" Type:"<< Interface_InterfaceModel::ClassName(start->DynamicType()->Name());
|
||||
// << start (handle) ??
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : CheckNum
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
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 iter;
|
||||
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
|
||||
{
|
||||
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;
|
||||
return !themodel->IsRedefinedContent(num);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : IsDataFail
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean Transfer_TransientProcess::IsDataFail
|
||||
(const Handle(Standard_Transient)& start) const
|
||||
{
|
||||
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
|
||||
return ach->HasFailed();
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : PrintStats
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Transfer_TransientProcess::PrintStats(const Standard_Integer /*mode*/,
|
||||
const Handle(Message_Messenger)& S) const
|
||||
{
|
||||
S<<"\n*******************************************************************\n";
|
||||
// if (mode == 1) { // Statistiques de base
|
||||
S << "******** Basic Statistics ********"<<endl;
|
||||
|
||||
Handle(Interface_InterfaceModel) model = Model();
|
||||
if (model.IsNull()) S<<"**** Model unknown"<<endl;
|
||||
else
|
||||
S<<"**** Nb Entities : "<<model->NbEntities()<<endl;
|
||||
|
||||
Standard_Integer nbr = 0, nbe = 0, nbw = 0;
|
||||
Standard_Integer i, max = NbMapped(), nbroots = NbRoots();
|
||||
S << "**** Nb Final Results : "<<nbroots<<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 (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<<endl;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : RootsForTransfer
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TColStd_HSequenceOfTransient) Transfer_TransientProcess::RootsForTransfer()
|
||||
{
|
||||
return thetrroots;
|
||||
}
|
33
src/Transfer/Transfer_VoidBinder.cdl
Executable file
33
src/Transfer/Transfer_VoidBinder.cdl
Executable file
@@ -0,0 +1,33 @@
|
||||
-- File: Transfer_VoidBinder.cdl
|
||||
-- Created: Mon Jun 27 16:12:08 1994
|
||||
-- Author: Design
|
||||
-- <design@anion>
|
||||
---Copyright: Matra Datavision 1994
|
||||
|
||||
|
||||
class VoidBinder from Transfer inherits Binder
|
||||
|
||||
---Purpose : a VoidBinder is used to bind a starting item with a status,
|
||||
-- error or warning messages, but no result
|
||||
-- It is interpreted by TransferProcess, which admits a
|
||||
-- VoidBinder to be over-written, and copies its check to the
|
||||
-- new Binder
|
||||
|
||||
uses CString, Type
|
||||
|
||||
is
|
||||
|
||||
Create returns mutable VoidBinder;
|
||||
|
||||
-- IsMultiple (me) returns Boolean;
|
||||
---Purpose : a VoidBinder is not Multiple (Remark : it is not Simple too)
|
||||
-- But it can bring next results ...
|
||||
|
||||
ResultType (me) returns Type;
|
||||
---Purpose : while a VoidBinder admits no Result, its ResultType returns
|
||||
-- the type of <me>
|
||||
|
||||
ResultTypeName (me) returns CString;
|
||||
---Purpose : Returns "(void)"
|
||||
|
||||
end VoidBinder;
|
19
src/Transfer/Transfer_VoidBinder.cxx
Executable file
19
src/Transfer/Transfer_VoidBinder.cxx
Executable file
@@ -0,0 +1,19 @@
|
||||
// Copyright: Matra-Datavision 1994
|
||||
// File: Transfer_VoidBinder.cxx
|
||||
// Created: Mon Jun 27 16:16:47 1994
|
||||
// Author: Christian CAILLET
|
||||
// <design>
|
||||
|
||||
#include <Transfer_VoidBinder.ixx>
|
||||
|
||||
Transfer_VoidBinder::Transfer_VoidBinder () { }
|
||||
|
||||
// Standard_Boolean Transfer_VoidBinder::IsMultiple () const
|
||||
// { return Standard_False; }
|
||||
|
||||
|
||||
Handle(Standard_Type) Transfer_VoidBinder::ResultType () const
|
||||
{ return DynamicType(); }
|
||||
|
||||
Standard_CString Transfer_VoidBinder::ResultTypeName () const
|
||||
{ return "(void)"; }
|
Reference in New Issue
Block a user