mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-14 13:30:48 +03:00
Integration of OCCT 6.5.0 from SVN
This commit is contained in:
88
src/BinMDataStd/BinMDataStd.cdl
Executable file
88
src/BinMDataStd/BinMDataStd.cdl
Executable file
@@ -0,0 +1,88 @@
|
||||
-- File: BinMDataStd.cdl
|
||||
-- Created: Wed Oct 30 14:49:06 2002
|
||||
-- Author: Michael SAZONOV
|
||||
-- <msv@novgorox.nnov.matra-dtv.fr>
|
||||
---Copyright: Matra Datavision 2002
|
||||
|
||||
package BinMDataStd
|
||||
|
||||
---Purpose: Storage and Retrieval drivers for modelling attributes.
|
||||
|
||||
uses BinMDF,
|
||||
BinObjMgt,
|
||||
TDF,
|
||||
CDM
|
||||
|
||||
is
|
||||
---Purpose: Storage/Retrieval drivers for TDataStd attributes
|
||||
-- =======================================
|
||||
|
||||
class NameDriver;
|
||||
|
||||
class IntegerDriver;
|
||||
|
||||
class RealDriver;
|
||||
|
||||
class IntegerArrayDriver;
|
||||
|
||||
class RealArrayDriver;
|
||||
|
||||
class UAttributeDriver;
|
||||
|
||||
class DirectoryDriver;
|
||||
|
||||
class CommentDriver;
|
||||
|
||||
class VariableDriver;
|
||||
|
||||
class ExpressionDriver;
|
||||
|
||||
class RelationDriver;
|
||||
|
||||
class NoteBookDriver;
|
||||
|
||||
class TreeNodeDriver;
|
||||
|
||||
class ExtStringArrayDriver;
|
||||
|
||||
|
||||
-- Extension
|
||||
|
||||
class TickDriver;
|
||||
|
||||
class AsciiStringDriver;
|
||||
|
||||
class IntPackedMapDriver;
|
||||
|
||||
-- Lists:
|
||||
|
||||
class IntegerListDriver;
|
||||
|
||||
class RealListDriver;
|
||||
|
||||
class ExtStringListDriver;
|
||||
|
||||
class BooleanListDriver;
|
||||
|
||||
class ReferenceListDriver;
|
||||
|
||||
-- Arrays:
|
||||
|
||||
class BooleanArrayDriver;
|
||||
|
||||
class ReferenceArrayDriver;
|
||||
|
||||
class ByteArrayDriver;
|
||||
|
||||
class NamedDataDriver;
|
||||
|
||||
|
||||
AddDrivers (theDriverTable : ADriverTable from BinMDF;
|
||||
aMsgDrv : MessageDriver from CDM);
|
||||
---Purpose: Adds the attribute drivers to <theDriverTable>.
|
||||
|
||||
SetDocumentVersion (DocVersion : Integer from Standard);
|
||||
|
||||
DocumentVersion returns Integer from Standard;
|
||||
|
||||
end BinMDataStd;
|
87
src/BinMDataStd/BinMDataStd.cxx
Executable file
87
src/BinMDataStd/BinMDataStd.cxx
Executable file
@@ -0,0 +1,87 @@
|
||||
// File: BinMDataStd.cxx
|
||||
// Created: 30.10.02 15:16:19
|
||||
// Author: Michael SAZONOV
|
||||
// Copyright: Open CASCADE 2002
|
||||
|
||||
#include <BinMDataStd.ixx>
|
||||
#include <BinMDataStd_IntegerDriver.hxx>
|
||||
#include <BinMDataStd_RealDriver.hxx>
|
||||
#include <BinMDataStd_IntegerArrayDriver.hxx>
|
||||
#include <BinMDataStd_RealArrayDriver.hxx>
|
||||
#include <BinMDataStd_NameDriver.hxx>
|
||||
#include <BinMDataStd_CommentDriver.hxx>
|
||||
#include <BinMDataStd_ExpressionDriver.hxx>
|
||||
#include <BinMDataStd_RelationDriver.hxx>
|
||||
#include <BinMDataStd_TreeNodeDriver.hxx>
|
||||
#include <BinMDataStd_UAttributeDriver.hxx>
|
||||
#include <BinMDataStd_VariableDriver.hxx>
|
||||
#include <BinMDataStd_DirectoryDriver.hxx>
|
||||
#include <BinMDataStd_NoteBookDriver.hxx>
|
||||
#include <BinMDataStd_ExtStringArrayDriver.hxx>
|
||||
#include <BinMDataStd_TickDriver.hxx>
|
||||
#include <BinMDataStd_IntegerListDriver.hxx>
|
||||
#include <BinMDataStd_RealListDriver.hxx>
|
||||
#include <BinMDataStd_ExtStringListDriver.hxx>
|
||||
#include <BinMDataStd_BooleanListDriver.hxx>
|
||||
#include <BinMDataStd_ReferenceListDriver.hxx>
|
||||
#include <BinMDataStd_BooleanArrayDriver.hxx>
|
||||
#include <BinMDataStd_ReferenceArrayDriver.hxx>
|
||||
#include <BinMDataStd_ByteArrayDriver.hxx>
|
||||
#include <BinMDataStd_NamedDataDriver.hxx>
|
||||
#include <BinMDataStd_AsciiStringDriver.hxx>
|
||||
#include <BinMDataStd_IntPackedMapDriver.hxx>
|
||||
|
||||
static Standard_Integer myDocumentVersion = -1;
|
||||
//=======================================================================
|
||||
//function : AddDrivers
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BinMDataStd::AddDrivers (const Handle(BinMDF_ADriverTable)& theDriverTable,
|
||||
const Handle(CDM_MessageDriver)& 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) );
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetDocumentVersion
|
||||
//purpose : Sets current document version
|
||||
//=======================================================================
|
||||
void BinMDataStd::SetDocumentVersion(const Standard_Integer theVersion)
|
||||
{
|
||||
myDocumentVersion = theVersion;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : DocumentVersion
|
||||
//purpose : Retrieved document version
|
||||
//=======================================================================
|
||||
Standard_Integer BinMDataStd::DocumentVersion()
|
||||
{
|
||||
return myDocumentVersion;
|
||||
}
|
36
src/BinMDataStd/BinMDataStd_AsciiStringDriver.cdl
Executable file
36
src/BinMDataStd/BinMDataStd_AsciiStringDriver.cdl
Executable file
@@ -0,0 +1,36 @@
|
||||
-- File: BinMDataStd_AsciiStringDriver.cdl
|
||||
-- Created: Wed Aug 1 12:04:13 2007
|
||||
-- Author: Sergey ZARITCHNY
|
||||
-- <sergey.zaritchny@opencascade.com>
|
||||
---Copyright: Open CasCade SA 2007
|
||||
|
||||
|
||||
class AsciiStringDriver from BinMDataStd inherits ADriver from BinMDF
|
||||
|
||||
---Purpose: TDataStd_AsciiString attribute Driver.
|
||||
|
||||
uses
|
||||
SRelocationTable from BinObjMgt,
|
||||
RRelocationTable from BinObjMgt,
|
||||
Persistent from BinObjMgt,
|
||||
MessageDriver from CDM,
|
||||
Attribute from TDF
|
||||
|
||||
is
|
||||
Create (theMessageDriver:MessageDriver from CDM)
|
||||
returns mutable AsciiStringDriver from BinMDataStd;
|
||||
|
||||
NewEmpty (me) returns mutable Attribute from TDF;
|
||||
|
||||
Paste(me; Source : Persistent from BinObjMgt;
|
||||
Target : mutable Attribute from TDF;
|
||||
RelocTable : out RRelocationTable from BinObjMgt)
|
||||
returns Boolean from Standard;
|
||||
---Purpose: persistent -> transient (retrieve)
|
||||
|
||||
Paste(me; Source : Attribute from TDF;
|
||||
Target : in out Persistent from BinObjMgt;
|
||||
RelocTable : out SRelocationTable from BinObjMgt);
|
||||
---Purpose: transient -> persistent (store)
|
||||
|
||||
end AsciiStringDriver;
|
66
src/BinMDataStd/BinMDataStd_AsciiStringDriver.cxx
Executable file
66
src/BinMDataStd/BinMDataStd_AsciiStringDriver.cxx
Executable file
@@ -0,0 +1,66 @@
|
||||
// File: BinMDataStd_AsciiStringDriver.cxx
|
||||
// Created: Wed Aug 1 12:09:29 2007
|
||||
// Author: Sergey ZARITCHNY
|
||||
// <sergey.zaritchny@opencascade.com>
|
||||
// Copyright: Open CASCADE SA 2007
|
||||
|
||||
#include <BinMDataStd_AsciiStringDriver.ixx>
|
||||
#include <CDM_MessageDriver.hxx>
|
||||
#include <BinMDF_ADriver.hxx>
|
||||
#include <TDataStd_AsciiString.hxx>
|
||||
#include <TDF_Attribute.hxx>
|
||||
#include <BinObjMgt_Persistent.hxx>
|
||||
#include <BinObjMgt_RRelocationTable.hxx>
|
||||
#include <BinObjMgt_SRelocationTable.hxx>
|
||||
//=======================================================================
|
||||
//function : BinMDataStd_AsciiStringDriver
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
BinMDataStd_AsciiStringDriver::BinMDataStd_AsciiStringDriver
|
||||
(const Handle(CDM_MessageDriver)& theMessageDriver)
|
||||
: BinMDF_ADriver (theMessageDriver, STANDARD_TYPE(TDataStd_AsciiString)->Name())
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewEmpty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TDF_Attribute) BinMDataStd_AsciiStringDriver::NewEmpty() const
|
||||
{
|
||||
return new TDataStd_AsciiString;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose : persistent -> transient (retrieve)
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BinMDataStd_AsciiStringDriver::Paste
|
||||
(const BinObjMgt_Persistent& Source,
|
||||
const Handle(TDF_Attribute)& Target,
|
||||
BinObjMgt_RRelocationTable& /*RelocTable*/) const
|
||||
{
|
||||
Handle(TDataStd_AsciiString) aStrAtt = Handle(TDataStd_AsciiString)::DownCast(Target);
|
||||
TCollection_AsciiString aString;
|
||||
Standard_Boolean ok = Source >> aString;
|
||||
if (ok)
|
||||
aStrAtt->Set( aString );
|
||||
return ok;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose : transient -> persistent (store)
|
||||
//=======================================================================
|
||||
|
||||
void BinMDataStd_AsciiStringDriver::Paste
|
||||
(const Handle(TDF_Attribute)& Source,
|
||||
BinObjMgt_Persistent& Target,
|
||||
BinObjMgt_SRelocationTable& /*RelocTable*/) const
|
||||
{
|
||||
Handle(TDataStd_AsciiString) anAtt = Handle(TDataStd_AsciiString)::DownCast(Source);
|
||||
Target << anAtt->Get();
|
||||
}
|
35
src/BinMDataStd/BinMDataStd_BooleanArrayDriver.cdl
Executable file
35
src/BinMDataStd/BinMDataStd_BooleanArrayDriver.cdl
Executable file
@@ -0,0 +1,35 @@
|
||||
-- File: BinMDataStd_BooleanArrayDriver.cdl
|
||||
-- Created: May 29 11:40:00 2007
|
||||
-- Author: Vlad Romashko
|
||||
-- <vladislav.romashko@opencascade.com>
|
||||
-- Copyright: Open CASCADE
|
||||
|
||||
class BooleanArrayDriver from BinMDataStd inherits ADriver from BinMDF
|
||||
|
||||
uses
|
||||
|
||||
MessageDriver from CDM,
|
||||
SRelocationTable from BinObjMgt,
|
||||
RRelocationTable from BinObjMgt,
|
||||
Persistent from BinObjMgt,
|
||||
Attribute from TDF
|
||||
|
||||
is
|
||||
Create (theMessageDriver:MessageDriver from CDM)
|
||||
returns mutable BooleanArrayDriver from BinMDataStd;
|
||||
|
||||
NewEmpty (me)
|
||||
returns mutable Attribute from TDF
|
||||
is redefined;
|
||||
|
||||
Paste(me; Source : Persistent from BinObjMgt;
|
||||
Target : mutable Attribute from TDF;
|
||||
RelocTable : out RRelocationTable from BinObjMgt)
|
||||
returns Boolean from Standard is redefined;
|
||||
|
||||
Paste(me; Source : Attribute from TDF;
|
||||
Target : in out Persistent from BinObjMgt;
|
||||
RelocTable : out SRelocationTable from BinObjMgt)
|
||||
is redefined;
|
||||
|
||||
end BooleanArrayDriver;
|
84
src/BinMDataStd/BinMDataStd_BooleanArrayDriver.cxx
Executable file
84
src/BinMDataStd/BinMDataStd_BooleanArrayDriver.cxx
Executable file
@@ -0,0 +1,84 @@
|
||||
// File: BinMDataStd_BooleanArrayDriver.cxx
|
||||
// Created: May 29 11:40:00 2007
|
||||
// Author: Vlad Romashko
|
||||
// <vladislav.romashko@opencascade.com>
|
||||
// Copyright: Open CASCADE
|
||||
|
||||
#include <BinMDataStd_BooleanArrayDriver.ixx>
|
||||
#include <TDataStd_BooleanArray.hxx>
|
||||
#include <TColStd_HArray1OfByte.hxx>
|
||||
#include <TColStd_Array1OfInteger.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : BinMDataStd_BooleanArrayDriver
|
||||
//purpose : Constructor
|
||||
//=======================================================================
|
||||
BinMDataStd_BooleanArrayDriver::BinMDataStd_BooleanArrayDriver(const Handle(CDM_MessageDriver)& theMsgDriver)
|
||||
: BinMDF_ADriver (theMsgDriver, STANDARD_TYPE(TDataStd_BooleanArray)->Name())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewEmpty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(TDF_Attribute) BinMDataStd_BooleanArrayDriver::NewEmpty() const
|
||||
{
|
||||
return new TDataStd_BooleanArray();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose : persistent -> transient (retrieve)
|
||||
//=======================================================================
|
||||
Standard_Boolean BinMDataStd_BooleanArrayDriver::Paste(const BinObjMgt_Persistent& theSource,
|
||||
const Handle(TDF_Attribute)& theTarget,
|
||||
BinObjMgt_RRelocationTable& ) const
|
||||
{
|
||||
Standard_Integer aFirstInd, aLastInd;
|
||||
if (! (theSource >> aFirstInd >> aLastInd))
|
||||
return Standard_False;
|
||||
if (aLastInd < aFirstInd)
|
||||
return Standard_False;
|
||||
|
||||
TColStd_Array1OfByte aTargetArray(0, (aLastInd - aFirstInd + 1) >> 3);
|
||||
theSource.GetByteArray (&aTargetArray(0), aTargetArray.Length());
|
||||
|
||||
Handle(TDataStd_BooleanArray) anAtt = Handle(TDataStd_BooleanArray)::DownCast(theTarget);
|
||||
anAtt->Init(aFirstInd, aLastInd);
|
||||
Handle(TColStd_HArray1OfByte) bytes = new TColStd_HArray1OfByte(aTargetArray.Lower(), aTargetArray.Upper());
|
||||
Standard_Integer lower = bytes->Lower(), i = lower, upper = bytes->Upper();
|
||||
for (; i <= upper; i++)
|
||||
{
|
||||
bytes->SetValue(i, aTargetArray.Value(i));
|
||||
}
|
||||
anAtt->SetInternalArray(bytes);
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose : transient -> persistent (store)
|
||||
//=======================================================================
|
||||
void BinMDataStd_BooleanArrayDriver::Paste(const Handle(TDF_Attribute)& theSource,
|
||||
BinObjMgt_Persistent& theTarget,
|
||||
BinObjMgt_SRelocationTable& ) const
|
||||
{
|
||||
Handle(TDataStd_BooleanArray) anAtt = Handle(TDataStd_BooleanArray)::DownCast(theSource);
|
||||
const Standard_Integer aFirstInd = anAtt->Lower();
|
||||
const Standard_Integer aLastInd = anAtt->Upper();
|
||||
if (aLastInd < aFirstInd)
|
||||
return;
|
||||
theTarget << aFirstInd << aLastInd;
|
||||
|
||||
const Handle(TColStd_HArray1OfByte)& bytes = anAtt->InternalArray();
|
||||
TColStd_Array1OfByte aSourceArray(bytes->Lower(), bytes->Upper());
|
||||
Standard_Integer lower = bytes->Lower(), i = lower, upper = bytes->Upper();
|
||||
for (; i <= upper; i++)
|
||||
{
|
||||
aSourceArray.SetValue(i, bytes->Value(i));
|
||||
}
|
||||
Standard_Byte *aPtr = (Standard_Byte *) &aSourceArray(lower);
|
||||
theTarget.PutByteArray(aPtr, upper - lower + 1);
|
||||
}
|
35
src/BinMDataStd/BinMDataStd_BooleanListDriver.cdl
Executable file
35
src/BinMDataStd/BinMDataStd_BooleanListDriver.cdl
Executable file
@@ -0,0 +1,35 @@
|
||||
-- File: BinMDataStd_BooleanListDriver.cdl
|
||||
-- Created: May 29 11:40:00 2007
|
||||
-- Author: Vlad Romashko
|
||||
-- <vladislav.romashko@opencascade.com>
|
||||
-- Copyright: Open CASCADE
|
||||
|
||||
class BooleanListDriver from BinMDataStd inherits ADriver from BinMDF
|
||||
|
||||
uses
|
||||
|
||||
MessageDriver from CDM,
|
||||
SRelocationTable from BinObjMgt,
|
||||
RRelocationTable from BinObjMgt,
|
||||
Persistent from BinObjMgt,
|
||||
Attribute from TDF
|
||||
|
||||
is
|
||||
Create (theMessageDriver:MessageDriver from CDM)
|
||||
returns mutable BooleanListDriver from BinMDataStd;
|
||||
|
||||
NewEmpty (me)
|
||||
returns mutable Attribute from TDF
|
||||
is redefined;
|
||||
|
||||
Paste(me; Source : Persistent from BinObjMgt;
|
||||
Target : mutable Attribute from TDF;
|
||||
RelocTable : out RRelocationTable from BinObjMgt)
|
||||
returns Boolean from Standard is redefined;
|
||||
|
||||
Paste(me; Source : Attribute from TDF;
|
||||
Target : in out Persistent from BinObjMgt;
|
||||
RelocTable : out SRelocationTable from BinObjMgt)
|
||||
is redefined;
|
||||
|
||||
end BooleanListDriver;
|
83
src/BinMDataStd/BinMDataStd_BooleanListDriver.cxx
Executable file
83
src/BinMDataStd/BinMDataStd_BooleanListDriver.cxx
Executable file
@@ -0,0 +1,83 @@
|
||||
// File: BinMDataStd_BooleanListDriver.cxx
|
||||
// Created: May 29 11:40:00 2007
|
||||
// Author: Vlad Romashko
|
||||
// <vladislav.romashko@opencascade.com>
|
||||
// Copyright: Open CASCADE
|
||||
|
||||
#include <BinMDataStd_BooleanListDriver.ixx>
|
||||
#include <TDataStd_BooleanList.hxx>
|
||||
#include <TDataStd_ListIteratorOfListOfByte.hxx>
|
||||
#include <TColStd_Array1OfByte.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : BinMDataStd_BooleanListDriver
|
||||
//purpose : Constructor
|
||||
//=======================================================================
|
||||
BinMDataStd_BooleanListDriver::BinMDataStd_BooleanListDriver(const Handle(CDM_MessageDriver)& theMsgDriver)
|
||||
: BinMDF_ADriver (theMsgDriver, STANDARD_TYPE(TDataStd_BooleanList)->Name())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewEmpty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(TDF_Attribute) BinMDataStd_BooleanListDriver::NewEmpty() const
|
||||
{
|
||||
return new TDataStd_BooleanList();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose : persistent -> transient (retrieve)
|
||||
//=======================================================================
|
||||
Standard_Boolean BinMDataStd_BooleanListDriver::Paste(const BinObjMgt_Persistent& theSource,
|
||||
const Handle(TDF_Attribute)& theTarget,
|
||||
BinObjMgt_RRelocationTable& ) const
|
||||
{
|
||||
Standard_Integer aIndex, aFirstInd, aLastInd;
|
||||
if (! (theSource >> aFirstInd >> aLastInd))
|
||||
return Standard_False;
|
||||
const Standard_Integer aLength = aLastInd - aFirstInd + 1;
|
||||
if (aLength <= 0)
|
||||
return Standard_False;
|
||||
|
||||
TColStd_Array1OfByte aTargetArray(aFirstInd, aLastInd);
|
||||
theSource.GetByteArray (&aTargetArray(aFirstInd), aLength);
|
||||
|
||||
Handle(TDataStd_BooleanList) anAtt = Handle(TDataStd_BooleanList)::DownCast(theTarget);
|
||||
for (aIndex = aFirstInd; aIndex <= aLastInd; aIndex++)
|
||||
{
|
||||
anAtt->Append(aTargetArray.Value(aIndex) ? Standard_True : Standard_False);
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose : transient -> persistent (store)
|
||||
//=======================================================================
|
||||
void BinMDataStd_BooleanListDriver::Paste(const Handle(TDF_Attribute)& theSource,
|
||||
BinObjMgt_Persistent& theTarget,
|
||||
BinObjMgt_SRelocationTable& ) const
|
||||
{
|
||||
Handle(TDataStd_BooleanList) anAtt = Handle(TDataStd_BooleanList)::DownCast(theSource);
|
||||
const Standard_Integer aFirstInd = 1;
|
||||
const Standard_Integer aLastInd = anAtt->Extent();
|
||||
const Standard_Integer aLength = aLastInd - aFirstInd + 1;
|
||||
if (aLength <= 0)
|
||||
return;
|
||||
theTarget << aFirstInd << aLastInd;
|
||||
TColStd_Array1OfByte aSourceArray(aFirstInd, aLastInd);
|
||||
if (aLastInd >= 1)
|
||||
{
|
||||
TDataStd_ListIteratorOfListOfByte itr(anAtt->List());
|
||||
for (Standard_Integer i = 1; itr.More(); itr.Next(), i++)
|
||||
{
|
||||
aSourceArray.SetValue(i, itr.Value());
|
||||
}
|
||||
Standard_Byte *aPtr = (Standard_Byte *) &aSourceArray(aFirstInd);
|
||||
theTarget.PutByteArray(aPtr, aLength);
|
||||
}
|
||||
}
|
35
src/BinMDataStd/BinMDataStd_ByteArrayDriver.cdl
Executable file
35
src/BinMDataStd/BinMDataStd_ByteArrayDriver.cdl
Executable file
@@ -0,0 +1,35 @@
|
||||
-- File: BinMDataStd_ByteArrayDriver.cdl
|
||||
-- Created: May 29 11:40:00 2007
|
||||
-- Author: Vlad Romashko
|
||||
-- <vladislav.romashko@opencascade.com>
|
||||
-- Copyright: Open CASCADE
|
||||
|
||||
class ByteArrayDriver from BinMDataStd inherits ADriver from BinMDF
|
||||
|
||||
uses
|
||||
|
||||
MessageDriver from CDM,
|
||||
SRelocationTable from BinObjMgt,
|
||||
RRelocationTable from BinObjMgt,
|
||||
Persistent from BinObjMgt,
|
||||
Attribute from TDF
|
||||
|
||||
is
|
||||
Create (theMessageDriver:MessageDriver from CDM)
|
||||
returns mutable ByteArrayDriver from BinMDataStd;
|
||||
|
||||
NewEmpty (me)
|
||||
returns mutable Attribute from TDF
|
||||
is redefined;
|
||||
|
||||
Paste(me; Source : Persistent from BinObjMgt;
|
||||
Target : mutable Attribute from TDF;
|
||||
RelocTable : out RRelocationTable from BinObjMgt)
|
||||
returns Boolean from Standard is redefined;
|
||||
|
||||
Paste(me; Source : Attribute from TDF;
|
||||
Target : in out Persistent from BinObjMgt;
|
||||
RelocTable : out SRelocationTable from BinObjMgt)
|
||||
is redefined;
|
||||
|
||||
end ByteArrayDriver;
|
101
src/BinMDataStd/BinMDataStd_ByteArrayDriver.cxx
Executable file
101
src/BinMDataStd/BinMDataStd_ByteArrayDriver.cxx
Executable file
@@ -0,0 +1,101 @@
|
||||
// File: BinMDataStd_ByteArrayDriver.cxx
|
||||
// Created: May 29 11:40:00 2007
|
||||
// Author: Vlad Romashko
|
||||
// <vladislav.romashko@opencascade.com>
|
||||
// Copyright: Open CASCADE
|
||||
|
||||
#include <BinMDataStd_ByteArrayDriver.ixx>
|
||||
#include <TDataStd_ByteArray.hxx>
|
||||
#include <TColStd_HArray1OfByte.hxx>
|
||||
#include <TColStd_Array1OfInteger.hxx>
|
||||
#include <BinMDataStd.hxx>
|
||||
//=======================================================================
|
||||
//function : BinMDataStd_ByteArrayDriver
|
||||
//purpose : Constructor
|
||||
//=======================================================================
|
||||
BinMDataStd_ByteArrayDriver::BinMDataStd_ByteArrayDriver(const Handle(CDM_MessageDriver)& theMsgDriver)
|
||||
: BinMDF_ADriver (theMsgDriver, STANDARD_TYPE(TDataStd_ByteArray)->Name())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewEmpty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(TDF_Attribute) BinMDataStd_ByteArrayDriver::NewEmpty() const
|
||||
{
|
||||
return new TDataStd_ByteArray();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose : persistent -> transient (retrieve)
|
||||
//=======================================================================
|
||||
Standard_Boolean BinMDataStd_ByteArrayDriver::Paste(const BinObjMgt_Persistent& theSource,
|
||||
const Handle(TDF_Attribute)& theTarget,
|
||||
BinObjMgt_RRelocationTable& ) const
|
||||
{
|
||||
#ifdef DEB
|
||||
// cout << "ByteArrayDriver::Retrieve: " << TypeName() << endl;
|
||||
#endif
|
||||
Standard_Integer aFirstInd, aLastInd;
|
||||
if (! (theSource >> aFirstInd >> aLastInd))
|
||||
return Standard_False;
|
||||
if (aLastInd < aFirstInd)
|
||||
return Standard_False;
|
||||
|
||||
TColStd_Array1OfByte aTargetArray(aFirstInd, aLastInd);
|
||||
theSource.GetByteArray (&aTargetArray(aFirstInd), aTargetArray.Length());
|
||||
|
||||
Handle(TDataStd_ByteArray) anAtt = Handle(TDataStd_ByteArray)::DownCast(theTarget);
|
||||
Handle(TColStd_HArray1OfByte) bytes = new TColStd_HArray1OfByte(aFirstInd, aLastInd);
|
||||
for (Standard_Integer i = aFirstInd; i <= aLastInd; i++)
|
||||
{
|
||||
bytes->SetValue(i, aTargetArray.Value(i));
|
||||
}
|
||||
anAtt->ChangeArray(bytes);
|
||||
#ifdef DEB
|
||||
//cout << "CurDocVersion = " << BinMDataStd::DocumentVersion() <<endl;
|
||||
#endif
|
||||
Standard_Boolean aDelta(Standard_False);
|
||||
if(BinMDataStd::DocumentVersion() > 2) {
|
||||
Standard_Byte aDeltaValue;
|
||||
if (! (theSource >> aDeltaValue))
|
||||
return Standard_False;
|
||||
else
|
||||
aDelta = (Standard_Boolean)aDeltaValue;
|
||||
}
|
||||
anAtt->SetDelta(aDelta);
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose : transient -> persistent (store)
|
||||
//=======================================================================
|
||||
void BinMDataStd_ByteArrayDriver::Paste(const Handle(TDF_Attribute)& theSource,
|
||||
BinObjMgt_Persistent& theTarget,
|
||||
BinObjMgt_SRelocationTable& ) const
|
||||
{
|
||||
#ifdef DEB
|
||||
// cout << "ByteArrayDriver::Store: " << TypeName() << endl;
|
||||
#endif
|
||||
Handle(TDataStd_ByteArray) anAtt = Handle(TDataStd_ByteArray)::DownCast(theSource);
|
||||
const Standard_Integer aFirstInd = anAtt->Lower();
|
||||
const Standard_Integer aLastInd = anAtt->Upper();
|
||||
if (aLastInd < aFirstInd)
|
||||
return;
|
||||
theTarget << aFirstInd << aLastInd;
|
||||
|
||||
const Handle(TColStd_HArray1OfByte)& bytes = anAtt->InternalArray();
|
||||
Standard_Integer lower = bytes->Lower(), i = lower, upper = bytes->Upper();
|
||||
TColStd_Array1OfByte aSourceArray(lower, upper);
|
||||
for (; i <= upper; i++)
|
||||
{
|
||||
aSourceArray.SetValue(i, bytes->Value(i));
|
||||
}
|
||||
Standard_Byte *aPtr = (Standard_Byte *) &aSourceArray(lower);
|
||||
theTarget.PutByteArray(aPtr, bytes->Length());
|
||||
theTarget << (Standard_Byte)anAtt->GetDelta();
|
||||
}
|
32
src/BinMDataStd/BinMDataStd_CommentDriver.cdl
Executable file
32
src/BinMDataStd/BinMDataStd_CommentDriver.cdl
Executable file
@@ -0,0 +1,32 @@
|
||||
-- File: BinMDataStd_CommentDriver.cdl
|
||||
-- Created: Fri Aug 24 20:16:51 2001
|
||||
-- Author: Alexander GRIGORIEV
|
||||
-- Copyright: Open Cascade 2001
|
||||
|
||||
class CommentDriver from BinMDataStd inherits ADriver from BinMDF
|
||||
|
||||
---Purpose: Attribute Driver.
|
||||
|
||||
uses
|
||||
SRelocationTable from BinObjMgt,
|
||||
RRelocationTable from BinObjMgt,
|
||||
Persistent from BinObjMgt,
|
||||
MessageDriver from CDM,
|
||||
Attribute from TDF
|
||||
|
||||
is
|
||||
Create (theMessageDriver:MessageDriver from CDM)
|
||||
returns mutable CommentDriver from BinMDataStd;
|
||||
|
||||
NewEmpty (me) returns mutable Attribute from TDF;
|
||||
|
||||
Paste(me; Source : Persistent from BinObjMgt;
|
||||
Target : mutable Attribute from TDF;
|
||||
RelocTable : out RRelocationTable from BinObjMgt)
|
||||
returns Boolean from Standard;
|
||||
|
||||
Paste(me; Source : Attribute from TDF;
|
||||
Target : in out Persistent from BinObjMgt;
|
||||
RelocTable : out SRelocationTable from BinObjMgt);
|
||||
|
||||
end CommentDriver;
|
56
src/BinMDataStd/BinMDataStd_CommentDriver.cxx
Executable file
56
src/BinMDataStd/BinMDataStd_CommentDriver.cxx
Executable file
@@ -0,0 +1,56 @@
|
||||
// File: BinMDataStd_CommentDriver.cxx
|
||||
// Created: Fri Aug 24 20:46:58 2001
|
||||
// Author: Alexnder GRIGORIEV
|
||||
// Copyright: Open Cascade 2001
|
||||
// History:
|
||||
|
||||
#include <BinMDataStd_CommentDriver.ixx>
|
||||
#include <TDataStd_Comment.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : BinMDataStd_CommentDriver
|
||||
//purpose : Constructor
|
||||
//=======================================================================
|
||||
|
||||
BinMDataStd_CommentDriver::BinMDataStd_CommentDriver
|
||||
(const Handle(CDM_MessageDriver)& 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;
|
||||
}
|
35
src/BinMDataStd/BinMDataStd_DirectoryDriver.cdl
Executable file
35
src/BinMDataStd/BinMDataStd_DirectoryDriver.cdl
Executable file
@@ -0,0 +1,35 @@
|
||||
-- File: BinMDataStd_DirectoryDriver.cdl
|
||||
-- Created: Thu May 13 12:45:59 2004
|
||||
-- Author: Sergey ZARITCHNY <szy@opencascade.com>
|
||||
-- Copyright: Open CasCade S.A. 2004
|
||||
|
||||
class DirectoryDriver from BinMDataStd inherits ADriver from BinMDF
|
||||
|
||||
---Purpose: Directory attribute Driver.
|
||||
|
||||
uses
|
||||
MessageDriver from CDM,
|
||||
SRelocationTable from BinObjMgt,
|
||||
RRelocationTable from BinObjMgt,
|
||||
Persistent from BinObjMgt,
|
||||
Attribute from TDF
|
||||
|
||||
is
|
||||
Create (theMessageDriver:MessageDriver from CDM)
|
||||
returns mutable DirectoryDriver from BinMDataStd;
|
||||
|
||||
NewEmpty (me) returns mutable Attribute from TDF
|
||||
is redefined;
|
||||
|
||||
Paste(me; Source : Persistent from BinObjMgt;
|
||||
Target : mutable Attribute from TDF;
|
||||
RelocTable : out RRelocationTable from BinObjMgt)
|
||||
returns Boolean from Standard is redefined;
|
||||
|
||||
Paste(me; Source : Attribute from TDF;
|
||||
Target : in out Persistent from BinObjMgt;
|
||||
RelocTable : out SRelocationTable from BinObjMgt)
|
||||
is redefined;
|
||||
|
||||
end DirectoryDriver;
|
||||
|
57
src/BinMDataStd/BinMDataStd_DirectoryDriver.cxx
Executable file
57
src/BinMDataStd/BinMDataStd_DirectoryDriver.cxx
Executable file
@@ -0,0 +1,57 @@
|
||||
// File: BinMDataStd_DirectoryDriver.cxx
|
||||
// Created: Thu May 13 12:47:22 2004
|
||||
// Author: Sergey ZARITCHNY <szy@opencascade.com>
|
||||
// Copyright: Open CasCade S.A. 2004
|
||||
|
||||
#include <BinMDataStd_DirectoryDriver.ixx>
|
||||
#include <CDM_MessageDriver.hxx>
|
||||
#include <TDF_Attribute.hxx>
|
||||
#include <TDataStd_Directory.hxx>
|
||||
#include <BinMDF_ADriver.hxx>
|
||||
#include <BinObjMgt_Persistent.hxx>
|
||||
#include <BinObjMgt_RRelocationTable.hxx>
|
||||
#include <BinObjMgt_SRelocationTable.hxx>
|
||||
//=======================================================================
|
||||
//function : BinMDataStd_DirectoryDriver
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
BinMDataStd_DirectoryDriver::BinMDataStd_DirectoryDriver
|
||||
(const Handle(CDM_MessageDriver)& 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
|
||||
{}
|
||||
|
||||
|
||||
|
32
src/BinMDataStd/BinMDataStd_ExpressionDriver.cdl
Executable file
32
src/BinMDataStd/BinMDataStd_ExpressionDriver.cdl
Executable file
@@ -0,0 +1,32 @@
|
||||
-- File: BinMDataStd_ExpressionDriver.cdl
|
||||
-- Created: Wed Sep 12 14:05:15 2001
|
||||
-- Author: Julia DOROVSKIKH
|
||||
-- Copyright: Open Cascade 2001
|
||||
|
||||
class ExpressionDriver from BinMDataStd inherits ADriver from BinMDF
|
||||
|
||||
---Purpose: Attribute Driver.
|
||||
|
||||
uses
|
||||
SRelocationTable from BinObjMgt,
|
||||
RRelocationTable from BinObjMgt,
|
||||
Persistent from BinObjMgt,
|
||||
MessageDriver from CDM,
|
||||
Attribute from TDF
|
||||
|
||||
is
|
||||
Create (theMessageDriver:MessageDriver from CDM)
|
||||
returns mutable ExpressionDriver from BinMDataStd;
|
||||
|
||||
NewEmpty (me) returns mutable Attribute from TDF;
|
||||
|
||||
Paste(me; Source : Persistent from BinObjMgt;
|
||||
Target : mutable Attribute from TDF;
|
||||
RelocTable : out RRelocationTable from BinObjMgt)
|
||||
returns Boolean from Standard;
|
||||
|
||||
Paste(me; Source : Attribute from TDF;
|
||||
Target : in out Persistent from BinObjMgt;
|
||||
RelocTable : out SRelocationTable from BinObjMgt);
|
||||
|
||||
end ExpressionDriver;
|
106
src/BinMDataStd/BinMDataStd_ExpressionDriver.cxx
Executable file
106
src/BinMDataStd/BinMDataStd_ExpressionDriver.cxx
Executable file
@@ -0,0 +1,106 @@
|
||||
// File: BinMDataStd_ExpressionDriver.cxx
|
||||
// Created: Wed Sep 12 14:07:32 2001
|
||||
// Author: Julia DOROVSKIKH
|
||||
// Copyright: Open Cascade 2001
|
||||
// History:
|
||||
|
||||
#include <BinMDataStd_ExpressionDriver.ixx>
|
||||
#include <TDataStd_Expression.hxx>
|
||||
#include <TDataStd_Variable.hxx>
|
||||
#include <TDF_ListIteratorOfAttributeList.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : BinMDataStd_ExpressionDriver
|
||||
//purpose : Constructor
|
||||
//=======================================================================
|
||||
BinMDataStd_ExpressionDriver::BinMDataStd_ExpressionDriver
|
||||
(const Handle(CDM_MessageDriver)& theMsgDriver)
|
||||
: BinMDF_ADriver (theMsgDriver, NULL)
|
||||
{}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewEmpty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(TDF_Attribute) BinMDataStd_ExpressionDriver::NewEmpty() const
|
||||
{
|
||||
return (new TDataStd_Expression());
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose : persistent -> transient (retrieve)
|
||||
//=======================================================================
|
||||
Standard_Boolean BinMDataStd_ExpressionDriver::Paste
|
||||
(const BinObjMgt_Persistent& theSource,
|
||||
const Handle(TDF_Attribute)& theTarget,
|
||||
BinObjMgt_RRelocationTable& theRelocTable) const
|
||||
{
|
||||
Handle(TDataStd_Expression) aC =
|
||||
Handle(TDataStd_Expression)::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->SetExpression(aString);
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose : transient -> persistent (store)
|
||||
//=======================================================================
|
||||
void BinMDataStd_ExpressionDriver::Paste
|
||||
(const Handle(TDF_Attribute)& theSource,
|
||||
BinObjMgt_Persistent& theTarget,
|
||||
BinObjMgt_SRelocationTable& theRelocTable) const
|
||||
{
|
||||
Handle(TDataStd_Expression) aC =
|
||||
Handle(TDataStd_Expression)::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;
|
||||
}
|
35
src/BinMDataStd/BinMDataStd_ExtStringArrayDriver.cdl
Executable file
35
src/BinMDataStd/BinMDataStd_ExtStringArrayDriver.cdl
Executable file
@@ -0,0 +1,35 @@
|
||||
-- File: BinMDataStd_ExtStringArrayDriver.cdl
|
||||
-- Created: Tue Aug 24 17:19:27 2004
|
||||
-- Author: Pavel TELKOV
|
||||
-- <ptv@valenox>
|
||||
---Copyright: Matra Datavision 2004
|
||||
|
||||
class ExtStringArrayDriver from BinMDataStd inherits ADriver from BinMDF
|
||||
|
||||
---Purpose: Array of extended string attribute Driver.
|
||||
|
||||
uses
|
||||
MessageDriver from CDM,
|
||||
SRelocationTable from BinObjMgt,
|
||||
RRelocationTable from BinObjMgt,
|
||||
Persistent from BinObjMgt,
|
||||
Attribute from TDF
|
||||
|
||||
is
|
||||
Create (theMessageDriver:MessageDriver from CDM)
|
||||
returns mutable ExtStringArrayDriver from BinMDataStd;
|
||||
|
||||
NewEmpty (me) returns mutable Attribute from TDF
|
||||
is redefined;
|
||||
|
||||
Paste(me; Source : Persistent from BinObjMgt;
|
||||
Target : mutable Attribute from TDF;
|
||||
RelocTable : out RRelocationTable from BinObjMgt)
|
||||
returns Boolean from Standard is redefined;
|
||||
|
||||
Paste(me; Source : Attribute from TDF;
|
||||
Target : in out Persistent from BinObjMgt;
|
||||
RelocTable : out SRelocationTable from BinObjMgt)
|
||||
is redefined;
|
||||
|
||||
end ExtStringArrayDriver;
|
102
src/BinMDataStd/BinMDataStd_ExtStringArrayDriver.cxx
Executable file
102
src/BinMDataStd/BinMDataStd_ExtStringArrayDriver.cxx
Executable file
@@ -0,0 +1,102 @@
|
||||
// File: BinMDataStd_ExtStringArrayDriver.cxx
|
||||
// Created: 24.08.04 17:22:25
|
||||
// Author: Pavel TELKOV
|
||||
// Copyright: Open CASCADE 2004
|
||||
|
||||
#include <BinMDataStd_ExtStringArrayDriver.ixx>
|
||||
#include <TDataStd_ExtStringArray.hxx>
|
||||
#include <BinObjMgt_Persistent.hxx>
|
||||
#include <TColStd_Array1OfExtendedString.hxx>
|
||||
#include <TColStd_HArray1OfExtendedString.hxx>
|
||||
#include <BinMDataStd.hxx>
|
||||
//=======================================================================
|
||||
//function : BinMDataStd_ExtStringArrayDriver
|
||||
//purpose : Constructor
|
||||
//=======================================================================
|
||||
|
||||
BinMDataStd_ExtStringArrayDriver::BinMDataStd_ExtStringArrayDriver
|
||||
(const Handle(CDM_MessageDriver)& theMsgDriver)
|
||||
: BinMDF_ADriver (theMsgDriver, STANDARD_TYPE(TDataStd_ExtStringArray)->Name())
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewEmpty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TDF_Attribute) BinMDataStd_ExtStringArrayDriver::NewEmpty() const
|
||||
{
|
||||
return new TDataStd_ExtStringArray();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose : persistent -> transient (retrieve)
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BinMDataStd_ExtStringArrayDriver::Paste
|
||||
(const BinObjMgt_Persistent& theSource,
|
||||
const Handle(TDF_Attribute)& theTarget,
|
||||
BinObjMgt_RRelocationTable& ) const
|
||||
{
|
||||
Standard_Integer aFirstInd, aLastInd;
|
||||
if (! (theSource >> aFirstInd >> aLastInd))
|
||||
return Standard_False;
|
||||
const Standard_Integer aLength = aLastInd - aFirstInd + 1;
|
||||
if (aLength <= 0)
|
||||
return Standard_False;
|
||||
|
||||
Handle(TDataStd_ExtStringArray) anAtt =
|
||||
Handle(TDataStd_ExtStringArray)::DownCast(theTarget);
|
||||
anAtt->Init(aFirstInd, aLastInd);
|
||||
TColStd_Array1OfExtendedString& aTargetArray = anAtt->Array()->ChangeArray1();
|
||||
Standard_Boolean ok = Standard_True;
|
||||
for (Standard_Integer i = aFirstInd; i <= aLastInd; i ++)
|
||||
{
|
||||
TCollection_ExtendedString aStr;
|
||||
if ( !(theSource >> aStr) )
|
||||
{
|
||||
ok = Standard_False;
|
||||
break;
|
||||
}
|
||||
aTargetArray.SetValue( i, aStr );
|
||||
}
|
||||
|
||||
if(ok) {
|
||||
#ifdef DEB
|
||||
//cout << "CurDocVersion = " << BinMDataStd::DocumentVersion() <<endl;
|
||||
#endif
|
||||
Standard_Boolean aDelta(Standard_False);
|
||||
if(BinMDataStd::DocumentVersion() > 2) {
|
||||
Standard_Byte aDeltaValue;
|
||||
if (! (theSource >> aDeltaValue))
|
||||
return Standard_False;
|
||||
else
|
||||
aDelta = (Standard_Boolean)aDeltaValue;
|
||||
}
|
||||
anAtt->SetDelta(aDelta);
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose : transient -> persistent (store)
|
||||
//=======================================================================
|
||||
|
||||
void BinMDataStd_ExtStringArrayDriver::Paste
|
||||
(const Handle(TDF_Attribute)& theSource,
|
||||
BinObjMgt_Persistent& theTarget,
|
||||
BinObjMgt_SRelocationTable& ) const
|
||||
{
|
||||
Handle(TDataStd_ExtStringArray) anAtt =
|
||||
Handle(TDataStd_ExtStringArray)::DownCast(theSource);
|
||||
const TColStd_Array1OfExtendedString& aSourceArray = anAtt->Array()->Array1();
|
||||
const Standard_Integer aFirstInd = aSourceArray.Lower();
|
||||
const Standard_Integer aLastInd = aSourceArray.Upper();
|
||||
const Standard_Integer aLength = aLastInd - aFirstInd + 1;
|
||||
theTarget << aFirstInd << aLastInd;
|
||||
for (Standard_Integer i = aFirstInd; i <= aLastInd; i ++)
|
||||
theTarget << anAtt->Value( i );
|
||||
}
|
35
src/BinMDataStd/BinMDataStd_ExtStringListDriver.cdl
Executable file
35
src/BinMDataStd/BinMDataStd_ExtStringListDriver.cdl
Executable file
@@ -0,0 +1,35 @@
|
||||
-- File: BinMDataStd_ExtStringListDriver.cdl
|
||||
-- Created: May 29 11:40:00 2007
|
||||
-- Author: Vlad Romashko
|
||||
-- <vladislav.romashko@opencascade.com>
|
||||
-- Copyright: Open CASCADE
|
||||
|
||||
class ExtStringListDriver from BinMDataStd inherits ADriver from BinMDF
|
||||
|
||||
uses
|
||||
|
||||
MessageDriver from CDM,
|
||||
SRelocationTable from BinObjMgt,
|
||||
RRelocationTable from BinObjMgt,
|
||||
Persistent from BinObjMgt,
|
||||
Attribute from TDF
|
||||
|
||||
is
|
||||
Create (theMessageDriver:MessageDriver from CDM)
|
||||
returns mutable ExtStringListDriver from BinMDataStd;
|
||||
|
||||
NewEmpty (me)
|
||||
returns mutable Attribute from TDF
|
||||
is redefined;
|
||||
|
||||
Paste(me; Source : Persistent from BinObjMgt;
|
||||
Target : mutable Attribute from TDF;
|
||||
RelocTable : out RRelocationTable from BinObjMgt)
|
||||
returns Boolean from Standard is redefined;
|
||||
|
||||
Paste(me; Source : Attribute from TDF;
|
||||
Target : in out Persistent from BinObjMgt;
|
||||
RelocTable : out SRelocationTable from BinObjMgt)
|
||||
is redefined;
|
||||
|
||||
end ExtStringListDriver;
|
78
src/BinMDataStd/BinMDataStd_ExtStringListDriver.cxx
Executable file
78
src/BinMDataStd/BinMDataStd_ExtStringListDriver.cxx
Executable file
@@ -0,0 +1,78 @@
|
||||
// File: BinMDataStd_ExtStringListDriver.cxx
|
||||
// Created: May 29 11:40:00 2007
|
||||
// Author: Vlad Romashko
|
||||
// <vladislav.romashko@opencascade.com>
|
||||
// Copyright: Open CASCADE
|
||||
|
||||
#include <BinMDataStd_ExtStringListDriver.ixx>
|
||||
#include <TDataStd_ExtStringList.hxx>
|
||||
#include <TColStd_Array1OfExtendedString.hxx>
|
||||
#include <TDataStd_ListIteratorOfListOfExtendedString.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : BinMDataStd_ExtStringListDriver
|
||||
//purpose : Constructor
|
||||
//=======================================================================
|
||||
BinMDataStd_ExtStringListDriver::BinMDataStd_ExtStringListDriver(const Handle(CDM_MessageDriver)& theMsgDriver)
|
||||
: BinMDF_ADriver (theMsgDriver, STANDARD_TYPE(TDataStd_ExtStringList)->Name())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewEmpty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(TDF_Attribute) BinMDataStd_ExtStringListDriver::NewEmpty() const
|
||||
{
|
||||
return new TDataStd_ExtStringList();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose : persistent -> transient (retrieve)
|
||||
//=======================================================================
|
||||
Standard_Boolean BinMDataStd_ExtStringListDriver::Paste(const BinObjMgt_Persistent& theSource,
|
||||
const Handle(TDF_Attribute)& theTarget,
|
||||
BinObjMgt_RRelocationTable& ) const
|
||||
{
|
||||
Standard_Integer aFirstInd, aLastInd;
|
||||
if (! (theSource >> aFirstInd >> aLastInd))
|
||||
return Standard_False;
|
||||
const Standard_Integer aLength = aLastInd - aFirstInd + 1;
|
||||
if (aLength <= 0)
|
||||
return Standard_False;
|
||||
|
||||
Handle(TDataStd_ExtStringList) anAtt = Handle(TDataStd_ExtStringList)::DownCast(theTarget);
|
||||
for (Standard_Integer i = aFirstInd; i <= aLastInd; i ++)
|
||||
{
|
||||
TCollection_ExtendedString aStr;
|
||||
if ( !(theSource >> aStr) )
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
anAtt->Append(aStr);
|
||||
}
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose : transient -> persistent (store)
|
||||
//=======================================================================
|
||||
void BinMDataStd_ExtStringListDriver::Paste(const Handle(TDF_Attribute)& theSource,
|
||||
BinObjMgt_Persistent& theTarget,
|
||||
BinObjMgt_SRelocationTable& ) const
|
||||
{
|
||||
Handle(TDataStd_ExtStringList) anAtt = Handle(TDataStd_ExtStringList)::DownCast(theSource);
|
||||
const Standard_Integer aFirstInd = 1;
|
||||
const Standard_Integer aLastInd = anAtt->Extent();
|
||||
const Standard_Integer aLength = aLastInd - aFirstInd + 1;
|
||||
theTarget << aFirstInd << aLastInd;
|
||||
TDataStd_ListIteratorOfListOfExtendedString itr(anAtt->List());
|
||||
for (; itr.More(); itr.Next())
|
||||
{
|
||||
theTarget << itr.Value();
|
||||
}
|
||||
}
|
35
src/BinMDataStd/BinMDataStd_IntPackedMapDriver.cdl
Executable file
35
src/BinMDataStd/BinMDataStd_IntPackedMapDriver.cdl
Executable file
@@ -0,0 +1,35 @@
|
||||
-- File: BinMDataStd_IntPackedMapDriver.cdl
|
||||
-- Created: Wed Aug 1 14:22:51 2007
|
||||
-- Author: Sergey ZARITCHNY
|
||||
-- <sergey.zaritchny@opencascade.com>
|
||||
---Copyright: Open CasCade SA 2007
|
||||
|
||||
|
||||
class IntPackedMapDriver from BinMDataStd inherits ADriver from BinMDF
|
||||
|
||||
---Purpose: TDataStd_IntPackedMap attribute Driver.
|
||||
|
||||
uses
|
||||
SRelocationTable from BinObjMgt,
|
||||
RRelocationTable from BinObjMgt,
|
||||
Persistent from BinObjMgt,
|
||||
MessageDriver from CDM,
|
||||
Attribute from TDF
|
||||
is
|
||||
Create (theMessageDriver:MessageDriver from CDM)
|
||||
returns mutable IntPackedMapDriver from BinMDataStd;
|
||||
|
||||
NewEmpty (me) returns mutable Attribute from TDF;
|
||||
|
||||
Paste(me; Source : Persistent from BinObjMgt;
|
||||
Target : mutable Attribute from TDF;
|
||||
RelocTable : out RRelocationTable from BinObjMgt)
|
||||
returns Boolean from Standard;
|
||||
---Purpose: persistent -> transient (retrieve)
|
||||
|
||||
Paste(me; Source : Attribute from TDF;
|
||||
Target : in out Persistent from BinObjMgt;
|
||||
RelocTable : out SRelocationTable from BinObjMgt);
|
||||
---Purpose: transient -> persistent (store)
|
||||
|
||||
end IntPackedMapDriver;
|
114
src/BinMDataStd/BinMDataStd_IntPackedMapDriver.cxx
Executable file
114
src/BinMDataStd/BinMDataStd_IntPackedMapDriver.cxx
Executable file
@@ -0,0 +1,114 @@
|
||||
// File: BinMDataStd_IntPackedMapDriver.cxx
|
||||
// Created: Wed Aug 1 14:30:43 2007
|
||||
// Author: Sergey ZARITCHNY
|
||||
// <sergey.zaritchny@opencascade.com>
|
||||
// Copyright: Open CASCADE SA 2007
|
||||
|
||||
|
||||
#include <BinMDataStd_IntPackedMapDriver.ixx>
|
||||
#include <CDM_MessageDriver.hxx>
|
||||
#include <TColStd_PackedMapOfInteger.hxx>
|
||||
#include <TColStd_HPackedMapOfInteger.hxx>
|
||||
#include <TColStd_MapIteratorOfPackedMapOfInteger.hxx>
|
||||
#include <BinMDF_ADriver.hxx>
|
||||
#include <TDataStd_IntPackedMap.hxx>
|
||||
#include <TDF_Attribute.hxx>
|
||||
#include <BinObjMgt_Persistent.hxx>
|
||||
#include <BinObjMgt_RRelocationTable.hxx>
|
||||
#include <BinObjMgt_SRelocationTable.hxx>
|
||||
#include <TCollection_ExtendedString.hxx>
|
||||
#include <BinMDataStd.hxx>
|
||||
//=======================================================================
|
||||
//function : BinMDataStd_IntPackedMapDriver
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
BinMDataStd_IntPackedMapDriver::BinMDataStd_IntPackedMapDriver
|
||||
(const Handle(CDM_MessageDriver)& theMessageDriver)
|
||||
: BinMDF_ADriver (theMessageDriver, STANDARD_TYPE(TDataStd_IntPackedMap)->Name())
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewEmpty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TDF_Attribute) BinMDataStd_IntPackedMapDriver::NewEmpty() const
|
||||
{
|
||||
return new TDataStd_IntPackedMap;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose : persistent -> transient (retrieve)
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BinMDataStd_IntPackedMapDriver::Paste
|
||||
(const BinObjMgt_Persistent& Source,
|
||||
const Handle(TDF_Attribute)& Target,
|
||||
BinObjMgt_RRelocationTable& /*RelocTable*/) const
|
||||
{
|
||||
Handle(TDataStd_IntPackedMap) aTagAtt = Handle(TDataStd_IntPackedMap)::DownCast(Target);
|
||||
if(aTagAtt.IsNull()) {
|
||||
WriteMessage (TCollection_ExtendedString("IntPackedMapDriver:: The target attribute is Null."));
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
Standard_Integer aSize = 0;
|
||||
if (! (Source >> aSize)) {
|
||||
WriteMessage (TCollection_ExtendedString("Cannot retrieve size for IntPackedMap attribute."));
|
||||
return Standard_False;
|
||||
}
|
||||
if(aSize) {
|
||||
Handle(TColStd_HPackedMapOfInteger) aHMap = new TColStd_HPackedMapOfInteger ();
|
||||
Standard_Integer aKey;
|
||||
for(Standard_Integer i = 0; i< aSize; i++) {
|
||||
Standard_Boolean ok = Source >> aKey;
|
||||
if (!ok) {
|
||||
WriteMessage ("Cannot retrieve integer member for IntPackedMap attribute.");
|
||||
return Standard_False;
|
||||
}
|
||||
if(!aHMap->ChangeMap().Add( aKey )) return Standard_False;
|
||||
}
|
||||
aTagAtt->ChangeMap(aHMap);
|
||||
}
|
||||
#ifdef DEB
|
||||
//cout << "CurDocVersion = " << BinMDataStd::DocumentVersion() <<endl;
|
||||
#endif
|
||||
Standard_Boolean aDelta(Standard_False);
|
||||
if(BinMDataStd::DocumentVersion() > 2) {
|
||||
Standard_Byte aDeltaValue;
|
||||
if (! (Source >> aDeltaValue))
|
||||
return Standard_False;
|
||||
else
|
||||
aDelta = (Standard_Boolean)aDeltaValue;
|
||||
}
|
||||
aTagAtt->SetDelta(aDelta);
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose : transient -> persistent (store)
|
||||
//=======================================================================
|
||||
|
||||
void BinMDataStd_IntPackedMapDriver::Paste
|
||||
(const Handle(TDF_Attribute)& Source,
|
||||
BinObjMgt_Persistent& Target,
|
||||
BinObjMgt_SRelocationTable& /*RelocTable*/) const
|
||||
{
|
||||
Handle(TDataStd_IntPackedMap) anAtt = Handle(TDataStd_IntPackedMap)::DownCast(Source);
|
||||
if (anAtt.IsNull()) {
|
||||
WriteMessage ("IntPackedMapDriver:: The source attribute is Null.");
|
||||
return;
|
||||
}
|
||||
Standard_Integer aSize = (anAtt->IsEmpty()) ? 0 : anAtt->Extent();
|
||||
Target << aSize;
|
||||
if(aSize) {
|
||||
TColStd_MapIteratorOfPackedMapOfInteger anIt(anAtt->GetMap());
|
||||
for(;anIt.More();anIt.Next())
|
||||
Target << anIt.Key();
|
||||
}
|
||||
Target << (Standard_Byte)anAtt->GetDelta();
|
||||
}
|
35
src/BinMDataStd/BinMDataStd_IntegerArrayDriver.cdl
Executable file
35
src/BinMDataStd/BinMDataStd_IntegerArrayDriver.cdl
Executable file
@@ -0,0 +1,35 @@
|
||||
-- File: BinMDataStd_IntegerArrayDriver.cdl
|
||||
-- Created: Thu Oct 31 19:40:31 2002
|
||||
-- Author: Michael SAZONOV
|
||||
-- <msv@novgorox.nnov.matra-dtv.fr>
|
||||
---Copyright: Matra Datavision 2002
|
||||
|
||||
class IntegerArrayDriver from BinMDataStd inherits ADriver from BinMDF
|
||||
|
||||
---Purpose: Array of Integer attribute Driver.
|
||||
|
||||
uses
|
||||
MessageDriver from CDM,
|
||||
SRelocationTable from BinObjMgt,
|
||||
RRelocationTable from BinObjMgt,
|
||||
Persistent from BinObjMgt,
|
||||
Attribute from TDF
|
||||
|
||||
is
|
||||
Create (theMessageDriver:MessageDriver from CDM)
|
||||
returns mutable IntegerArrayDriver from BinMDataStd;
|
||||
|
||||
NewEmpty (me) returns mutable Attribute from TDF
|
||||
is redefined;
|
||||
|
||||
Paste(me; Source : Persistent from BinObjMgt;
|
||||
Target : mutable Attribute from TDF;
|
||||
RelocTable : out RRelocationTable from BinObjMgt)
|
||||
returns Boolean from Standard is redefined;
|
||||
|
||||
Paste(me; Source : Attribute from TDF;
|
||||
Target : in out Persistent from BinObjMgt;
|
||||
RelocTable : out SRelocationTable from BinObjMgt)
|
||||
is redefined;
|
||||
|
||||
end IntegerArrayDriver;
|
94
src/BinMDataStd/BinMDataStd_IntegerArrayDriver.cxx
Executable file
94
src/BinMDataStd/BinMDataStd_IntegerArrayDriver.cxx
Executable file
@@ -0,0 +1,94 @@
|
||||
// File: BinMDataStd_IntegerArrayDriver.cxx
|
||||
// Created: 31.10.02 19:43:57
|
||||
// Author: Michael SAZONOV
|
||||
// Copyright: Open CASCADE 2002
|
||||
|
||||
#include <BinMDataStd_IntegerArrayDriver.ixx>
|
||||
#include <TDataStd_IntegerArray.hxx>
|
||||
#include <TColStd_HArray1OfInteger.hxx>
|
||||
#include <BinMDataStd.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : BinMDataStd_IntegerArrayDriver
|
||||
//purpose : Constructor
|
||||
//=======================================================================
|
||||
|
||||
BinMDataStd_IntegerArrayDriver::BinMDataStd_IntegerArrayDriver
|
||||
(const Handle(CDM_MessageDriver)& theMsgDriver)
|
||||
: BinMDF_ADriver (theMsgDriver, STANDARD_TYPE(TDataStd_IntegerArray)->Name())
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewEmpty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TDF_Attribute) BinMDataStd_IntegerArrayDriver::NewEmpty() const
|
||||
{
|
||||
return new TDataStd_IntegerArray();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose : persistent -> transient (retrieve)
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BinMDataStd_IntegerArrayDriver::Paste
|
||||
(const BinObjMgt_Persistent& theSource,
|
||||
const Handle(TDF_Attribute)& theTarget,
|
||||
BinObjMgt_RRelocationTable& ) const
|
||||
{
|
||||
Standard_Integer aFirstInd, aLastInd;
|
||||
if (! (theSource >> aFirstInd >> aLastInd))
|
||||
return Standard_False;
|
||||
const Standard_Integer aLength = aLastInd - aFirstInd + 1;
|
||||
if (aLength <= 0)
|
||||
return Standard_False;
|
||||
|
||||
Handle(TDataStd_IntegerArray) anAtt =
|
||||
Handle(TDataStd_IntegerArray)::DownCast(theTarget);
|
||||
anAtt->Init(aFirstInd, aLastInd);
|
||||
TColStd_Array1OfInteger& aTargetArray = anAtt->Array()->ChangeArray1();
|
||||
if(!theSource.GetIntArray (&aTargetArray(aFirstInd), aLength))
|
||||
return Standard_False;
|
||||
Standard_Boolean aDelta(Standard_False);
|
||||
#ifdef DEB
|
||||
//cout << "CurDocVersion = " << BinMDataStd::DocumentVersion() <<endl;
|
||||
#endif
|
||||
if(BinMDataStd::DocumentVersion() > 2) {
|
||||
Standard_Byte aDeltaValue;
|
||||
if (! (theSource >> aDeltaValue))
|
||||
return Standard_False;
|
||||
else
|
||||
aDelta = (Standard_Boolean)aDeltaValue;
|
||||
}
|
||||
#ifdef DEB
|
||||
else if(BinMDataStd::DocumentVersion() == -1)
|
||||
cout << "Current DocVersion field is not initialized. " <<endl;
|
||||
#endif
|
||||
anAtt->SetDelta(aDelta);
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose : transient -> persistent (store)
|
||||
//=======================================================================
|
||||
|
||||
void BinMDataStd_IntegerArrayDriver::Paste
|
||||
(const Handle(TDF_Attribute)& theSource,
|
||||
BinObjMgt_Persistent& theTarget,
|
||||
BinObjMgt_SRelocationTable& ) const
|
||||
{
|
||||
Handle(TDataStd_IntegerArray) anAtt =
|
||||
Handle(TDataStd_IntegerArray)::DownCast(theSource);
|
||||
const TColStd_Array1OfInteger& aSourceArray = anAtt->Array()->Array1();
|
||||
const Standard_Integer aFirstInd = aSourceArray.Lower();
|
||||
const Standard_Integer aLastInd = aSourceArray.Upper();
|
||||
const Standard_Integer aLength = aLastInd - aFirstInd + 1;
|
||||
theTarget << aFirstInd << aLastInd;
|
||||
Standard_Integer *aPtr = (Standard_Integer *) &aSourceArray(aFirstInd);
|
||||
theTarget.PutIntArray (aPtr, aLength);
|
||||
theTarget << (Standard_Byte)anAtt->GetDelta();
|
||||
}
|
35
src/BinMDataStd/BinMDataStd_IntegerDriver.cdl
Executable file
35
src/BinMDataStd/BinMDataStd_IntegerDriver.cdl
Executable file
@@ -0,0 +1,35 @@
|
||||
-- File: BinMDataStd_IntegerDriver.cdl
|
||||
-- Created: Wed Oct 30 14:53:50 2002
|
||||
-- Author: Michael SAZONOV
|
||||
-- <msv@novgorox.nnov.matra-dtv.fr>
|
||||
---Copyright: Matra Datavision 2002
|
||||
|
||||
class IntegerDriver from BinMDataStd inherits ADriver from BinMDF
|
||||
|
||||
---Purpose: Integer attribute Driver.
|
||||
|
||||
uses
|
||||
MessageDriver from CDM,
|
||||
SRelocationTable from BinObjMgt,
|
||||
RRelocationTable from BinObjMgt,
|
||||
Persistent from BinObjMgt,
|
||||
Attribute from TDF
|
||||
|
||||
is
|
||||
Create (theMessageDriver:MessageDriver from CDM)
|
||||
returns mutable IntegerDriver from BinMDataStd;
|
||||
|
||||
NewEmpty (me) returns mutable Attribute from TDF
|
||||
is redefined;
|
||||
|
||||
Paste(me; Source : Persistent from BinObjMgt;
|
||||
Target : mutable Attribute from TDF;
|
||||
RelocTable : out RRelocationTable from BinObjMgt)
|
||||
returns Boolean from Standard is redefined;
|
||||
|
||||
Paste(me; Source : Attribute from TDF;
|
||||
Target : in out Persistent from BinObjMgt;
|
||||
RelocTable : out SRelocationTable from BinObjMgt)
|
||||
is redefined;
|
||||
|
||||
end IntegerDriver;
|
59
src/BinMDataStd/BinMDataStd_IntegerDriver.cxx
Executable file
59
src/BinMDataStd/BinMDataStd_IntegerDriver.cxx
Executable file
@@ -0,0 +1,59 @@
|
||||
// File: BinMDataStd_IntegerDriver.cxx
|
||||
// Created: 30.10.02 14:56:34
|
||||
// Author: Michael SAZONOV
|
||||
// Copyright: Open CASCADE 2002
|
||||
|
||||
#include <BinMDataStd_IntegerDriver.ixx>
|
||||
#include <TDataStd_Integer.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : BinMDataStd_IntegerDriver
|
||||
//purpose : Constructor
|
||||
//=======================================================================
|
||||
|
||||
BinMDataStd_IntegerDriver::BinMDataStd_IntegerDriver
|
||||
(const Handle(CDM_MessageDriver)& theMsgDriver)
|
||||
: BinMDF_ADriver (theMsgDriver, STANDARD_TYPE(TDataStd_Integer)->Name())
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewEmpty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TDF_Attribute) BinMDataStd_IntegerDriver::NewEmpty() const
|
||||
{
|
||||
return new TDataStd_Integer();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose : persistent -> transient (retrieve)
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BinMDataStd_IntegerDriver::Paste
|
||||
(const BinObjMgt_Persistent& theSource,
|
||||
const Handle(TDF_Attribute)& theTarget,
|
||||
BinObjMgt_RRelocationTable& ) const
|
||||
{
|
||||
Handle(TDataStd_Integer) anAtt = Handle(TDataStd_Integer)::DownCast(theTarget);
|
||||
Standard_Integer aValue;
|
||||
Standard_Boolean ok = theSource >> aValue;
|
||||
if (ok)
|
||||
anAtt->Set(aValue);
|
||||
return ok;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose : transient -> persistent (store)
|
||||
//=======================================================================
|
||||
|
||||
void BinMDataStd_IntegerDriver::Paste (const Handle(TDF_Attribute)& theSource,
|
||||
BinObjMgt_Persistent& theTarget,
|
||||
BinObjMgt_SRelocationTable& ) const
|
||||
{
|
||||
Handle(TDataStd_Integer) anAtt = Handle(TDataStd_Integer)::DownCast(theSource);
|
||||
theTarget << anAtt->Get();
|
||||
}
|
35
src/BinMDataStd/BinMDataStd_IntegerListDriver.cdl
Executable file
35
src/BinMDataStd/BinMDataStd_IntegerListDriver.cdl
Executable file
@@ -0,0 +1,35 @@
|
||||
-- File: BinMDataStd_IntegerListDriver.cdl
|
||||
-- Created: May 29 11:40:00 2007
|
||||
-- Author: Vlad Romashko
|
||||
-- <vladislav.romashko@opencascade.com>
|
||||
-- Copyright: Open CASCADE
|
||||
|
||||
class IntegerListDriver from BinMDataStd inherits ADriver from BinMDF
|
||||
|
||||
uses
|
||||
|
||||
MessageDriver from CDM,
|
||||
SRelocationTable from BinObjMgt,
|
||||
RRelocationTable from BinObjMgt,
|
||||
Persistent from BinObjMgt,
|
||||
Attribute from TDF
|
||||
|
||||
is
|
||||
Create (theMessageDriver:MessageDriver from CDM)
|
||||
returns mutable IntegerListDriver from BinMDataStd;
|
||||
|
||||
NewEmpty (me)
|
||||
returns mutable Attribute from TDF
|
||||
is redefined;
|
||||
|
||||
Paste(me; Source : Persistent from BinObjMgt;
|
||||
Target : mutable Attribute from TDF;
|
||||
RelocTable : out RRelocationTable from BinObjMgt)
|
||||
returns Boolean from Standard is redefined;
|
||||
|
||||
Paste(me; Source : Attribute from TDF;
|
||||
Target : in out Persistent from BinObjMgt;
|
||||
RelocTable : out SRelocationTable from BinObjMgt)
|
||||
is redefined;
|
||||
|
||||
end IntegerListDriver;
|
83
src/BinMDataStd/BinMDataStd_IntegerListDriver.cxx
Executable file
83
src/BinMDataStd/BinMDataStd_IntegerListDriver.cxx
Executable file
@@ -0,0 +1,83 @@
|
||||
// File: BinMDataStd_IntegerListDriver.cxx
|
||||
// Created: May 29 11:40:00 2007
|
||||
// Author: Vlad Romashko
|
||||
// <vladislav.romashko@opencascade.com>
|
||||
// Copyright: Open CASCADE
|
||||
|
||||
#include <BinMDataStd_IntegerListDriver.ixx>
|
||||
#include <TDataStd_IntegerList.hxx>
|
||||
#include <TColStd_Array1OfInteger.hxx>
|
||||
#include <TColStd_ListIteratorOfListOfInteger.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : BinMDataStd_IntegerListDriver
|
||||
//purpose : Constructor
|
||||
//=======================================================================
|
||||
BinMDataStd_IntegerListDriver::BinMDataStd_IntegerListDriver(const Handle(CDM_MessageDriver)& theMsgDriver)
|
||||
: BinMDF_ADriver (theMsgDriver, STANDARD_TYPE(TDataStd_IntegerList)->Name())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewEmpty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(TDF_Attribute) BinMDataStd_IntegerListDriver::NewEmpty() const
|
||||
{
|
||||
return new TDataStd_IntegerList();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose : persistent -> transient (retrieve)
|
||||
//=======================================================================
|
||||
Standard_Boolean BinMDataStd_IntegerListDriver::Paste(const BinObjMgt_Persistent& theSource,
|
||||
const Handle(TDF_Attribute)& theTarget,
|
||||
BinObjMgt_RRelocationTable& ) const
|
||||
{
|
||||
Standard_Integer aIndex, aFirstInd, aLastInd;
|
||||
if (! (theSource >> aFirstInd >> aLastInd))
|
||||
return Standard_False;
|
||||
const Standard_Integer aLength = aLastInd - aFirstInd + 1;
|
||||
if (aLength <= 0)
|
||||
return Standard_False;
|
||||
|
||||
TColStd_Array1OfInteger aTargetArray(aFirstInd, aLastInd);
|
||||
theSource.GetIntArray (&aTargetArray(aFirstInd), aLength);
|
||||
|
||||
Handle(TDataStd_IntegerList) anAtt = Handle(TDataStd_IntegerList)::DownCast(theTarget);
|
||||
for (aIndex = aFirstInd; aIndex <= aLastInd; aIndex++)
|
||||
{
|
||||
anAtt->Append(aTargetArray.Value(aIndex));
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose : transient -> persistent (store)
|
||||
//=======================================================================
|
||||
void BinMDataStd_IntegerListDriver::Paste(const Handle(TDF_Attribute)& theSource,
|
||||
BinObjMgt_Persistent& theTarget,
|
||||
BinObjMgt_SRelocationTable& ) const
|
||||
{
|
||||
Handle(TDataStd_IntegerList) anAtt = Handle(TDataStd_IntegerList)::DownCast(theSource);
|
||||
const Standard_Integer aFirstInd = 1;
|
||||
const Standard_Integer aLastInd = anAtt->Extent();
|
||||
const Standard_Integer aLength = aLastInd - aFirstInd + 1;
|
||||
if (aLength <= 0)
|
||||
return;
|
||||
theTarget << aFirstInd << aLastInd;
|
||||
TColStd_Array1OfInteger aSourceArray(aFirstInd, aLastInd);
|
||||
if (aLastInd >= 1)
|
||||
{
|
||||
TColStd_ListIteratorOfListOfInteger itr(anAtt->List());
|
||||
for (Standard_Integer i = 1; itr.More(); itr.Next(), i++)
|
||||
{
|
||||
aSourceArray.SetValue(i, itr.Value());
|
||||
}
|
||||
Standard_Integer *aPtr = (Standard_Integer *) &aSourceArray(aFirstInd);
|
||||
theTarget.PutIntArray(aPtr, aLength);
|
||||
}
|
||||
}
|
35
src/BinMDataStd/BinMDataStd_NameDriver.cdl
Executable file
35
src/BinMDataStd/BinMDataStd_NameDriver.cdl
Executable file
@@ -0,0 +1,35 @@
|
||||
-- File: BinMDataStd_NameDriver.cdl
|
||||
-- Created: Tue Nov 19 12:22:02 2002
|
||||
-- Author: Edward AGAPOV
|
||||
-- <eap@strelox.nnov.matra-dtv.fr>
|
||||
---Copyright: Matra Datavision 2002
|
||||
|
||||
class NameDriver from BinMDataStd inherits ADriver from BinMDF
|
||||
|
||||
---Purpose: TDataStd_Name attribute Driver.
|
||||
|
||||
uses
|
||||
SRelocationTable from BinObjMgt,
|
||||
RRelocationTable from BinObjMgt,
|
||||
Persistent from BinObjMgt,
|
||||
MessageDriver from CDM,
|
||||
Attribute from TDF
|
||||
|
||||
is
|
||||
Create (theMessageDriver:MessageDriver from CDM)
|
||||
returns mutable NameDriver from BinMDataStd;
|
||||
|
||||
NewEmpty (me) returns mutable Attribute from TDF;
|
||||
|
||||
Paste(me; Source : Persistent from BinObjMgt;
|
||||
Target : mutable Attribute from TDF;
|
||||
RelocTable : out RRelocationTable from BinObjMgt)
|
||||
returns Boolean from Standard;
|
||||
---Purpose: persistent -> transient (retrieve)
|
||||
|
||||
Paste(me; Source : Attribute from TDF;
|
||||
Target : in out Persistent from BinObjMgt;
|
||||
RelocTable : out SRelocationTable from BinObjMgt);
|
||||
---Purpose: transient -> persistent (store)
|
||||
|
||||
end NameDriver;
|
61
src/BinMDataStd/BinMDataStd_NameDriver.cxx
Executable file
61
src/BinMDataStd/BinMDataStd_NameDriver.cxx
Executable file
@@ -0,0 +1,61 @@
|
||||
// File : BinMDataStd_NameDriver.cxx
|
||||
// Created : Tue Nov 19 12:30:18 2002
|
||||
// Author : Edward AGAPOV (eap)
|
||||
// Copyright : Open CASCADE
|
||||
|
||||
|
||||
#include <BinMDataStd_NameDriver.ixx>
|
||||
#include <TDataStd_Name.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : BinMDataStd_NameDriver
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
BinMDataStd_NameDriver::BinMDataStd_NameDriver
|
||||
(const Handle(CDM_MessageDriver)& theMessageDriver)
|
||||
: BinMDF_ADriver (theMessageDriver, STANDARD_TYPE(TDataStd_Name)->Name())
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewEmpty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TDF_Attribute) BinMDataStd_NameDriver::NewEmpty() const
|
||||
{
|
||||
return new TDataStd_Name;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose : persistent -> transient (retrieve)
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BinMDataStd_NameDriver::Paste
|
||||
(const BinObjMgt_Persistent& Source,
|
||||
const Handle(TDF_Attribute)& Target,
|
||||
BinObjMgt_RRelocationTable& /*RelocTable*/) const
|
||||
{
|
||||
Handle(TDataStd_Name) aName = Handle(TDataStd_Name)::DownCast(Target);
|
||||
TCollection_ExtendedString aStr;
|
||||
Standard_Boolean ok = Source >> aStr;
|
||||
if (ok)
|
||||
aName->Set( aStr );
|
||||
return ok;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose : transient -> persistent (store)
|
||||
//=======================================================================
|
||||
|
||||
void BinMDataStd_NameDriver::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();
|
||||
}
|
37
src/BinMDataStd/BinMDataStd_NamedDataDriver.cdl
Executable file
37
src/BinMDataStd/BinMDataStd_NamedDataDriver.cdl
Executable file
@@ -0,0 +1,37 @@
|
||||
-- File: BinMDataStd_NamedDataDriver.cdl
|
||||
-- Created: Mon Jul 2 10:16:56 2007
|
||||
-- Author: Sergey ZARITCHNY
|
||||
-- <sergey.zaritchny@opencascade.com>
|
||||
---Copyright: Open CasCade SA 2007
|
||||
|
||||
|
||||
class NamedDataDriver from BinMDataStd inherits ADriver from BinMDF
|
||||
|
||||
---Purpose:
|
||||
|
||||
uses
|
||||
MessageDriver from CDM,
|
||||
SRelocationTable from BinObjMgt,
|
||||
RRelocationTable from BinObjMgt,
|
||||
Persistent from BinObjMgt,
|
||||
Attribute from TDF
|
||||
|
||||
is
|
||||
Create (theMessageDriver:MessageDriver from CDM)
|
||||
returns mutable NamedDataDriver from BinMDataStd;
|
||||
|
||||
NewEmpty (me)
|
||||
returns mutable Attribute from TDF
|
||||
is redefined;
|
||||
|
||||
Paste(me; Source : Persistent from BinObjMgt;
|
||||
Target : mutable Attribute from TDF;
|
||||
RelocTable : out RRelocationTable from BinObjMgt)
|
||||
returns Boolean from Standard is redefined;
|
||||
|
||||
Paste(me; Source : Attribute from TDF;
|
||||
Target : in out Persistent from BinObjMgt;
|
||||
RelocTable : out SRelocationTable from BinObjMgt)
|
||||
is redefined;
|
||||
|
||||
end NamedDataDriver;
|
262
src/BinMDataStd/BinMDataStd_NamedDataDriver.cxx
Executable file
262
src/BinMDataStd/BinMDataStd_NamedDataDriver.cxx
Executable file
@@ -0,0 +1,262 @@
|
||||
// File: BinMDataStd_NamedDataDriver.cxx
|
||||
// Created: Mon Jul 2 10:19:20 2007
|
||||
// Author: Sergey ZARITCHNY
|
||||
// <szy@popox.nnov.matra-dtv.fr>
|
||||
// Copyright: Open CasCade SA 2007
|
||||
|
||||
#include <BinMDataStd_NamedDataDriver.ixx>
|
||||
#include <TCollection_ExtendedString.hxx>
|
||||
#include <CDM_MessageDriver.hxx>
|
||||
#include <TDataStd_NamedData.hxx>
|
||||
#include <TColStd_HArray1OfReal.hxx>
|
||||
#include <TColStd_HArray1OfInteger.hxx>
|
||||
#include <TColStd_HArray1OfReal.hxx>
|
||||
#include <TColStd_DataMapOfStringInteger.hxx>
|
||||
#include <TDataStd_DataMapOfStringReal.hxx>
|
||||
#include <TDataStd_DataMapOfStringString.hxx>
|
||||
#include <TDataStd_DataMapOfStringByte.hxx>
|
||||
#include <TDataStd_DataMapOfStringHArray1OfInteger.hxx>
|
||||
#include <TDataStd_DataMapOfStringHArray1OfReal.hxx>
|
||||
#include <TColStd_DataMapIteratorOfDataMapOfStringInteger.hxx>
|
||||
#include <TDataStd_DataMapIteratorOfDataMapOfStringReal.hxx>
|
||||
#include <TDataStd_DataMapIteratorOfDataMapOfStringString.hxx>
|
||||
#include <TDataStd_DataMapIteratorOfDataMapOfStringByte.hxx>
|
||||
#include <TDataStd_DataMapIteratorOfDataMapOfStringHArray1OfInteger.hxx>
|
||||
#include <TDataStd_DataMapIteratorOfDataMapOfStringHArray1OfReal.hxx>
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : BinMDataStd_NamedDataDriver
|
||||
//purpose : Constructor
|
||||
//=======================================================================
|
||||
BinMDataStd_NamedDataDriver::BinMDataStd_NamedDataDriver(const Handle(CDM_MessageDriver)& theMsgDriver)
|
||||
: BinMDF_ADriver (theMsgDriver, STANDARD_TYPE(TDataStd_NamedData)->Name())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewEmpty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(TDF_Attribute) BinMDataStd_NamedDataDriver::NewEmpty() const
|
||||
{
|
||||
return new TDataStd_NamedData();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose : persistent -> transient (retrieve)
|
||||
//=======================================================================
|
||||
Standard_Boolean BinMDataStd_NamedDataDriver::Paste(const BinObjMgt_Persistent& theSource,
|
||||
const Handle(TDF_Attribute)& theTarget,
|
||||
BinObjMgt_RRelocationTable& ) const
|
||||
{
|
||||
|
||||
Handle(TDataStd_NamedData) T = Handle(TDataStd_NamedData)::DownCast(theTarget);
|
||||
if(T.IsNull()) return Standard_False;
|
||||
Standard_Integer aLower, anUpper,i;
|
||||
if (! (theSource >> aLower >> anUpper))
|
||||
return Standard_False;
|
||||
// const Standard_Integer aLength = anUpper - aLower + 1;
|
||||
if (anUpper < aLower) return Standard_False;
|
||||
if(anUpper | aLower) {
|
||||
TColStd_DataMapOfStringInteger anIntegers;
|
||||
for (i=aLower; i<=anUpper; i++) {
|
||||
TCollection_ExtendedString aKey;
|
||||
Standard_Integer aValue;
|
||||
if (! (theSource >> aKey >> aValue))
|
||||
return Standard_False;
|
||||
anIntegers.Bind(aKey, aValue);
|
||||
}
|
||||
T->ChangeIntegers(anIntegers);
|
||||
}
|
||||
|
||||
if (! (theSource >> aLower >> anUpper))
|
||||
return Standard_False;
|
||||
if (anUpper < aLower) return Standard_False;
|
||||
if(anUpper | aLower) {
|
||||
TDataStd_DataMapOfStringReal aReals;
|
||||
for (i=aLower; i<=anUpper; i++) {
|
||||
TCollection_ExtendedString aKey;
|
||||
Standard_Real aValue;
|
||||
if (! (theSource >> aKey >> aValue))
|
||||
return Standard_False;
|
||||
aReals.Bind(aKey, aValue);
|
||||
}
|
||||
T->ChangeReals(aReals);
|
||||
}
|
||||
|
||||
// strings
|
||||
if (! (theSource >> aLower >> anUpper))
|
||||
return Standard_False;
|
||||
if (anUpper < aLower) return Standard_False;
|
||||
if(anUpper | aLower) {
|
||||
TDataStd_DataMapOfStringString aStrings;
|
||||
for (i=aLower; i<=anUpper; i++) {
|
||||
TCollection_ExtendedString aKey;
|
||||
TCollection_ExtendedString aValue;
|
||||
if (! (theSource >> aKey >> aValue))
|
||||
return Standard_False;
|
||||
aStrings.Bind(aKey, aValue);
|
||||
}
|
||||
T->ChangeStrings(aStrings);
|
||||
}
|
||||
|
||||
//Bytes
|
||||
if (! (theSource >> aLower >> anUpper))
|
||||
return Standard_False;
|
||||
if (anUpper < aLower) return Standard_False;
|
||||
if(anUpper | aLower) {
|
||||
TDataStd_DataMapOfStringByte aBytes;
|
||||
for (i=aLower; i<=anUpper; i++) {
|
||||
TCollection_ExtendedString aKey;
|
||||
Standard_Byte aValue;
|
||||
if (! (theSource >> aKey >> aValue))
|
||||
return Standard_False;
|
||||
aBytes.Bind(aKey, (Standard_Byte)aValue);
|
||||
}
|
||||
T->ChangeBytes(aBytes);
|
||||
}
|
||||
|
||||
// arrays of integers
|
||||
if (! (theSource >> aLower >> anUpper))
|
||||
return Standard_False;
|
||||
if (anUpper < aLower) return Standard_False;
|
||||
Standard_Boolean aResult = Standard_False;
|
||||
if(anUpper | aLower) {
|
||||
TDataStd_DataMapOfStringHArray1OfInteger anIntArrays;
|
||||
for (i=aLower; i<=anUpper; i++) {
|
||||
TCollection_ExtendedString aKey;
|
||||
if (! (theSource >> aKey))
|
||||
return Standard_False;
|
||||
Standard_Integer low, up;
|
||||
if (! (theSource >> low >> up))
|
||||
return Standard_False;
|
||||
if(up < low)
|
||||
return Standard_False;
|
||||
if(up | low) {
|
||||
Handle(TColStd_HArray1OfInteger) aTargetArray = new TColStd_HArray1OfInteger (low, up);
|
||||
if(!theSource.GetIntArray (&(aTargetArray->ChangeArray1())(low), up-low+1))
|
||||
return Standard_False;
|
||||
|
||||
Standard_Boolean Ok = anIntArrays.Bind(aKey, aTargetArray);
|
||||
aResult |= Ok;
|
||||
}
|
||||
}
|
||||
if (aResult)
|
||||
T->ChangeArraysOfIntegers(anIntArrays);
|
||||
}
|
||||
|
||||
// arrays of reals
|
||||
if (! (theSource >> aLower >> anUpper))
|
||||
return Standard_False;
|
||||
if (anUpper < aLower) return Standard_False;
|
||||
aResult = Standard_False;
|
||||
if(anUpper | aLower) {
|
||||
TDataStd_DataMapOfStringHArray1OfReal aRealArrays;
|
||||
for (i=aLower; i<=anUpper; i++) {
|
||||
TCollection_ExtendedString aKey;
|
||||
if (! (theSource >> aKey))
|
||||
return Standard_False;
|
||||
Standard_Integer low, up;
|
||||
if (! (theSource >> low >> up))
|
||||
return Standard_False;
|
||||
if(up < low) Standard_False;
|
||||
if(low | up) {
|
||||
Handle(TColStd_HArray1OfReal) aTargetArray =
|
||||
new TColStd_HArray1OfReal(low, up);
|
||||
if(!theSource.GetRealArray (&(aTargetArray->ChangeArray1())(low), up-low+1))
|
||||
return Standard_False;
|
||||
Standard_Boolean Ok = aRealArrays.Bind(aKey, aTargetArray);
|
||||
aResult |= Ok;
|
||||
}
|
||||
}
|
||||
if(aResult)
|
||||
T->ChangeArraysOfReals(aRealArrays);
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose : transient -> persistent (store)
|
||||
//=======================================================================
|
||||
void BinMDataStd_NamedDataDriver::Paste(const Handle(TDF_Attribute)& theSource,
|
||||
BinObjMgt_Persistent& theTarget,
|
||||
BinObjMgt_SRelocationTable& ) const
|
||||
{
|
||||
Handle(TDataStd_NamedData) S = Handle(TDataStd_NamedData)::DownCast (theSource);
|
||||
if(S.IsNull()) return;
|
||||
// Standard_Integer i=0;
|
||||
|
||||
if(S->HasIntegers() && !S->GetIntegersContainer().IsEmpty()) {
|
||||
theTarget.PutInteger(1) << S->GetIntegersContainer().Extent(); //dim
|
||||
TColStd_DataMapIteratorOfDataMapOfStringInteger itr(S->GetIntegersContainer());
|
||||
for (; itr.More(); itr.Next()) {
|
||||
theTarget << itr.Key() << itr.Value(); // key - value;
|
||||
}
|
||||
} else {
|
||||
theTarget.PutInteger(0).PutInteger(0);
|
||||
}
|
||||
|
||||
if(S->HasReals() && !S->GetRealsContainer().IsEmpty()) {
|
||||
theTarget.PutInteger(1) << S->GetRealsContainer().Extent();
|
||||
TDataStd_DataMapIteratorOfDataMapOfStringReal itr(S->GetRealsContainer());
|
||||
for (; itr.More(); itr.Next()) {
|
||||
theTarget << itr.Key() << itr.Value();
|
||||
}
|
||||
} else {
|
||||
theTarget.PutInteger(0).PutInteger(0);
|
||||
}
|
||||
|
||||
if(S->HasStrings() && !S->GetStringsContainer().IsEmpty()) {
|
||||
theTarget.PutInteger(1) << S->GetStringsContainer().Extent();
|
||||
TDataStd_DataMapIteratorOfDataMapOfStringString itr(S->GetStringsContainer());
|
||||
for (; itr.More(); itr.Next()) {
|
||||
theTarget << itr.Key() << itr.Value();
|
||||
}
|
||||
} else {
|
||||
theTarget.PutInteger(0).PutInteger(0);
|
||||
}
|
||||
|
||||
if(S->HasBytes() && !S->GetBytesContainer().IsEmpty()) {
|
||||
theTarget.PutInteger(1) << S->GetBytesContainer().Extent();
|
||||
TDataStd_DataMapIteratorOfDataMapOfStringByte itr(S->GetBytesContainer());
|
||||
for (; itr.More(); itr.Next()) {
|
||||
theTarget << itr.Key() << (Standard_Byte) itr.Value();
|
||||
}
|
||||
} else {
|
||||
theTarget.PutInteger(0).PutInteger(0);
|
||||
}
|
||||
|
||||
if(S->HasArraysOfIntegers() && !S->GetArraysOfIntegersContainer().IsEmpty()) {
|
||||
theTarget.PutInteger(1) << S->GetArraysOfIntegersContainer().Extent();
|
||||
TDataStd_DataMapIteratorOfDataMapOfStringHArray1OfInteger
|
||||
itr(S->GetArraysOfIntegersContainer());
|
||||
for (; itr.More(); itr.Next()) {
|
||||
theTarget << itr.Key(); //key
|
||||
const TColStd_Array1OfInteger& anArr1 = itr.Value()->Array1();
|
||||
theTarget << anArr1.Lower() <<anArr1.Upper(); // value Arr1 dimensions
|
||||
Standard_Integer *aPtr = (Standard_Integer *) &anArr1(anArr1.Lower());
|
||||
theTarget.PutIntArray(aPtr, anArr1.Length());
|
||||
}
|
||||
} else {
|
||||
theTarget.PutInteger(0).PutInteger(0);
|
||||
}
|
||||
|
||||
if(S->HasArraysOfReals() && !S->GetArraysOfRealsContainer().IsEmpty()) {
|
||||
theTarget.PutInteger(1) << S->GetArraysOfRealsContainer().Extent(); //dim
|
||||
TDataStd_DataMapIteratorOfDataMapOfStringHArray1OfReal
|
||||
itr(S->GetArraysOfRealsContainer());
|
||||
for (; itr.More(); itr.Next()) {
|
||||
theTarget << itr.Key();//key
|
||||
const TColStd_Array1OfReal& anArr1 = itr.Value()->Array1();
|
||||
theTarget << anArr1.Lower() <<anArr1.Upper(); // value Arr1 dimensions
|
||||
Standard_Real *aPtr = (Standard_Real *) &anArr1(anArr1.Lower());
|
||||
theTarget.PutRealArray(aPtr, anArr1.Length());
|
||||
}
|
||||
} else {
|
||||
theTarget.PutInteger(0).PutInteger(0);
|
||||
}
|
||||
}
|
35
src/BinMDataStd/BinMDataStd_NoteBookDriver.cdl
Executable file
35
src/BinMDataStd/BinMDataStd_NoteBookDriver.cdl
Executable file
@@ -0,0 +1,35 @@
|
||||
-- File: BinMDataStd_NoteBookDriver.cdl
|
||||
-- Created: Thu May 13 12:31:45 2004
|
||||
-- Author: Sergey ZARITCHNY <szy@opencascade.com>
|
||||
-- Copyright: Open CasCade S.A. 2004
|
||||
|
||||
class NoteBookDriver from BinMDataStd inherits ADriver from BinMDF
|
||||
|
||||
---Purpose: NoteBook attribute Driver.
|
||||
|
||||
uses
|
||||
MessageDriver from CDM,
|
||||
SRelocationTable from BinObjMgt,
|
||||
RRelocationTable from BinObjMgt,
|
||||
Persistent from BinObjMgt,
|
||||
Attribute from TDF
|
||||
|
||||
is
|
||||
Create (theMessageDriver:MessageDriver from CDM)
|
||||
returns mutable NoteBookDriver from BinMDataStd;
|
||||
|
||||
NewEmpty (me) returns mutable Attribute from TDF
|
||||
is redefined;
|
||||
|
||||
Paste(me; Source : Persistent from BinObjMgt;
|
||||
Target : mutable Attribute from TDF;
|
||||
RelocTable : out RRelocationTable from BinObjMgt)
|
||||
returns Boolean from Standard is redefined;
|
||||
|
||||
Paste(me; Source : Attribute from TDF;
|
||||
Target : in out Persistent from BinObjMgt;
|
||||
RelocTable : out SRelocationTable from BinObjMgt)
|
||||
is redefined;
|
||||
|
||||
end NoteBookDriver;
|
||||
|
57
src/BinMDataStd/BinMDataStd_NoteBookDriver.cxx
Executable file
57
src/BinMDataStd/BinMDataStd_NoteBookDriver.cxx
Executable file
@@ -0,0 +1,57 @@
|
||||
// File: BinMDataStd_NoteBookDriver.cxx
|
||||
// Created: Thu May 13 12:34:39 2004
|
||||
// Author: Sergey ZARITCHNY <szy@opencascade.com>
|
||||
// Copyright: Open CasCade S.A. 2004
|
||||
|
||||
|
||||
#include <BinMDataStd_NoteBookDriver.ixx>
|
||||
#include <CDM_MessageDriver.hxx>
|
||||
#include <TDF_Attribute.hxx>
|
||||
#include <TDataStd_NoteBook.hxx>
|
||||
#include <BinMDF_ADriver.hxx>
|
||||
#include <BinObjMgt_Persistent.hxx>
|
||||
#include <BinObjMgt_RRelocationTable.hxx>
|
||||
#include <BinObjMgt_SRelocationTable.hxx>
|
||||
//=======================================================================
|
||||
//function : BinMDataStd_NoteBookDriver
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
BinMDataStd_NoteBookDriver::BinMDataStd_NoteBookDriver
|
||||
(const Handle(CDM_MessageDriver)& 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
|
||||
{}
|
||||
|
||||
|
35
src/BinMDataStd/BinMDataStd_RealArrayDriver.cdl
Executable file
35
src/BinMDataStd/BinMDataStd_RealArrayDriver.cdl
Executable file
@@ -0,0 +1,35 @@
|
||||
-- File: BinMDataStd_RealArrayDriver.cdl
|
||||
-- Created: Thu Oct 31 20:38:50 2002
|
||||
-- Author: Michael SAZONOV
|
||||
-- <msv@novgorox.nnov.matra-dtv.fr>
|
||||
---Copyright: Matra Datavision 2002
|
||||
|
||||
class RealArrayDriver from BinMDataStd inherits ADriver from BinMDF
|
||||
|
||||
---Purpose: Array of Real attribute Driver.
|
||||
|
||||
uses
|
||||
MessageDriver from CDM,
|
||||
SRelocationTable from BinObjMgt,
|
||||
RRelocationTable from BinObjMgt,
|
||||
Persistent from BinObjMgt,
|
||||
Attribute from TDF
|
||||
|
||||
is
|
||||
Create (theMessageDriver:MessageDriver from CDM)
|
||||
returns mutable RealArrayDriver from BinMDataStd;
|
||||
|
||||
NewEmpty (me) returns mutable Attribute from TDF
|
||||
is redefined;
|
||||
|
||||
Paste(me; Source : Persistent from BinObjMgt;
|
||||
Target : mutable Attribute from TDF;
|
||||
RelocTable : out RRelocationTable from BinObjMgt)
|
||||
returns Boolean from Standard is redefined;
|
||||
|
||||
Paste(me; Source : Attribute from TDF;
|
||||
Target : in out Persistent from BinObjMgt;
|
||||
RelocTable : out SRelocationTable from BinObjMgt)
|
||||
is redefined;
|
||||
|
||||
end RealArrayDriver;
|
90
src/BinMDataStd/BinMDataStd_RealArrayDriver.cxx
Executable file
90
src/BinMDataStd/BinMDataStd_RealArrayDriver.cxx
Executable file
@@ -0,0 +1,90 @@
|
||||
// File: BinMDataStd_RealArrayDriver.cxx
|
||||
// Created: 31.10.02 20:42:59
|
||||
// Author: Michael SAZONOV
|
||||
// Copyright: Open CASCADE 2002
|
||||
|
||||
#include <BinMDataStd_RealArrayDriver.ixx>
|
||||
#include <TDataStd_RealArray.hxx>
|
||||
#include <TColStd_HArray1OfReal.hxx>
|
||||
#include <BinMDataStd.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : BinMDataStd_RealArrayDriver
|
||||
//purpose : Constructor
|
||||
//=======================================================================
|
||||
|
||||
BinMDataStd_RealArrayDriver::BinMDataStd_RealArrayDriver
|
||||
(const Handle(CDM_MessageDriver)& theMsgDriver)
|
||||
: BinMDF_ADriver (theMsgDriver, STANDARD_TYPE(TDataStd_RealArray)->Name())
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewEmpty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TDF_Attribute) BinMDataStd_RealArrayDriver::NewEmpty() const
|
||||
{
|
||||
return new TDataStd_RealArray();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose : persistent -> transient (retrieve)
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BinMDataStd_RealArrayDriver::Paste
|
||||
(const BinObjMgt_Persistent& theSource,
|
||||
const Handle(TDF_Attribute)& theTarget,
|
||||
BinObjMgt_RRelocationTable& ) const
|
||||
{
|
||||
Standard_Integer aFirstInd, aLastInd;
|
||||
if (! (theSource >> aFirstInd >> aLastInd))
|
||||
return Standard_False;
|
||||
const Standard_Integer aLength = aLastInd - aFirstInd + 1;
|
||||
if (aLength <= 0)
|
||||
return Standard_False;
|
||||
|
||||
Handle(TDataStd_RealArray) anAtt =
|
||||
Handle(TDataStd_RealArray)::DownCast(theTarget);
|
||||
anAtt->Init(aFirstInd, aLastInd);
|
||||
TColStd_Array1OfReal& aTargetArray = anAtt->Array()->ChangeArray1();
|
||||
if(!theSource.GetRealArray (&aTargetArray(aFirstInd), aLength))
|
||||
return Standard_False;
|
||||
#ifdef DEB
|
||||
//cout << "CurDocVersion = " << BinMDataStd::DocumentVersion() <<endl;
|
||||
#endif
|
||||
Standard_Boolean aDelta(Standard_False);
|
||||
if(BinMDataStd::DocumentVersion() > 2) {
|
||||
Standard_Byte aDeltaValue;
|
||||
if (! (theSource >> aDeltaValue))
|
||||
return Standard_False;
|
||||
else
|
||||
aDelta = (Standard_Boolean)aDeltaValue;
|
||||
}
|
||||
anAtt->SetDelta(aDelta);
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose : transient -> persistent (store)
|
||||
//=======================================================================
|
||||
|
||||
void BinMDataStd_RealArrayDriver::Paste
|
||||
(const Handle(TDF_Attribute)& theSource,
|
||||
BinObjMgt_Persistent& theTarget,
|
||||
BinObjMgt_SRelocationTable& ) const
|
||||
{
|
||||
Handle(TDataStd_RealArray) anAtt =
|
||||
Handle(TDataStd_RealArray)::DownCast(theSource);
|
||||
const TColStd_Array1OfReal& aSourceArray = anAtt->Array()->Array1();
|
||||
const Standard_Integer aFirstInd = aSourceArray.Lower();
|
||||
const Standard_Integer aLastInd = aSourceArray.Upper();
|
||||
const Standard_Integer aLength = aLastInd - aFirstInd + 1;
|
||||
theTarget << aFirstInd << aLastInd;
|
||||
Standard_Real *aPtr = (Standard_Real *) &aSourceArray(aFirstInd);
|
||||
theTarget.PutRealArray (aPtr, aLength);
|
||||
theTarget << (Standard_Byte)anAtt->GetDelta();
|
||||
}
|
35
src/BinMDataStd/BinMDataStd_RealDriver.cdl
Executable file
35
src/BinMDataStd/BinMDataStd_RealDriver.cdl
Executable file
@@ -0,0 +1,35 @@
|
||||
-- File: BinMDataStd_RealDriver.cdl
|
||||
-- Created: Wed Oct 30 14:53:50 2002
|
||||
-- Author: Michael SAZONOV
|
||||
-- <msv@novgorox.nnov.matra-dtv.fr>
|
||||
---Copyright: Matra Datavision 2002
|
||||
|
||||
class RealDriver from BinMDataStd inherits ADriver from BinMDF
|
||||
|
||||
---Purpose: Real attribute Driver.
|
||||
|
||||
uses
|
||||
MessageDriver from CDM,
|
||||
SRelocationTable from BinObjMgt,
|
||||
RRelocationTable from BinObjMgt,
|
||||
Persistent from BinObjMgt,
|
||||
Attribute from TDF
|
||||
|
||||
is
|
||||
Create (theMessageDriver:MessageDriver from CDM)
|
||||
returns mutable RealDriver from BinMDataStd;
|
||||
|
||||
NewEmpty (me) returns mutable Attribute from TDF
|
||||
is redefined;
|
||||
|
||||
Paste(me; Source : Persistent from BinObjMgt;
|
||||
Target : mutable Attribute from TDF;
|
||||
RelocTable : out RRelocationTable from BinObjMgt)
|
||||
returns Boolean from Standard is redefined;
|
||||
|
||||
Paste(me; Source : Attribute from TDF;
|
||||
Target : in out Persistent from BinObjMgt;
|
||||
RelocTable : out SRelocationTable from BinObjMgt)
|
||||
is redefined;
|
||||
|
||||
end RealDriver;
|
59
src/BinMDataStd/BinMDataStd_RealDriver.cxx
Executable file
59
src/BinMDataStd/BinMDataStd_RealDriver.cxx
Executable file
@@ -0,0 +1,59 @@
|
||||
// File: BinMDataStd_RealDriver.cxx
|
||||
// Created: 30.10.02 14:56:34
|
||||
// Author: Michael SAZONOV
|
||||
// Copyright: Open CASCADE 2002
|
||||
|
||||
#include <BinMDataStd_RealDriver.ixx>
|
||||
#include <TDataStd_Real.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : BinMDataStd_RealDriver
|
||||
//purpose : Constructor
|
||||
//=======================================================================
|
||||
|
||||
BinMDataStd_RealDriver::BinMDataStd_RealDriver
|
||||
(const Handle(CDM_MessageDriver)& theMsgDriver)
|
||||
: BinMDF_ADriver (theMsgDriver, STANDARD_TYPE(TDataStd_Real)->Name())
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewEmpty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TDF_Attribute) BinMDataStd_RealDriver::NewEmpty() const
|
||||
{
|
||||
return new TDataStd_Real();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose : persistent -> transient (retrieve)
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BinMDataStd_RealDriver::Paste
|
||||
(const BinObjMgt_Persistent& theSource,
|
||||
const Handle(TDF_Attribute)& theTarget,
|
||||
BinObjMgt_RRelocationTable& ) const
|
||||
{
|
||||
Handle(TDataStd_Real) anAtt= Handle(TDataStd_Real)::DownCast(theTarget);
|
||||
Standard_Real aValue;
|
||||
Standard_Boolean ok = theSource >> aValue;
|
||||
if (ok)
|
||||
anAtt->Set(aValue);
|
||||
return ok;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose : transient -> persistent (store)
|
||||
//=======================================================================
|
||||
|
||||
void BinMDataStd_RealDriver::Paste (const Handle(TDF_Attribute)& theSource,
|
||||
BinObjMgt_Persistent& theTarget,
|
||||
BinObjMgt_SRelocationTable& ) const
|
||||
{
|
||||
Handle(TDataStd_Real) anAtt= Handle(TDataStd_Real)::DownCast(theSource);
|
||||
theTarget << anAtt->Get();
|
||||
}
|
35
src/BinMDataStd/BinMDataStd_RealListDriver.cdl
Executable file
35
src/BinMDataStd/BinMDataStd_RealListDriver.cdl
Executable file
@@ -0,0 +1,35 @@
|
||||
-- File: BinMDataStd_RealListDriver.cdl
|
||||
-- Created: May 29 11:40:00 2007
|
||||
-- Author: Vlad Romashko
|
||||
-- <vladislav.romashko@opencascade.com>
|
||||
-- Copyright: Open CASCADE
|
||||
|
||||
class RealListDriver from BinMDataStd inherits ADriver from BinMDF
|
||||
|
||||
uses
|
||||
|
||||
MessageDriver from CDM,
|
||||
SRelocationTable from BinObjMgt,
|
||||
RRelocationTable from BinObjMgt,
|
||||
Persistent from BinObjMgt,
|
||||
Attribute from TDF
|
||||
|
||||
is
|
||||
Create (theMessageDriver:MessageDriver from CDM)
|
||||
returns mutable RealListDriver from BinMDataStd;
|
||||
|
||||
NewEmpty (me)
|
||||
returns mutable Attribute from TDF
|
||||
is redefined;
|
||||
|
||||
Paste(me; Source : Persistent from BinObjMgt;
|
||||
Target : mutable Attribute from TDF;
|
||||
RelocTable : out RRelocationTable from BinObjMgt)
|
||||
returns Boolean from Standard is redefined;
|
||||
|
||||
Paste(me; Source : Attribute from TDF;
|
||||
Target : in out Persistent from BinObjMgt;
|
||||
RelocTable : out SRelocationTable from BinObjMgt)
|
||||
is redefined;
|
||||
|
||||
end RealListDriver;
|
83
src/BinMDataStd/BinMDataStd_RealListDriver.cxx
Executable file
83
src/BinMDataStd/BinMDataStd_RealListDriver.cxx
Executable file
@@ -0,0 +1,83 @@
|
||||
// File: BinMDataStd_RealListDriver.cxx
|
||||
// Created: May 29 11:40:00 2007
|
||||
// Author: Vlad Romashko
|
||||
// <vladislav.romashko@opencascade.com>
|
||||
// Copyright: Open CASCADE
|
||||
|
||||
#include <BinMDataStd_RealListDriver.ixx>
|
||||
#include <TDataStd_RealList.hxx>
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
#include <TColStd_ListIteratorOfListOfReal.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : BinMDataStd_RealListDriver
|
||||
//purpose : Constructor
|
||||
//=======================================================================
|
||||
BinMDataStd_RealListDriver::BinMDataStd_RealListDriver(const Handle(CDM_MessageDriver)& theMsgDriver)
|
||||
: BinMDF_ADriver (theMsgDriver, STANDARD_TYPE(TDataStd_RealList)->Name())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewEmpty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(TDF_Attribute) BinMDataStd_RealListDriver::NewEmpty() const
|
||||
{
|
||||
return new TDataStd_RealList();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose : persistent -> transient (retrieve)
|
||||
//=======================================================================
|
||||
Standard_Boolean BinMDataStd_RealListDriver::Paste(const BinObjMgt_Persistent& theSource,
|
||||
const Handle(TDF_Attribute)& theTarget,
|
||||
BinObjMgt_RRelocationTable& ) const
|
||||
{
|
||||
Standard_Integer aIndex, aFirstInd, aLastInd;
|
||||
if (! (theSource >> aFirstInd >> aLastInd))
|
||||
return Standard_False;
|
||||
const Standard_Integer aLength = aLastInd - aFirstInd + 1;
|
||||
if (aLength <= 0)
|
||||
return Standard_False;
|
||||
|
||||
TColStd_Array1OfReal aTargetArray(aFirstInd, aLastInd);
|
||||
theSource.GetRealArray (&aTargetArray(aFirstInd), aLength);
|
||||
|
||||
Handle(TDataStd_RealList) anAtt = Handle(TDataStd_RealList)::DownCast(theTarget);
|
||||
for (aIndex = aFirstInd; aIndex <= aLastInd; aIndex++)
|
||||
{
|
||||
anAtt->Append(aTargetArray.Value(aIndex));
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose : transient -> persistent (store)
|
||||
//=======================================================================
|
||||
void BinMDataStd_RealListDriver::Paste(const Handle(TDF_Attribute)& theSource,
|
||||
BinObjMgt_Persistent& theTarget,
|
||||
BinObjMgt_SRelocationTable& ) const
|
||||
{
|
||||
Handle(TDataStd_RealList) anAtt = Handle(TDataStd_RealList)::DownCast(theSource);
|
||||
const Standard_Integer aFirstInd = 1;
|
||||
const Standard_Integer aLastInd = anAtt->Extent();
|
||||
const Standard_Integer aLength = aLastInd - aFirstInd + 1;
|
||||
if (aLength <= 0)
|
||||
return;
|
||||
theTarget << aFirstInd << aLastInd;
|
||||
TColStd_Array1OfReal aSourceArray(aFirstInd, aLastInd);
|
||||
if (aLastInd >= 1)
|
||||
{
|
||||
TColStd_ListIteratorOfListOfReal itr(anAtt->List());
|
||||
for (Standard_Integer i = 1; itr.More(); itr.Next(), i++)
|
||||
{
|
||||
aSourceArray.SetValue(i, itr.Value());
|
||||
}
|
||||
Standard_Real *aPtr = (Standard_Real *) &aSourceArray(aFirstInd);
|
||||
theTarget.PutRealArray(aPtr, aLength);
|
||||
}
|
||||
}
|
35
src/BinMDataStd/BinMDataStd_ReferenceArrayDriver.cdl
Executable file
35
src/BinMDataStd/BinMDataStd_ReferenceArrayDriver.cdl
Executable file
@@ -0,0 +1,35 @@
|
||||
-- File: BinMDataStd_ReferenceArrayDriver.cdl
|
||||
-- Created: May 29 11:40:00 2007
|
||||
-- Author: Vlad Romashko
|
||||
-- <vladislav.romashko@opencascade.com>
|
||||
-- Copyright: Open CASCADE
|
||||
|
||||
class ReferenceArrayDriver from BinMDataStd inherits ADriver from BinMDF
|
||||
|
||||
uses
|
||||
|
||||
MessageDriver from CDM,
|
||||
SRelocationTable from BinObjMgt,
|
||||
RRelocationTable from BinObjMgt,
|
||||
Persistent from BinObjMgt,
|
||||
Attribute from TDF
|
||||
|
||||
is
|
||||
Create (theMessageDriver:MessageDriver from CDM)
|
||||
returns mutable ReferenceArrayDriver from BinMDataStd;
|
||||
|
||||
NewEmpty (me)
|
||||
returns mutable Attribute from TDF
|
||||
is redefined;
|
||||
|
||||
Paste(me; Source : Persistent from BinObjMgt;
|
||||
Target : mutable Attribute from TDF;
|
||||
RelocTable : out RRelocationTable from BinObjMgt)
|
||||
returns Boolean from Standard is redefined;
|
||||
|
||||
Paste(me; Source : Attribute from TDF;
|
||||
Target : in out Persistent from BinObjMgt;
|
||||
RelocTable : out SRelocationTable from BinObjMgt)
|
||||
is redefined;
|
||||
|
||||
end ReferenceArrayDriver;
|
85
src/BinMDataStd/BinMDataStd_ReferenceArrayDriver.cxx
Executable file
85
src/BinMDataStd/BinMDataStd_ReferenceArrayDriver.cxx
Executable file
@@ -0,0 +1,85 @@
|
||||
// File: BinMDataStd_ReferenceArrayDriver.cxx
|
||||
// Created: May 29 11:40:00 2007
|
||||
// Author: Vlad Romashko
|
||||
// <vladislav.romashko@opencascade.com>
|
||||
// Copyright: Open CASCADE
|
||||
|
||||
#include <BinMDataStd_ReferenceArrayDriver.ixx>
|
||||
#include <TDataStd_ReferenceArray.hxx>
|
||||
#include <TDF_Label.hxx>
|
||||
#include <TDF_Tool.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : BinMDataStd_ReferenceArrayDriver
|
||||
//purpose : Constructor
|
||||
//=======================================================================
|
||||
BinMDataStd_ReferenceArrayDriver::BinMDataStd_ReferenceArrayDriver(const Handle(CDM_MessageDriver)& theMsgDriver)
|
||||
: BinMDF_ADriver (theMsgDriver, STANDARD_TYPE(TDataStd_ReferenceArray)->Name())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewEmpty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(TDF_Attribute) BinMDataStd_ReferenceArrayDriver::NewEmpty() const
|
||||
{
|
||||
return new TDataStd_ReferenceArray();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose : persistent -> transient (retrieve)
|
||||
//=======================================================================
|
||||
Standard_Boolean BinMDataStd_ReferenceArrayDriver::Paste(const BinObjMgt_Persistent& theSource,
|
||||
const Handle(TDF_Attribute)& theTarget,
|
||||
BinObjMgt_RRelocationTable& ) const
|
||||
{
|
||||
Standard_Integer aFirstInd, aLastInd;
|
||||
if (! (theSource >> aFirstInd >> aLastInd))
|
||||
return Standard_False;
|
||||
const Standard_Integer aLength = aLastInd - aFirstInd + 1;
|
||||
if (aLength <= 0)
|
||||
return Standard_False;
|
||||
|
||||
Handle(TDataStd_ReferenceArray) anAtt = Handle(TDataStd_ReferenceArray)::DownCast(theTarget);
|
||||
anAtt->Init(aFirstInd, aLastInd);
|
||||
for (Standard_Integer i = aFirstInd; i <= aLastInd; i++)
|
||||
{
|
||||
TCollection_AsciiString entry;
|
||||
if ( !(theSource >> entry) )
|
||||
return Standard_False;
|
||||
TDF_Label L;
|
||||
TDF_Tool::Label(anAtt->Label().Data(), entry, L, Standard_True);
|
||||
if (!L.IsNull())
|
||||
anAtt->SetValue(i, L);
|
||||
}
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose : transient -> persistent (store)
|
||||
//=======================================================================
|
||||
void BinMDataStd_ReferenceArrayDriver::Paste(const Handle(TDF_Attribute)& theSource,
|
||||
BinObjMgt_Persistent& theTarget,
|
||||
BinObjMgt_SRelocationTable& ) const
|
||||
{
|
||||
Handle(TDataStd_ReferenceArray) anAtt = Handle(TDataStd_ReferenceArray)::DownCast(theSource);
|
||||
Standard_Integer aFirstInd = anAtt->Lower(), aLastInd = anAtt->Upper(), i = aFirstInd;
|
||||
if (aFirstInd > aLastInd)
|
||||
return;
|
||||
theTarget << aFirstInd << aLastInd;
|
||||
for (; i <= aLastInd; i++)
|
||||
{
|
||||
TDF_Label L = anAtt->Value(i);
|
||||
if (!L.IsNull())
|
||||
{
|
||||
TCollection_AsciiString entry;
|
||||
TDF_Tool::Entry(L, entry);
|
||||
theTarget << entry;
|
||||
}
|
||||
}
|
||||
}
|
35
src/BinMDataStd/BinMDataStd_ReferenceListDriver.cdl
Executable file
35
src/BinMDataStd/BinMDataStd_ReferenceListDriver.cdl
Executable file
@@ -0,0 +1,35 @@
|
||||
-- File: BinMDataStd_ReferenceListDriver.cdl
|
||||
-- Created: May 29 11:40:00 2007
|
||||
-- Author: Vlad Romashko
|
||||
-- <vladislav.romashko@opencascade.com>
|
||||
-- Copyright: Open CASCADE
|
||||
|
||||
class ReferenceListDriver from BinMDataStd inherits ADriver from BinMDF
|
||||
|
||||
uses
|
||||
|
||||
MessageDriver from CDM,
|
||||
SRelocationTable from BinObjMgt,
|
||||
RRelocationTable from BinObjMgt,
|
||||
Persistent from BinObjMgt,
|
||||
Attribute from TDF
|
||||
|
||||
is
|
||||
Create (theMessageDriver:MessageDriver from CDM)
|
||||
returns mutable ReferenceListDriver from BinMDataStd;
|
||||
|
||||
NewEmpty (me)
|
||||
returns mutable Attribute from TDF
|
||||
is redefined;
|
||||
|
||||
Paste(me; Source : Persistent from BinObjMgt;
|
||||
Target : mutable Attribute from TDF;
|
||||
RelocTable : out RRelocationTable from BinObjMgt)
|
||||
returns Boolean from Standard is redefined;
|
||||
|
||||
Paste(me; Source : Attribute from TDF;
|
||||
Target : in out Persistent from BinObjMgt;
|
||||
RelocTable : out SRelocationTable from BinObjMgt)
|
||||
is redefined;
|
||||
|
||||
end ReferenceListDriver;
|
86
src/BinMDataStd/BinMDataStd_ReferenceListDriver.cxx
Executable file
86
src/BinMDataStd/BinMDataStd_ReferenceListDriver.cxx
Executable file
@@ -0,0 +1,86 @@
|
||||
// File: BinMDataStd_ReferenceListDriver.cxx
|
||||
// Created: May 29 11:40:00 2007
|
||||
// Author: Vlad Romashko
|
||||
// <vladislav.romashko@opencascade.com>
|
||||
// Copyright: Open CASCADE
|
||||
|
||||
#include <BinMDataStd_ReferenceListDriver.ixx>
|
||||
#include <TDataStd_ReferenceList.hxx>
|
||||
#include <TDF_ListIteratorOfLabelList.hxx>
|
||||
#include <TDF_Label.hxx>
|
||||
#include <TDF_Tool.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : BinMDataStd_ReferenceListDriver
|
||||
//purpose : Constructor
|
||||
//=======================================================================
|
||||
BinMDataStd_ReferenceListDriver::BinMDataStd_ReferenceListDriver(const Handle(CDM_MessageDriver)& theMsgDriver)
|
||||
: BinMDF_ADriver (theMsgDriver, STANDARD_TYPE(TDataStd_ReferenceList)->Name())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewEmpty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(TDF_Attribute) BinMDataStd_ReferenceListDriver::NewEmpty() const
|
||||
{
|
||||
return new TDataStd_ReferenceList();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose : persistent -> transient (retrieve)
|
||||
//=======================================================================
|
||||
Standard_Boolean BinMDataStd_ReferenceListDriver::Paste(const BinObjMgt_Persistent& theSource,
|
||||
const Handle(TDF_Attribute)& theTarget,
|
||||
BinObjMgt_RRelocationTable& ) const
|
||||
{
|
||||
Standard_Integer aFirstInd, aLastInd;
|
||||
if (! (theSource >> aFirstInd >> aLastInd))
|
||||
return Standard_False;
|
||||
const Standard_Integer aLength = aLastInd - aFirstInd + 1;
|
||||
if (aLength <= 0)
|
||||
return Standard_False;
|
||||
|
||||
Handle(TDataStd_ReferenceList) anAtt = Handle(TDataStd_ReferenceList)::DownCast(theTarget);
|
||||
for (Standard_Integer i = aFirstInd; i <= aLastInd; i++)
|
||||
{
|
||||
TCollection_AsciiString entry;
|
||||
if ( !(theSource >> entry) )
|
||||
return Standard_False;
|
||||
TDF_Label L;
|
||||
TDF_Tool::Label(anAtt->Label().Data(), entry, L, Standard_True);
|
||||
if (!L.IsNull())
|
||||
anAtt->Append(L);
|
||||
}
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose : transient -> persistent (store)
|
||||
//=======================================================================
|
||||
void BinMDataStd_ReferenceListDriver::Paste(const Handle(TDF_Attribute)& theSource,
|
||||
BinObjMgt_Persistent& theTarget,
|
||||
BinObjMgt_SRelocationTable& ) const
|
||||
{
|
||||
Handle(TDataStd_ReferenceList) anAtt = Handle(TDataStd_ReferenceList)::DownCast(theSource);
|
||||
if (anAtt->IsEmpty())
|
||||
return;
|
||||
Standard_Integer aFirstInd = 1, aLastInd = anAtt->Extent(), i = aFirstInd;
|
||||
theTarget << aFirstInd << aLastInd;
|
||||
TDF_ListIteratorOfLabelList itr(anAtt->List());
|
||||
for (; itr.More(); itr.Next(), i++)
|
||||
{
|
||||
TDF_Label L = itr.Value();
|
||||
if (!L.IsNull())
|
||||
{
|
||||
TCollection_AsciiString entry;
|
||||
TDF_Tool::Entry(L, entry);
|
||||
theTarget << entry;
|
||||
}
|
||||
}
|
||||
}
|
32
src/BinMDataStd/BinMDataStd_RelationDriver.cdl
Executable file
32
src/BinMDataStd/BinMDataStd_RelationDriver.cdl
Executable file
@@ -0,0 +1,32 @@
|
||||
-- File: BinMDataStd_RelationDriver.cdl
|
||||
-- Created: Wed Sep 12 14:05:15 2001
|
||||
-- Author: Julia DOROVSKIKH
|
||||
-- Copyright: Open Cascade 2001
|
||||
|
||||
class RelationDriver from BinMDataStd inherits ADriver from BinMDF
|
||||
|
||||
---Purpose: Attribute Driver.
|
||||
|
||||
uses
|
||||
SRelocationTable from BinObjMgt,
|
||||
RRelocationTable from BinObjMgt,
|
||||
Persistent from BinObjMgt,
|
||||
MessageDriver from CDM,
|
||||
Attribute from TDF
|
||||
|
||||
is
|
||||
Create (theMessageDriver:MessageDriver from CDM)
|
||||
returns mutable RelationDriver from BinMDataStd;
|
||||
|
||||
NewEmpty (me) returns mutable Attribute from TDF;
|
||||
|
||||
Paste(me; Source : Persistent from BinObjMgt;
|
||||
Target : mutable Attribute from TDF;
|
||||
RelocTable : out RRelocationTable from BinObjMgt)
|
||||
returns Boolean from Standard;
|
||||
|
||||
Paste(me; Source : Attribute from TDF;
|
||||
Target : in out Persistent from BinObjMgt;
|
||||
RelocTable : out SRelocationTable from BinObjMgt);
|
||||
|
||||
end RelationDriver;
|
106
src/BinMDataStd/BinMDataStd_RelationDriver.cxx
Executable file
106
src/BinMDataStd/BinMDataStd_RelationDriver.cxx
Executable file
@@ -0,0 +1,106 @@
|
||||
// File: BinMDataStd_RelationDriver.cxx
|
||||
// Created: Wed Sep 12 14:07:32 2001
|
||||
// Author: Julia DOROVSKIKH
|
||||
// Copyright: Open Cascade 2001
|
||||
// History:
|
||||
|
||||
#include <BinMDataStd_RelationDriver.ixx>
|
||||
#include <TDataStd_Relation.hxx>
|
||||
#include <TDataStd_Variable.hxx>
|
||||
#include <TDF_ListIteratorOfAttributeList.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : BinMDataStd_RelationDriver
|
||||
//purpose : Constructor
|
||||
//=======================================================================
|
||||
BinMDataStd_RelationDriver::BinMDataStd_RelationDriver
|
||||
(const Handle(CDM_MessageDriver)& 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;
|
||||
}
|
40
src/BinMDataStd/BinMDataStd_TickDriver.cdl
Executable file
40
src/BinMDataStd/BinMDataStd_TickDriver.cdl
Executable file
@@ -0,0 +1,40 @@
|
||||
-- File: BinMDataStd_TickDriver.cdl
|
||||
-- Created: May 29 11:40:00 2007
|
||||
-- Author: Vlad Romashko
|
||||
-- <vladislav.romashko@opencascade.com>
|
||||
-- Copyright: Open CASCADE
|
||||
|
||||
class TickDriver from BinMDataStd inherits ADriver from BinMDF
|
||||
|
||||
---Purpose: Tick attribute driver.
|
||||
|
||||
uses
|
||||
|
||||
MessageDriver from CDM,
|
||||
SRelocationTable from BinObjMgt,
|
||||
RRelocationTable from BinObjMgt,
|
||||
Persistent from BinObjMgt,
|
||||
Attribute from TDF
|
||||
|
||||
is
|
||||
|
||||
Create (theMessageDriver:MessageDriver from CDM)
|
||||
returns mutable TickDriver from BinMDataStd;
|
||||
|
||||
NewEmpty (me)
|
||||
returns mutable Attribute from TDF
|
||||
is redefined;
|
||||
|
||||
Paste(me; Source : Persistent from BinObjMgt;
|
||||
Target : mutable Attribute from TDF;
|
||||
RelocTable : out RRelocationTable from BinObjMgt)
|
||||
returns Boolean from Standard is redefined;
|
||||
|
||||
Paste(me; Source : Attribute from TDF;
|
||||
Target : in out Persistent from BinObjMgt;
|
||||
RelocTable : out SRelocationTable from BinObjMgt)
|
||||
is redefined;
|
||||
|
||||
end TickDriver;
|
||||
|
||||
|
53
src/BinMDataStd/BinMDataStd_TickDriver.cxx
Executable file
53
src/BinMDataStd/BinMDataStd_TickDriver.cxx
Executable file
@@ -0,0 +1,53 @@
|
||||
// File: BinMDataStd_TickDriver.cxx
|
||||
// Created: May 29 11:40:00 2007
|
||||
// Author: Vlad Romashko
|
||||
// <vladislav.romashko@opencascade.com>
|
||||
// Copyright: Open CASCADE
|
||||
|
||||
#include <BinMDataStd_TickDriver.ixx>
|
||||
#include <CDM_MessageDriver.hxx>
|
||||
#include <TDF_Attribute.hxx>
|
||||
#include <TDataStd_Tick.hxx>
|
||||
#include <BinMDF_ADriver.hxx>
|
||||
#include <BinObjMgt_Persistent.hxx>
|
||||
#include <BinObjMgt_RRelocationTable.hxx>
|
||||
#include <BinObjMgt_SRelocationTable.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : BinMDataStd_TickDriver
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BinMDataStd_TickDriver::BinMDataStd_TickDriver(const Handle(CDM_MessageDriver)& theMsgDriver)
|
||||
: BinMDF_ADriver (theMsgDriver, STANDARD_TYPE(TDataStd_Tick)->Name())
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewEmpty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(TDF_Attribute) BinMDataStd_TickDriver::NewEmpty() const
|
||||
{
|
||||
return new TDataStd_Tick();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose : persistent -> transient (retrieve)
|
||||
//=======================================================================
|
||||
Standard_Boolean BinMDataStd_TickDriver::Paste(const BinObjMgt_Persistent&,
|
||||
const Handle(TDF_Attribute)&,
|
||||
BinObjMgt_RRelocationTable& ) const
|
||||
{
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose : transient -> persistent (store)
|
||||
//=======================================================================
|
||||
void BinMDataStd_TickDriver::Paste(const Handle(TDF_Attribute)&,
|
||||
BinObjMgt_Persistent&,
|
||||
BinObjMgt_SRelocationTable& ) const
|
||||
{
|
||||
}
|
32
src/BinMDataStd/BinMDataStd_TreeNodeDriver.cdl
Executable file
32
src/BinMDataStd/BinMDataStd_TreeNodeDriver.cdl
Executable file
@@ -0,0 +1,32 @@
|
||||
-- File: BinMDataStd_TreeNodeDriver.cdl
|
||||
-- Created: Fri Aug 24 20:16:51 2001
|
||||
-- Author: Alexander GRIGORIEV
|
||||
-- Copyright: Open Cascade 2001
|
||||
|
||||
class TreeNodeDriver from BinMDataStd inherits ADriver from BinMDF
|
||||
|
||||
---Purpose: Attribute Driver.
|
||||
|
||||
uses
|
||||
SRelocationTable from BinObjMgt,
|
||||
RRelocationTable from BinObjMgt,
|
||||
Persistent from BinObjMgt,
|
||||
MessageDriver from CDM,
|
||||
Attribute from TDF
|
||||
|
||||
is
|
||||
Create (theMessageDriver:MessageDriver from CDM)
|
||||
returns mutable TreeNodeDriver from BinMDataStd;
|
||||
|
||||
NewEmpty (me) returns mutable Attribute from TDF;
|
||||
|
||||
Paste(me; Source : Persistent from BinObjMgt;
|
||||
Target : mutable Attribute from TDF;
|
||||
RelocTable : out RRelocationTable from BinObjMgt)
|
||||
returns Boolean from Standard;
|
||||
|
||||
Paste(me; Source : Attribute from TDF;
|
||||
Target : in out Persistent from BinObjMgt;
|
||||
RelocTable : out SRelocationTable from BinObjMgt);
|
||||
|
||||
end TreeNodeDriver;
|
107
src/BinMDataStd/BinMDataStd_TreeNodeDriver.cxx
Executable file
107
src/BinMDataStd/BinMDataStd_TreeNodeDriver.cxx
Executable file
@@ -0,0 +1,107 @@
|
||||
// File: BinMDataStd_TreeNodeDriver.cxx
|
||||
// Created: Fri Aug 24 20:46:58 2001
|
||||
// Author: Alexnder GRIGORIEV
|
||||
// Copyright: Open Cascade 2001
|
||||
// History:
|
||||
|
||||
#include <BinMDataStd_TreeNodeDriver.ixx>
|
||||
#include <TDataStd_TreeNode.hxx>
|
||||
#include <TCollection_ExtendedString.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : BinMDataStd_TreeNodeDriver
|
||||
//purpose : Constructor
|
||||
//=======================================================================
|
||||
|
||||
BinMDataStd_TreeNodeDriver::BinMDataStd_TreeNodeDriver
|
||||
(const Handle(CDM_MessageDriver)& theMsgDriver)
|
||||
: BinMDF_ADriver (theMsgDriver, NULL)
|
||||
{}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewEmpty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(TDF_Attribute) BinMDataStd_TreeNodeDriver::NewEmpty() const
|
||||
{
|
||||
return (new TDataStd_TreeNode());
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean BinMDataStd_TreeNodeDriver::Paste
|
||||
(const BinObjMgt_Persistent& theSource,
|
||||
const Handle(TDF_Attribute)& theTarget,
|
||||
BinObjMgt_RRelocationTable& theRelocTable) const
|
||||
{
|
||||
Handle(TDataStd_TreeNode) aT = Handle(TDataStd_TreeNode)::DownCast(theTarget);
|
||||
|
||||
// read int fields
|
||||
Standard_Integer i, aNb;
|
||||
for (i = 0 ; i < 4; ++i)
|
||||
{
|
||||
if (! (theSource >> aNb))
|
||||
return Standard_False;
|
||||
if (aNb < 0) continue;
|
||||
|
||||
Handle(TDataStd_TreeNode) aNode;
|
||||
if (theRelocTable.IsBound(aNb))
|
||||
aNode = Handle(TDataStd_TreeNode)::DownCast(theRelocTable.Find(aNb));
|
||||
else
|
||||
{
|
||||
aNode = Handle(TDataStd_TreeNode)::DownCast( aT->NewEmpty() ); // already with tree ID
|
||||
theRelocTable.Bind(aNb, aNode);
|
||||
}
|
||||
switch (i) {
|
||||
case 0: aT->SetFather (aNode); break;
|
||||
case 1: aT->SetNext (aNode); break;
|
||||
case 2: aT->SetPrevious(aNode); break;
|
||||
case 3: aT->SetFirst (aNode); break;
|
||||
default: continue;
|
||||
}
|
||||
}
|
||||
|
||||
// tree id
|
||||
Standard_GUID aGUID;
|
||||
if (! (theSource >> aGUID))
|
||||
return Standard_False;
|
||||
aT->SetTreeID(aGUID);
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BinMDataStd_TreeNodeDriver::Paste
|
||||
(const Handle(TDF_Attribute)& theSource,
|
||||
BinObjMgt_Persistent& theTarget,
|
||||
BinObjMgt_SRelocationTable& theRelocTable) const
|
||||
{
|
||||
Handle(TDataStd_TreeNode) aS = Handle(TDataStd_TreeNode)::DownCast(theSource);
|
||||
|
||||
// first write int fields
|
||||
Standard_Integer i, aNb;
|
||||
for (i = 0 ; i < 4; ++i)
|
||||
{
|
||||
Handle(TDataStd_TreeNode) aNode;
|
||||
switch (i) {
|
||||
case 0: aNode = aS->Father(); break;
|
||||
case 1: aNode = aS->Next(); break;
|
||||
case 2: aNode = aS->Previous(); break;
|
||||
case 3: aNode = aS->First(); break;
|
||||
default: continue;
|
||||
}
|
||||
if (aNode.IsNull())
|
||||
aNb = -1;
|
||||
else
|
||||
aNb = theRelocTable.Add(aNode); // create and/or get index
|
||||
theTarget.PutInteger(aNb);
|
||||
}
|
||||
|
||||
// tree id
|
||||
theTarget << aS->ID();
|
||||
}
|
32
src/BinMDataStd/BinMDataStd_UAttributeDriver.cdl
Executable file
32
src/BinMDataStd/BinMDataStd_UAttributeDriver.cdl
Executable file
@@ -0,0 +1,32 @@
|
||||
-- File: BinMDataStd_UAttributeDriver.cdl
|
||||
-- Created: Fri Aug 24 20:16:51 2001
|
||||
-- Author: Alexander GRIGORIEV
|
||||
-- Copyright: Open Cascade 2001
|
||||
|
||||
class UAttributeDriver from BinMDataStd inherits ADriver from BinMDF
|
||||
|
||||
---Purpose: Attribute Driver.
|
||||
|
||||
uses
|
||||
SRelocationTable from BinObjMgt,
|
||||
RRelocationTable from BinObjMgt,
|
||||
Persistent from BinObjMgt,
|
||||
MessageDriver from CDM,
|
||||
Attribute from TDF
|
||||
|
||||
is
|
||||
Create (theMessageDriver:MessageDriver from CDM)
|
||||
returns mutable UAttributeDriver from BinMDataStd;
|
||||
|
||||
NewEmpty (me) returns mutable Attribute from TDF;
|
||||
|
||||
Paste(me; Source : Persistent from BinObjMgt;
|
||||
Target : mutable Attribute from TDF;
|
||||
RelocTable : out RRelocationTable from BinObjMgt)
|
||||
returns Boolean from Standard;
|
||||
|
||||
Paste(me; Source : Attribute from TDF;
|
||||
Target : in out Persistent from BinObjMgt;
|
||||
RelocTable : out SRelocationTable from BinObjMgt);
|
||||
|
||||
end UAttributeDriver;
|
58
src/BinMDataStd/BinMDataStd_UAttributeDriver.cxx
Executable file
58
src/BinMDataStd/BinMDataStd_UAttributeDriver.cxx
Executable file
@@ -0,0 +1,58 @@
|
||||
// File: BinMDataStd_UAttributeDriver.cxx
|
||||
// Created: Fri Aug 24 20:46:58 2001
|
||||
// Author: Alexnder GRIGORIEV
|
||||
// Copyright: Open Cascade 2001
|
||||
// History:
|
||||
|
||||
#include <BinMDataStd_UAttributeDriver.ixx>
|
||||
#include <TDataStd_UAttribute.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : BinMDataStd_UAttributeDriver
|
||||
//purpose : Constructor
|
||||
//=======================================================================
|
||||
|
||||
BinMDataStd_UAttributeDriver::BinMDataStd_UAttributeDriver
|
||||
(const Handle(CDM_MessageDriver)& theMsgDriver)
|
||||
: BinMDF_ADriver (theMsgDriver, NULL)
|
||||
{}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewEmpty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(TDF_Attribute) BinMDataStd_UAttributeDriver::NewEmpty() const
|
||||
{
|
||||
return (new TDataStd_UAttribute());
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean BinMDataStd_UAttributeDriver::Paste
|
||||
(const BinObjMgt_Persistent& theSource,
|
||||
const Handle(TDF_Attribute)& theTarget,
|
||||
BinObjMgt_RRelocationTable& ) const
|
||||
{
|
||||
Handle(TDataStd_UAttribute) anUAttr =
|
||||
Handle(TDataStd_UAttribute)::DownCast (theTarget);
|
||||
Standard_GUID aGUID;
|
||||
Standard_Boolean ok = theSource >> aGUID;
|
||||
if (ok)
|
||||
anUAttr -> SetID (aGUID);
|
||||
return ok;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BinMDataStd_UAttributeDriver::Paste(const Handle(TDF_Attribute)& theSource,
|
||||
BinObjMgt_Persistent& theTarget,
|
||||
BinObjMgt_SRelocationTable& ) const
|
||||
{
|
||||
Handle(TDataStd_UAttribute) anUAttr =
|
||||
Handle(TDataStd_UAttribute)::DownCast(theSource);
|
||||
theTarget << anUAttr->ID();
|
||||
}
|
32
src/BinMDataStd/BinMDataStd_VariableDriver.cdl
Executable file
32
src/BinMDataStd/BinMDataStd_VariableDriver.cdl
Executable file
@@ -0,0 +1,32 @@
|
||||
-- File: BinMDataStd_VariableDriver.cdl
|
||||
-- Created: Fri Aug 24 20:16:51 2001
|
||||
-- Author: Alexander GRIGORIEV
|
||||
-- Copyright: Open Cascade 2001
|
||||
|
||||
class VariableDriver from BinMDataStd inherits ADriver from BinMDF
|
||||
|
||||
---Purpose: Attribute Driver.
|
||||
|
||||
uses
|
||||
SRelocationTable from BinObjMgt,
|
||||
RRelocationTable from BinObjMgt,
|
||||
Persistent from BinObjMgt,
|
||||
MessageDriver from CDM,
|
||||
Attribute from TDF
|
||||
|
||||
is
|
||||
Create (theMessageDriver:MessageDriver from CDM)
|
||||
returns mutable VariableDriver from BinMDataStd;
|
||||
|
||||
NewEmpty (me) returns mutable Attribute from TDF;
|
||||
|
||||
Paste(me; Source : Persistent from BinObjMgt;
|
||||
Target : mutable Attribute from TDF;
|
||||
RelocTable : out RRelocationTable from BinObjMgt)
|
||||
returns Boolean from Standard;
|
||||
|
||||
Paste(me; Source : Attribute from TDF;
|
||||
Target : in out Persistent from BinObjMgt;
|
||||
RelocTable : out SRelocationTable from BinObjMgt);
|
||||
|
||||
end VariableDriver;
|
63
src/BinMDataStd/BinMDataStd_VariableDriver.cxx
Executable file
63
src/BinMDataStd/BinMDataStd_VariableDriver.cxx
Executable file
@@ -0,0 +1,63 @@
|
||||
// File: BinMDataStd_VariableDriver.cxx
|
||||
// Created: Fri Aug 24 20:46:58 2001
|
||||
// Author: Alexnder GRIGORIEV
|
||||
// Copyright: Open Cascade 2001
|
||||
// History:
|
||||
|
||||
#include <BinMDataStd_VariableDriver.ixx>
|
||||
#include <TDataStd_Variable.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : BinMDataStd_VariableDriver
|
||||
//purpose : Constructor
|
||||
//=======================================================================
|
||||
BinMDataStd_VariableDriver::BinMDataStd_VariableDriver
|
||||
(const Handle(CDM_MessageDriver)& theMsgDriver)
|
||||
: BinMDF_ADriver (theMsgDriver, NULL)
|
||||
{}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewEmpty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(TDF_Attribute) BinMDataStd_VariableDriver::NewEmpty() const
|
||||
{
|
||||
return (new TDataStd_Variable());
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean BinMDataStd_VariableDriver::Paste
|
||||
(const BinObjMgt_Persistent& theSource,
|
||||
const Handle(TDF_Attribute)& theTarget,
|
||||
BinObjMgt_RRelocationTable& ) const
|
||||
{
|
||||
Handle(TDataStd_Variable) aV = Handle(TDataStd_Variable)::DownCast(theTarget);
|
||||
|
||||
Standard_Boolean isConstant;
|
||||
if (! (theSource >> isConstant))
|
||||
return Standard_False;
|
||||
aV->Constant (isConstant);
|
||||
|
||||
TCollection_AsciiString anStr;
|
||||
if (! (theSource >> anStr))
|
||||
return Standard_False;
|
||||
aV->Unit(anStr);
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BinMDataStd_VariableDriver::Paste (const Handle(TDF_Attribute)& theSource,
|
||||
BinObjMgt_Persistent& theTarget,
|
||||
BinObjMgt_SRelocationTable& ) const
|
||||
{
|
||||
Handle(TDataStd_Variable) aV = Handle(TDataStd_Variable)::DownCast(theSource);
|
||||
theTarget << aV->IsConstant() << aV->Unit();
|
||||
}
|
Reference in New Issue
Block a user