mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-04 13:13:25 +03:00
Integration of OCCT 6.5.0 from SVN
This commit is contained in:
25
src/BinMFunction/BinMFunction.cdl
Executable file
25
src/BinMFunction/BinMFunction.cdl
Executable file
@@ -0,0 +1,25 @@
|
||||
-- File: BinMFunction.cdl
|
||||
-- Created: Thu May 13 14:40:40 2004
|
||||
-- Author: Sergey ZARITCHNY <szy@opencascade.com>
|
||||
-- Copyright: Open CasCade S.A. 2004
|
||||
|
||||
package BinMFunction
|
||||
|
||||
---Purpose: Storage and Retrieval drivers for TFunction modelling attributes.
|
||||
|
||||
uses BinMDF,
|
||||
BinObjMgt,
|
||||
TDF,
|
||||
TFunction,
|
||||
CDM
|
||||
|
||||
is
|
||||
class FunctionDriver;
|
||||
class GraphNodeDriver;
|
||||
class ScopeDriver;
|
||||
|
||||
AddDrivers (theDriverTable : ADriverTable from BinMDF;
|
||||
aMsgDrv : MessageDriver from CDM);
|
||||
---Purpose: Adds the attribute drivers to <theDriverTable>.
|
||||
|
||||
end BinMFunction;
|
24
src/BinMFunction/BinMFunction.cxx
Executable file
24
src/BinMFunction/BinMFunction.cxx
Executable file
@@ -0,0 +1,24 @@
|
||||
// File: BinMFunction.cxx
|
||||
// Created: Thu May 13 15:16:24 2004
|
||||
// Author: Sergey ZARITCHNY <szy@opencascade.com>
|
||||
// Copyright: Open CasCade S.A. 2004
|
||||
|
||||
#include <BinMFunction.ixx>
|
||||
#include <BinMDF_ADriverTable.hxx>
|
||||
#include <CDM_MessageDriver.hxx>
|
||||
#include <BinMFunction_FunctionDriver.hxx>
|
||||
#include <BinMFunction_GraphNodeDriver.hxx>
|
||||
#include <BinMFunction_ScopeDriver.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : AddDrivers
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BinMFunction::AddDrivers (const Handle(BinMDF_ADriverTable)& theDriverTable,
|
||||
const Handle(CDM_MessageDriver)& theMsgDriver)
|
||||
{
|
||||
theDriverTable->AddDriver (new BinMFunction_FunctionDriver (theMsgDriver) );
|
||||
theDriverTable->AddDriver (new BinMFunction_GraphNodeDriver (theMsgDriver) );
|
||||
theDriverTable->AddDriver (new BinMFunction_ScopeDriver (theMsgDriver) );
|
||||
}
|
35
src/BinMFunction/BinMFunction_FunctionDriver.cdl
Executable file
35
src/BinMFunction/BinMFunction_FunctionDriver.cdl
Executable file
@@ -0,0 +1,35 @@
|
||||
-- File: BinMFunction_FunctionDriver.cdl
|
||||
-- Created: Thu May 13 14:43:39 2004
|
||||
-- Author: Sergey ZARITCHNY <szy@opencascade.com>
|
||||
-- Copyright: Open CasCade S.A. 2004
|
||||
|
||||
class FunctionDriver from BinMFunction inherits ADriver from BinMDF
|
||||
|
||||
---Purpose: Function 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 FunctionDriver from BinMFunction;
|
||||
|
||||
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 FunctionDriver;
|
||||
|
73
src/BinMFunction/BinMFunction_FunctionDriver.cxx
Executable file
73
src/BinMFunction/BinMFunction_FunctionDriver.cxx
Executable file
@@ -0,0 +1,73 @@
|
||||
// File: BinMFunction_FunctionDriver.cxx
|
||||
// Created: Thu May 13 14:46:12 2004
|
||||
// Author: Sergey ZARITCHNY <szy@opencascade.com>
|
||||
// Copyright: Open CasCade S.A. 2004
|
||||
|
||||
|
||||
#include <BinMFunction_FunctionDriver.ixx>
|
||||
#include <CDM_MessageDriver.hxx>
|
||||
#include <TDF_Attribute.hxx>
|
||||
#include <TFunction_Function.hxx>
|
||||
#include <BinMDF_ADriver.hxx>
|
||||
#include <BinObjMgt_Persistent.hxx>
|
||||
#include <BinObjMgt_RRelocationTable.hxx>
|
||||
#include <BinObjMgt_SRelocationTable.hxx>
|
||||
//=======================================================================
|
||||
//function : BinMFunction_FunctionDriver
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
BinMFunction_FunctionDriver::BinMFunction_FunctionDriver
|
||||
(const Handle(CDM_MessageDriver)& theMsgDriver)
|
||||
: BinMDF_ADriver (theMsgDriver, STANDARD_TYPE(TFunction_Function)->Name())
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewEmpty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TDF_Attribute) BinMFunction_FunctionDriver::NewEmpty() const
|
||||
{
|
||||
return new TFunction_Function();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose : persistent -> transient (retrieve)
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BinMFunction_FunctionDriver::Paste
|
||||
(const BinObjMgt_Persistent& theSource,
|
||||
const Handle(TDF_Attribute)& theTarget,
|
||||
BinObjMgt_RRelocationTable& ) const
|
||||
{
|
||||
|
||||
Handle(TFunction_Function) anAtt = Handle(TFunction_Function)::DownCast(theTarget);
|
||||
Standard_GUID aGUID("00000000-0000-0000-0000-000000000000");
|
||||
Standard_Boolean ok = theSource >> aGUID;
|
||||
if (ok) {
|
||||
anAtt->SetDriverGUID(aGUID);
|
||||
Standard_Integer aValue;
|
||||
ok = theSource >> aValue;
|
||||
if(ok)
|
||||
anAtt->SetFailure(aValue);
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose : transient -> persistent (store)
|
||||
//=======================================================================
|
||||
|
||||
void BinMFunction_FunctionDriver::Paste (const Handle(TDF_Attribute)& theSource,
|
||||
BinObjMgt_Persistent& theTarget,
|
||||
BinObjMgt_SRelocationTable& ) const
|
||||
{
|
||||
Handle(TFunction_Function) aS = Handle(TFunction_Function)::DownCast (theSource);
|
||||
theTarget << aS->GetDriverGUID();
|
||||
theTarget << aS->GetFailure();
|
||||
}
|
||||
|
37
src/BinMFunction/BinMFunction_GraphNodeDriver.cdl
Executable file
37
src/BinMFunction/BinMFunction_GraphNodeDriver.cdl
Executable file
@@ -0,0 +1,37 @@
|
||||
-- File: BinMFunction_GraphNodeDriver.cdl
|
||||
-- Created: Thu May 11 14:45:49 2008
|
||||
-- Author: Vlad ROMASHKO <vladislav.romashko@opencascade.com>
|
||||
-- Copyright: Open CasCade S.A. 2008
|
||||
|
||||
class GraphNodeDriver from BinMFunction inherits ADriver from BinMDF
|
||||
|
||||
---Purpose: GraphNode 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 GraphNodeDriver from BinMFunction;
|
||||
|
||||
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 GraphNodeDriver;
|
129
src/BinMFunction/BinMFunction_GraphNodeDriver.cxx
Executable file
129
src/BinMFunction/BinMFunction_GraphNodeDriver.cxx
Executable file
@@ -0,0 +1,129 @@
|
||||
// File: BinMFunction_GraphNodeDriver.cxx
|
||||
// Created: Thu May 11 11:26:02 2008
|
||||
// Author: Vlad Romashko <vladislav.romashko@opencascade.com>
|
||||
// Copyright: Open CasCade S.A. 2008
|
||||
|
||||
|
||||
#include <BinMFunction_GraphNodeDriver.ixx>
|
||||
#include <CDM_MessageDriver.hxx>
|
||||
#include <TDF_Attribute.hxx>
|
||||
#include <TFunction_GraphNode.hxx>
|
||||
#include <BinMDF_ADriver.hxx>
|
||||
#include <BinObjMgt_Persistent.hxx>
|
||||
#include <BinObjMgt_RRelocationTable.hxx>
|
||||
#include <BinObjMgt_SRelocationTable.hxx>
|
||||
#include <TColStd_Array1OfInteger.hxx>
|
||||
#include <TColStd_MapIteratorOfMapOfInteger.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : BinMFunction_GraphNodeDriver
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
BinMFunction_GraphNodeDriver::BinMFunction_GraphNodeDriver(const Handle(CDM_MessageDriver)& theMsgDriver)
|
||||
: BinMDF_ADriver (theMsgDriver, STANDARD_TYPE(TFunction_GraphNode)->Name())
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewEmpty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TDF_Attribute) BinMFunction_GraphNodeDriver::NewEmpty() const
|
||||
{
|
||||
return new TFunction_GraphNode();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose : persistent -> transient (retrieve)
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BinMFunction_GraphNodeDriver::Paste(const BinObjMgt_Persistent& theSource,
|
||||
const Handle(TDF_Attribute)& theTarget,
|
||||
BinObjMgt_RRelocationTable& ) const
|
||||
{
|
||||
Handle(TFunction_GraphNode) GN = Handle(TFunction_GraphNode)::DownCast(theTarget);
|
||||
|
||||
Standard_Integer intStatus, nb_previous, nb_next;
|
||||
if (! (theSource >> intStatus >> nb_previous >> nb_next))
|
||||
return Standard_False;
|
||||
|
||||
// Execution status
|
||||
GN->SetStatus((TFunction_ExecutionStatus) intStatus);
|
||||
|
||||
// Previous functions
|
||||
if (nb_previous)
|
||||
{
|
||||
TColStd_Array1OfInteger aTargetArray(1, nb_previous);
|
||||
theSource.GetIntArray (&aTargetArray(1), nb_previous);
|
||||
|
||||
for (Standard_Integer i = 1; i <= nb_previous; i++)
|
||||
{
|
||||
GN->AddPrevious(aTargetArray.Value(i));
|
||||
}
|
||||
}
|
||||
|
||||
// Next functions
|
||||
if (nb_next)
|
||||
{
|
||||
TColStd_Array1OfInteger aTargetArray(1, nb_next);
|
||||
theSource.GetIntArray (&aTargetArray(1), nb_next);
|
||||
|
||||
for (Standard_Integer i = 1; i <= nb_next; i++)
|
||||
{
|
||||
GN->AddNext(aTargetArray.Value(i));
|
||||
}
|
||||
}
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose : transient -> persistent (store)
|
||||
//=======================================================================
|
||||
|
||||
void BinMFunction_GraphNodeDriver::Paste (const Handle(TDF_Attribute)& theSource,
|
||||
BinObjMgt_Persistent& theTarget,
|
||||
BinObjMgt_SRelocationTable& ) const
|
||||
{
|
||||
Handle(TFunction_GraphNode) GN = Handle(TFunction_GraphNode)::DownCast(theSource);
|
||||
|
||||
// Execution status
|
||||
theTarget << (Standard_Integer) GN->GetStatus();
|
||||
// Number of previous functions
|
||||
theTarget << GN->GetPrevious().Extent();
|
||||
// Number of next functions
|
||||
theTarget << GN->GetNext().Extent();
|
||||
|
||||
// Previous functions
|
||||
Standard_Integer nb = GN->GetPrevious().Extent();
|
||||
if (nb)
|
||||
{
|
||||
TColStd_Array1OfInteger aSourceArray(1, nb);
|
||||
TColStd_MapIteratorOfMapOfInteger itr(GN->GetPrevious());
|
||||
for (Standard_Integer i = 1; itr.More(); itr.Next(), i++)
|
||||
{
|
||||
aSourceArray.SetValue(i, itr.Key());
|
||||
}
|
||||
Standard_Integer *aPtr = (Standard_Integer *) &aSourceArray(1);
|
||||
theTarget.PutIntArray(aPtr, nb);
|
||||
}
|
||||
|
||||
// Next functions
|
||||
nb = GN->GetNext().Extent();
|
||||
if (nb)
|
||||
{
|
||||
TColStd_Array1OfInteger aSourceArray(1, nb);
|
||||
TColStd_MapIteratorOfMapOfInteger itr(GN->GetNext());
|
||||
for (Standard_Integer i = 1; itr.More(); itr.Next(), i++)
|
||||
{
|
||||
aSourceArray.SetValue(i, itr.Key());
|
||||
}
|
||||
Standard_Integer *aPtr = (Standard_Integer *) &aSourceArray(1);
|
||||
theTarget.PutIntArray(aPtr, nb);
|
||||
}
|
||||
}
|
||||
|
37
src/BinMFunction/BinMFunction_ScopeDriver.cdl
Executable file
37
src/BinMFunction/BinMFunction_ScopeDriver.cdl
Executable file
@@ -0,0 +1,37 @@
|
||||
-- File: BinMFunction_ScopeDriver.cdl
|
||||
-- Created: Thu May 11 16:35:12 2008
|
||||
-- Author: Vlad ROMASHKO <vladislav.romashko@opencascade.com>
|
||||
-- Copyright: Open CasCade S.A. 2008
|
||||
|
||||
class ScopeDriver from BinMFunction inherits ADriver from BinMDF
|
||||
|
||||
---Purpose: Scope 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 ScopeDriver from BinMFunction;
|
||||
|
||||
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 ScopeDriver;
|
132
src/BinMFunction/BinMFunction_ScopeDriver.cxx
Executable file
132
src/BinMFunction/BinMFunction_ScopeDriver.cxx
Executable file
@@ -0,0 +1,132 @@
|
||||
// File: BinMFunction_ScopeDriver.cxx
|
||||
// Created: Thu May 11 11:26:02 2008
|
||||
// Author: Vlad Romashko <vladislav.romashko@opencascade.com>
|
||||
// Copyright: Open CasCade S.A. 2008
|
||||
|
||||
|
||||
#include <BinMFunction_ScopeDriver.ixx>
|
||||
#include <CDM_MessageDriver.hxx>
|
||||
#include <TDF_Attribute.hxx>
|
||||
#include <TFunction_Scope.hxx>
|
||||
#include <BinMDF_ADriver.hxx>
|
||||
#include <BinObjMgt_Persistent.hxx>
|
||||
#include <BinObjMgt_RRelocationTable.hxx>
|
||||
#include <BinObjMgt_SRelocationTable.hxx>
|
||||
#include <TColStd_Array1OfInteger.hxx>
|
||||
#include <TFunction_DoubleMapIteratorOfDoubleMapOfIntegerLabel.hxx>
|
||||
#include <TDF_Label.hxx>
|
||||
#include <TDF_Tool.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : BinMFunction_GraphNodeDriver
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
BinMFunction_ScopeDriver::BinMFunction_ScopeDriver(const Handle(CDM_MessageDriver)& theMsgDriver)
|
||||
: BinMDF_ADriver (theMsgDriver, STANDARD_TYPE(TFunction_Scope)->Name())
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewEmpty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TDF_Attribute) BinMFunction_ScopeDriver::NewEmpty() const
|
||||
{
|
||||
return new TFunction_Scope();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose : persistent -> transient (retrieve)
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BinMFunction_ScopeDriver::Paste(const BinObjMgt_Persistent& theSource,
|
||||
const Handle(TDF_Attribute)& theTarget,
|
||||
BinObjMgt_RRelocationTable& ) const
|
||||
{
|
||||
Handle(TFunction_Scope) S = Handle(TFunction_Scope)::DownCast(theTarget);
|
||||
|
||||
Standard_Integer nb;
|
||||
if ( !(theSource >> nb) )
|
||||
return Standard_False;
|
||||
if (!nb)
|
||||
return Standard_True;
|
||||
|
||||
TFunction_DoubleMapOfIntegerLabel& map = S->ChangeFunctions();
|
||||
|
||||
// IDs
|
||||
TColStd_Array1OfInteger IDs(1, nb);
|
||||
theSource.GetIntArray (&IDs(1), nb);
|
||||
|
||||
// Labels
|
||||
Standard_Integer freeID = 0;
|
||||
for (Standard_Integer i = 1; i <= nb; i++)
|
||||
{
|
||||
TCollection_AsciiString entry;
|
||||
if ( !(theSource >> entry) )
|
||||
return Standard_False;
|
||||
TDF_Label L;
|
||||
TDF_Tool::Label(S->Label().Data(), entry, L, Standard_True);
|
||||
if (!L.IsNull())
|
||||
{
|
||||
map.Bind(IDs.Value(i), L);
|
||||
if (IDs.Value(i) > freeID)
|
||||
freeID = IDs.Value(i);
|
||||
}
|
||||
}
|
||||
|
||||
// Free ID
|
||||
freeID++;
|
||||
S->SetFreeID(freeID);
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose : transient -> persistent (store)
|
||||
//=======================================================================
|
||||
|
||||
void BinMFunction_ScopeDriver::Paste (const Handle(TDF_Attribute)& theSource,
|
||||
BinObjMgt_Persistent& theTarget,
|
||||
BinObjMgt_SRelocationTable& ) const
|
||||
{
|
||||
Handle(TFunction_Scope) S = Handle(TFunction_Scope)::DownCast(theSource);
|
||||
const TFunction_DoubleMapOfIntegerLabel& map = S->GetFunctions();
|
||||
const Standard_Integer nb = map.Extent();
|
||||
|
||||
// Number of functions
|
||||
theTarget << nb;
|
||||
if (!nb)
|
||||
return;
|
||||
|
||||
// IDs
|
||||
{
|
||||
TColStd_Array1OfInteger aSourceArray(1, nb);
|
||||
TFunction_DoubleMapIteratorOfDoubleMapOfIntegerLabel itr(map);
|
||||
for (Standard_Integer i = 1; itr.More(); itr.Next(), i++)
|
||||
{
|
||||
aSourceArray.SetValue(i, itr.Key1());
|
||||
}
|
||||
Standard_Integer *aPtr = (Standard_Integer *) &aSourceArray(1);
|
||||
theTarget.PutIntArray(aPtr, nb);
|
||||
}
|
||||
|
||||
// Labels
|
||||
{
|
||||
TFunction_DoubleMapIteratorOfDoubleMapOfIntegerLabel itr(map);
|
||||
for (; itr.More(); itr.Next())
|
||||
{
|
||||
TDF_Label L = itr.Key2();
|
||||
if (!L.IsNull())
|
||||
{
|
||||
TCollection_AsciiString entry;
|
||||
TDF_Tool::Entry(L, entry);
|
||||
theTarget << entry;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user