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

0027970: Improvement of standard attributes usability - containers.

This commit is contained in:
szy
2017-05-11 17:37:44 +03:00
committed by bugmaster
parent b18a83d4a7
commit 5a1271c8b4
111 changed files with 6038 additions and 1223 deletions

View File

@@ -16,11 +16,13 @@
#ifndef _BinMDataStd_HeaderFile
#define _BinMDataStd_HeaderFile
#include <Standard.hxx>
#include <Standard_GUID.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <Standard_Integer.hxx>
#include <BinObjMgt_Persistent.hxx>
class BinMDF_ADriverTable;
class CDM_MessageDriver;
class BinMDataStd_NameDriver;
@@ -50,7 +52,6 @@ class BinMDataStd_ReferenceArrayDriver;
class BinMDataStd_ByteArrayDriver;
class BinMDataStd_NamedDataDriver;
//! Storage and Retrieval drivers for modelling attributes.
class BinMDataStd
{
@@ -66,7 +67,24 @@ public:
Standard_EXPORT static Standard_Integer DocumentVersion();
template<class T>
static void SetAttributeID(const BinObjMgt_Persistent& theSource, const Handle(T)& anAtt)
{
Standard_Boolean ok = Standard_True;
if(BinMDataStd::DocumentVersion() > 9) { // process user defined guid
const Standard_Integer& aPos = theSource.Position();
Standard_GUID aGuid;
ok = theSource >> aGuid;
if (!ok) {
theSource.SetPosition(aPos);
anAtt->SetID(T::GetID());
ok = Standard_True;
} else {
anAtt->SetID(aGuid);
}
} else
anAtt->SetID(T::GetID());
}
protected:

View File

@@ -15,6 +15,7 @@
#include <BinMDataStd_BooleanArrayDriver.hxx>
#include <BinMDataStd.hxx>
#include <BinObjMgt_Persistent.hxx>
#include <CDM_MessageDriver.hxx>
#include <Standard_Type.hxx>
@@ -49,8 +50,8 @@ Handle(TDF_Attribute) BinMDataStd_BooleanArrayDriver::NewEmpty() const
//purpose : persistent -> transient (retrieve)
//=======================================================================
Standard_Boolean BinMDataStd_BooleanArrayDriver::Paste(const BinObjMgt_Persistent& theSource,
const Handle(TDF_Attribute)& theTarget,
BinObjMgt_RRelocationTable& ) const
const Handle(TDF_Attribute)& theTarget,
BinObjMgt_RRelocationTable& ) const
{
Standard_Integer aFirstInd, aLastInd;
if (! (theSource >> aFirstInd >> aLastInd))
@@ -61,7 +62,7 @@ Standard_Boolean BinMDataStd_BooleanArrayDriver::Paste(const BinObjMgt_Persisten
TColStd_Array1OfByte aTargetArray(0, (aLastInd - aFirstInd + 1) >> 3);
theSource.GetByteArray (&aTargetArray(0), aTargetArray.Length());
Handle(TDataStd_BooleanArray) anAtt = Handle(TDataStd_BooleanArray)::DownCast(theTarget);
const 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();
@@ -70,6 +71,7 @@ Standard_Boolean BinMDataStd_BooleanArrayDriver::Paste(const BinObjMgt_Persisten
bytes->SetValue(i, aTargetArray.Value(i));
}
anAtt->SetInternalArray(bytes);
BinMDataStd::SetAttributeID(theSource, anAtt);
return Standard_True;
}
@@ -78,8 +80,8 @@ Standard_Boolean BinMDataStd_BooleanArrayDriver::Paste(const BinObjMgt_Persisten
//purpose : transient -> persistent (store)
//=======================================================================
void BinMDataStd_BooleanArrayDriver::Paste(const Handle(TDF_Attribute)& theSource,
BinObjMgt_Persistent& theTarget,
BinObjMgt_SRelocationTable& ) const
BinObjMgt_Persistent& theTarget,
BinObjMgt_SRelocationTable& ) const
{
Handle(TDataStd_BooleanArray) anAtt = Handle(TDataStd_BooleanArray)::DownCast(theSource);
const Standard_Integer aFirstInd = anAtt->Lower();
@@ -97,4 +99,8 @@ void BinMDataStd_BooleanArrayDriver::Paste(const Handle(TDF_Attribute)& theSourc
}
Standard_Byte *aPtr = (Standard_Byte *) &aSourceArray(lower);
theTarget.PutByteArray(aPtr, upper - lower + 1);
// process user defined guid
if(anAtt->ID() != TDataStd_BooleanArray::GetID())
theTarget << anAtt->ID();
}

View File

@@ -15,6 +15,7 @@
#include <BinMDataStd_BooleanListDriver.hxx>
#include <BinMDataStd.hxx>
#include <BinObjMgt_Persistent.hxx>
#include <CDM_MessageDriver.hxx>
#include <Standard_Type.hxx>
@@ -49,25 +50,28 @@ Handle(TDF_Attribute) BinMDataStd_BooleanListDriver::NewEmpty() const
//purpose : persistent -> transient (retrieve)
//=======================================================================
Standard_Boolean BinMDataStd_BooleanListDriver::Paste(const BinObjMgt_Persistent& theSource,
const Handle(TDF_Attribute)& theTarget,
BinObjMgt_RRelocationTable& ) const
const Handle(TDF_Attribute)& theTarget,
BinObjMgt_RRelocationTable& ) const
{
Standard_Integer aIndex, aFirstInd, aLastInd;
if (! (theSource >> aFirstInd >> aLastInd))
return Standard_False;
if(aLastInd == 0) return Standard_True;
const Standard_Integer aLength = aLastInd - aFirstInd + 1;
if (aLength <= 0)
return Standard_False;
TColStd_Array1OfByte aTargetArray(aFirstInd, aLastInd);
theSource.GetByteArray (&aTargetArray(aFirstInd), aLength);
const Handle(TDataStd_BooleanList) anAtt = Handle(TDataStd_BooleanList)::DownCast(theTarget);
for (aIndex = aFirstInd; aIndex <= aLastInd; aIndex++)
{
anAtt->Append(aTargetArray.Value(aIndex) ? Standard_True : Standard_False);
if(aLastInd > 0) {
const Standard_Integer aLength = aLastInd - aFirstInd + 1;
if (aLength > 0) {
TColStd_Array1OfByte aTargetArray(aFirstInd, aLastInd);
theSource.GetByteArray (&aTargetArray(aFirstInd), aLength);
for (aIndex = aFirstInd; aIndex <= aLastInd; aIndex++)
{
anAtt->Append(aTargetArray.Value(aIndex) ? Standard_True : Standard_False);
}
}
}
BinMDataStd::SetAttributeID(theSource, anAtt);
return Standard_True;
}
@@ -93,4 +97,8 @@ void BinMDataStd_BooleanListDriver::Paste(const Handle(TDF_Attribute)& theSource
}
Standard_Byte *aPtr = (Standard_Byte *) &aSourceArray(aFirstInd);
theTarget.PutByteArray(aPtr, aLength);
}
// process user defined guid
if(anAtt->ID() != TDataStd_BooleanList::GetID())
theTarget << anAtt->ID();
}

View File

@@ -50,8 +50,8 @@ Handle(TDF_Attribute) BinMDataStd_ByteArrayDriver::NewEmpty() const
//purpose : persistent -> transient (retrieve)
//=======================================================================
Standard_Boolean BinMDataStd_ByteArrayDriver::Paste(const BinObjMgt_Persistent& theSource,
const Handle(TDF_Attribute)& theTarget,
BinObjMgt_RRelocationTable& ) const
const Handle(TDF_Attribute)& theTarget,
BinObjMgt_RRelocationTable& ) const
{
Standard_Integer aFirstInd, aLastInd;
if (! (theSource >> aFirstInd >> aLastInd))
@@ -62,7 +62,7 @@ Standard_Boolean BinMDataStd_ByteArrayDriver::Paste(const BinObjMgt_Persistent&
TColStd_Array1OfByte aTargetArray(aFirstInd, aLastInd);
theSource.GetByteArray (&aTargetArray(aFirstInd), aTargetArray.Length());
Handle(TDataStd_ByteArray) anAtt = Handle(TDataStd_ByteArray)::DownCast(theTarget);
const 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++)
{
@@ -79,6 +79,8 @@ Standard_Boolean BinMDataStd_ByteArrayDriver::Paste(const BinObjMgt_Persistent&
aDelta = (aDeltaValue != 0);
}
anAtt->SetDelta(aDelta);
BinMDataStd::SetAttributeID(theSource, anAtt);
return Standard_True;
}
@@ -87,8 +89,8 @@ Standard_Boolean BinMDataStd_ByteArrayDriver::Paste(const BinObjMgt_Persistent&
//purpose : transient -> persistent (store)
//=======================================================================
void BinMDataStd_ByteArrayDriver::Paste(const Handle(TDF_Attribute)& theSource,
BinObjMgt_Persistent& theTarget,
BinObjMgt_SRelocationTable& ) const
BinObjMgt_Persistent& theTarget,
BinObjMgt_SRelocationTable& ) const
{
Handle(TDataStd_ByteArray) anAtt = Handle(TDataStd_ByteArray)::DownCast(theSource);
const Standard_Integer aFirstInd = anAtt->Lower();
@@ -107,4 +109,8 @@ void BinMDataStd_ByteArrayDriver::Paste(const Handle(TDF_Attribute)& theSource,
Standard_Byte *aPtr = (Standard_Byte *) &aSourceArray(lower);
theTarget.PutByteArray(aPtr, bytes->Length());
theTarget << (Standard_Byte)(anAtt->GetDelta() ? 1 : 0);
// process user defined guid
if(anAtt->ID() != TDataStd_ByteArray::GetID())
theTarget << anAtt->ID();
}

View File

@@ -83,14 +83,16 @@ Standard_Boolean BinMDataStd_ExtStringArrayDriver::Paste
Standard_Boolean aDelta(Standard_False);
if(BinMDataStd::DocumentVersion() > 2) {
Standard_Byte aDeltaValue;
if (! (theSource >> aDeltaValue)) {
return Standard_False;
}
if (! (theSource >> aDeltaValue)) {
return Standard_False;
}
else
aDelta = (aDeltaValue != 0);
}
aDelta = (aDeltaValue != 0);
}
anAtt->SetDelta(aDelta);
}
BinMDataStd::SetAttributeID(theSource, anAtt);
return ok;
}
@@ -104,7 +106,7 @@ void BinMDataStd_ExtStringArrayDriver::Paste
BinObjMgt_Persistent& theTarget,
BinObjMgt_SRelocationTable& ) const
{
Handle(TDataStd_ExtStringArray) anAtt =
const Handle(TDataStd_ExtStringArray) anAtt =
Handle(TDataStd_ExtStringArray)::DownCast(theSource);
const TColStd_Array1OfExtendedString& aSourceArray = anAtt->Array()->Array1();
const Standard_Integer aFirstInd = aSourceArray.Lower();
@@ -114,4 +116,8 @@ void BinMDataStd_ExtStringArrayDriver::Paste
theTarget << anAtt->Value( i );
theTarget << (Standard_Byte)(anAtt->GetDelta() ? 1 : 0);
// process user defined guid
if(anAtt->ID() != TDataStd_ExtStringArray::GetID())
theTarget << anAtt->ID();
}

View File

@@ -15,6 +15,7 @@
#include <BinMDataStd_ExtStringListDriver.hxx>
#include <BinMDataStd.hxx>
#include <BinObjMgt_Persistent.hxx>
#include <CDM_MessageDriver.hxx>
#include <Standard_Type.hxx>
@@ -56,22 +57,24 @@ Standard_Boolean BinMDataStd_ExtStringListDriver::Paste
Standard_Integer aFirstInd, aLastInd;
if (! (theSource >> aFirstInd >> aLastInd))
return Standard_False;
if(aLastInd == 0) return Standard_True;
const Standard_Integer aLength = aLastInd - aFirstInd + 1;
if (aLength <= 0)
return Standard_False;
const Handle(TDataStd_ExtStringList) anAtt =
Handle(TDataStd_ExtStringList)::DownCast(theTarget);
for (Standard_Integer i = aFirstInd; i <= aLastInd; i ++)
{
TCollection_ExtendedString aStr;
if ( !(theSource >> aStr) )
{
const Handle(TDataStd_ExtStringList) anAtt = Handle(TDataStd_ExtStringList)::DownCast(theTarget);
if(aLastInd > 0) {
const Standard_Integer aLength = aLastInd - aFirstInd + 1;
if (aLength <= 0)
return Standard_False;
for (Standard_Integer i = aFirstInd; i <= aLastInd; i ++)
{
TCollection_ExtendedString aStr;
if ( !(theSource >> aStr) )
{
return Standard_False;
}
anAtt->Append(aStr);
}
anAtt->Append(aStr);
}
BinMDataStd::SetAttributeID(theSource, anAtt);
return Standard_True;
}
@@ -94,4 +97,8 @@ void BinMDataStd_ExtStringListDriver::Paste
{
theTarget << itr.Value();
}
// process user defined guid
if(anAtt->ID() != TDataStd_ExtStringList::GetID())
theTarget << anAtt->ID();
}

View File

@@ -62,7 +62,7 @@ Standard_Boolean BinMDataStd_IntegerArrayDriver::Paste
if (aLength <= 0)
return Standard_False;
Handle(TDataStd_IntegerArray) anAtt =
const Handle(TDataStd_IntegerArray) anAtt =
Handle(TDataStd_IntegerArray)::DownCast(theTarget);
anAtt->Init(aFirstInd, aLastInd);
TColStd_Array1OfInteger& aTargetArray = anAtt->Array()->ChangeArray1();
@@ -81,6 +81,8 @@ Standard_Boolean BinMDataStd_IntegerArrayDriver::Paste
cout << "Current DocVersion field is not initialized. " <<endl;
#endif
anAtt->SetDelta(aDelta);
BinMDataStd::SetAttributeID(theSource, anAtt);
return Standard_True;
}
@@ -104,4 +106,8 @@ void BinMDataStd_IntegerArrayDriver::Paste
Standard_Integer *aPtr = (Standard_Integer *) &aSourceArray(aFirstInd);
theTarget.PutIntArray (aPtr, aLength);
theTarget << (Standard_Byte)(anAtt->GetDelta() ? 1 : 0);
// process user defined guid
if(anAtt->ID() != TDataStd_IntegerArray::GetID())
theTarget << anAtt->ID();
}

View File

@@ -15,6 +15,7 @@
#include <BinMDataStd_IntegerListDriver.hxx>
#include <BinMDataStd.hxx>
#include <BinObjMgt_Persistent.hxx>
#include <CDM_MessageDriver.hxx>
#include <Standard_Type.hxx>
@@ -49,26 +50,24 @@ Handle(TDF_Attribute) BinMDataStd_IntegerListDriver::NewEmpty() const
//purpose : persistent -> transient (retrieve)
//=======================================================================
Standard_Boolean BinMDataStd_IntegerListDriver::Paste(const BinObjMgt_Persistent& theSource,
const Handle(TDF_Attribute)& theTarget,
BinObjMgt_RRelocationTable& ) const
const Handle(TDF_Attribute)& theTarget,
BinObjMgt_RRelocationTable& ) const
{
Standard_Integer aIndex, aFirstInd, aLastInd;
if (! (theSource >> aFirstInd >> aLastInd))
return Standard_False;
if(aLastInd == 0) return Standard_True;
const Standard_Integer aLength = aLastInd - aFirstInd + 1;
if (aLength <= 0)
return Standard_False;
TColStd_Array1OfInteger aTargetArray(aFirstInd, aLastInd);
theSource.GetIntArray (&aTargetArray(aFirstInd), aLength);
const Handle(TDataStd_IntegerList) anAtt = Handle(TDataStd_IntegerList)::DownCast(theTarget);
for (aIndex = aFirstInd; aIndex <= aLastInd; aIndex++)
{
anAtt->Append(aTargetArray.Value(aIndex));
if(aLastInd > 0) {
const Standard_Integer aLength = aLastInd - aFirstInd + 1;
if (aLength > 0) {
TColStd_Array1OfInteger aTargetArray(aFirstInd, aLastInd);
theSource.GetIntArray (&aTargetArray(aFirstInd), aLength);
for (aIndex = aFirstInd; aIndex <= aLastInd; aIndex++)
anAtt->Append(aTargetArray.Value(aIndex));
}
}
BinMDataStd::SetAttributeID(theSource, anAtt);
return Standard_True;
}
@@ -99,4 +98,8 @@ void BinMDataStd_IntegerListDriver::Paste(const Handle(TDF_Attribute)& theSource
Standard_Integer *aPtr = (Standard_Integer *) &aSourceArray(aFirstInd);
theTarget.PutIntArray(aPtr, aLength);
}
// process user defined guid
if(anAtt->ID() != TDataStd_IntegerList::GetID())
theTarget << anAtt->ID();
}

View File

@@ -62,7 +62,7 @@ Standard_Boolean BinMDataStd_RealArrayDriver::Paste
if (aLength <= 0)
return Standard_False;
Handle(TDataStd_RealArray) anAtt =
const Handle(TDataStd_RealArray) anAtt =
Handle(TDataStd_RealArray)::DownCast(theTarget);
anAtt->Init(aFirstInd, aLastInd);
TColStd_Array1OfReal& aTargetArray = anAtt->Array()->ChangeArray1();
@@ -78,6 +78,8 @@ Standard_Boolean BinMDataStd_RealArrayDriver::Paste
aDelta = (aDeltaValue != 0);
}
anAtt->SetDelta(aDelta);
BinMDataStd::SetAttributeID(theSource, anAtt);
return Standard_True;
}
@@ -101,4 +103,7 @@ void BinMDataStd_RealArrayDriver::Paste
Standard_Real *aPtr = (Standard_Real *) &aSourceArray(aFirstInd);
theTarget.PutRealArray (aPtr, aLength);
theTarget << (Standard_Byte)(anAtt->GetDelta() ? 1 : 0);
// process user defined guid
if(anAtt->ID() != TDataStd_RealArray::GetID())
theTarget << anAtt->ID();
}

View File

@@ -15,6 +15,7 @@
#include <BinMDataStd_RealListDriver.hxx>
#include <BinMDataStd.hxx>
#include <BinObjMgt_Persistent.hxx>
#include <CDM_MessageDriver.hxx>
#include <Standard_Type.hxx>
@@ -49,26 +50,25 @@ Handle(TDF_Attribute) BinMDataStd_RealListDriver::NewEmpty() const
//purpose : persistent -> transient (retrieve)
//=======================================================================
Standard_Boolean BinMDataStd_RealListDriver::Paste(const BinObjMgt_Persistent& theSource,
const Handle(TDF_Attribute)& theTarget,
BinObjMgt_RRelocationTable& ) const
const Handle(TDF_Attribute)& theTarget,
BinObjMgt_RRelocationTable& ) const
{
Standard_Integer aIndex, aFirstInd, aLastInd;
if (! (theSource >> aFirstInd >> aLastInd))
return Standard_False;
if(aLastInd == 0) return Standard_True;
const Standard_Integer aLength = aLastInd - aFirstInd + 1;
if (aLength <= 0)
return Standard_False;
TColStd_Array1OfReal aTargetArray(aFirstInd, aLastInd);
theSource.GetRealArray (&aTargetArray(aFirstInd), aLength);
const Handle(TDataStd_RealList) anAtt = Handle(TDataStd_RealList)::DownCast(theTarget);
for (aIndex = aFirstInd; aIndex <= aLastInd; aIndex++)
{
anAtt->Append(aTargetArray.Value(aIndex));
if(aLastInd > 0) {
const Standard_Integer aLength = aLastInd - aFirstInd + 1;
if (aLength > 0) {
TColStd_Array1OfReal aTargetArray(aFirstInd, aLastInd);
theSource.GetRealArray (&aTargetArray(aFirstInd), aLength);
for (aIndex = aFirstInd; aIndex <= aLastInd; aIndex++)
anAtt->Append(aTargetArray.Value(aIndex));
}
}
BinMDataStd::SetAttributeID(theSource, anAtt);
return Standard_True;
}
@@ -77,8 +77,8 @@ Standard_Boolean BinMDataStd_RealListDriver::Paste(const BinObjMgt_Persistent&
//purpose : transient -> persistent (store)
//=======================================================================
void BinMDataStd_RealListDriver::Paste(const Handle(TDF_Attribute)& theSource,
BinObjMgt_Persistent& theTarget,
BinObjMgt_SRelocationTable& ) const
BinObjMgt_Persistent& theTarget,
BinObjMgt_SRelocationTable& ) const
{
const Handle(TDataStd_RealList) anAtt = Handle(TDataStd_RealList)::DownCast(theSource);
const Standard_Integer aFirstInd = (anAtt->Extent()> 0) ? 1 : 0;
@@ -99,4 +99,8 @@ void BinMDataStd_RealListDriver::Paste(const Handle(TDF_Attribute)& theSource,
Standard_Real *aPtr = (Standard_Real *) &aSourceArray(aFirstInd);
theTarget.PutRealArray(aPtr, aLength);
}
// process user defined guid
if(anAtt->ID() != TDataStd_RealList::GetID())
theTarget << anAtt->ID();
}

View File

@@ -15,6 +15,7 @@
#include <BinMDataStd_ReferenceArrayDriver.hxx>
#include <BinMDataStd.hxx>
#include <BinObjMgt_Persistent.hxx>
#include <CDM_MessageDriver.hxx>
#include <Standard_Type.hxx>
@@ -49,8 +50,8 @@ Handle(TDF_Attribute) BinMDataStd_ReferenceArrayDriver::NewEmpty() const
//purpose : persistent -> transient (retrieve)
//=======================================================================
Standard_Boolean BinMDataStd_ReferenceArrayDriver::Paste(const BinObjMgt_Persistent& theSource,
const Handle(TDF_Attribute)& theTarget,
BinObjMgt_RRelocationTable& ) const
const Handle(TDF_Attribute)& theTarget,
BinObjMgt_RRelocationTable& ) const
{
Standard_Integer aFirstInd, aLastInd;
if (! (theSource >> aFirstInd >> aLastInd))
@@ -59,7 +60,7 @@ Standard_Boolean BinMDataStd_ReferenceArrayDriver::Paste(const BinObjMgt_Persist
if (aLength <= 0)
return Standard_False;
Handle(TDataStd_ReferenceArray) anAtt = Handle(TDataStd_ReferenceArray)::DownCast(theTarget);
const Handle(TDataStd_ReferenceArray) anAtt = Handle(TDataStd_ReferenceArray)::DownCast(theTarget);
anAtt->Init(aFirstInd, aLastInd);
for (Standard_Integer i = aFirstInd; i <= aLastInd; i++)
{
@@ -72,6 +73,7 @@ Standard_Boolean BinMDataStd_ReferenceArrayDriver::Paste(const BinObjMgt_Persist
anAtt->SetValue(i, L);
}
BinMDataStd::SetAttributeID(theSource, anAtt);
return Standard_True;
}
@@ -80,8 +82,8 @@ Standard_Boolean BinMDataStd_ReferenceArrayDriver::Paste(const BinObjMgt_Persist
//purpose : transient -> persistent (store)
//=======================================================================
void BinMDataStd_ReferenceArrayDriver::Paste(const Handle(TDF_Attribute)& theSource,
BinObjMgt_Persistent& theTarget,
BinObjMgt_SRelocationTable& ) const
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;
@@ -98,4 +100,8 @@ void BinMDataStd_ReferenceArrayDriver::Paste(const Handle(TDF_Attribute)& theSou
theTarget << entry;
}
}
// process user defined guid
if(anAtt->ID() != TDataStd_ReferenceArray::GetID())
theTarget << anAtt->ID();
}

View File

@@ -15,6 +15,7 @@
#include <BinMDataStd_ReferenceListDriver.hxx>
#include <BinMDataStd.hxx>
#include <BinObjMgt_Persistent.hxx>
#include <CDM_MessageDriver.hxx>
#include <Standard_Type.hxx>
@@ -50,30 +51,32 @@ Handle(TDF_Attribute) BinMDataStd_ReferenceListDriver::NewEmpty() const
//purpose : persistent -> transient (retrieve)
//=======================================================================
Standard_Boolean BinMDataStd_ReferenceListDriver::Paste(const BinObjMgt_Persistent& theSource,
const Handle(TDF_Attribute)& theTarget,
BinObjMgt_RRelocationTable& ) const
const Handle(TDF_Attribute)& theTarget,
BinObjMgt_RRelocationTable& ) const
{
Standard_Integer aFirstInd, aLastInd;
if (! (theSource >> aFirstInd >> aLastInd))
return Standard_False;
if(aLastInd == 0) return Standard_True;
const Standard_Integer aLength = aLastInd - aFirstInd + 1;
if (aLength <= 0)
return Standard_False;
const Handle(TDataStd_ReferenceList) anAtt = Handle(TDataStd_ReferenceList)::DownCast(theTarget);
for (Standard_Integer i = aFirstInd; i <= aLastInd; i++)
{
TCollection_AsciiString entry;
if ( !(theSource >> entry) )
if(aLastInd > 0) {
const Standard_Integer aLength = aLastInd - aFirstInd + 1;
if (aLength <= 0)
return Standard_False;
TDF_Label L;
TDF_Tool::Label(anAtt->Label().Data(), entry, L, Standard_True);
if (!L.IsNull())
anAtt->Append(L);
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);
}
}
BinMDataStd::SetAttributeID(theSource, anAtt);
return Standard_True;
}
@@ -82,8 +85,8 @@ Standard_Boolean BinMDataStd_ReferenceListDriver::Paste(const BinObjMgt_Persiste
//purpose : transient -> persistent (store)
//=======================================================================
void BinMDataStd_ReferenceListDriver::Paste(const Handle(TDF_Attribute)& theSource,
BinObjMgt_Persistent& theTarget,
BinObjMgt_SRelocationTable& ) const
BinObjMgt_Persistent& theTarget,
BinObjMgt_SRelocationTable& ) const
{
const Handle(TDataStd_ReferenceList) anAtt = Handle(TDataStd_ReferenceList)::DownCast(theSource);
if (anAtt.IsNull())
@@ -103,4 +106,8 @@ void BinMDataStd_ReferenceListDriver::Paste(const Handle(TDF_Attribute)& theSour
theTarget << entry;
}
}
// process user defined guid
if(anAtt->ID() != TDataStd_ReferenceList::GetID())
theTarget << anAtt->ID();
}