mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-19 13:40:49 +03:00
Integration of OCCT 6.5.0 from SVN
This commit is contained in:
165
src/MDF/MDF.cdl
Executable file
165
src/MDF/MDF.cdl
Executable file
@@ -0,0 +1,165 @@
|
||||
-- File: MDF.cdl
|
||||
-- ---------
|
||||
-- Author: DAUTRY Philippe
|
||||
-- <fid@fox.paris1.matra-dtv.fr>
|
||||
---Copyright: MATRA DATAVISION 1997
|
||||
|
||||
---Version: 0.0
|
||||
---History: Version Date Purpose
|
||||
-- 0.0 Mar 13 1997 Creation
|
||||
|
||||
|
||||
package MDF
|
||||
|
||||
---Purpose: This package provides classes and methods to
|
||||
-- translate a transient DF into a persistent one and
|
||||
-- vice versa.
|
||||
--
|
||||
-- Driver
|
||||
--
|
||||
-- A driver is a tool used to translate a transient
|
||||
-- attribute into a persistent one and vice versa.
|
||||
--
|
||||
-- Relocation Table
|
||||
--
|
||||
-- A relocation table is a tool who provides services
|
||||
-- to relocate transient objects into persistent ones
|
||||
-- (or vice versa). It uses a map system to keep the
|
||||
-- sharing. This service is used by the drivers.
|
||||
--
|
||||
-- Driver Table
|
||||
--
|
||||
-- A driver table is an object building links between
|
||||
-- object types and object drivers. In the
|
||||
-- translation process, a driver table is asked to
|
||||
-- give a translation driver for each current object
|
||||
-- to be translated.
|
||||
|
||||
uses
|
||||
|
||||
Standard,
|
||||
MMgt,
|
||||
TCollection,
|
||||
TColStd,
|
||||
PColStd,
|
||||
PTColStd,
|
||||
TDF,
|
||||
CDM,
|
||||
PDF
|
||||
|
||||
is
|
||||
|
||||
---Category: Classes
|
||||
-- =============================================================
|
||||
|
||||
deferred class ASDriver; -- Attribute Storage Driver.
|
||||
|
||||
deferred class ARDriver; -- Attribute Retrieval Driver.
|
||||
|
||||
generic class RelocationTable; -- Relocation Table.
|
||||
|
||||
generic class DriverTable,
|
||||
DriverList,
|
||||
TypeDriverListMap; -- Driver Table.
|
||||
|
||||
class Tool from MDF;
|
||||
|
||||
|
||||
---Purpose: Storage and Retrieval attributes drivers
|
||||
-- ========================================
|
||||
|
||||
class TagSourceStorageDriver;
|
||||
|
||||
class TagSourceRetrievalDriver;
|
||||
|
||||
class ReferenceStorageDriver;
|
||||
|
||||
class ReferenceRetrievalDriver;
|
||||
|
||||
---Category: Instantiations
|
||||
-- =============================================================
|
||||
|
||||
class ASDriverSequence instantiates Sequence from TCollection
|
||||
(ASDriver from MDF);
|
||||
|
||||
class ASDriverHSequence instantiates HSequence from TCollection
|
||||
(ASDriver from MDF,
|
||||
ASDriverSequence from MDF);
|
||||
|
||||
class ARDriverSequence instantiates Sequence from TCollection
|
||||
(ARDriver from MDF);
|
||||
|
||||
class ARDriverHSequence instantiates HSequence from TCollection
|
||||
(ARDriver from MDF,
|
||||
ARDriverSequence from MDF);
|
||||
|
||||
-- Storage Relocation Table (Transient->Persistent)
|
||||
class SRelocationTable instantiates RelocationTable from MDF
|
||||
(Attribute from TDF,
|
||||
Attribute from PDF,
|
||||
Transient from Standard,
|
||||
Persistent from Standard,
|
||||
TransientPersistentMap from PTColStd);
|
||||
|
||||
-- Retrieval Relocation Table (Persistent->Transient)
|
||||
class RRelocationTable instantiates RelocationTable from MDF
|
||||
(Attribute from PDF,
|
||||
Attribute from TDF,
|
||||
Persistent from Standard,
|
||||
Transient from Standard,
|
||||
PersistentTransientMap from PTColStd);
|
||||
|
||||
-- Map (Type, ASDriver)
|
||||
class TypeASDriverMap instantiates DataMap from TCollection
|
||||
(Type from Standard,
|
||||
ASDriver from MDF,
|
||||
MapTransientHasher from TColStd);
|
||||
|
||||
-- Map (Type, ARDriver)
|
||||
class TypeARDriverMap instantiates DataMap from TCollection
|
||||
(Type from Standard,
|
||||
ARDriver from MDF,
|
||||
MapTransientHasher from TColStd);
|
||||
|
||||
-- Attribute Storage Driver Table.
|
||||
class ASDriverTable instantiates DriverTable from MDF
|
||||
(ASDriver from MDF,
|
||||
ASDriverHSequence from MDF,
|
||||
TypeASDriverMap from MDF);
|
||||
|
||||
-- Attribute Retrieval Driver Table.
|
||||
class ARDriverTable instantiates DriverTable from MDF
|
||||
(ARDriver from MDF,
|
||||
ARDriverHSequence from MDF,
|
||||
TypeARDriverMap from MDF);
|
||||
|
||||
|
||||
|
||||
-- From Source To Target Object...
|
||||
-- ===============================
|
||||
|
||||
|
||||
FromTo(aSource : Data from TDF;
|
||||
aTarget : in out Data from PDF;
|
||||
aDriverTable : ASDriverTable from MDF;
|
||||
aReloc : SRelocationTable from MDF;
|
||||
aVersion : Integer from Standard = 0);
|
||||
---Purpose: Translates a transient <aSource> into a persistent
|
||||
-- <aTarget>.
|
||||
|
||||
FromTo(aSource : Data from PDF;
|
||||
aTarget : in out Data from TDF;
|
||||
aDriverTable : ARDriverTable from MDF;
|
||||
aReloc : RRelocationTable from MDF);
|
||||
---Purpose: Translates a persistent <aSource> into a transient
|
||||
-- <aTarget>.
|
||||
|
||||
AddStorageDrivers(aDriverSeq : ASDriverHSequence from MDF; theMessageDriver : MessageDriver from CDM);
|
||||
---Purpose: Adds the attribute storage drivers to <aDriverSeq>.
|
||||
|
||||
|
||||
AddRetrievalDrivers(aDriverSeq : ARDriverHSequence from MDF; theMessageDriver : MessageDriver from CDM);
|
||||
---Purpose: Adds the attribute retrieval drivers to <aDriverSeq>.
|
||||
|
||||
|
||||
end MDF;
|
110
src/MDF/MDF.cxx
Executable file
110
src/MDF/MDF.cxx
Executable file
@@ -0,0 +1,110 @@
|
||||
// File: MDF.cxx
|
||||
// ---------
|
||||
// Author: DAUTRY Philippe
|
||||
// <fid@fox.paris1.matra-dtv.fr>
|
||||
// Copyright: Matra Datavision 1997
|
||||
|
||||
// Version: 0.0
|
||||
// History: Version Date Purpose
|
||||
// 0.0 Mar 13 1997 Creation
|
||||
|
||||
|
||||
|
||||
#include <MDF.ixx>
|
||||
|
||||
#include <TDF_Attribute.hxx>
|
||||
#include <TDF_Label.hxx>
|
||||
#include <TDF_Tool.hxx>
|
||||
|
||||
#include <MDF_RRelocationTable.hxx>
|
||||
#include <MDF_SRelocationTable.hxx>
|
||||
#include <MDF_Tool.hxx>
|
||||
#include <MDF_TypeARDriverMap.hxx>
|
||||
#include <MDF_TypeASDriverMap.hxx>
|
||||
|
||||
#include <PDF_Attribute.hxx>
|
||||
#include <PDF_HAttributeArray1.hxx>
|
||||
|
||||
#include <PColStd_HArray1OfInteger.hxx>
|
||||
|
||||
#include <PTColStd_TransientPersistentMap.hxx>
|
||||
|
||||
#include <MDF_TagSourceStorageDriver.hxx>
|
||||
#include <MDF_TagSourceRetrievalDriver.hxx>
|
||||
#include <MDF_ReferenceStorageDriver.hxx>
|
||||
#include <MDF_ReferenceRetrievalDriver.hxx>
|
||||
#include <CDM_MessageDriver.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : FromTo
|
||||
//purpose : From TRANSIENT to PERSISTENT.
|
||||
//=======================================================================
|
||||
|
||||
void MDF::FromTo
|
||||
(const Handle(TDF_Data)& aSource,
|
||||
Handle(PDF_Data)& aTarget,
|
||||
const Handle(MDF_ASDriverTable)& aDriverTable,
|
||||
const Handle(MDF_SRelocationTable)& aReloc,
|
||||
const Standard_Integer aVersion)
|
||||
{
|
||||
// Into Data.
|
||||
aTarget = new PDF_Data(aVersion);
|
||||
|
||||
// Extraction of the driver subset.
|
||||
const MDF_TypeASDriverMap& driverMap =
|
||||
aDriverTable->GetDrivers(aVersion);
|
||||
|
||||
// Translation.
|
||||
MDF_Tool::WriteLabels(aSource, aTarget, driverMap, aReloc);
|
||||
MDF_Tool::WriteAttributes(driverMap, aReloc);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : FromTo
|
||||
//purpose : From PERSISTENT to TRANSIENT.
|
||||
//=======================================================================
|
||||
|
||||
void MDF::FromTo
|
||||
(const Handle(PDF_Data)& aSource,
|
||||
Handle(TDF_Data)& aTarget,
|
||||
const Handle(MDF_ARDriverTable)& aDriverTable,
|
||||
const Handle(MDF_RRelocationTable)& aReloc)
|
||||
{
|
||||
// Version number.
|
||||
Standard_Integer version = aSource->VersionNumber();
|
||||
|
||||
// Extraction of the driver subset.
|
||||
const MDF_TypeARDriverMap& driverMap =
|
||||
aDriverTable->GetDrivers(version);
|
||||
|
||||
// Translation.
|
||||
MDF_Tool::ReadLabels(aSource, aTarget, driverMap, aReloc);
|
||||
MDF_Tool::ReadAttributes(driverMap, aReloc);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : AddStorageDriver
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void MDF::AddStorageDrivers
|
||||
(const Handle(MDF_ASDriverHSequence)& theDriverSeq,const Handle(CDM_MessageDriver)& theMsgDriver)
|
||||
{
|
||||
theDriverSeq->Append(new MDF_TagSourceStorageDriver(theMsgDriver));
|
||||
theDriverSeq->Append(new MDF_ReferenceStorageDriver(theMsgDriver));
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : AddRetrievalDriver
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void MDF::AddRetrievalDrivers
|
||||
(const Handle(MDF_ARDriverHSequence)& theDriverSeq, const Handle(CDM_MessageDriver)& theMsgDriver)
|
||||
{
|
||||
theDriverSeq->Append(new MDF_TagSourceRetrievalDriver(theMsgDriver));
|
||||
theDriverSeq->Append(new MDF_ReferenceRetrievalDriver(theMsgDriver));
|
||||
}
|
||||
|
60
src/MDF/MDF_ARDriver.cdl
Executable file
60
src/MDF/MDF_ARDriver.cdl
Executable file
@@ -0,0 +1,60 @@
|
||||
-- File: MDF_ARDriver.cdl
|
||||
-- ----------------
|
||||
-- Author: DAUTRY Philippe
|
||||
-- <fid@fox.paris1.matra-dtv.fr>
|
||||
---Copyright: MATRA DATAVISION 1997
|
||||
|
||||
---Version: 0.0
|
||||
---History: Version Date Purpose
|
||||
-- 0.0 Apr 4 1997 Creation
|
||||
|
||||
|
||||
deferred class ARDriver from MDF
|
||||
inherits TShared from MMgt
|
||||
|
||||
---Purpose: Attribute Retrieval Driver.
|
||||
|
||||
uses
|
||||
|
||||
Attribute from TDF,
|
||||
Attribute from PDF,
|
||||
RRelocationTable from MDF,
|
||||
MessageDriver from CDM,
|
||||
ExtendedString from TCollection
|
||||
|
||||
-- raises
|
||||
|
||||
is
|
||||
Initialize (theMessageDriver : MessageDriver from CDM);
|
||||
|
||||
VersionNumber(me) returns Integer from Standard
|
||||
is deferred;
|
||||
---Purpose: Returns the version number from which the driver
|
||||
-- is available.
|
||||
|
||||
SourceType(me) returns Type from Standard
|
||||
is deferred;
|
||||
---Purpose: Returns the type of source object, inheriting from
|
||||
-- Attribute from PDF.
|
||||
|
||||
NewEmpty(me)
|
||||
returns mutable Attribute from TDF
|
||||
is deferred;
|
||||
---Purpose: Creates a new attribute from PDF.
|
||||
|
||||
Paste(me;
|
||||
aSource : Attribute from PDF;
|
||||
aTarget : mutable Attribute from TDF;
|
||||
aRelocTable : RRelocationTable from MDF)
|
||||
is deferred;
|
||||
---Purpose: Translate the contents of <aSource> and put it
|
||||
-- into <aTarget>, using the relocation table
|
||||
-- <aRelocTable> to keep the sharings.
|
||||
|
||||
WriteMessage (me; theMessage : ExtendedString from TCollection);
|
||||
---Purpose: To send message to Application (if MessageDriver defined)
|
||||
fields
|
||||
|
||||
myMessageDriver : MessageDriver from CDM;
|
||||
|
||||
end ARDriver;
|
31
src/MDF/MDF_ARDriver.cxx
Executable file
31
src/MDF/MDF_ARDriver.cxx
Executable file
@@ -0,0 +1,31 @@
|
||||
// File: MDF_ARDriver.cxx
|
||||
// ----------------
|
||||
// Author: DAUTRY Philippe
|
||||
// <fid@fox.paris1.matra-dtv.fr>
|
||||
// Copyright: Matra Datavision 1997
|
||||
|
||||
// Version: 0.0
|
||||
// History: Version Date Purpose
|
||||
// 0.0 Apr 28 1997 Creation
|
||||
|
||||
|
||||
|
||||
#include <MDF_ARDriver.ixx>
|
||||
#include <TCollection_ExtendedString.hxx>
|
||||
#include <CDM_MessageDriver.hxx>
|
||||
//=======================================================================
|
||||
//function : MDF_ARDriver
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
MDF_ARDriver::MDF_ARDriver (const Handle(CDM_MessageDriver)& theMsgDriver)
|
||||
: myMessageDriver (theMsgDriver) {}
|
||||
|
||||
//=======================================================================
|
||||
//function : WriteMessage
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void MDF_ARDriver::WriteMessage(const TCollection_ExtendedString& theMessage) const {
|
||||
myMessageDriver->Write (theMessage.ToExtString());
|
||||
}
|
61
src/MDF/MDF_ASDriver.cdl
Executable file
61
src/MDF/MDF_ASDriver.cdl
Executable file
@@ -0,0 +1,61 @@
|
||||
-- File: MDF_ASDriver.cdl
|
||||
-- ----------------
|
||||
-- Author: DAUTRY Philippe
|
||||
-- <fid@fox.paris1.matra-dtv.fr>
|
||||
---Copyright: MATRA DATAVISION 1997
|
||||
|
||||
---Version: 0.0
|
||||
---History: Version Date Purpose
|
||||
-- 0.0 Apr 4 1997 Creation
|
||||
|
||||
|
||||
deferred class ASDriver from MDF
|
||||
inherits TShared from MMgt
|
||||
|
||||
---Purpose: Attribute Storage Driver.
|
||||
|
||||
uses
|
||||
|
||||
Attribute from TDF,
|
||||
Attribute from PDF,
|
||||
SRelocationTable from MDF,
|
||||
MessageDriver from CDM,
|
||||
ExtendedString from TCollection
|
||||
|
||||
-- raises
|
||||
|
||||
is
|
||||
Initialize (theMessageDriver : MessageDriver from CDM);
|
||||
|
||||
VersionNumber(me) returns Integer from Standard
|
||||
is deferred;
|
||||
---Purpose: Returns the version number from which the driver
|
||||
-- is available.
|
||||
|
||||
SourceType(me) returns Type from Standard
|
||||
is deferred;
|
||||
---Purpose: Returns the type of source object, inheriting from
|
||||
-- Attribute from TDF.
|
||||
|
||||
NewEmpty(me)
|
||||
returns mutable Attribute from PDF
|
||||
is deferred;
|
||||
---Purpose: Creates a new attribute from PDF.
|
||||
|
||||
Paste(me;
|
||||
aSource : Attribute from TDF;
|
||||
aTarget : mutable Attribute from PDF;
|
||||
aRelocTable : SRelocationTable from MDF)
|
||||
is deferred;
|
||||
---Purpose: Translate the contents of <aSource> and put it
|
||||
-- into <aTarget>, using the relocation table
|
||||
-- <aRelocTable> to keep the sharings.
|
||||
|
||||
WriteMessage (me; theMessage : ExtendedString from TCollection);
|
||||
---Purpose: To send message to Application (if MessageDriver defined)
|
||||
|
||||
fields
|
||||
|
||||
myMessageDriver : MessageDriver from CDM;
|
||||
|
||||
end ASDriver;
|
31
src/MDF/MDF_ASDriver.cxx
Executable file
31
src/MDF/MDF_ASDriver.cxx
Executable file
@@ -0,0 +1,31 @@
|
||||
// File: MDF_ASDriver.cxx
|
||||
// ----------------
|
||||
// Author: DAUTRY Philippe
|
||||
// <fid@fox.paris1.matra-dtv.fr>
|
||||
// Copyright: Matra Datavision 1997
|
||||
|
||||
// Version: 0.0
|
||||
// History: Version Date Purpose
|
||||
// 0.0 Apr 28 1997 Creation
|
||||
|
||||
|
||||
|
||||
#include <MDF_ASDriver.ixx>
|
||||
#include <TCollection_ExtendedString.hxx>
|
||||
#include <CDM_MessageDriver.hxx>
|
||||
//=======================================================================
|
||||
//function : MDF_ASDriver
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
MDF_ASDriver::MDF_ASDriver (const Handle(CDM_MessageDriver)& theMsgDriver)
|
||||
: myMessageDriver (theMsgDriver) {}
|
||||
|
||||
//=======================================================================
|
||||
//function : WriteMessage
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void MDF_ASDriver::WriteMessage(const TCollection_ExtendedString& theMessage) const {
|
||||
myMessageDriver->Write (theMessage.ToExtString());
|
||||
}
|
87
src/MDF/MDF_DriverTable.cdl
Executable file
87
src/MDF/MDF_DriverTable.cdl
Executable file
@@ -0,0 +1,87 @@
|
||||
-- File: MDF_DriverTable.cdl
|
||||
-- -------------------
|
||||
-- Author: DAUTRY Philippe
|
||||
-- <fid@fox.paris1.matra-dtv.fr>
|
||||
---Copyright: MATRA DATAVISION 1997
|
||||
|
||||
---Version: 0.0
|
||||
---History: Version Date Purpose
|
||||
-- 0.0 May 6 1997 Creation
|
||||
|
||||
|
||||
generic class DriverTable from MDF
|
||||
(TheHDriver as Transient from Standard;
|
||||
TheDriverHSeq as Transient from Standard;
|
||||
TheTypeDriverMap as any)
|
||||
inherits TShared from MMgt
|
||||
|
||||
---Purpose: A driver table is an object building links between
|
||||
-- object types and object drivers. In the
|
||||
-- translation process, a driver table is asked to
|
||||
-- give a translation driver for each current object
|
||||
-- to be translated.
|
||||
--
|
||||
-- Validity range of a driver: a driver is available
|
||||
-- from its version number till the next upper
|
||||
-- version number.
|
||||
|
||||
uses
|
||||
|
||||
Type from Standard,
|
||||
MapTransientHasher from TColStd
|
||||
|
||||
|
||||
-- raises
|
||||
|
||||
class DriverList instantiates List from TCollection
|
||||
(TheHDriver);
|
||||
|
||||
class TypeDriverListMap instantiates DataMap from TCollection
|
||||
(Type from Standard,
|
||||
DriverList,
|
||||
MapTransientHasher from TColStd);
|
||||
|
||||
is
|
||||
|
||||
Create returns mutable DriverTable from MDF;
|
||||
---Purpose: Creates a mutable DriverTable from MDF.
|
||||
|
||||
SetDriver(me : mutable;
|
||||
anHDriver : TheHDriver);
|
||||
---Purpose: Sets a translation driver: <aDriver>.
|
||||
|
||||
SetDrivers(me : mutable;
|
||||
aDriverHSeq : TheDriverHSeq);
|
||||
---Purpose: Sets translation drivers.
|
||||
|
||||
GetDrivers(me : mutable;
|
||||
aVersion : Integer from Standard = 0)
|
||||
returns TheTypeDriverMap;
|
||||
---Purpose: Gets a map of drivers available for <aVersion>.
|
||||
--
|
||||
-- If <aVersion> is not given or is null, the highest
|
||||
-- version number driver is returned.
|
||||
--
|
||||
---C++: return const &
|
||||
|
||||
GetDriver(me;
|
||||
aType : Type from Standard;
|
||||
anHDriver : in out TheHDriver;
|
||||
aVersion : Integer from Standard = 0)
|
||||
returns Boolean from Standard;
|
||||
---Purpose: Gets a driver <aDriver> according to <aType> and
|
||||
-- <aVersion>.
|
||||
--
|
||||
-- If <aVersion> is not given or is null, the highest
|
||||
-- version number driver is returned.
|
||||
--
|
||||
-- Returns True if a driver is found; false otherwise.
|
||||
|
||||
|
||||
fields
|
||||
|
||||
myVersion : Integer from Standard;
|
||||
myMap : TheTypeDriverMap; -- available for myVersion.
|
||||
myMapOfLst : TypeDriverListMap;
|
||||
|
||||
end DriverTable;
|
138
src/MDF/MDF_DriverTable.gxx
Executable file
138
src/MDF/MDF_DriverTable.gxx
Executable file
@@ -0,0 +1,138 @@
|
||||
// File: MDF_DriverTable.gxx
|
||||
// -------------------
|
||||
// Author: DAUTRY Philippe
|
||||
// <fid@fox.paris1.matra-dtv.fr>
|
||||
// Copyright: Matra Datavision 1997
|
||||
|
||||
// Version: 0.0
|
||||
// History: Version Date Purpose
|
||||
// 0.0 May 6 1997 Creation
|
||||
|
||||
|
||||
#include TheHDriver_hxx
|
||||
#include MDF_DataMapIteratorOfTypeDriverListMap_hxx
|
||||
#include MDF_DriverList_hxx
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : MDF_DriverTable
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
MDF_DriverTable::MDF_DriverTable() :
|
||||
myVersion(-1)
|
||||
{}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : SetDriver
|
||||
//purpose : Sets a driver in its List,
|
||||
// in decreasing version number order
|
||||
//=======================================================================
|
||||
|
||||
void MDF_DriverTable::SetDriver
|
||||
(const Handle(TheHDriver)& anHDriver)
|
||||
{
|
||||
const Handle(Standard_Type)& type = anHDriver->SourceType();
|
||||
if (myMapOfLst.IsBound(type)) {
|
||||
MDF_DriverList& lst = myMapOfLst.ChangeFind(type);
|
||||
if (lst.IsEmpty()) {
|
||||
lst.Append(anHDriver);
|
||||
}
|
||||
else {
|
||||
Standard_Integer driverVersion = anHDriver->VersionNumber();
|
||||
Standard_Integer currentVersion;
|
||||
for (MDF_ListIteratorOfDriverList itr(lst); itr.More(); itr.Next()) {
|
||||
const Handle(TheHDriver)& driver = itr.Value();
|
||||
currentVersion = driver->VersionNumber();
|
||||
if (driverVersion == currentVersion) {
|
||||
lst.Remove(itr);
|
||||
if (lst.IsEmpty()) lst.Append(anHDriver);
|
||||
else lst.InsertBefore(anHDriver,itr);
|
||||
break;
|
||||
}
|
||||
else if (driverVersion > currentVersion) {
|
||||
lst.InsertAfter(anHDriver,itr);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
MDF_DriverList lst;
|
||||
lst.Append(anHDriver);
|
||||
myMapOfLst.Bind(type,lst);
|
||||
}
|
||||
myMap.Clear();
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : SetDrivers
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void MDF_DriverTable::SetDrivers
|
||||
(const Handle(TheDriverHSeq)& aDriverHSeq)
|
||||
{
|
||||
const Standard_Integer upper = aDriverHSeq->Length();
|
||||
for (Standard_Integer i = 1; i <= upper; ++i)
|
||||
SetDriver(aDriverHSeq->Value(i));
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : GetDrivers
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const TheTypeDriverMap& MDF_DriverTable::GetDrivers
|
||||
(const Standard_Integer aVersion)
|
||||
{
|
||||
if ((myMap.IsEmpty()) || (myVersion != aVersion)) {
|
||||
// Rebuild the map.
|
||||
Handle(TheHDriver) driver;
|
||||
MDF_DataMapIteratorOfTypeDriverListMap itr(myMapOfLst);
|
||||
for ( ; itr.More(); itr.Next()) {
|
||||
const Handle(Standard_Type)& type = itr.Key();
|
||||
if (MDF_DriverTable::GetDriver(type, driver, aVersion))
|
||||
myMap.Bind(type, driver);
|
||||
}
|
||||
myVersion = aVersion;
|
||||
}
|
||||
return myMap;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetDriver
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean MDF_DriverTable::GetDriver
|
||||
(const Handle(Standard_Type)& aType,
|
||||
Handle(TheHDriver)& anHDriver,
|
||||
const Standard_Integer aVersion) const
|
||||
{
|
||||
Standard_Boolean found = Standard_False;
|
||||
if (myMapOfLst.IsBound(aType)) {
|
||||
const MDF_DriverList& lst = myMapOfLst.Find(aType);
|
||||
if ( (aVersion == 0) && !lst.IsEmpty() ) {
|
||||
found = Standard_True;
|
||||
anHDriver = lst.First();
|
||||
}
|
||||
else {
|
||||
for (MDF_ListIteratorOfDriverList itr(lst); itr.More(); itr.Next()) {
|
||||
const Handle(TheHDriver)& driver = itr.Value();
|
||||
if (driver->VersionNumber() >= aVersion) {
|
||||
found = Standard_True;
|
||||
anHDriver = driver;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return found;
|
||||
}
|
||||
|
||||
|
||||
|
39
src/MDF/MDF_ReferenceRetrievalDriver.cdl
Executable file
39
src/MDF/MDF_ReferenceRetrievalDriver.cdl
Executable file
@@ -0,0 +1,39 @@
|
||||
-- File: MDF_ReferenceRetrievalDriver.cdl
|
||||
-- Created: Thu Aug 7 17:15:56 1997
|
||||
-- Author: VAUTHIER Jean-Claude
|
||||
---Copyright: Matra Datavision 1997
|
||||
|
||||
|
||||
class ReferenceRetrievalDriver from MDF inherits ARDriver from MDF
|
||||
|
||||
---Purpose:
|
||||
|
||||
uses RRelocationTable from MDF,
|
||||
Attribute from PDF,
|
||||
Attribute from TDF,
|
||||
MessageDriver from CDM
|
||||
|
||||
is
|
||||
|
||||
|
||||
Create(theMessageDriver : MessageDriver from CDM) -- Version 0
|
||||
returns mutable ReferenceRetrievalDriver from MDF;
|
||||
|
||||
|
||||
VersionNumber(me) returns Integer from Standard;
|
||||
---Purpose: Returns the version number from which the driver
|
||||
-- is available: 0.
|
||||
|
||||
SourceType(me) returns Type from Standard;
|
||||
---Purpose: Returns the type: Reference from PDF.
|
||||
|
||||
NewEmpty (me) returns mutable Attribute from TDF;
|
||||
|
||||
|
||||
Paste(me;
|
||||
Source : Attribute from PDF;
|
||||
Target : mutable Attribute from TDF;
|
||||
RelocTable : RRelocationTable from MDF);
|
||||
|
||||
end ReferenceRetrievalDriver;
|
||||
|
45
src/MDF/MDF_ReferenceRetrievalDriver.cxx
Executable file
45
src/MDF/MDF_ReferenceRetrievalDriver.cxx
Executable file
@@ -0,0 +1,45 @@
|
||||
#include <MDF_ReferenceRetrievalDriver.ixx>
|
||||
#include <PCollection_HAsciiString.hxx>
|
||||
#include <PDF_Reference.hxx>
|
||||
#include <Standard_NoSuchObject.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <TDF_Label.hxx>
|
||||
#include <TDF_Tool.hxx>
|
||||
#include <TDF_Reference.hxx>
|
||||
#include <CDM_MessageDriver.hxx>
|
||||
|
||||
#define DeclareAndSpeedCast(V,T,Vdown) Handle(T) Vdown = *((Handle(T)*)& V)
|
||||
#define DeclareConstAndSpeedCast(V,T,Vdown) const Handle(T)& Vdown = (Handle(T)&) V
|
||||
#define SpeedCast(V,T,Vdown) Vdown = *((Handle(T)*)& V)
|
||||
|
||||
MDF_ReferenceRetrievalDriver::MDF_ReferenceRetrievalDriver(const Handle(CDM_MessageDriver)& theMsgDriver):MDF_ARDriver(theMsgDriver)
|
||||
{
|
||||
}
|
||||
|
||||
Standard_Integer MDF_ReferenceRetrievalDriver::VersionNumber() const
|
||||
{ return 0; }
|
||||
|
||||
Handle(Standard_Type) MDF_ReferenceRetrievalDriver::SourceType() const
|
||||
{ return STANDARD_TYPE (PDF_Reference); }
|
||||
|
||||
Handle(TDF_Attribute) MDF_ReferenceRetrievalDriver::NewEmpty() const
|
||||
{ return new TDF_Reference; }
|
||||
|
||||
void MDF_ReferenceRetrievalDriver::Paste (
|
||||
const Handle(PDF_Attribute)& Source,
|
||||
const Handle(TDF_Attribute)& Target,
|
||||
// const Handle(MDF_RRelocationTable)& RelocTable) const
|
||||
const Handle(MDF_RRelocationTable)& ) const
|
||||
|
||||
{
|
||||
DeclareAndSpeedCast(Source,PDF_Reference,S);
|
||||
DeclareAndSpeedCast(Target,TDF_Reference,T);
|
||||
TDF_Label tLab; // Null label.
|
||||
Handle(PCollection_HAsciiString) pEntry = S->ReferencedLabel();
|
||||
if (!pEntry.IsNull()) {
|
||||
TCollection_AsciiString entry = pEntry->Convert();
|
||||
TDF_Tool::Label(T->Label().Data(),entry,tLab,Standard_True);
|
||||
}
|
||||
T->Set(tLab);
|
||||
}
|
||||
|
40
src/MDF/MDF_ReferenceStorageDriver.cdl
Executable file
40
src/MDF/MDF_ReferenceStorageDriver.cdl
Executable file
@@ -0,0 +1,40 @@
|
||||
-- File: MDF_ReferenceStorageDriver.cdl
|
||||
-- Created: Thu Aug 7 17:09:27 1997
|
||||
-- Author: VAUTHIER Jean-Claude
|
||||
---Copyright: Matra Datavision 1997
|
||||
|
||||
class ReferenceStorageDriver from MDF inherits ASDriver from MDF
|
||||
|
||||
---Purpose:
|
||||
|
||||
uses SRelocationTable from MDF,
|
||||
Attribute from TDF,
|
||||
Attribute from PDF,
|
||||
MessageDriver from CDM
|
||||
|
||||
is
|
||||
|
||||
Create(theMessageDriver : MessageDriver from CDM)
|
||||
returns mutable ReferenceStorageDriver from MDF;
|
||||
|
||||
|
||||
VersionNumber(me) returns Integer from Standard;
|
||||
---Purpose: Returns the version number from which the driver
|
||||
-- is available: 0.
|
||||
|
||||
SourceType(me) returns Type from Standard;
|
||||
---Purpose: Returns the type: Integer from TDF.
|
||||
|
||||
NewEmpty (me) returns mutable Attribute from PDF;
|
||||
|
||||
|
||||
Paste(me;
|
||||
Source : Attribute from TDF;
|
||||
Target : mutable Attribute from PDF;
|
||||
RelocTable : SRelocationTable from MDF);
|
||||
|
||||
|
||||
end ReferenceStorageDriver;
|
||||
|
||||
|
||||
|
51
src/MDF/MDF_ReferenceStorageDriver.cxx
Executable file
51
src/MDF/MDF_ReferenceStorageDriver.cxx
Executable file
@@ -0,0 +1,51 @@
|
||||
#include <MDF_ReferenceStorageDriver.ixx>
|
||||
#include <PCollection_HAsciiString.hxx>
|
||||
#include <PDF_Reference.hxx>
|
||||
#include <Standard_NoSuchObject.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <TDF_Label.hxx>
|
||||
#include <TDF_Tool.hxx>
|
||||
#include <TDF_Reference.hxx>
|
||||
#include <CDM_MessageDriver.hxx>
|
||||
|
||||
#define DeclareAndSpeedCast(V,T,Vdown) Handle(T) Vdown = *((Handle(T)*)& V)
|
||||
#define DeclareConstAndSpeedCast(V,T,Vdown) const Handle(T)& Vdown = (Handle(T)&) V
|
||||
#define SpeedCast(V,T,Vdown) Vdown = *((Handle(T)*)& V)
|
||||
|
||||
MDF_ReferenceStorageDriver::MDF_ReferenceStorageDriver(const Handle(CDM_MessageDriver)& theMsgDriver):MDF_ASDriver(theMsgDriver)
|
||||
{
|
||||
}
|
||||
|
||||
Standard_Integer MDF_ReferenceStorageDriver::VersionNumber() const
|
||||
{ return 0; }
|
||||
|
||||
Handle(Standard_Type) MDF_ReferenceStorageDriver::SourceType() const
|
||||
{ return STANDARD_TYPE(TDF_Reference); }
|
||||
|
||||
Handle(PDF_Attribute) MDF_ReferenceStorageDriver::NewEmpty() const
|
||||
{ return new PDF_Reference; }
|
||||
|
||||
void MDF_ReferenceStorageDriver::Paste (
|
||||
const Handle(TDF_Attribute)& Source,
|
||||
const Handle(PDF_Attribute)& Target,
|
||||
// const Handle(MDF_SRelocationTable)& RelocTable) const
|
||||
const Handle(MDF_SRelocationTable)& ) const
|
||||
{
|
||||
DeclareAndSpeedCast(Source,TDF_Reference,S);
|
||||
DeclareAndSpeedCast(Target,PDF_Reference,T);
|
||||
Handle(PCollection_HAsciiString) pEntry; // Null handle.
|
||||
if (!S.IsNull()) {
|
||||
const TDF_Label& lab = S->Label();
|
||||
const TDF_Label& refLab = S->Get();
|
||||
if (!lab.IsNull() && !refLab.IsNull()) {
|
||||
if (lab.IsDescendant(refLab.Root())) {
|
||||
// Ref. interne.
|
||||
TCollection_AsciiString entry;
|
||||
TDF_Tool::Entry(refLab,entry);
|
||||
pEntry = new PCollection_HAsciiString(entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
T->ReferencedLabel(pEntry);
|
||||
}
|
||||
|
109
src/MDF/MDF_RelocationTable.cdl
Executable file
109
src/MDF/MDF_RelocationTable.cdl
Executable file
@@ -0,0 +1,109 @@
|
||||
-- File: MDF_RelocationTable.cdl
|
||||
-- -----------------------
|
||||
-- Author: DAUTRY Philippe
|
||||
-- <fid@fox.paris1.matra-dtv.fr>
|
||||
---Copyright: MATRA DATAVISION 1997
|
||||
|
||||
---Version: 0.0
|
||||
---History: Version Date Purpose
|
||||
-- 0.0 May 7 1997 Creation
|
||||
|
||||
|
||||
|
||||
generic class RelocationTable from MDF
|
||||
(TheSourceType as any;
|
||||
TheTargetType as any;
|
||||
TheOtherSourceType as any;
|
||||
TheOtherTargetType as any;
|
||||
TheMapType as any)
|
||||
inherits TShared from MMgt
|
||||
|
||||
---Purpose: Storage Relocation Table
|
||||
-- (Transient->Persistent). It is a relocation
|
||||
-- dictionnary.
|
||||
|
||||
uses
|
||||
|
||||
Tool from MDF
|
||||
|
||||
-- raises
|
||||
|
||||
is
|
||||
|
||||
Create(theSelfRelocation : Boolean from Standard = Standard_False)
|
||||
returns mutable RelocationTable from MDF;
|
||||
---Purpose: Creates a relocation table.
|
||||
-- <theSelfRelocation> status says that the relocation table allows self relocation.
|
||||
|
||||
SetSelfRelocation(me : mutable; theStatus : Boolean from Standard = Standard_True);
|
||||
---Purpose: Sets self relocation status.
|
||||
|
||||
IsSelfRelocation(me)
|
||||
---Purpose: Returns true if the self relocation status is set.
|
||||
returns Boolean from Standard;
|
||||
|
||||
|
||||
-- Attribute relocation methods.
|
||||
-- ---------
|
||||
|
||||
SetRelocation(me : mutable;
|
||||
aSourceAttribute : TheSourceType;
|
||||
aTargetAttribute : TheTargetType);
|
||||
---Purpose: Sets the relocation value of <aSourceAttribute> to
|
||||
-- <aTargetAttribute>.
|
||||
|
||||
HasRelocation(me : mutable;
|
||||
aSourceAttribute : TheSourceType;
|
||||
aTargetAttribute : in out mutable TheTargetType)
|
||||
returns Boolean from Standard;
|
||||
---Purpose: Finds the relocation value of <aSourceAttribute>
|
||||
-- and returns it into <aTargetAttribute>.
|
||||
--
|
||||
-- If a value is found, returns True; False otherwise.
|
||||
|
||||
|
||||
-- Transient other types object relocation methods.
|
||||
-- ---------------------
|
||||
|
||||
SetOtherRelocation(me : mutable;
|
||||
aSource : TheOtherSourceType;
|
||||
aTarget : TheOtherTargetType);
|
||||
---Purpose: Sets the relocation value of <aSourceTransient> to
|
||||
-- <aTargetTransient>.
|
||||
|
||||
HasOtherRelocation(me : mutable;
|
||||
aSource : TheOtherSourceType;
|
||||
aTarget : in out mutable TheOtherTargetType)
|
||||
returns Boolean from Standard;
|
||||
---Purpose: Finds the relocation value of <aSource>
|
||||
-- and returns it into <aTarget>.
|
||||
--
|
||||
-- If a value is found, returns True; False otherwise.
|
||||
|
||||
|
||||
-- Try not to use the following methods...
|
||||
|
||||
AttributeTable(me : mutable)
|
||||
returns TheMapType;
|
||||
---Purpose: Returns <myAttributeTable> to be read or
|
||||
-- updated. Please, for a better security, avoid to
|
||||
-- use this method.
|
||||
--
|
||||
---C++: return &
|
||||
|
||||
OtherTable(me : mutable)
|
||||
returns TheMapType;
|
||||
---Purpose: Returns <myOtherTable> to be read or
|
||||
-- updated. Please, for a better security, avoid to
|
||||
-- use this method.
|
||||
--
|
||||
---C++: return &
|
||||
|
||||
|
||||
fields
|
||||
|
||||
myAttributeTable : TheMapType;
|
||||
myOtherTable : TheMapType;
|
||||
mySelfRelocation : Boolean from Standard;
|
||||
|
||||
end RelocationTable;
|
117
src/MDF/MDF_RelocationTable.gxx
Executable file
117
src/MDF/MDF_RelocationTable.gxx
Executable file
@@ -0,0 +1,117 @@
|
||||
// File: MDF_RelocationTable.gxx
|
||||
// -----------------------
|
||||
// Author: DAUTRY Philippe
|
||||
// <fid@fox.paris1.matra-dtv.fr>
|
||||
// Copyright: Matra Datavision 1997
|
||||
|
||||
// Version: 0.0
|
||||
// History: Version Date Purpose
|
||||
// 0.0 May 7 1997 Creation
|
||||
|
||||
|
||||
|
||||
#include TheSourceType_hxx
|
||||
#include TheTargetType_hxx
|
||||
#include TheOtherSourceType_hxx
|
||||
#include TheOtherTargetType_hxx
|
||||
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : MDF_RelocationTable
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
MDF_RelocationTable::MDF_RelocationTable(const Standard_Boolean theSelfRelocation):mySelfRelocation(theSelfRelocation) {}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetSelfRelocation
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void MDF_RelocationTable::SetSelfRelocation(const Standard_Boolean theStatus) {
|
||||
mySelfRelocation = theStatus;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsSelfRelocation
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean MDF_RelocationTable::IsSelfRelocation() const {
|
||||
return mySelfRelocation;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetRelocation
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void MDF_RelocationTable::SetRelocation
|
||||
(const TheSourceType& aSourceAttribute,
|
||||
const TheTargetType& aTargetAttribute)
|
||||
{ myAttributeTable.Bind (aSourceAttribute, aTargetAttribute); }
|
||||
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : HasRelocation
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean MDF_RelocationTable::HasRelocation
|
||||
(const TheSourceType& aSourceAttribute,
|
||||
TheTargetType& aTargetAttribute)
|
||||
{
|
||||
Standard_Boolean isFound = myAttributeTable.IsBound (aSourceAttribute);
|
||||
if (isFound) aTargetAttribute = TheTargetType::DownCast(myAttributeTable.Find(aSourceAttribute));
|
||||
else if (mySelfRelocation) isFound = Standard_True;
|
||||
return isFound;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : SetOtherRelocation
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void MDF_RelocationTable::SetOtherRelocation
|
||||
(const TheOtherSourceType& aSource,
|
||||
const TheOtherTargetType& aTarget)
|
||||
{ myOtherTable.Bind (aSource, aTarget); }
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : HasOtherRelocation
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean MDF_RelocationTable::HasOtherRelocation
|
||||
(const TheOtherSourceType& aSource,
|
||||
TheOtherTargetType& aTarget)
|
||||
{
|
||||
Standard_Boolean isFound = myOtherTable.IsBound (aSource);
|
||||
if (isFound) aTarget = myOtherTable.Find (aSource);
|
||||
else if (mySelfRelocation) isFound = Standard_True;
|
||||
return isFound;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : AttributeTable
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
TheMapType& MDF_RelocationTable::AttributeTable()
|
||||
{ return myAttributeTable; }
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : OtherTable
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
TheMapType& MDF_RelocationTable::OtherTable()
|
||||
{ return myOtherTable; }
|
||||
|
||||
|
39
src/MDF/MDF_TagSourceRetrievalDriver.cdl
Executable file
39
src/MDF/MDF_TagSourceRetrievalDriver.cdl
Executable file
@@ -0,0 +1,39 @@
|
||||
-- File: MDF_TagSourceRetrievalDriver.cdl
|
||||
-- Created: Thu Aug 7 17:14:38 1997
|
||||
-- Author: VAUTHIER Jean-Claude
|
||||
---Copyright: Matra Datavision 1997
|
||||
|
||||
|
||||
class TagSourceRetrievalDriver from MDF inherits ARDriver from MDF
|
||||
|
||||
---Purpose:
|
||||
|
||||
uses RRelocationTable from MDF,
|
||||
Attribute from PDF,
|
||||
Attribute from TDF,
|
||||
MessageDriver from CDM
|
||||
|
||||
is
|
||||
|
||||
|
||||
Create (theMessageDriver : MessageDriver from CDM) -- Version 0
|
||||
returns mutable TagSourceRetrievalDriver from MDF;
|
||||
|
||||
|
||||
VersionNumber(me) returns Integer from Standard;
|
||||
---Purpose: Returns the version number from which the driver
|
||||
-- is available: 0.
|
||||
|
||||
SourceType(me) returns Type from Standard;
|
||||
---Purpose: Returns the type: TagSource from PDF.
|
||||
|
||||
NewEmpty (me) returns mutable Attribute from TDF;
|
||||
|
||||
|
||||
Paste(me;
|
||||
Source : Attribute from PDF;
|
||||
Target : mutable Attribute from TDF;
|
||||
RelocTable : RRelocationTable from MDF);
|
||||
|
||||
end TagSourceRetrievalDriver;
|
||||
|
26
src/MDF/MDF_TagSourceRetrievalDriver.cxx
Executable file
26
src/MDF/MDF_TagSourceRetrievalDriver.cxx
Executable file
@@ -0,0 +1,26 @@
|
||||
#include <MDF_TagSourceRetrievalDriver.ixx>
|
||||
#include <PDF_TagSource.hxx>
|
||||
#include <TDF_TagSource.hxx>
|
||||
#include <CDM_MessageDriver.hxx>
|
||||
|
||||
MDF_TagSourceRetrievalDriver::MDF_TagSourceRetrievalDriver(const Handle(CDM_MessageDriver)& theMsgDriver):MDF_ARDriver(theMsgDriver)
|
||||
{
|
||||
}
|
||||
|
||||
Standard_Integer MDF_TagSourceRetrievalDriver::VersionNumber() const
|
||||
{ return 0; }
|
||||
|
||||
Handle(Standard_Type) MDF_TagSourceRetrievalDriver::SourceType() const
|
||||
{ return STANDARD_TYPE(PDF_TagSource); }
|
||||
|
||||
Handle(TDF_Attribute) MDF_TagSourceRetrievalDriver::NewEmpty() const
|
||||
{ return new TDF_TagSource; }
|
||||
|
||||
//void MDF_TagSourceRetrievalDriver::Paste(const Handle(PDF_Attribute)& Source,const Handle(TDF_Attribute)& Target,const Handle(MDF_RRelocationTable)& RelocTable) const
|
||||
void MDF_TagSourceRetrievalDriver::Paste(const Handle(PDF_Attribute)& Source,const Handle(TDF_Attribute)& Target,const Handle(MDF_RRelocationTable)& ) const
|
||||
{
|
||||
Handle(PDF_TagSource) S = Handle(PDF_TagSource)::DownCast (Source);
|
||||
Handle(TDF_TagSource) T = Handle(TDF_TagSource)::DownCast (Target);
|
||||
T->Set (S->Get ());
|
||||
}
|
||||
|
39
src/MDF/MDF_TagSourceStorageDriver.cdl
Executable file
39
src/MDF/MDF_TagSourceStorageDriver.cdl
Executable file
@@ -0,0 +1,39 @@
|
||||
-- File: MDF_TagSourceStorageDriver.cdl
|
||||
-- Created: Thu Aug 7 17:09:27 1997
|
||||
-- Author: VAUTHIER Jean-Claude
|
||||
---Copyright: Matra Datavision 1997
|
||||
|
||||
class TagSourceStorageDriver from MDF inherits ASDriver from MDF
|
||||
|
||||
---Purpose:
|
||||
|
||||
uses SRelocationTable from MDF,
|
||||
Attribute from TDF,
|
||||
Attribute from PDF,
|
||||
MessageDriver from CDM
|
||||
|
||||
|
||||
is
|
||||
|
||||
Create(theMessageDriver : MessageDriver from CDM)
|
||||
returns mutable TagSourceStorageDriver from MDF;
|
||||
|
||||
|
||||
VersionNumber(me) returns Integer from Standard;
|
||||
---Purpose: Returns the version number from which the driver
|
||||
-- is available: 0.
|
||||
|
||||
SourceType(me) returns Type from Standard;
|
||||
---Purpose: Returns the type: Integer from TDF.
|
||||
|
||||
NewEmpty (me) returns mutable Attribute from PDF;
|
||||
|
||||
|
||||
Paste(me;
|
||||
Source : Attribute from TDF;
|
||||
Target : mutable Attribute from PDF;
|
||||
RelocTable : SRelocationTable from MDF);
|
||||
|
||||
|
||||
end TagSourceStorageDriver;
|
||||
|
26
src/MDF/MDF_TagSourceStorageDriver.cxx
Executable file
26
src/MDF/MDF_TagSourceStorageDriver.cxx
Executable file
@@ -0,0 +1,26 @@
|
||||
#include <MDF_TagSourceStorageDriver.ixx>
|
||||
#include <PDF_TagSource.hxx>
|
||||
#include <TDF_TagSource.hxx>
|
||||
#include <CDM_MessageDriver.hxx>
|
||||
|
||||
MDF_TagSourceStorageDriver::MDF_TagSourceStorageDriver(const Handle(CDM_MessageDriver)& theMsgDriver):MDF_ASDriver(theMsgDriver)
|
||||
{
|
||||
}
|
||||
|
||||
Standard_Integer MDF_TagSourceStorageDriver::VersionNumber() const
|
||||
{ return 0; }
|
||||
|
||||
Handle(Standard_Type) MDF_TagSourceStorageDriver::SourceType() const
|
||||
{ return STANDARD_TYPE(TDF_TagSource); }
|
||||
|
||||
Handle(PDF_Attribute) MDF_TagSourceStorageDriver::NewEmpty() const
|
||||
{ return new PDF_TagSource (); }
|
||||
|
||||
//void MDF_TagSourceStorageDriver::Paste(const Handle(TDF_Attribute)& Source,const Handle(PDF_Attribute)& Target,const Handle(MDF_SRelocationTable)& RelocTable) const
|
||||
void MDF_TagSourceStorageDriver::Paste(const Handle(TDF_Attribute)& Source,const Handle(PDF_Attribute)& Target,const Handle(MDF_SRelocationTable)& ) const
|
||||
{
|
||||
Handle(TDF_TagSource) S = Handle(TDF_TagSource)::DownCast (Source);
|
||||
Handle(PDF_TagSource) T = Handle(PDF_TagSource)::DownCast (Target);
|
||||
T->Set (S->Get ());
|
||||
}
|
||||
|
82
src/MDF/MDF_Tool.cdl
Executable file
82
src/MDF/MDF_Tool.cdl
Executable file
@@ -0,0 +1,82 @@
|
||||
-- File: MDF_Tool.cdl
|
||||
-- --------------
|
||||
-- Author: DAUTRY Philippe
|
||||
-- <fid@fox.paris1.matra-dtv.fr>
|
||||
---Copyright: MATRA DATAVISION 1997
|
||||
|
||||
---Version: 0.0
|
||||
---History: Version Date Purpose
|
||||
-- 0.0 Mar 13 1997 Creation
|
||||
|
||||
|
||||
class Tool from MDF
|
||||
|
||||
---Purpose: A tool to translate...
|
||||
|
||||
uses
|
||||
|
||||
Label from TDF,
|
||||
Data from TDF,
|
||||
Data from PDF,
|
||||
HAttributeArray1 from PDF,
|
||||
TypeARDriverMap from MDF,
|
||||
TypeASDriverMap from MDF,
|
||||
ARDriverTable from MDF,
|
||||
ASDriverTable from MDF,
|
||||
RRelocationTable from MDF,
|
||||
SRelocationTable from MDF,
|
||||
Integer from Standard,
|
||||
HArray1OfInteger from PColStd,
|
||||
TransientPersistentMap from PTColStd
|
||||
|
||||
-- raises
|
||||
|
||||
is
|
||||
|
||||
WriteLabels(myclass;
|
||||
aSource : Data from TDF;
|
||||
aTarget : Data from PDF;
|
||||
aDriverMap : TypeASDriverMap from MDF;
|
||||
aReloc : SRelocationTable from MDF);
|
||||
---Purpose: Writes the labels with empty attributes.
|
||||
|
||||
WriteLabels(myclass;
|
||||
aSourceLab : Label from TDF;
|
||||
theLabels : HArray1OfInteger from PColStd;
|
||||
theAttributes : HAttributeArray1 from PDF;
|
||||
aDriverMap : TypeASDriverMap from MDF;
|
||||
aReloc : SRelocationTable from MDF;
|
||||
labAlloc : in out Integer from Standard;
|
||||
attAlloc : in out Integer from Standard);
|
||||
---Purpose: Used for recursivity.
|
||||
|
||||
WriteAttributes(myclass;
|
||||
aDriverMap : TypeASDriverMap from MDF;
|
||||
aReloc : SRelocationTable from MDF);
|
||||
---Purpose: Writes attributes content.
|
||||
|
||||
|
||||
|
||||
ReadLabels(myclass;
|
||||
aSource : Data from PDF;
|
||||
aTarget : Data from TDF;
|
||||
aDriverMap : TypeARDriverMap from MDF;
|
||||
aReloc : RRelocationTable from MDF);
|
||||
---Purpose: Reads the labels abd adds empty attributes to them.
|
||||
|
||||
ReadLabels(myclass;
|
||||
anIns : in out Label from TDF;
|
||||
theLabels : HArray1OfInteger from PColStd;
|
||||
theAttributes : HAttributeArray1 from PDF;
|
||||
aDriverMap : TypeARDriverMap from MDF;
|
||||
aReloc : RRelocationTable from MDF;
|
||||
labRead : in out Integer from Standard;
|
||||
attRead : in out Integer from Standard);
|
||||
---Purpose: Used for recursivity.
|
||||
|
||||
ReadAttributes(myclass;
|
||||
aDriverMap : TypeARDriverMap from MDF;
|
||||
aReloc : RRelocationTable from MDF);
|
||||
---Purpose: Reads attributes content and paste them.
|
||||
|
||||
end Tool;
|
405
src/MDF/MDF_Tool.cxx
Executable file
405
src/MDF/MDF_Tool.cxx
Executable file
@@ -0,0 +1,405 @@
|
||||
// File: MDF_Tool.cxx
|
||||
// --------------
|
||||
// Author: DAUTRY Philippe
|
||||
// <fid@fox.paris1.matra-dtv.fr>
|
||||
// Copyright: Matra Datavision 1997
|
||||
|
||||
// Version: 0.0
|
||||
// History: Version Date Purpose
|
||||
// 0.0 Mar 13 1997 Creation
|
||||
|
||||
|
||||
|
||||
#include <MDF_Tool.ixx>
|
||||
|
||||
#include <MDF_ARDriver.hxx>
|
||||
#include <MDF_ASDriver.hxx>
|
||||
#include <MDF_RRelocationTable.hxx>
|
||||
#include <MDF_SRelocationTable.hxx>
|
||||
|
||||
#include <PDF_Attribute.hxx>
|
||||
#include <PDF_HAttributeArray1.hxx>
|
||||
|
||||
#include <TDF_Attribute.hxx>
|
||||
#include <TDF_AttributeIterator.hxx>
|
||||
#include <TDF_ListIteratorOfAttributeList.hxx>
|
||||
#include <TDF_AttributeList.hxx>
|
||||
#include <TDF_ChildIterator.hxx>
|
||||
#include <TDF_Label.hxx>
|
||||
#include <TDF_Tool.hxx>
|
||||
|
||||
#include <TColStd_HArray1OfInteger.hxx>
|
||||
|
||||
#include <PTColStd_DataMapIteratorOfPersistentTransientMap.hxx>
|
||||
#include <PTColStd_DataMapIteratorOfTransientPersistentMap.hxx>
|
||||
#include <PTColStd_PersistentTransientMap.hxx>
|
||||
#include <PTColStd_TransientPersistentMap.hxx>
|
||||
|
||||
#include <Standard_GUID.hxx>
|
||||
|
||||
#ifdef DEB
|
||||
#include <Standard_ConstructionError.hxx>
|
||||
#endif
|
||||
|
||||
#define DeclareAndSpeedCast(V,T,Vdown) Handle(T) Vdown = *((Handle(T)*)& V)
|
||||
#define DeclareConstAndSpeedCast(V,T,Vdown) const Handle(T)& Vdown = (Handle(T)&) V
|
||||
#define SpeedCast(V,T,Vdown) Vdown = *((Handle(T)*)& V)
|
||||
|
||||
#undef DEB_MDF_TOOL
|
||||
|
||||
// Persistent structure:
|
||||
//
|
||||
// Label Array Item
|
||||
//
|
||||
// (Tag; NbOfAttributes; NbOfChildren)
|
||||
//
|
||||
// The attributes are stored sequencially in the Attribute Array.
|
||||
// The children of a label are stored recursively after the label item itself.
|
||||
|
||||
|
||||
// W W RRRRR III TTTTT EEEEE
|
||||
// W W R R I T E
|
||||
// W W R R I T E
|
||||
// W W W RRRRR I T EEE
|
||||
// WW WW R R I T E
|
||||
// W W R R III T EEEEE
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : MDF_NbAttributesWithDriver
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
static Standard_Integer MDF_NbAttributesWithDriver
|
||||
(const TDF_Label& aLabel,
|
||||
const MDF_TypeASDriverMap& aDriverMap)
|
||||
{
|
||||
Standard_Integer n = 0;
|
||||
for (TDF_AttributeIterator itr1(aLabel); itr1.More(); itr1.Next())
|
||||
if (aDriverMap.IsBound(itr1.Value()->DynamicType())) ++n;
|
||||
for (TDF_ChildIterator itr2(aLabel); itr2.More(); itr2.Next())
|
||||
n += MDF_NbAttributesWithDriver(itr2.Value(),aDriverMap);
|
||||
return n;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : WriteLabels
|
||||
//purpose : TRANSIENT -> PERSISTENT;
|
||||
// writes the arrays contents with empty attributes.
|
||||
//=======================================================================
|
||||
|
||||
void MDF_Tool::WriteLabels
|
||||
(const Handle(TDF_Data)& aSource,
|
||||
const Handle(PDF_Data)& aTarget,
|
||||
const MDF_TypeASDriverMap& aDriverMap,
|
||||
const Handle(MDF_SRelocationTable)& aReloc)
|
||||
{
|
||||
TDF_Label aSourceLab = aSource->Root();
|
||||
|
||||
// Label array sizing.
|
||||
Handle(PColStd_HArray1OfInteger) theLabels;
|
||||
Standard_Integer nbLab = TDF_Tool::NbLabels(aSourceLab);
|
||||
if (nbLab) {
|
||||
theLabels = new PColStd_HArray1OfInteger(1,nbLab*3);
|
||||
aTarget->Labels(theLabels);
|
||||
}
|
||||
// In fact, some labels whithout attributes attached to themselves
|
||||
// nor to their descendants will not be kept.
|
||||
|
||||
// Attribute array sizing.
|
||||
Handle(PDF_HAttributeArray1) theAttributes;
|
||||
Standard_Integer nbAtt = 0;
|
||||
if (nbLab) {
|
||||
nbAtt = MDF_NbAttributesWithDriver(aSourceLab,aDriverMap);
|
||||
if (nbAtt) {
|
||||
theAttributes = new PDF_HAttributeArray1(1,nbAtt);
|
||||
aTarget->Attributes(theAttributes);
|
||||
}
|
||||
// In fact, some attributes will not be kept by the filter.
|
||||
}
|
||||
|
||||
if (nbLab && nbAtt) {
|
||||
// labAlloc & attAlloc content the last used cell address.
|
||||
Standard_Integer labAlloc = 0;
|
||||
Standard_Integer attAlloc = 0;
|
||||
MDF_Tool::WriteLabels(aSourceLab, aTarget->Labels(), aTarget->Attributes(),
|
||||
aDriverMap, aReloc, labAlloc, attAlloc);
|
||||
|
||||
// Label array REsizing.
|
||||
if (labAlloc < theLabels->Upper()) {
|
||||
#ifdef DEB
|
||||
cout<<"MDF_Tool::WriteLabels LABEL array resizing from "<<theLabels->Upper()<<" to "<<labAlloc<<endl;
|
||||
#endif
|
||||
Handle(PColStd_HArray1OfInteger) newLabels =
|
||||
new PColStd_HArray1OfInteger(1,labAlloc);
|
||||
for (Standard_Integer i = 1; i <= labAlloc; ++i)
|
||||
newLabels->SetValue(i,theLabels->Value(i));
|
||||
aTarget->Labels(newLabels);
|
||||
}
|
||||
|
||||
|
||||
// Attribute array REsizing.
|
||||
if (attAlloc < theAttributes->Upper()) {
|
||||
#ifdef DEB
|
||||
cout<<"MDF_Tool::WriteLabels ATTRIBUTES array resizing from "<<theAttributes->Upper()<<" to "<<attAlloc<<endl;
|
||||
#endif
|
||||
Handle(PDF_HAttributeArray1) newAttributes =
|
||||
new PDF_HAttributeArray1(1,attAlloc);
|
||||
for (Standard_Integer i = 1; i <= attAlloc; ++i)
|
||||
newAttributes->SetValue(i,theAttributes->Value(i));
|
||||
aTarget->Attributes(newAttributes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : WriteLabels
|
||||
//purpose : TRANSIENT -> PERSISTENT;
|
||||
// writes the arrays contents with empty attributes.
|
||||
//=======================================================================
|
||||
|
||||
void MDF_Tool::WriteLabels
|
||||
(const TDF_Label& aSourceLab,
|
||||
const Handle(PColStd_HArray1OfInteger)& theLabels,
|
||||
const Handle(PDF_HAttributeArray1)& theAttributes,
|
||||
const MDF_TypeASDriverMap& aDriverMap,
|
||||
const Handle(MDF_SRelocationTable)& aReloc,
|
||||
Standard_Integer& labAlloc,
|
||||
Standard_Integer& attAlloc)
|
||||
{
|
||||
// Cells allocation.
|
||||
Standard_Integer labIndex = labAlloc;
|
||||
labAlloc += 3;
|
||||
Standard_Integer attIndex = attAlloc; // Backup the value.
|
||||
|
||||
// Tag.
|
||||
theLabels->SetValue(++labIndex,aSourceLab.Tag());
|
||||
|
||||
Standard_Integer count = 0;
|
||||
|
||||
// Attributes.
|
||||
Handle(PDF_Attribute) pAtt;
|
||||
TDF_AttributeIterator itr1(aSourceLab);
|
||||
for ( ; itr1.More(); itr1.Next()) {
|
||||
const Handle(TDF_Attribute)& tAtt = itr1.Value();
|
||||
const Handle(Standard_Type)& type = tAtt->DynamicType();
|
||||
if (aDriverMap.IsBound(type)) {
|
||||
++count;
|
||||
const Handle(MDF_ASDriver)& driver = aDriverMap.Find(type);
|
||||
pAtt = driver->NewEmpty();
|
||||
theAttributes->SetValue(++attAlloc,pAtt);
|
||||
aReloc->SetRelocation(tAtt,pAtt);
|
||||
}
|
||||
}
|
||||
theLabels->SetValue(++labIndex,count); // Nb Attributes.
|
||||
count = 0;
|
||||
|
||||
// Label Children.
|
||||
Standard_Integer childLabIndex;
|
||||
TDF_ChildIterator itr2(aSourceLab);
|
||||
for ( ; itr2.More(); itr2.Next()) {
|
||||
childLabIndex = labAlloc;
|
||||
const TDF_Label& label = itr2.Value();
|
||||
MDF_Tool::WriteLabels(label, theLabels, theAttributes,
|
||||
aDriverMap, aReloc, labAlloc, attAlloc);
|
||||
if (childLabIndex < labAlloc) ++count;
|
||||
}
|
||||
|
||||
#ifdef DEB_MDF_TOOL
|
||||
aSourceLab.EntryDump(cout);
|
||||
cout<<" Count="<<count<<" attIndex="<<attIndex<<" attAlloc="<<attAlloc;
|
||||
#endif
|
||||
if (attIndex < attAlloc) { // At least one attribute has been stored.
|
||||
theLabels->SetValue(++labIndex,count); // Nb Children.
|
||||
}
|
||||
else {
|
||||
labAlloc -= 2;
|
||||
theLabels->SetValue(labAlloc--,0); // To clean the tag value.
|
||||
#ifdef DEB_MDF_TOOL
|
||||
cout<<" <== Cleared";
|
||||
#endif
|
||||
}
|
||||
#ifdef DEB_MDF_TOOL
|
||||
cout<<endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : WriteAttributes
|
||||
//purpose : TRANSIENT -> PERSISTENT
|
||||
// writes the persistent attributes content.
|
||||
//=======================================================================
|
||||
|
||||
void MDF_Tool::WriteAttributes
|
||||
(const MDF_TypeASDriverMap& aDriverMap,
|
||||
const Handle(MDF_SRelocationTable)& aReloc)
|
||||
{
|
||||
// Iterer sur la map pour traduire si target.IsNull().
|
||||
const PTColStd_TransientPersistentMap& attMap = aReloc->AttributeTable();
|
||||
PTColStd_DataMapIteratorOfTransientPersistentMap itr(attMap);
|
||||
Handle(PDF_Attribute) pAtt;
|
||||
for ( ; itr.More(); itr.Next()) {
|
||||
DeclareConstAndSpeedCast(itr.Key(),TDF_Attribute,tAtt);
|
||||
const Handle(Standard_Type)& type = tAtt->DynamicType();
|
||||
if (aDriverMap.IsBound(type)) {
|
||||
SpeedCast(itr.Value(),PDF_Attribute,pAtt);
|
||||
const Handle(MDF_ASDriver)& driver = aDriverMap.Find(type);
|
||||
driver->Paste(tAtt, pAtt, aReloc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// RRRRR EEEEE A DDDD
|
||||
// R R E A A D D
|
||||
// R R E A A D D
|
||||
// RRRRR EEE AAAAA D D
|
||||
// R R E A A D D
|
||||
// R R EEEEE A A DDDD
|
||||
|
||||
//=======================================================================
|
||||
//function : ReadLabels
|
||||
//purpose : PERSISTENT -> TRANSIENT;
|
||||
// reads the arrays contents and build the objects
|
||||
// with empty attributes.
|
||||
//=======================================================================
|
||||
|
||||
void MDF_Tool::ReadLabels
|
||||
(const Handle(PDF_Data)& aSource,
|
||||
const Handle(TDF_Data)& aTarget,
|
||||
const MDF_TypeARDriverMap& aDriverMap,
|
||||
const Handle(MDF_RRelocationTable)& aReloc)
|
||||
{
|
||||
// Root label creation.
|
||||
//TDF_Insertor ins(aTarget->Root());
|
||||
TDF_Label ins = aTarget->Root();
|
||||
|
||||
// labAlloc & attAlloc content the last used cell address.
|
||||
Standard_Integer labRead = 1; // Root already used above.
|
||||
Standard_Integer attRead = 0;
|
||||
MDF_Tool::ReadLabels(ins, aSource->Labels(), aSource->Attributes(),
|
||||
aDriverMap, aReloc, labRead, attRead);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : ReadLabels
|
||||
//purpose : PERSISTENT -> TRANSIENT;
|
||||
// Reads the arrays contents and build the objects
|
||||
// with empty attributes.
|
||||
//=======================================================================
|
||||
|
||||
void MDF_Tool::ReadLabels
|
||||
(TDF_Label& anIns,
|
||||
const Handle(PColStd_HArray1OfInteger)& theLabels,
|
||||
const Handle(PDF_HAttributeArray1)& theAttributes,
|
||||
const MDF_TypeARDriverMap& aDriverMap,
|
||||
const Handle(MDF_RRelocationTable)& aReloc,
|
||||
Standard_Integer& labRead,
|
||||
Standard_Integer& attRead)
|
||||
{
|
||||
// Empty attributes creation.
|
||||
Handle(TDF_Attribute) tAtt;
|
||||
// Number of attributes.
|
||||
Standard_Integer nbAtt = theLabels->Value(++labRead);
|
||||
for (Standard_Integer iAtt = 1 ; iAtt <= nbAtt; iAtt++) {
|
||||
const Handle(PDF_Attribute)& pAtt = theAttributes->Value(++attRead);
|
||||
if (pAtt.IsNull()) {
|
||||
// This case occurs only if somebody modified manually the file.
|
||||
tAtt.Nullify();
|
||||
}
|
||||
else {
|
||||
const Standard_GUID anEmptyID;
|
||||
Handle(MDF_RRelocationTable) anEmptyRelocaTable = new MDF_RRelocationTable(Standard_True);
|
||||
const Handle(Standard_Type)& type = pAtt->DynamicType();
|
||||
if (aDriverMap.IsBound(type)) {
|
||||
const Handle(MDF_ARDriver)& driver = aDriverMap.Find(type);
|
||||
tAtt = driver->NewEmpty();
|
||||
if (tAtt->ID() == anEmptyID) driver->Paste(pAtt, tAtt, anEmptyRelocaTable);
|
||||
anIns.AddAttribute(tAtt);
|
||||
}
|
||||
aReloc->SetRelocation(pAtt,tAtt);
|
||||
}
|
||||
}
|
||||
|
||||
// Label Children creation.
|
||||
Standard_Integer tag;
|
||||
// Number of labels.
|
||||
Standard_Integer nbLab = theLabels->Value(++labRead);
|
||||
for (Standard_Integer iLab = 1 ; iLab <= nbLab; iLab++) {
|
||||
// Label creation.
|
||||
tag = theLabels->Value(++labRead);
|
||||
|
||||
|
||||
//TDF_Insertor ins(anIns,tag);
|
||||
TDF_Label ins = anIns.FindChild(tag,Standard_True);
|
||||
|
||||
MDF_Tool::ReadLabels(ins, theLabels, theAttributes,
|
||||
aDriverMap, aReloc, labRead, attRead);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : ReadAttributes
|
||||
//purpose : PERSISTENT -> TRANSIENT
|
||||
// Reads the persistent attributes content.
|
||||
//=======================================================================
|
||||
|
||||
void MDF_Tool::ReadAttributes
|
||||
(const MDF_TypeARDriverMap& aDriverMap,
|
||||
const Handle(MDF_RRelocationTable)& aReloc)
|
||||
{
|
||||
// cout<<"MDF_Tool::ReadAttributes ..."<<endl;
|
||||
// Iterer sur la map pour traduire si target.IsNull().
|
||||
const PTColStd_PersistentTransientMap& attMap = aReloc->AttributeTable();
|
||||
PTColStd_DataMapIteratorOfPersistentTransientMap itr(attMap);
|
||||
Handle(TDF_Attribute) tAtt;
|
||||
for ( ; itr.More(); itr.Next()) {
|
||||
DeclareConstAndSpeedCast(itr.Key(),PDF_Attribute,pAtt);
|
||||
if (!pAtt.IsNull()) { // See above...
|
||||
const Handle(Standard_Type)& type = pAtt->DynamicType();
|
||||
if (aDriverMap.IsBound(type)) {
|
||||
SpeedCast(itr.Value(),TDF_Attribute,tAtt);
|
||||
const Handle(MDF_ARDriver)& driver = aDriverMap.Find(type);
|
||||
driver->Paste(pAtt, tAtt, aReloc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TDF_AttributeList attList;
|
||||
for (itr.Initialize(attMap); itr.More(); itr.Next()) {
|
||||
SpeedCast(itr.Value(),TDF_Attribute,tAtt);
|
||||
attList.Append(tAtt);
|
||||
}
|
||||
|
||||
TDF_ListIteratorOfAttributeList itr2;
|
||||
Standard_Boolean noDeadLock = Standard_True;
|
||||
Standard_Integer nbAtt = attList.Extent();
|
||||
while (noDeadLock && (nbAtt != 0)) {
|
||||
itr2.Initialize(attList);
|
||||
while (itr2.More()) {
|
||||
if (!itr2.Value()->AfterRetrieval())
|
||||
itr2.Next();
|
||||
else
|
||||
attList.Remove(itr2);
|
||||
}
|
||||
noDeadLock = (nbAtt > attList.Extent());
|
||||
nbAtt = attList.Extent();
|
||||
}
|
||||
|
||||
if (!noDeadLock) {
|
||||
#ifdef DEB
|
||||
cout<<"AfterRetrieval(): dead lock between these attributes:"<<endl;
|
||||
for (itr2.Initialize(attList); itr2.More(); itr2.Next())
|
||||
cout<<"Attribute type = "<<itr2.Value()->DynamicType()->Name()<<endl;;
|
||||
Standard_ConstructionError::Raise("AfterRetrieval: dead lock.");
|
||||
#endif
|
||||
for (itr2.Initialize(attList); itr2.More(); itr2.Next())
|
||||
itr2.Value()->AfterRetrieval(Standard_True);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user