1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-29 14:00:49 +03:00

Integration of OCCT 6.5.0 from SVN

This commit is contained in:
bugmaster
2011-03-16 07:30:28 +00:00
committed by bugmaster
parent 4903637061
commit 7fd59977df
16375 changed files with 3882564 additions and 0 deletions

View File

@@ -0,0 +1,62 @@
// File: BinTObjDrivers.cxx
// Created: 24.11.04 11:22:17
// Author: Michael SAZONOV
// Copyright: Open CASCADE 2007
// The original implementation Copyright: (C) RINA S.p.A
#include <BinLDrivers.hxx>
#include <BinMDF_ADriverTable.hxx>
#include <BinTObjDrivers.hxx>
#include <BinTObjDrivers_DocumentStorageDriver.hxx>
#include <BinTObjDrivers_DocumentRetrievalDriver.hxx>
#include <BinTObjDrivers_IntSparseArrayDriver.hxx>
#include <BinTObjDrivers_ModelDriver.hxx>
#include <BinTObjDrivers_ObjectDriver.hxx>
#include <BinTObjDrivers_ReferenceDriver.hxx>
#include <BinTObjDrivers_XYZDriver.hxx>
#include <Plugin_Macro.hxx>
// avoid warnings on 'extern "C"' functions returning C++ classes
#ifdef WNT
#pragma warning(4:4190)
#endif
static Standard_GUID BinStorageDriver ("f78ff4a2-a779-11d5-aab4-0050044b1af1");
static Standard_GUID BinRetrievalDriver("f78ff4a3-a779-11d5-aab4-0050044b1af1");
Handle(Standard_Transient) BinTObjDrivers::Factory(const Standard_GUID& aGUID)
{
if(aGUID == BinStorageDriver)
{
cout << "BinTObjDrivers : Storage Plugin" << endl;
static Handle(BinTObjDrivers_DocumentStorageDriver) model_sd
= new BinTObjDrivers_DocumentStorageDriver;
return model_sd;
}
if(aGUID == BinRetrievalDriver)
{
cout << "BinTObjDrivers : Retrieval Plugin" << endl;
static Handle (BinTObjDrivers_DocumentRetrievalDriver) model_rd
= new BinTObjDrivers_DocumentRetrievalDriver;
return model_rd;
}
return BinLDrivers::Factory (aGUID);
}
//=======================================================================
//function : AddDrivers
//purpose :
//=======================================================================
void BinTObjDrivers::AddDrivers (const Handle(BinMDF_ADriverTable)& aDriverTable,
const Handle(CDM_MessageDriver)& aMsgDrv)
{
aDriverTable -> AddDriver (new BinTObjDrivers_ModelDriver (aMsgDrv));
aDriverTable -> AddDriver (new BinTObjDrivers_ObjectDriver (aMsgDrv));
aDriverTable -> AddDriver (new BinTObjDrivers_ReferenceDriver (aMsgDrv));
aDriverTable -> AddDriver (new BinTObjDrivers_XYZDriver (aMsgDrv));
aDriverTable -> AddDriver (new BinTObjDrivers_IntSparseArrayDriver (aMsgDrv));
}
PLUGIN(BinTObjDrivers)

View File

@@ -0,0 +1,38 @@
// File: BinTObjDrivers.hxx
// Created: 24.11.04 11:23:12
// Author: Michael SAZONOV
// Copyright: Open CASCADE 2007
// The original implementation Copyright: (C) RINA S.p.A
#ifndef BinTObjDrivers_HeaderFile
#define BinTObjDrivers_HeaderFile
#include <TObj_Common.hxx>
#include <Standard_GUID.hxx>
class Handle(BinMDF_ADriverTable);
class Handle(CDM_MessageDriver);
// Class for registering storage/retrieval drivers for TObj Bin persistence
//
class BinTObjDrivers
{
public:
// ---------- PUBLIC METHODS ----------
Standard_EXPORT static Handle(Standard_Transient) Factory
(const Standard_GUID& aGUID);
// Returns a driver corresponding to <aGUID>. Used for plugin.
Standard_EXPORT static void AddDrivers
(const Handle(BinMDF_ADriverTable)& aDriverTable,
const Handle(CDM_MessageDriver)& aMsgDrv);
};
#endif
#ifdef _MSC_VER
#pragma once
#endif

View File

@@ -0,0 +1,42 @@
// File: BinTObjDrivers_DocumentRetrievalDriver.cxx
// Created: 24.11.04 11:24:07
// Author: Michael SAZONOV
// Copyright: Open CASCADE 2007
// The original implementation Copyright: (C) RINA S.p.A
#include <BinTObjDrivers_DocumentRetrievalDriver.hxx>
#include <BinLDrivers.hxx>
#include <BinTObjDrivers.hxx>
IMPLEMENT_STANDARD_HANDLE (BinTObjDrivers_DocumentRetrievalDriver,
BinLDrivers_DocumentRetrievalDriver)
IMPLEMENT_STANDARD_RTTIEXT(BinTObjDrivers_DocumentRetrievalDriver,
BinLDrivers_DocumentRetrievalDriver)
//=======================================================================
//function : BinTObjDrivers_DocumentRetrievalDriver
//purpose :
//=======================================================================
BinTObjDrivers_DocumentRetrievalDriver::BinTObjDrivers_DocumentRetrievalDriver()
: BinLDrivers_DocumentRetrievalDriver ()
{
}
//=======================================================================
//function : AttributeDrivers
//purpose :
//=======================================================================
Handle(BinMDF_ADriverTable)
BinTObjDrivers_DocumentRetrievalDriver::AttributeDrivers
(const Handle(CDM_MessageDriver)& theMsgDrv)
{
// Standard drivers
Handle(BinMDF_ADriverTable) aTable = BinLDrivers::AttributeDrivers (theMsgDrv);
// Native drivers
BinTObjDrivers::AddDrivers(aTable, theMsgDrv);
return aTable;
}

View File

@@ -0,0 +1,44 @@
// File: BinTObjDrivers_DocumentRetrievalDriver.hxx
// Created: 24.11.04 11:24:29
// Author: Michael SAZONOV
// Copyright: Open CASCADE 2007
// The original implementation Copyright: (C) RINA S.p.A
#ifndef BinTObjDrivers_DocumentRetrievalDriver_HeaderFile
#define BinTObjDrivers_DocumentRetrievalDriver_HeaderFile
#include <TObj_Common.hxx>
#include <BinLDrivers_DocumentRetrievalDriver.hxx>
#include <Handle_BinMDF_ADriverTable.hxx>
class Handle(CDM_MessageDriver);
// Retrieval driver of a TObj Bin document
//
class BinTObjDrivers_DocumentRetrievalDriver :
public BinLDrivers_DocumentRetrievalDriver
{
public:
// ---------- PUBLIC METHODS ----------
Standard_EXPORT BinTObjDrivers_DocumentRetrievalDriver ();
// Constructor
Standard_EXPORT virtual Handle(BinMDF_ADriverTable) AttributeDrivers
(const Handle(CDM_MessageDriver)& theMsgDriver);
public:
// Declaration of CASCADE RTTI
DEFINE_STANDARD_RTTI (BinTObjDrivers_DocumentRetrievalDriver)
};
// Definition of HANDLE object using Standard_DefineHandle.hxx
DEFINE_STANDARD_HANDLE (BinTObjDrivers_DocumentRetrievalDriver,
BinLDrivers_DocumentRetrievalDriver)
#endif
#ifdef _MSC_VER
#pragma once
#endif

View File

@@ -0,0 +1,42 @@
// File: BinTObjDrivers_DocumentStorageDriver.cxx
// Created: 24.11.04 11:25:58
// Author: Michael SAZONOV
// Copyright: Open CASCADE 2007
// The original implementation Copyright: (C) RINA S.p.A
#include <BinTObjDrivers_DocumentStorageDriver.hxx>
#include <BinLDrivers.hxx>
#include <BinTObjDrivers.hxx>
IMPLEMENT_STANDARD_HANDLE (BinTObjDrivers_DocumentStorageDriver,
BinLDrivers_DocumentStorageDriver)
IMPLEMENT_STANDARD_RTTIEXT(BinTObjDrivers_DocumentStorageDriver,
BinLDrivers_DocumentStorageDriver)
//=======================================================================
//function : BinTObjDrivers_DocumentStorageDriver
//purpose :
//=======================================================================
BinTObjDrivers_DocumentStorageDriver::BinTObjDrivers_DocumentStorageDriver ()
: BinLDrivers_DocumentStorageDriver ()
{
}
//=======================================================================
//function : AttributeDrivers
//purpose :
//=======================================================================
Handle(BinMDF_ADriverTable)
BinTObjDrivers_DocumentStorageDriver::AttributeDrivers
(const Handle(CDM_MessageDriver)& theMsgDrv)
{
// Standard drivers
Handle(BinMDF_ADriverTable) aTable = BinLDrivers::AttributeDrivers (theMsgDrv);
// Native drivers
BinTObjDrivers::AddDrivers(aTable, theMsgDrv);
return aTable;
}

View File

@@ -0,0 +1,44 @@
// File: BinTObjDrivers_DocumentStorageDriver.hxx
// Created: 24.11.04 11:25:26
// Author: Michael SAZONOV
// Copyright: Open CASCADE 2007
// The original implementation Copyright: (C) RINA S.p.A
#ifndef BinTObjDrivers_DocumentStorageDriver_HeaderFile
#define BinTObjDrivers_DocumentStorageDriver_HeaderFile
#include <TObj_Common.hxx>
#include <BinLDrivers_DocumentStorageDriver.hxx>
#include <Handle_BinMDF_ADriverTable.hxx>
class Handle(CDM_MessageDriver);
// Block of comments describing class BinTObjDrivers_DocumentStorageDriver
//
class BinTObjDrivers_DocumentStorageDriver :
public BinLDrivers_DocumentStorageDriver
{
public:
// ---------- PUBLIC METHODS ----------
Standard_EXPORT BinTObjDrivers_DocumentStorageDriver();
// Constructor
Standard_EXPORT virtual Handle(BinMDF_ADriverTable) AttributeDrivers
(const Handle(CDM_MessageDriver)& theMsgDriver);
public:
// Declaration of CASCADE RTTI
DEFINE_STANDARD_RTTI (BinTObjDrivers_DocumentStorageDriver)
};
// Definition of HANDLE object using Standard_DefineHandle.hxx
DEFINE_STANDARD_HANDLE (BinTObjDrivers_DocumentStorageDriver,
BinLDrivers_DocumentStorageDriver)
#endif
#ifdef _MSC_VER
#pragma once
#endif

View File

@@ -0,0 +1,104 @@
// File : BinTObjDrivers_IntSparseArrayDriver.cxx
// Created : 30.03.2007
// Author : Michael SAZONOV
// Copyright: Open CASCADE 2007
// The original implementation Copyright: (C) RINA S.p.A
#include <BinTObjDrivers_IntSparseArrayDriver.hxx>
#include <CDM_MessageDriver.hxx>
#include <TDF_Attribute.hxx>
#include <BinObjMgt_Persistent.hxx>
#include <TObj_TIntSparseArray.hxx>
#include <TObj_Assistant.hxx>
#include <TCollection_AsciiString.hxx>
#include <TDF_Tool.hxx>
IMPLEMENT_STANDARD_HANDLE(BinTObjDrivers_IntSparseArrayDriver,BinMDF_ADriver)
IMPLEMENT_STANDARD_RTTIEXT(BinTObjDrivers_IntSparseArrayDriver,BinMDF_ADriver)
//=======================================================================
//function : BinTObjDrivers_IntSparseArrayDriver
//purpose : constructor
//=======================================================================
BinTObjDrivers_IntSparseArrayDriver::BinTObjDrivers_IntSparseArrayDriver
(const Handle(CDM_MessageDriver)& theMessageDriver)
: BinMDF_ADriver( theMessageDriver, NULL)
{
}
//=======================================================================
//function : NewEmpty
//purpose : Creates a new attribute
//=======================================================================
Handle(TDF_Attribute) BinTObjDrivers_IntSparseArrayDriver::NewEmpty() const
{
return new TObj_TIntSparseArray;
}
//=======================================================================
//function : Paste
//purpose : Retrieve. Translate the contents of <theSource> and put it
// into <theTarget>.
//=======================================================================
Standard_Boolean BinTObjDrivers_IntSparseArrayDriver::Paste
(const BinObjMgt_Persistent& theSource,
const Handle(TDF_Attribute)& theTarget,
BinObjMgt_RRelocationTable&) const
{
Handle(TObj_TIntSparseArray) aTarget =
Handle(TObj_TIntSparseArray)::DownCast(theTarget);
// get pairs (ID, value) while ID != 0
Standard_Integer anId;
if (!(theSource >> anId) || anId < 0)
return Standard_False;
while (anId)
{
Standard_Integer aValue;
if (!(theSource >> aValue) || aValue <= 0)
return Standard_False;
// store the value in the target array
aTarget->SetDoBackup (Standard_False);
aTarget->SetValue (anId, aValue);
aTarget->SetDoBackup (Standard_True);
// get next ID
if (!(theSource >> anId) || anId < 0)
return Standard_False;
}
return Standard_True;
}
//=======================================================================
//function : Paste
//purpose : Store. Translate the contents of <theSource> and put it
// into <theTarget>
//=======================================================================
void BinTObjDrivers_IntSparseArrayDriver::Paste
(const Handle(TDF_Attribute)& theSource,
BinObjMgt_Persistent& theTarget,
BinObjMgt_SRelocationTable&) const
{
Handle(TObj_TIntSparseArray) aSource =
Handle(TObj_TIntSparseArray)::DownCast (theSource);
// put only non-null values as pairs (ID, value)
// terminate the list by ID=0
TObj_TIntSparseArray::Iterator anIt = aSource->GetIterator();
for ( ; anIt.More() ; anIt.Next() )
{
Standard_Integer aValue = anIt.Value();
if (aValue == 0)
continue;
// store ID and value
theTarget << (Standard_Integer) anIt.Index() << aValue;
}
// zero indicates end of the entities
theTarget << (Standard_Integer) 0;
}

View File

@@ -0,0 +1,51 @@
// File : BinTObjDrivers_IntSparseArrayDriver.hxx
// Created : 30.03.2007
// Author : Michael SAZONOV
// Copyright: Open CASCADE 2007
// The original implementation Copyright: (C) RINA S.p.A
#ifndef BinTObjDrivers_IntSparseArrayDriver_HeaderFile
#define BinTObjDrivers_IntSparseArrayDriver_HeaderFile
#include <TObj_Common.hxx>
#include <BinMDF_ADriver.hxx>
class BinTObjDrivers_IntSparseArrayDriver : public BinMDF_ADriver
{
public:
Standard_EXPORT BinTObjDrivers_IntSparseArrayDriver
(const Handle(CDM_MessageDriver)& theMessageDriver);
// constructor
Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const;
// Creates a new attribute
Standard_EXPORT Standard_Boolean Paste
(const BinObjMgt_Persistent& theSource,
const Handle(TDF_Attribute)& theTarget,
BinObjMgt_RRelocationTable& theRelocTable) const;
// Translate the contents of <theSource> and put it
// into <theTarget>
Standard_EXPORT void Paste
(const Handle(TDF_Attribute)& theSource,
BinObjMgt_Persistent& theTarget,
BinObjMgt_SRelocationTable& theRelocTable) const;
// Translate the contents of <aSource> and put it
// into <aTarget>
public:
// CASCADE RTTI
DEFINE_STANDARD_RTTI(BinTObjDrivers_IntSparseArrayDriver)
};
// Define handle class
DEFINE_STANDARD_HANDLE(BinTObjDrivers_IntSparseArrayDriver,BinMDF_ADriver)
#endif
#ifdef _MSC_VER
#pragma once
#endif

View File

@@ -0,0 +1,94 @@
// File : BinTObjDrivers_ModelDriver.cxx
// Created : Wed Nov 24 11:27:45 2004
// Author : Edward AGAPOV
// Copyright: Open CASCADE 2007
// The original implementation Copyright: (C) RINA S.p.A
#include <BinTObjDrivers_ModelDriver.hxx>
#include <BinObjMgt_Persistent.hxx>
#include <CDM_MessageDriver.hxx>
#include <Standard_GUID.hxx>
#include <TDF_Attribute.hxx>
#include <TObj_TModel.hxx>
#include <TObj_Model.hxx>
#include <TObj_Assistant.hxx>
IMPLEMENT_STANDARD_HANDLE(BinTObjDrivers_ModelDriver,BinMDF_ADriver)
IMPLEMENT_STANDARD_RTTIEXT(BinTObjDrivers_ModelDriver,BinMDF_ADriver);
//=======================================================================
//function : BinTObjDrivers_ModelDriver
//purpose : constructor
//=======================================================================
BinTObjDrivers_ModelDriver::BinTObjDrivers_ModelDriver
(const Handle(CDM_MessageDriver)& theMessageDriver)
: BinMDF_ADriver( theMessageDriver, NULL)
{
}
//=======================================================================
//function : NewEmpty
//purpose : Creates a new attribute
//=======================================================================
Handle(TDF_Attribute) BinTObjDrivers_ModelDriver::NewEmpty() const
{
return new TObj_TModel;
}
//=======================================================================
//function : Paste
//purpose : Translate the contents of <theSource> and put it
// into <theTarget>.
// Set CurrentModel of TObj_Assistant into theTarget TObj_TModel
// if its GUID and GUID stored in theSource are same
//=======================================================================
Standard_Boolean BinTObjDrivers_ModelDriver::Paste
(const BinObjMgt_Persistent& theSource,
const Handle(TDF_Attribute)& theTarget,
BinObjMgt_RRelocationTable&) const
{
Standard_GUID aGUID;
if (! (theSource >> aGUID)) return Standard_False;
Handle(TObj_Model) aCurrentModel = TObj_Assistant::GetCurrentModel();
if (aCurrentModel.IsNull()) return Standard_False;
if (aGUID != aCurrentModel->GetGUID())
{
WriteMessage("TObj_TModel retrieval: wrong model GUID");
return Standard_False;
}
Handle(TObj_TModel) aTModel = Handle(TObj_TModel)::DownCast( theTarget );
aCurrentModel->SetLabel ( aTModel->Label() );
aTModel->Set( aCurrentModel );
return Standard_True;
}
//=======================================================================
//function : Paste
//purpose : Translate the contents of <theSource> and put it
// into <theTarget>.
// a Model is stored as its GUID
//=======================================================================
void BinTObjDrivers_ModelDriver::Paste
(const Handle(TDF_Attribute)& theSource,
BinObjMgt_Persistent& theTarget,
BinObjMgt_SRelocationTable&) const
{
Handle(TObj_TModel) aTModel =
Handle(TObj_TModel)::DownCast( theSource );
Handle(TObj_Model) aModel = aTModel->Model();
if (!aModel.IsNull())
{
// Store model GUID.
Standard_GUID aGUID = aModel->GetGUID();
theTarget << aGUID;
}
}

View File

@@ -0,0 +1,57 @@
// File : BinTObjDrivers_ModelDriver.hxx
// Created : Wed Nov 24 11:28:12 2004
// Author : Edward AGAPOV
// Copyright: Open CASCADE 2007
// The original implementation Copyright: (C) RINA S.p.A
#ifndef BinTObjDrivers_ModelDriver_HeaderFile
#define BinTObjDrivers_ModelDriver_HeaderFile
#include <TObj_Common.hxx>
#include <BinMDF_ADriver.hxx>
class BinTObjDrivers_ModelDriver : public BinMDF_ADriver
{
public:
Standard_EXPORT BinTObjDrivers_ModelDriver
(const Handle(CDM_MessageDriver)& theMessageDriver);
// constructor
Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const;
// Creates a new attribute
Standard_EXPORT Standard_Boolean Paste
(const BinObjMgt_Persistent& Source,
const Handle(TDF_Attribute)& Target,
BinObjMgt_RRelocationTable& RelocTable) const;
// Translate the contents of <aSource> and put it
// into <aTarget>, using the relocation table
// <aRelocTable> to keep the sharings.
// Set CurrentModel of TObj_Persistence into Target TObj_TModel
// if its GUID and GUID stored in Source are same
Standard_EXPORT void Paste
(const Handle(TDF_Attribute)& Source,
BinObjMgt_Persistent& Target,
BinObjMgt_SRelocationTable& RelocTable) const;
// Translate the contents of <aSource> and put it
// into <aTarget>, using the relocation table
// <aRelocTable> to keep the sharings.
// a Model is stored as its GUID
public:
// CASCADE RTTI
DEFINE_STANDARD_RTTI(BinTObjDrivers_ModelDriver)
};
// Define handle class
DEFINE_STANDARD_HANDLE(BinTObjDrivers_ModelDriver,BinMDF_ADriver)
#endif
#ifdef _MSC_VER
#pragma once
#endif

View File

@@ -0,0 +1,130 @@
// File : BinTObjDrivers_ObjectDriver.cxx
// Created : Wed Nov 24 11:28:22 2004
// Author : Edward AGAPOV
// Copyright: Open CASCADE 2007
// The original implementation Copyright: (C) RINA S.p.A
#include <CDM_MessageDriver.hxx>
#include <BinObjMgt_Persistent.hxx>
#include <TDF_Tool.hxx>
#include <BinTObjDrivers_ObjectDriver.hxx>
#include <TObj_Assistant.hxx>
#include <TObj_TObject.hxx>
#include <TObj_Persistence.hxx>
IMPLEMENT_STANDARD_HANDLE(BinTObjDrivers_ObjectDriver,BinMDF_ADriver)
IMPLEMENT_STANDARD_RTTIEXT(BinTObjDrivers_ObjectDriver,BinMDF_ADriver);
//=======================================================================
//function : BinTObjDrivers_ObjectDriver
//purpose : constructor
//=======================================================================
BinTObjDrivers_ObjectDriver::BinTObjDrivers_ObjectDriver
(const Handle(CDM_MessageDriver)& theMessageDriver)
: BinMDF_ADriver( theMessageDriver, NULL)
{
}
//=======================================================================
//function : NewEmpty
//purpose : Creates a new attribute
//=======================================================================
Handle(TDF_Attribute) BinTObjDrivers_ObjectDriver::NewEmpty() const
{
return new TObj_TObject;
}
//=======================================================================
//function : Paste
//purpose : Translate the contents of <theSource> and put it
// into <theTarget>.
//=======================================================================
Standard_Boolean BinTObjDrivers_ObjectDriver::Paste
(const BinObjMgt_Persistent& theSource,
const Handle(TDF_Attribute)& theTarget,
BinObjMgt_RRelocationTable&) const
{
Standard_Integer aSavedPos = theSource.Position();
// first try to get the type as an integer ID
Standard_Integer anID;
if (! (theSource >> anID)) return Standard_False;
Handle(TObj_Object) anObject;
if ( (unsigned)anID > 0xffff)
{
// if we are here it means that the type was stored as an ascii string,
// so rewind theSource and reget
theSource.SetPosition(aSavedPos);
TCollection_AsciiString aName;
if (! (theSource >> aName)) return Standard_False;
anObject =
TObj_Persistence::CreateNewObject(aName.ToCString(),theTarget->Label());
if (anObject.IsNull())
{
TCollection_AsciiString anEntry;
TDF_Tool::Entry (theTarget->Label(), anEntry);
WriteMessage (TCollection_ExtendedString
("TObj_TObject retrieval: wrong object type name ") +
aName + ", entry " + anEntry);
TObj_Assistant::BindType(0);
return Standard_False;
}
// register the type
TObj_Assistant::BindType(anObject->DynamicType());
}
else
{
// use anID to get the type from earlier registered ones
Handle(Standard_Type) aType = TObj_Assistant::FindType(anID);
if(!aType.IsNull())
anObject =
TObj_Persistence::CreateNewObject(aType->Name(), theTarget->Label());
else
{
return Standard_False;
}
}
Handle(TObj_TObject)::DownCast (theTarget) ->Set( anObject );
return Standard_True;
}
//=======================================================================
//function : Paste
//purpose : Translate the contents of <theSource> and put it
// into <theTarget>.
// anObject is stored as a Name of class derived from TObj_Object
//=======================================================================
void BinTObjDrivers_ObjectDriver::Paste
(const Handle(TDF_Attribute)& theSource,
BinObjMgt_Persistent& theTarget,
BinObjMgt_SRelocationTable&) const
{
Handle(TObj_TObject) aTObj =
Handle(TObj_TObject)::DownCast( theSource );
Handle(TObj_Object) anIObject = aTObj->Get();
if (anIObject.IsNull()) return;
Handle(Standard_Type) aType = anIObject->DynamicType();
Standard_Integer anID = TObj_Assistant::FindTypeIndex(anIObject->DynamicType());
if(anID == 0)
{
// we first meet this type;
// register a type and store a type name as a string
TObj_Assistant::BindType(aType);
TCollection_AsciiString aName = aType->Name();
theTarget << aName;
}
else
{
// store the integer type ID
theTarget << anID;
}
}

View File

@@ -0,0 +1,58 @@
// File : BinTObjDrivers_ObjectDriver.hxx
// Created : Wed Nov 24 11:31:42 2004
// Author : Edward AGAPOV
// Copyright: Open CASCADE 2007
// The original implementation Copyright: (C) RINA S.p.A
#ifndef BinTObjDrivers_ObjectDriver_HeaderFile
#define BinTObjDrivers_ObjectDriver_HeaderFile
#include <TObj_Common.hxx>
#include <BinMDF_ADriver.hxx>
class BinTObjDrivers_ObjectDriver : public BinMDF_ADriver
{
public:
Standard_EXPORT BinTObjDrivers_ObjectDriver
(const Handle(CDM_MessageDriver)& theMessageDriver);
// constructor
Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const;
// Creates a new attribute
Standard_EXPORT Standard_Boolean Paste
(const BinObjMgt_Persistent& Source,
const Handle(TDF_Attribute)& Target,
BinObjMgt_RRelocationTable& RelocTable) const;
// Translate the contents of <aSource> and put it
// into <aTarget>, using the relocation table
// <aRelocTable> to keep the sharings.
// an TObj_Object is restored by TObj_Persistence basing on class name
// stored in Source
Standard_EXPORT void Paste
(const Handle(TDF_Attribute)& Source,
BinObjMgt_Persistent& Target,
BinObjMgt_SRelocationTable& RelocTable) const;
// Translate the contents of <aSource> and put it
// into <aTarget>, using the relocation table
// <aRelocTable> to keep the sharings.
// anObject is stored as a Name of class derived from TObj_Object
public:
// CASCADE RTTI
DEFINE_STANDARD_RTTI(BinTObjDrivers_ObjectDriver)
};
// Define handle class
DEFINE_STANDARD_HANDLE(BinTObjDrivers_ObjectDriver,BinMDF_ADriver)
#endif
#ifdef _MSC_VER
#pragma once
#endif

View File

@@ -0,0 +1,132 @@
// File : BinTObjDrivers_ReferenceDriver.cxx
// Created : Wed Nov 24 11:42:17 2004
// Author : Edward AGAPOV
// Copyright: Open CASCADE 2007
// The original implementation Copyright: (C) RINA S.p.A
#include <BinTObjDrivers_ReferenceDriver.hxx>
#include <CDM_MessageDriver.hxx>
#include <TDF_Attribute.hxx>
#include <TObj_TReference.hxx>
#include <BinObjMgt_Persistent.hxx>
#include <TObj_Object.hxx>
#include <TObj_Model.hxx>
#include <TObj_Assistant.hxx>
#include <TDF_ChildIterator.hxx>
#include <TDF_Tool.hxx>
IMPLEMENT_STANDARD_HANDLE(BinTObjDrivers_ReferenceDriver,BinMDF_ADriver)
IMPLEMENT_STANDARD_RTTIEXT(BinTObjDrivers_ReferenceDriver,BinMDF_ADriver)
//=======================================================================
//function : BinTObjDrivers_ReferenceDriver
//purpose : constructor
//=======================================================================
BinTObjDrivers_ReferenceDriver::BinTObjDrivers_ReferenceDriver
(const Handle(CDM_MessageDriver)& theMessageDriver)
: BinMDF_ADriver( theMessageDriver, NULL)
{
}
//=======================================================================
//function : NewEmpty
//purpose : Creates a new attribute
//=======================================================================
Handle(TDF_Attribute) BinTObjDrivers_ReferenceDriver::NewEmpty() const
{
return new TObj_TReference;
}
//=======================================================================
//function : Paste
//purpose : Translate the contents of <theSource> and put it
// into <theTarget>.
//=======================================================================
Standard_Boolean BinTObjDrivers_ReferenceDriver::Paste
(const BinObjMgt_Persistent& theSource,
const Handle(TDF_Attribute)& theTarget,
BinObjMgt_RRelocationTable&) const
{
// master label
TDF_Label aMasterLabel;
Handle(TDF_Data) aDS = theTarget->Label().Data();
if (! theSource.GetLabel (aDS, aMasterLabel)) return Standard_False;
// isSameDoc flag
Standard_Boolean isSameDoc = Standard_False;
if (! (theSource >> isSameDoc)) return Standard_False;
// DS for referred label
if (!isSameDoc)
{
TCollection_AsciiString aName;
if (! (theSource >> aName)) return Standard_False;
Handle(TObj_Model) aModel = Handle(TObj_Model)::DownCast
( TObj_Assistant::FindModel( aName.ToCString() ));
if (aModel.IsNull())
{
TCollection_AsciiString anEntry;
TDF_Tool::Entry (theTarget->Label(), anEntry);
WriteMessage (TCollection_ExtendedString ("TObj_TReference retrieval: ")
+ "wrong model ID " + aName + ", entry " + anEntry);
return Standard_False;
}
aDS = aModel->GetLabel().Data();
}
// reffered label
TDF_Label aLabel;
if (! theSource.GetLabel (aDS, aLabel)) return Standard_False;
// set reference attribute fields
Handle(TObj_TReference) aTarget =
Handle(TObj_TReference)::DownCast (theTarget);
aTarget->Set ( aLabel, aMasterLabel );
return !aLabel.IsNull() && !aMasterLabel.IsNull();
}
//=======================================================================
//function : Paste
//purpose : Translate the contents of <theSource> and put it
// into <theTarget>.
// Store master and referred labels as entry, the other model referred
// as entry in model-container
//=======================================================================
void BinTObjDrivers_ReferenceDriver::Paste
(const Handle(TDF_Attribute)& theSource,
BinObjMgt_Persistent& theTarget,
BinObjMgt_SRelocationTable&) const
{
Handle(TObj_TReference) aSource =
Handle(TObj_TReference)::DownCast (theSource);
Handle(TObj_Object) aLObject = aSource->Get();
if (aLObject.IsNull())
return;
// labels
TDF_Label aLabel = aLObject->GetLabel();
TDF_Label aMasterLabel = aSource->GetMasterLabel();
Standard_Boolean isSameDoc = (aLabel.Root() == aMasterLabel.Root());
// store data
// 1 - the master label;
theTarget << aMasterLabel;
// 2 - isSameDoc flag plus may be a Model ID
theTarget << isSameDoc;
if (! isSameDoc)
{
TCollection_AsciiString aName;
Handle(TObj_Model) aModel =
Handle(TObj_Model)::DownCast( aLObject->GetModel() );
aName = TCollection_AsciiString( aModel->GetModelName()->String() );
theTarget << aName;
}
// 3 - referred label;
theTarget << aLabel;
}

View File

@@ -0,0 +1,59 @@
// File : BinTObjDrivers_ReferenceDriver.hxx
// Created : Wed Nov 24 11:32:18 2004
// Author : Edward AGAPOV
// Copyright: Open CASCADE 2007
// The original implementation Copyright: (C) RINA S.p.A
#ifndef BinTObjDrivers_ReferenceDriver_HeaderFile
#define BinTObjDrivers_ReferenceDriver_HeaderFile
#include <TObj_Common.hxx>
#include <BinMDF_ADriver.hxx>
class BinTObjDrivers_ReferenceDriver : public BinMDF_ADriver
{
public:
Standard_EXPORT BinTObjDrivers_ReferenceDriver
(const Handle(CDM_MessageDriver)& theMessageDriver);
// constructor
Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const;
// Creates a new attribute
Standard_EXPORT Standard_Boolean Paste
(const BinObjMgt_Persistent& Source,
const Handle(TDF_Attribute)& Target,
BinObjMgt_RRelocationTable& RelocTable) const;
// Translate the contents of <aSource> and put it
// into <aTarget>, using the relocation table
// <aRelocTable> to keep the sharings.
Standard_EXPORT void Paste
(const Handle(TDF_Attribute)& Source,
BinObjMgt_Persistent& Target,
BinObjMgt_SRelocationTable& RelocTable) const;
// Translate the contents of <aSource> and put it
// into <aTarget>, using the relocation table
// <aRelocTable> to keep the sharings.
// Store master and referred labels as entry, the other model referred
// as entry in model-container
// The reference pointing nowhere is not stored
public:
// CASCADE RTTI
DEFINE_STANDARD_RTTI(BinTObjDrivers_ReferenceDriver)
};
// Define handle class
DEFINE_STANDARD_HANDLE(BinTObjDrivers_ReferenceDriver,BinMDF_ADriver)
#endif
#ifdef _MSC_VER
#pragma once
#endif

View File

@@ -0,0 +1,71 @@
// File : BinTObjDrivers_XYZDriver.cxx
// Created : Wed Nov 24 11:23:54 2004
// Author : Michael SAZONOV
// Copyright: Open CASCADE 2007
// The original implementation Copyright: (C) RINA S.p.A
#include <BinTObjDrivers_XYZDriver.hxx>
#include <CDM_MessageDriver.hxx>
#include <TDF_Attribute.hxx>
#include <BinObjMgt_Persistent.hxx>
#include <TObj_TXYZ.hxx>
IMPLEMENT_STANDARD_HANDLE(BinTObjDrivers_XYZDriver,BinMDF_ADriver)
IMPLEMENT_STANDARD_RTTIEXT(BinTObjDrivers_XYZDriver,BinMDF_ADriver)
//=======================================================================
//function : BinTObjDrivers_XYZDriver
//purpose : constructor
//=======================================================================
BinTObjDrivers_XYZDriver::BinTObjDrivers_XYZDriver
(const Handle(CDM_MessageDriver)& theMessageDriver)
: BinMDF_ADriver( theMessageDriver, NULL)
{
}
//=======================================================================
//function : NewEmpty
//purpose : Creates a new attribute
//=======================================================================
Handle(TDF_Attribute) BinTObjDrivers_XYZDriver::NewEmpty() const
{
return new TObj_TXYZ;
}
//=======================================================================
//function : Paste
//purpose : Retrieve. Translate the contents of <theSource> and put it
// into <theTarget>.
//=======================================================================
Standard_Boolean BinTObjDrivers_XYZDriver::Paste
(const BinObjMgt_Persistent& theSource,
const Handle(TDF_Attribute)& theTarget,
BinObjMgt_RRelocationTable&) const
{
Handle(TObj_TXYZ) aTarget = Handle(TObj_TXYZ)::DownCast(theTarget);
Standard_Real aX, aY, aZ;
if (! (theSource >> aX >> aY >> aZ))
return Standard_False;
aTarget->Set (gp_XYZ (aX, aY, aZ));
return Standard_True;
}
//=======================================================================
//function : Paste
//purpose : Store. Translate the contents of <theSource> and put it
// into <theTarget>
//=======================================================================
void BinTObjDrivers_XYZDriver::Paste
(const Handle(TDF_Attribute)& theSource,
BinObjMgt_Persistent& theTarget,
BinObjMgt_SRelocationTable&) const
{
Handle(TObj_TXYZ) aSource = Handle(TObj_TXYZ)::DownCast (theSource);
gp_XYZ aXYZ = aSource->Get();
theTarget << aXYZ.X() << aXYZ.Y() << aXYZ.Z();
}

View File

@@ -0,0 +1,52 @@
// File : BinTObjDrivers_XYZDriver.hxx
// Created : Wed Nov 24 11:33:24 2004
// Author : Michael SAZONOV
// Copyright: Open CASCADE 2007
// The original implementation Copyright: (C) RINA S.p.A
#ifndef BinTObjDrivers_XYZDriver_HeaderFile
#define BinTObjDrivers_XYZDriver_HeaderFile
#include <TObj_Common.hxx>
#include <BinMDF_ADriver.hxx>
class BinTObjDrivers_XYZDriver : public BinMDF_ADriver
{
public:
Standard_EXPORT BinTObjDrivers_XYZDriver
(const Handle(CDM_MessageDriver)& theMessageDriver);
// constructor
Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const;
// Creates a new attribute
Standard_EXPORT Standard_Boolean Paste
(const BinObjMgt_Persistent& theSource,
const Handle(TDF_Attribute)& theTarget,
BinObjMgt_RRelocationTable& theRelocTable) const;
// Translate the contents of <theSource> and put it
// into <theTarget>
Standard_EXPORT void Paste
(const Handle(TDF_Attribute)& theSource,
BinObjMgt_Persistent& theTarget,
BinObjMgt_SRelocationTable& theRelocTable) const;
// Translate the contents of <aSource> and put it
// into <aTarget>
public:
// CASCADE RTTI
DEFINE_STANDARD_RTTI(BinTObjDrivers_XYZDriver)
};
// Define handle class
DEFINE_STANDARD_HANDLE(BinTObjDrivers_XYZDriver,BinMDF_ADriver)
#endif
#ifdef _MSC_VER
#pragma once
#endif

16
src/BinTObjDrivers/FILES Executable file
View File

@@ -0,0 +1,16 @@
BinTObjDrivers.cxx
BinTObjDrivers.hxx
BinTObjDrivers_DocumentRetrievalDriver.cxx
BinTObjDrivers_DocumentRetrievalDriver.hxx
BinTObjDrivers_DocumentStorageDriver.cxx
BinTObjDrivers_DocumentStorageDriver.hxx
BinTObjDrivers_IntSparseArrayDriver.cxx
BinTObjDrivers_IntSparseArrayDriver.hxx
BinTObjDrivers_ModelDriver.cxx
BinTObjDrivers_ModelDriver.hxx
BinTObjDrivers_ObjectDriver.cxx
BinTObjDrivers_ObjectDriver.hxx
BinTObjDrivers_ReferenceDriver.cxx
BinTObjDrivers_ReferenceDriver.hxx
BinTObjDrivers_XYZDriver.cxx
BinTObjDrivers_XYZDriver.hxx