1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0030773: Application Framework - To allow to inherit existing attributes to reuse persistence mechanisms

Added possibility to inherit existing attributes if the same persistent fields are used. All methods that allow controlling the data model changes or getting some callbacks may be overridden in successor. They may have same GUIDs as a base class or new ones.

Special macros IMPLEMENT_DERIVED_ATTRIBUTE and IMPLEMENT_DERIVED_ATTRIBUTE_WITH_TYPE must be used instead of standard Handle macro definition IMPLEMENT_STANDARD_RTTIEXT to register new derived attributes.

Using this improvement several existing attributes from TDataStd, TDataXtd and XCAFDoc packages become inherited from other base attribute-classes. XML and Bin drivers of these attributes are removed. New base attribute classes are added: TDataStd_GenericEmpty and TDataStd_GenericExtString.

This improvement does not change both present formats Bin and XML documents. The obsolete Standard scheme is not changed at all.
This commit is contained in:
mpv
2020-06-19 23:12:17 +03:00
committed by abv
parent 59e11a2f75
commit c99ad5d760
202 changed files with 1438 additions and 8261 deletions

View File

@@ -19,8 +19,6 @@
#include <BinMDataStd_BooleanArrayDriver.hxx>
#include <BinMDataStd_BooleanListDriver.hxx>
#include <BinMDataStd_ByteArrayDriver.hxx>
#include <BinMDataStd_CommentDriver.hxx>
#include <BinMDataStd_DirectoryDriver.hxx>
#include <BinMDataStd_ExpressionDriver.hxx>
#include <BinMDataStd_ExtStringArrayDriver.hxx>
#include <BinMDataStd_ExtStringListDriver.hxx>
@@ -29,15 +27,13 @@
#include <BinMDataStd_IntegerListDriver.hxx>
#include <BinMDataStd_IntPackedMapDriver.hxx>
#include <BinMDataStd_NamedDataDriver.hxx>
#include <BinMDataStd_NameDriver.hxx>
#include <BinMDataStd_NoteBookDriver.hxx>
#include <BinMDataStd_GenericExtStringDriver.hxx>
#include <BinMDataStd_RealArrayDriver.hxx>
#include <BinMDataStd_RealDriver.hxx>
#include <BinMDataStd_RealListDriver.hxx>
#include <BinMDataStd_ReferenceArrayDriver.hxx>
#include <BinMDataStd_ReferenceListDriver.hxx>
#include <BinMDataStd_RelationDriver.hxx>
#include <BinMDataStd_TickDriver.hxx>
#include <BinMDataStd_GenericEmptyDriver.hxx>
#include <BinMDataStd_TreeNodeDriver.hxx>
#include <BinMDataStd_UAttributeDriver.hxx>
#include <BinMDataStd_VariableDriver.hxx>
@@ -52,31 +48,26 @@
void BinMDataStd::AddDrivers (const Handle(BinMDF_ADriverTable)& theDriverTable,
const Handle(Message_Messenger)& theMsgDriver)
{
theDriverTable->AddDriver (new BinMDataStd_CommentDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_ExpressionDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_IntegerArrayDriver(theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_IntegerDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_NameDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_RealArrayDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_RealDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_RelationDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_TreeNodeDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_UAttributeDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_VariableDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_DirectoryDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_NoteBookDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_ExtStringArrayDriver(theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_TickDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_IntegerListDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_RealListDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_ExtStringListDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_BooleanListDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_ReferenceListDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_BooleanArrayDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_ReferenceArrayDriver(theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_ByteArrayDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_NamedDataDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_AsciiStringDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_IntPackedMapDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_ExpressionDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_IntegerArrayDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_IntegerDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_GenericExtStringDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_RealArrayDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_RealDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_TreeNodeDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_UAttributeDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_VariableDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_ExtStringArrayDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_GenericEmptyDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_IntegerListDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_RealListDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_ExtStringListDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_BooleanListDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_ReferenceListDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_BooleanArrayDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_ReferenceArrayDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_ByteArrayDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_NamedDataDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_AsciiStringDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_IntPackedMapDriver (theMsgDriver) );
}

View File

@@ -68,21 +68,17 @@ private:
friend class BinMDataStd_NameDriver;
friend class BinMDataStd_GenericExtStringDriver;
friend class BinMDataStd_IntegerDriver;
friend class BinMDataStd_RealDriver;
friend class BinMDataStd_IntegerArrayDriver;
friend class BinMDataStd_RealArrayDriver;
friend class BinMDataStd_UAttributeDriver;
friend class BinMDataStd_DirectoryDriver;
friend class BinMDataStd_CommentDriver;
friend class BinMDataStd_VariableDriver;
friend class BinMDataStd_ExpressionDriver;
friend class BinMDataStd_RelationDriver;
friend class BinMDataStd_NoteBookDriver;
friend class BinMDataStd_TreeNodeDriver;
friend class BinMDataStd_ExtStringArrayDriver;
friend class BinMDataStd_TickDriver;
friend class BinMDataStd_GenericEmptyDriver;
friend class BinMDataStd_AsciiStringDriver;
friend class BinMDataStd_IntPackedMapDriver;
friend class BinMDataStd_IntegerListDriver;

View File

@@ -1,71 +0,0 @@
// Created on: 2001-08-24
// Created by: Alexnder GRIGORIEV
// Copyright (c) 2001-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <BinMDataStd_CommentDriver.hxx>
#include <BinObjMgt_Persistent.hxx>
#include <Message_Messenger.hxx>
#include <Standard_Type.hxx>
#include <TDataStd_Comment.hxx>
#include <TDF_Attribute.hxx>
IMPLEMENT_STANDARD_RTTIEXT(BinMDataStd_CommentDriver,BinMDF_ADriver)
//=======================================================================
//function : BinMDataStd_CommentDriver
//purpose : Constructor
//=======================================================================
BinMDataStd_CommentDriver::BinMDataStd_CommentDriver
(const Handle(Message_Messenger)& theMsgDriver)
: BinMDF_ADriver (theMsgDriver, NULL)
{}
//=======================================================================
//function : NewEmpty
//purpose :
//=======================================================================
Handle(TDF_Attribute) BinMDataStd_CommentDriver::NewEmpty() const
{
return (new TDataStd_Comment());
}
//=======================================================================
//function : Paste
//purpose :
//=======================================================================
Standard_Boolean BinMDataStd_CommentDriver::Paste
(const BinObjMgt_Persistent& theSource,
const Handle(TDF_Attribute)& theTarget,
BinObjMgt_RRelocationTable& ) const
{
TCollection_ExtendedString aString;
Standard_Boolean ok = theSource >> aString;
if (ok)
Handle(TDataStd_Comment)::DownCast(theTarget) -> Set (aString);
return ok;
}
//=======================================================================
//function : Paste
//purpose :
//=======================================================================
void BinMDataStd_CommentDriver::Paste (const Handle(TDF_Attribute)& theSource,
BinObjMgt_Persistent& theTarget,
BinObjMgt_SRelocationTable& ) const
{
TCollection_ExtendedString aName =
Handle(TDataStd_Comment)::DownCast(theSource) -> Get();
theTarget << aName;
}

View File

@@ -1,72 +0,0 @@
// Created on: 2001-08-24
// Created by: Alexander GRIGORIEV
// Copyright (c) 2001-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _BinMDataStd_CommentDriver_HeaderFile
#define _BinMDataStd_CommentDriver_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <BinMDF_ADriver.hxx>
#include <Standard_Boolean.hxx>
#include <BinObjMgt_RRelocationTable.hxx>
#include <BinObjMgt_SRelocationTable.hxx>
class Message_Messenger;
class TDF_Attribute;
class BinObjMgt_Persistent;
class BinMDataStd_CommentDriver;
DEFINE_STANDARD_HANDLE(BinMDataStd_CommentDriver, BinMDF_ADriver)
//! Attribute Driver.
class BinMDataStd_CommentDriver : public BinMDF_ADriver
{
public:
Standard_EXPORT BinMDataStd_CommentDriver(const Handle(Message_Messenger)& theMessageDriver);
Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
Standard_EXPORT Standard_Boolean Paste (const BinObjMgt_Persistent& Source, const Handle(TDF_Attribute)& Target, BinObjMgt_RRelocationTable& RelocTable) const Standard_OVERRIDE;
Standard_EXPORT void Paste (const Handle(TDF_Attribute)& Source, BinObjMgt_Persistent& Target, BinObjMgt_SRelocationTable& RelocTable) const Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(BinMDataStd_CommentDriver,BinMDF_ADriver)
protected:
private:
};
#endif // _BinMDataStd_CommentDriver_HeaderFile

View File

@@ -1,71 +0,0 @@
// Created on: 2004-05-13
// Created by: Sergey ZARITCHNY
// Copyright (c) 2004-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <BinMDataStd_DirectoryDriver.hxx>
#include <BinMDF_ADriver.hxx>
#include <BinObjMgt_Persistent.hxx>
#include <BinObjMgt_RRelocationTable.hxx>
#include <BinObjMgt_SRelocationTable.hxx>
#include <Message_Messenger.hxx>
#include <Standard_Type.hxx>
#include <TDataStd_Directory.hxx>
#include <TDF_Attribute.hxx>
IMPLEMENT_STANDARD_RTTIEXT(BinMDataStd_DirectoryDriver,BinMDF_ADriver)
//=======================================================================
//function : BinMDataStd_DirectoryDriver
//purpose :
//=======================================================================
BinMDataStd_DirectoryDriver::BinMDataStd_DirectoryDriver
(const Handle(Message_Messenger)& theMsgDriver)
: BinMDF_ADriver (theMsgDriver, STANDARD_TYPE(TDataStd_Directory)->Name())
{
}
//=======================================================================
//function : NewEmpty
//purpose :
//=======================================================================
Handle(TDF_Attribute) BinMDataStd_DirectoryDriver::NewEmpty() const
{
return new TDataStd_Directory();
}
//=======================================================================
//function : Paste
//purpose : persistent -> transient (retrieve)
//=======================================================================
Standard_Boolean BinMDataStd_DirectoryDriver::Paste
(const BinObjMgt_Persistent&,
const Handle(TDF_Attribute)&,
BinObjMgt_RRelocationTable& ) const
{return Standard_True;}
//=======================================================================
//function : Paste
//purpose : transient -> persistent (store)
//=======================================================================
void BinMDataStd_DirectoryDriver::Paste (const Handle(TDF_Attribute)&,
BinObjMgt_Persistent&,
BinObjMgt_SRelocationTable& ) const
{}

View File

@@ -1,72 +0,0 @@
// Created on: 2004-05-13
// Created by: Sergey ZARITCHNY <szy@opencascade.com>
// Copyright (c) 2004-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _BinMDataStd_DirectoryDriver_HeaderFile
#define _BinMDataStd_DirectoryDriver_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <BinMDF_ADriver.hxx>
#include <Standard_Boolean.hxx>
#include <BinObjMgt_RRelocationTable.hxx>
#include <BinObjMgt_SRelocationTable.hxx>
class Message_Messenger;
class TDF_Attribute;
class BinObjMgt_Persistent;
class BinMDataStd_DirectoryDriver;
DEFINE_STANDARD_HANDLE(BinMDataStd_DirectoryDriver, BinMDF_ADriver)
//! Directory attribute Driver.
class BinMDataStd_DirectoryDriver : public BinMDF_ADriver
{
public:
Standard_EXPORT BinMDataStd_DirectoryDriver(const Handle(Message_Messenger)& theMessageDriver);
Standard_EXPORT virtual Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
Standard_EXPORT virtual Standard_Boolean Paste (const BinObjMgt_Persistent& Source, const Handle(TDF_Attribute)& Target, BinObjMgt_RRelocationTable& RelocTable) const Standard_OVERRIDE;
Standard_EXPORT virtual void Paste (const Handle(TDF_Attribute)& Source, BinObjMgt_Persistent& Target, BinObjMgt_SRelocationTable& RelocTable) const Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(BinMDataStd_DirectoryDriver,BinMDF_ADriver)
protected:
private:
};
#endif // _BinMDataStd_DirectoryDriver_HeaderFile

View File

@@ -1,6 +1,4 @@
// Created on: 2007-05-29
// Created by: Vlad Romashko
// Copyright (c) 2007-2014 OPEN CASCADE SAS
// Copyright (c) 2020 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
@@ -14,41 +12,49 @@
// commercial license or contractual agreement.
#include <BinMDataStd_TickDriver.hxx>
#include <BinMDataStd_GenericEmptyDriver.hxx>
#include <BinMDF_ADriver.hxx>
#include <BinObjMgt_Persistent.hxx>
#include <BinObjMgt_RRelocationTable.hxx>
#include <BinObjMgt_SRelocationTable.hxx>
#include <Message_Messenger.hxx>
#include <Standard_Type.hxx>
#include <TDataStd_Tick.hxx>
#include <TDataStd_GenericEmpty.hxx>
#include <TDF_Attribute.hxx>
IMPLEMENT_STANDARD_RTTIEXT(BinMDataStd_TickDriver,BinMDF_ADriver)
IMPLEMENT_STANDARD_RTTIEXT(BinMDataStd_GenericEmptyDriver,BinMDF_ADriver)
//=======================================================================
//function : BinMDataStd_TickDriver
//function : BinMDataStd_GenericEmptyDriver
//purpose :
//=======================================================================
BinMDataStd_TickDriver::BinMDataStd_TickDriver(const Handle(Message_Messenger)& theMsgDriver)
: BinMDF_ADriver (theMsgDriver, STANDARD_TYPE(TDataStd_Tick)->Name())
{
}
BinMDataStd_GenericEmptyDriver::BinMDataStd_GenericEmptyDriver(const Handle(Message_Messenger)& theMsgDriver)
: BinMDF_ADriver (theMsgDriver, STANDARD_TYPE(TDataStd_GenericEmpty)->Name())
{}
//=======================================================================
//function : NewEmpty
//purpose :
//=======================================================================
Handle(TDF_Attribute) BinMDataStd_TickDriver::NewEmpty() const
Handle(TDF_Attribute) BinMDataStd_GenericEmptyDriver::NewEmpty() const
{
return new TDataStd_Tick();
return Handle(TDF_Attribute)(); // this attribute can not be created
}
//=======================================================================
//function : SourceType
//purpose :
//=======================================================================
const Handle(Standard_Type)& BinMDataStd_GenericEmptyDriver::SourceType() const
{
return Standard_Type::Instance<TDataStd_GenericEmpty>();
}
//=======================================================================
//function : Paste
//purpose : persistent -> transient (retrieve)
//=======================================================================
Standard_Boolean BinMDataStd_TickDriver::Paste(const BinObjMgt_Persistent&,
Standard_Boolean BinMDataStd_GenericEmptyDriver::Paste(const BinObjMgt_Persistent&,
const Handle(TDF_Attribute)&,
BinObjMgt_RRelocationTable& ) const
{
@@ -59,7 +65,7 @@ Standard_Boolean BinMDataStd_TickDriver::Paste(const BinObjMgt_Persistent&,
//function : Paste
//purpose : transient -> persistent (store)
//=======================================================================
void BinMDataStd_TickDriver::Paste(const Handle(TDF_Attribute)&,
void BinMDataStd_GenericEmptyDriver::Paste(const Handle(TDF_Attribute)&,
BinObjMgt_Persistent&,
BinObjMgt_SRelocationTable& ) const
{

View File

@@ -1,6 +1,4 @@
// Created on: 2007-05-29
// Created by: Vlad Romashko
// Copyright (c) 2007-2014 OPEN CASCADE SAS
// Copyright (c) 2020 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
@@ -13,8 +11,8 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _BinMDataStd_TickDriver_HeaderFile
#define _BinMDataStd_TickDriver_HeaderFile
#ifndef _BinMDataStd_GenericEmptyDriver_HeaderFile
#define _BinMDataStd_GenericEmptyDriver_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
@@ -28,19 +26,21 @@ class TDF_Attribute;
class BinObjMgt_Persistent;
class BinMDataStd_TickDriver;
DEFINE_STANDARD_HANDLE(BinMDataStd_TickDriver, BinMDF_ADriver)
class BinMDataStd_GenericEmptyDriver;
DEFINE_STANDARD_HANDLE(BinMDataStd_GenericEmptyDriver, BinMDF_ADriver)
//! Tick attribute driver.
class BinMDataStd_TickDriver : public BinMDF_ADriver
//! GenericEmpty attribute driver.
class BinMDataStd_GenericEmptyDriver : public BinMDF_ADriver
{
public:
Standard_EXPORT BinMDataStd_TickDriver(const Handle(Message_Messenger)& theMessageDriver);
Standard_EXPORT BinMDataStd_GenericEmptyDriver(const Handle(Message_Messenger)& theMessageDriver);
Standard_EXPORT virtual Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
Standard_EXPORT virtual const Handle(Standard_Type)& SourceType() const Standard_OVERRIDE;
Standard_EXPORT virtual Standard_Boolean Paste (const BinObjMgt_Persistent& Source, const Handle(TDF_Attribute)& Target, BinObjMgt_RRelocationTable& RelocTable) const Standard_OVERRIDE;
@@ -49,7 +49,7 @@ public:
DEFINE_STANDARD_RTTIEXT(BinMDataStd_TickDriver,BinMDF_ADriver)
DEFINE_STANDARD_RTTIEXT(BinMDataStd_GenericEmptyDriver,BinMDF_ADriver)
protected:
@@ -69,4 +69,4 @@ private:
#endif // _BinMDataStd_TickDriver_HeaderFile
#endif // _BinMDataStd_GenericEmptyDriver_HeaderFile

View File

@@ -1,6 +1,4 @@
// Created on: 2002-11-19
// Created by: Edward AGAPOV (eap)
// Copyright (c) 2002-2014 OPEN CASCADE SAS
// Copyright (c) 2020 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
@@ -14,7 +12,7 @@
// commercial license or contractual agreement.
#include <BinMDataStd_NameDriver.hxx>
#include <BinMDataStd_GenericExtStringDriver.hxx>
#include <BinObjMgt_Persistent.hxx>
#include <Message_Messenger.hxx>
#include <Standard_Type.hxx>
@@ -22,15 +20,15 @@
#include <TDF_Attribute.hxx>
#include <BinMDataStd.hxx>
IMPLEMENT_STANDARD_RTTIEXT(BinMDataStd_NameDriver,BinMDF_ADriver)
IMPLEMENT_STANDARD_RTTIEXT(BinMDataStd_GenericExtStringDriver,BinMDF_ADriver)
//=======================================================================
//function : BinMDataStd_NameDriver
//function : BinMDataStd_GenericExtStringDriver
//purpose :
//=======================================================================
BinMDataStd_NameDriver::BinMDataStd_NameDriver
BinMDataStd_GenericExtStringDriver::BinMDataStd_GenericExtStringDriver
(const Handle(Message_Messenger)& theMessageDriver)
: BinMDF_ADriver (theMessageDriver, STANDARD_TYPE(TDataStd_Name)->Name())
: BinMDF_ADriver (theMessageDriver, STANDARD_TYPE(TDataStd_GenericExtString)->Name())
{
}
@@ -39,39 +37,47 @@ BinMDataStd_NameDriver::BinMDataStd_NameDriver
//purpose :
//=======================================================================
Handle(TDF_Attribute) BinMDataStd_NameDriver::NewEmpty() const
Handle(TDF_Attribute) BinMDataStd_GenericExtStringDriver::NewEmpty() const
{
return new TDataStd_Name;
}
//=======================================================================
//function : SourceType
//purpose :
//=======================================================================
Handle(Standard_Type)& BinMDataStd_GenericExtStringDriver::SourceType() const
{
static Handle(Standard_Type) aSourceType = Standard_Type::Instance<TDataStd_GenericExtString>();
return aSourceType;
}
//=======================================================================
//function : Paste
//purpose : persistent -> transient (retrieve)
//=======================================================================
Standard_Boolean BinMDataStd_NameDriver::Paste
Standard_Boolean BinMDataStd_GenericExtStringDriver::Paste
(const BinObjMgt_Persistent& Source,
const Handle(TDF_Attribute)& Target,
BinObjMgt_RRelocationTable& RelocTable) const
{
Handle(TDataStd_Name) aName = Handle(TDataStd_Name)::DownCast(Target);
Handle(TDataStd_GenericExtString) aStrAttr = Handle(TDataStd_GenericExtString)::DownCast(Target);
TCollection_ExtendedString aStr;
Standard_Boolean ok = Source >> aStr;
if (ok)
aName->Set( aStr );
aStrAttr->Set( aStr );
if(RelocTable.GetHeaderData()->StorageVersion().IntegerValue() > 8) { // process user defined guid
const Standard_Integer& aPos = Source.Position();
Standard_GUID aGuid;
ok = Source >> aGuid;
if (!ok) {
Source.SetPosition(aPos);
aName->SetID(TDataStd_Name::GetID());
ok = Standard_True;
} else {
aName->SetID(aGuid);
aStrAttr->SetID(aGuid);
}
} else
aName->SetID(TDataStd_Name::GetID());
}
return ok;
}
@@ -80,14 +86,13 @@ Standard_Boolean BinMDataStd_NameDriver::Paste
//purpose : transient -> persistent (store)
//=======================================================================
void BinMDataStd_NameDriver::Paste
void BinMDataStd_GenericExtStringDriver::Paste
(const Handle(TDF_Attribute)& Source,
BinObjMgt_Persistent& Target,
BinObjMgt_SRelocationTable& /*RelocTable*/) const
{
Handle(TDataStd_Name) aName = Handle(TDataStd_Name)::DownCast(Source);
Target << aName->Get();
Handle(TDataStd_GenericExtString) aStrAttr = Handle(TDataStd_GenericExtString)::DownCast(Source);
Target << aStrAttr->Get();
// process user defined guid
if(aName->ID() != TDataStd_Name::GetID())
Target << aName->ID();
Target << aStrAttr->ID();
}

View File

@@ -1,6 +1,4 @@
// Created on: 2002-11-19
// Created by: Edward AGAPOV
// Copyright (c) 2002-2014 OPEN CASCADE SAS
// Copyright (c) 2020 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
@@ -13,8 +11,8 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _BinMDataStd_NameDriver_HeaderFile
#define _BinMDataStd_NameDriver_HeaderFile
#ifndef _BinMDataStd_GenericExtStringDriver_HeaderFile
#define _BinMDataStd_GenericExtStringDriver_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
@@ -28,20 +26,22 @@ class TDF_Attribute;
class BinObjMgt_Persistent;
class BinMDataStd_NameDriver;
DEFINE_STANDARD_HANDLE(BinMDataStd_NameDriver, BinMDF_ADriver)
class BinMDataStd_GenericExtStringDriver;
DEFINE_STANDARD_HANDLE(BinMDataStd_GenericExtStringDriver, BinMDF_ADriver)
//! TDataStd_Name attribute Driver.
class BinMDataStd_NameDriver : public BinMDF_ADriver
class BinMDataStd_GenericExtStringDriver : public BinMDF_ADriver
{
public:
Standard_EXPORT BinMDataStd_NameDriver(const Handle(Message_Messenger)& theMessageDriver);
Standard_EXPORT BinMDataStd_GenericExtStringDriver(const Handle(Message_Messenger)& theMessageDriver);
Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
Standard_EXPORT virtual Handle(Standard_Type)& SourceType() const Standard_OVERRIDE;
//! persistent -> transient (retrieve)
Standard_EXPORT Standard_Boolean Paste (const BinObjMgt_Persistent& Source, const Handle(TDF_Attribute)& Target, BinObjMgt_RRelocationTable& RelocTable) const Standard_OVERRIDE;
@@ -51,7 +51,7 @@ public:
DEFINE_STANDARD_RTTIEXT(BinMDataStd_NameDriver,BinMDF_ADriver)
DEFINE_STANDARD_RTTIEXT(BinMDataStd_GenericExtStringDriver,BinMDF_ADriver)
protected:
@@ -71,4 +71,4 @@ private:
#endif // _BinMDataStd_NameDriver_HeaderFile
#endif // _BinMDataStd_GenericExtStringDriver_HeaderFile

View File

@@ -65,7 +65,6 @@ Standard_Boolean BinMDataStd_IntegerDriver::Paste
ok = theSource >> aGuid;
if (!ok) {
theSource.SetPosition(aPos);
anAtt->SetID(TDataStd_Integer::GetID());
ok = Standard_True;
} else {
anAtt->SetID(aGuid);

View File

@@ -1,70 +0,0 @@
// Created on: 2004-05-13
// Created by: Sergey ZARITCHNY
// Copyright (c) 2004-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <BinMDataStd_NoteBookDriver.hxx>
#include <BinMDF_ADriver.hxx>
#include <BinObjMgt_Persistent.hxx>
#include <BinObjMgt_RRelocationTable.hxx>
#include <BinObjMgt_SRelocationTable.hxx>
#include <Message_Messenger.hxx>
#include <Standard_Type.hxx>
#include <TDataStd_NoteBook.hxx>
#include <TDF_Attribute.hxx>
IMPLEMENT_STANDARD_RTTIEXT(BinMDataStd_NoteBookDriver,BinMDF_ADriver)
//=======================================================================
//function : BinMDataStd_NoteBookDriver
//purpose :
//=======================================================================
BinMDataStd_NoteBookDriver::BinMDataStd_NoteBookDriver
(const Handle(Message_Messenger)& theMsgDriver)
: BinMDF_ADriver (theMsgDriver, STANDARD_TYPE(TDataStd_NoteBook)->Name())
{
}
//=======================================================================
//function : NewEmpty
//purpose :
//=======================================================================
Handle(TDF_Attribute) BinMDataStd_NoteBookDriver::NewEmpty() const
{
return new TDataStd_NoteBook();
}
//=======================================================================
//function : Paste
//purpose : persistent -> transient (retrieve)
//=======================================================================
Standard_Boolean BinMDataStd_NoteBookDriver::Paste
(const BinObjMgt_Persistent&,
const Handle(TDF_Attribute)&,
BinObjMgt_RRelocationTable& ) const
{return Standard_True;}
//=======================================================================
//function : Paste
//purpose : transient -> persistent (store)
//=======================================================================
void BinMDataStd_NoteBookDriver::Paste (const Handle(TDF_Attribute)&,
BinObjMgt_Persistent&,
BinObjMgt_SRelocationTable& ) const
{}

View File

@@ -1,72 +0,0 @@
// Created on: 2004-05-13
// Created by: Sergey ZARITCHNY <szy@opencascade.com>
// Copyright (c) 2004-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _BinMDataStd_NoteBookDriver_HeaderFile
#define _BinMDataStd_NoteBookDriver_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <BinMDF_ADriver.hxx>
#include <Standard_Boolean.hxx>
#include <BinObjMgt_RRelocationTable.hxx>
#include <BinObjMgt_SRelocationTable.hxx>
class Message_Messenger;
class TDF_Attribute;
class BinObjMgt_Persistent;
class BinMDataStd_NoteBookDriver;
DEFINE_STANDARD_HANDLE(BinMDataStd_NoteBookDriver, BinMDF_ADriver)
//! NoteBook attribute Driver.
class BinMDataStd_NoteBookDriver : public BinMDF_ADriver
{
public:
Standard_EXPORT BinMDataStd_NoteBookDriver(const Handle(Message_Messenger)& theMessageDriver);
Standard_EXPORT virtual Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
Standard_EXPORT virtual Standard_Boolean Paste (const BinObjMgt_Persistent& Source, const Handle(TDF_Attribute)& Target, BinObjMgt_RRelocationTable& RelocTable) const Standard_OVERRIDE;
Standard_EXPORT virtual void Paste (const Handle(TDF_Attribute)& Source, BinObjMgt_Persistent& Target, BinObjMgt_SRelocationTable& RelocTable) const Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(BinMDataStd_NoteBookDriver,BinMDF_ADriver)
protected:
private:
};
#endif // _BinMDataStd_NoteBookDriver_HeaderFile

View File

@@ -1,122 +0,0 @@
// Created on: 2001-09-12
// Created by: Julia DOROVSKIKH
// Copyright (c) 2001-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <BinMDataStd_RelationDriver.hxx>
#include <BinObjMgt_Persistent.hxx>
#include <Message_Messenger.hxx>
#include <Standard_Type.hxx>
#include <TDataStd_Relation.hxx>
#include <TDataStd_Variable.hxx>
#include <TDF_Attribute.hxx>
#include <TDF_ListIteratorOfAttributeList.hxx>
IMPLEMENT_STANDARD_RTTIEXT(BinMDataStd_RelationDriver,BinMDF_ADriver)
//=======================================================================
//function : BinMDataStd_RelationDriver
//purpose : Constructor
//=======================================================================
BinMDataStd_RelationDriver::BinMDataStd_RelationDriver
(const Handle(Message_Messenger)& theMsgDriver)
: BinMDF_ADriver (theMsgDriver, NULL)
{}
//=======================================================================
//function : NewEmpty
//purpose :
//=======================================================================
Handle(TDF_Attribute) BinMDataStd_RelationDriver::NewEmpty() const
{
return (new TDataStd_Relation());
}
//=======================================================================
//function : Paste
//purpose : persistent -> transient (retrieve)
//=======================================================================
Standard_Boolean BinMDataStd_RelationDriver::Paste
(const BinObjMgt_Persistent& theSource,
const Handle(TDF_Attribute)& theTarget,
BinObjMgt_RRelocationTable& theRelocTable) const
{
Handle(TDataStd_Relation) aC =
Handle(TDataStd_Relation)::DownCast(theTarget);
// variables
Standard_Integer nbvar;
if (! (theSource >> nbvar) || nbvar < 0)
return Standard_False;
TDF_AttributeList& aList = aC->GetVariables();
for (; nbvar > 0; nbvar--)
{
Handle(TDF_Attribute) aV;
Standard_Integer aNb;
if (! (theSource >> aNb))
return Standard_False;
if (aNb > 0)
{
if (theRelocTable.IsBound(aNb))
aV = Handle(TDataStd_Variable)::DownCast(theRelocTable.Find(aNb));
else
{
aV = new TDataStd_Variable;
theRelocTable.Bind(aNb, aV);
}
}
aList.Append(aV);
}
// expression
TCollection_ExtendedString aString;
if (! (theSource >> aString))
return Standard_False;
aC->SetRelation(aString);
return Standard_True;
}
//=======================================================================
//function : Paste
//purpose : transient -> persistent (store)
//=======================================================================
void BinMDataStd_RelationDriver::Paste
(const Handle(TDF_Attribute)& theSource,
BinObjMgt_Persistent& theTarget,
BinObjMgt_SRelocationTable& theRelocTable) const
{
Handle(TDataStd_Relation) aC =
Handle(TDataStd_Relation)::DownCast(theSource);
// variables
const TDF_AttributeList& aList = aC->GetVariables();
Standard_Integer nbvar = aList.Extent();
theTarget << nbvar;
TDF_ListIteratorOfAttributeList it;
for (it.Initialize(aList); it.More(); it.Next())
{
const Handle(TDF_Attribute)& TV = it.Value();
Standard_Integer aNb;
if (!TV.IsNull())
aNb = theRelocTable.Add(TV);
else
aNb = -1;
theTarget << aNb;
}
// expression
TCollection_ExtendedString aName = aC->Name();
theTarget << aName;
}

View File

@@ -1,72 +0,0 @@
// Created on: 2001-09-12
// Created by: Julia DOROVSKIKH
// Copyright (c) 2001-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _BinMDataStd_RelationDriver_HeaderFile
#define _BinMDataStd_RelationDriver_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <BinMDF_ADriver.hxx>
#include <Standard_Boolean.hxx>
#include <BinObjMgt_RRelocationTable.hxx>
#include <BinObjMgt_SRelocationTable.hxx>
class Message_Messenger;
class TDF_Attribute;
class BinObjMgt_Persistent;
class BinMDataStd_RelationDriver;
DEFINE_STANDARD_HANDLE(BinMDataStd_RelationDriver, BinMDF_ADriver)
//! Attribute Driver.
class BinMDataStd_RelationDriver : public BinMDF_ADriver
{
public:
Standard_EXPORT BinMDataStd_RelationDriver(const Handle(Message_Messenger)& theMessageDriver);
Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
Standard_EXPORT Standard_Boolean Paste (const BinObjMgt_Persistent& Source, const Handle(TDF_Attribute)& Target, BinObjMgt_RRelocationTable& RelocTable) const Standard_OVERRIDE;
Standard_EXPORT void Paste (const Handle(TDF_Attribute)& Source, BinObjMgt_Persistent& Target, BinObjMgt_SRelocationTable& RelocTable) const Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(BinMDataStd_RelationDriver,BinMDF_ADriver)
protected:
private:
};
#endif // _BinMDataStd_RelationDriver_HeaderFile

View File

@@ -8,10 +8,6 @@ BinMDataStd_BooleanListDriver.cxx
BinMDataStd_BooleanListDriver.hxx
BinMDataStd_ByteArrayDriver.cxx
BinMDataStd_ByteArrayDriver.hxx
BinMDataStd_CommentDriver.cxx
BinMDataStd_CommentDriver.hxx
BinMDataStd_DirectoryDriver.cxx
BinMDataStd_DirectoryDriver.hxx
BinMDataStd_ExpressionDriver.cxx
BinMDataStd_ExpressionDriver.hxx
BinMDataStd_ExtStringArrayDriver.cxx
@@ -28,10 +24,8 @@ BinMDataStd_IntPackedMapDriver.cxx
BinMDataStd_IntPackedMapDriver.hxx
BinMDataStd_NamedDataDriver.cxx
BinMDataStd_NamedDataDriver.hxx
BinMDataStd_NameDriver.cxx
BinMDataStd_NameDriver.hxx
BinMDataStd_NoteBookDriver.cxx
BinMDataStd_NoteBookDriver.hxx
BinMDataStd_GenericExtStringDriver.cxx
BinMDataStd_GenericExtStringDriver.hxx
BinMDataStd_RealArrayDriver.cxx
BinMDataStd_RealArrayDriver.hxx
BinMDataStd_RealDriver.cxx
@@ -42,10 +36,8 @@ BinMDataStd_ReferenceArrayDriver.cxx
BinMDataStd_ReferenceArrayDriver.hxx
BinMDataStd_ReferenceListDriver.cxx
BinMDataStd_ReferenceListDriver.hxx
BinMDataStd_RelationDriver.cxx
BinMDataStd_RelationDriver.hxx
BinMDataStd_TickDriver.cxx
BinMDataStd_TickDriver.hxx
BinMDataStd_GenericEmptyDriver.cxx
BinMDataStd_GenericEmptyDriver.hxx
BinMDataStd_TreeNodeDriver.cxx
BinMDataStd_TreeNodeDriver.hxx
BinMDataStd_UAttributeDriver.cxx