1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-03 17:56:21 +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();
}

File diff suppressed because it is too large Load Diff

View File

@ -23,7 +23,6 @@
#include <Standard_Integer.hxx>
class Standard_ErrorHandler;
class Standard_GUID;
class Standard_Persistent;
class Standard_Transient;
class Standard_Failure;

View File

@ -17,7 +17,6 @@
#ifndef _Standard_GUID_HeaderFile
#define _Standard_GUID_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>

View File

@ -18,7 +18,6 @@
#include <TDF_Data.hxx>
#include <TDF_Attribute.hxx>
//! Create a transient label tree from persistent data
class StdLPersistent_Data::Parser
{
@ -44,10 +43,12 @@ public:
// read persistent attribute
Handle(StdObjMgt_Persistent)& aPAttrib = myAttribIter.ChangeValue();
myAttribIter.Next();
// create transient attribute and add it to the label
if (aPAttrib)
theLabel.AddAttribute (aPAttrib->CreateAttribute());
if (aPAttrib) {
Handle (TDF_Attribute) anAtt = aPAttrib->CreateAttribute();
anAtt->SetID();
theLabel.AddAttribute (anAtt);
}
}
// Read child labels count

View File

@ -140,7 +140,14 @@ public:
//! Returns the ID of the attribute.
Standard_EXPORT virtual const Standard_GUID& ID() const = 0;
//! Sets specific ID of the attribute (supports several attributes
//! of one type at the same label feature).
Standard_EXPORT virtual void SetID(const Standard_GUID& theGuid);
//! Sets default ID defined in nested class (to be used for attributes having User ID feature).
Standard_EXPORT virtual void SetID();
//! Returns the label to which the attribute is
//! attached. If the label is not included in a DF,
//! the label is null. See Label.

View File

@ -57,5 +57,13 @@ inline Standard_Boolean TDF_Attribute::IsForgotten() const
// operator <<
inline Standard_OStream& operator << (Standard_OStream& anOS,
const Handle(TDF_Attribute)& anAtt)
const Handle(TDF_Attribute)& anAtt)
{ return anAtt->Dump(anOS); }
//=======================================================================
inline void TDF_Attribute::SetID(const Standard_GUID& )
{}
//=======================================================================
inline void TDF_Attribute::SetID()
{}

View File

@ -108,7 +108,7 @@ void TDF_CopyTool::Copy
if (theLabMap.IsBound(sLab)) {
TDF_Label tIns(theLabMap.Find(sLab));
TDF_CopyTool::CopyLabels(sLab,tIns,
theLabMap,theAttMap,srcLabs,srcAtts);
theLabMap,theAttMap,srcLabs,srcAtts);
}
// if not bound : do nothing!
}
@ -127,7 +127,7 @@ void TDF_CopyTool::Copy
// 2 - The target attribute is present BUT its privilege over the
// source one must be ignored. The source attribute can be copied.
if ((sAtt != tAtt) && aPrivilegeFilter.IsIgnored(tAtt->ID()))
sAtt->Paste(tAtt,aRelocationTable);
sAtt->Paste(tAtt,aRelocationTable);
}
}
}
@ -148,7 +148,7 @@ void TDF_CopyTool::CopyLabels
const TDF_AttributeMap& aSrcAttributeMap)
{
TDF_CopyTool::CopyAttributes(aSLabel,aTargetLabel,
aAttMap,aSrcAttributeMap);
aAttMap,aSrcAttributeMap);
// Does the same for the children.
for (TDF_ChildIterator childItr(aSLabel); childItr.More(); childItr.Next()){
@ -157,13 +157,12 @@ void TDF_CopyTool::CopyLabels
TDF_Label childTIns = aTargetLabel.FindChild(childSLab.Tag());
aLabMap.Bind(childSLab,childTIns);
TDF_CopyTool::CopyLabels(childSLab,childTIns,
aLabMap,aAttMap,
aSrcLabelMap,aSrcAttributeMap);
aLabMap,aAttMap,
aSrcLabelMap,aSrcAttributeMap);
}
}
}
//=======================================================================
//function : CopyAttributes
//purpose : Internal attribute copy method.
@ -184,17 +183,19 @@ void TDF_CopyTool::CopyAttributes
if (aSrcAttributeMap.Contains(sAtt)) {
const Standard_GUID& id = sAtt->ID();
if (!aTargetLabel.FindAttribute(id,tAtt)) {
tAtt = sAtt->NewEmpty();
aTargetLabel.AddAttribute(tAtt);
aAttMap.Bind(sAtt,tAtt);
tAtt = sAtt->NewEmpty();
if(tAtt->ID() != id)
tAtt->SetID(id);//
aTargetLabel.AddAttribute(tAtt);
aAttMap.Bind(sAtt,tAtt);
}
else {
// Some attributes have the same ID, but are different and
// exclusive. This obliged to test the dynamic type identity.
if (tAtt->IsInstance(sAtt->DynamicType()))
aAttMap.Bind(sAtt,tAtt);
else
throw Standard_TypeMismatch("TDF_CopyTool: Cannot paste to a different type attribute.");
// Some attributes have the same ID, but are different and
// exclusive. This obliged to test the dynamic type identity.
if (tAtt->IsInstance(sAtt->DynamicType()))
aAttMap.Bind(sAtt,tAtt);
else
throw Standard_TypeMismatch("TDF_CopyTool: Cannot paste to a different type attribute.");
}
}
}

View File

@ -127,6 +127,15 @@ void TDataStd_AsciiString::SetID( const Standard_GUID& theGuid)
myID = theGuid;
}
//=======================================================================
//function : SetID
//purpose : sets default ID
//=======================================================================
void TDataStd_AsciiString::SetID()
{
Backup();
myID = GetID();
}
//=======================================================================
//function : NewEmpty
//purpose :

View File

@ -62,7 +62,10 @@ public:
Standard_EXPORT void Set (const TCollection_AsciiString& S);
//! Sets the explicit user defined GUID to the attribute.
Standard_EXPORT void SetID (const Standard_GUID& guid);
Standard_EXPORT void SetID (const Standard_GUID& guid) Standard_OVERRIDE;
//! Sets default GUID for the attribute.
Standard_EXPORT void SetID() Standard_OVERRIDE;
Standard_EXPORT const TCollection_AsciiString& Get() const;

View File

@ -59,6 +59,30 @@ const Standard_GUID& TDataStd_BooleanArray::GetID()
return TDataStd_BooleanArrayID;
}
//=======================================================================
//function : SetAttr
//purpose : Implements Set functionality
//=======================================================================
static Handle(TDataStd_BooleanArray) SetAttr(const TDF_Label& label,
const Standard_Integer lower,
const Standard_Integer upper,
const Standard_GUID& theGuid)
{
Handle(TDataStd_BooleanArray) A;
if (!label.FindAttribute (theGuid, A))
{
A = new TDataStd_BooleanArray;
A->SetID(theGuid);
A->Init (lower, upper);
label.AddAttribute(A);
}
else if (lower != A->Lower() || upper != A->Upper())
{
A->Init(lower, upper);
}
return A;
}
//=======================================================================
//function : TDataStd_BooleanArray
//purpose : Empty Constructor
@ -73,14 +97,13 @@ TDataStd_BooleanArray::TDataStd_BooleanArray()
//purpose :
//=======================================================================
void TDataStd_BooleanArray::Init(const Standard_Integer lower,
const Standard_Integer upper)
const Standard_Integer upper)
{
Standard_RangeError_Raise_if(upper < lower,"TDataStd_BooleanArray::Init");
Backup();
myLower = lower;
myUpper = upper;
if (myUpper >= myLower)
myValues = new TColStd_HArray1OfByte(0, Length() >> 3, 0/*initialize to FALSE*/);
myValues = new TColStd_HArray1OfByte(0, Length() >> 3, 0/*initialize to FALSE*/);
}
//=======================================================================
@ -88,30 +111,31 @@ void TDataStd_BooleanArray::Init(const Standard_Integer lower,
//purpose :
//=======================================================================
Handle(TDataStd_BooleanArray) TDataStd_BooleanArray::Set(const TDF_Label& label,
const Standard_Integer lower,
const Standard_Integer upper)
const Standard_Integer lower,
const Standard_Integer upper)
{
Handle(TDataStd_BooleanArray) A;
if (!label.FindAttribute (TDataStd_BooleanArray::GetID(), A))
{
A = new TDataStd_BooleanArray;
A->Init (lower, upper);
label.AddAttribute(A);
}
else if (lower != A->Lower() || upper != A->Upper())
{
A->Init(lower, upper);
}
return A;
return SetAttr(label, lower, upper, GetID());
}
//=======================================================================
//function : Set
//purpose : Set user defined attribute with specific ID
//=======================================================================
Handle(TDataStd_BooleanArray) TDataStd_BooleanArray::Set(const TDF_Label& label,
const Standard_GUID& theGuid,
const Standard_Integer lower,
const Standard_Integer upper)
{
return SetAttr(label, lower, upper, theGuid);
}
//=======================================================================
//function : SetValue
//purpose :
//=======================================================================
void TDataStd_BooleanArray::SetValue (const Standard_Integer index,
const Standard_Boolean value)
const Standard_Boolean value)
{
if (myValues.IsNull())
@ -204,9 +228,30 @@ void TDataStd_BooleanArray::SetInternalArray (const Handle(TColStd_HArray1OfByte
//=======================================================================
const Standard_GUID& TDataStd_BooleanArray::ID () const
{
return GetID();
return myID;
}
//=======================================================================
//function : SetID
//purpose :
//=======================================================================
void TDataStd_BooleanArray::SetID( const Standard_GUID& theGuid)
{
if(myID == theGuid) return;
Backup();
myID = theGuid;
}
//=======================================================================
//function : SetID
//purpose : sets default ID
//=======================================================================
void TDataStd_BooleanArray::SetID()
{
Backup();
myID = GetID();
}
//=======================================================================
//function : NewEmpty
//purpose :
@ -234,6 +279,7 @@ void TDataStd_BooleanArray::Restore(const Handle(TDF_Attribute)& With)
{
myValues->SetValue(i, with_array.Value(i));
}
myID = anArray->ID();
}
else
{
@ -256,9 +302,10 @@ void TDataStd_BooleanArray::Paste (const Handle(TDF_Attribute)& Into,
anArray->Init(myLower, myUpper);
for (Standard_Integer i = myLower; i <= myUpper; i++)
{
anArray->SetValue(i, Value(i));
anArray->SetValue(i, Value(i));
}
}
anArray->SetID(myID);
}
}
@ -268,6 +315,10 @@ void TDataStd_BooleanArray::Paste (const Handle(TDF_Attribute)& Into,
//=======================================================================
Standard_OStream& TDataStd_BooleanArray::Dump (Standard_OStream& anOS) const
{
anOS << "BooleanArray";
anOS << "\nBooleanArray: ";
Standard_Character sguid[Standard_GUID_SIZE_ALLOC];
myID.ToCString(sguid);
anOS << sguid;
anOS <<endl;
return anOS;
}

View File

@ -24,6 +24,7 @@
#include <TDF_Attribute.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_OStream.hxx>
#include <Standard_GUID.hxx>
class Standard_GUID;
class TDF_Label;
class TDF_Attribute;
@ -45,22 +46,33 @@ public:
//! Returns an ID for array.
Standard_EXPORT static const Standard_GUID& GetID();
//! Finds or creates an attribute with the array.
//! Finds or creates an attribute with internal boolean array.
Standard_EXPORT static Handle(TDataStd_BooleanArray) Set (const TDF_Label& label, const Standard_Integer lower, const Standard_Integer upper);
//! Finds or creates an attribute with the array using explicit user defined <guid>.
Standard_EXPORT static Handle(TDataStd_BooleanArray) Set (const TDF_Label& label, const Standard_GUID& theGuid,
const Standard_Integer lower, const Standard_Integer upper);
//! Initialize the inner array with bounds from <lower> to <upper>
Standard_EXPORT void Init (const Standard_Integer lower, const Standard_Integer upper);
//! Sets the <Index>th element of the array to <Value>
//! OutOfRange exception is raised if <Index> doesn't respect Lower and Upper bounds of the internal array.
Standard_EXPORT void SetValue (const Standard_Integer index, const Standard_Boolean value);
//! Sets the explicit GUID (user defined) for the attribute.
Standard_EXPORT void SetID( const Standard_GUID& theGuid) Standard_OVERRIDE;
//! Sets default GUID for the attribute.
Standard_EXPORT void SetID() Standard_OVERRIDE;
//! Return the value of the <Index>th element of the array.
Standard_EXPORT Standard_Boolean Value (const Standard_Integer Index) const;
Standard_Boolean operator () (const Standard_Integer Index) const
{
return Value(Index);
}
Standard_Boolean operator () (const Standard_Integer Index) const
{
return Value(Index);
}
//! Returns the lower boundary of the array.
Standard_EXPORT Standard_Integer Lower() const;
@ -103,7 +115,7 @@ private:
Handle(TColStd_HArray1OfByte) myValues;
Standard_Integer myLower;
Standard_Integer myUpper;
Standard_GUID myID;
};

View File

@ -34,6 +34,23 @@ const Standard_GUID& TDataStd_BooleanList::GetID()
return TDataStd_BooleanListID;
}
//=======================================================================
//function : SetAttr
//purpose : Implements Set functionality
//=======================================================================
static Handle(TDataStd_BooleanList) SetAttr(const TDF_Label& label,
const Standard_GUID& theGuid)
{
Handle(TDataStd_BooleanList) A;
if (!label.FindAttribute (theGuid, A))
{
A = new TDataStd_BooleanList;
A->SetID(theGuid);
label.AddAttribute(A);
}
return A;
}
//=======================================================================
//function : TDataStd_BooleanList
//purpose : Empty Constructor
@ -49,15 +66,18 @@ TDataStd_BooleanList::TDataStd_BooleanList()
//=======================================================================
Handle(TDataStd_BooleanList) TDataStd_BooleanList::Set(const TDF_Label& label)
{
Handle(TDataStd_BooleanList) A;
if (!label.FindAttribute (TDataStd_BooleanList::GetID(), A))
{
A = new TDataStd_BooleanList;
label.AddAttribute(A);
}
return A;
return SetAttr(label, GetID());
}
//=======================================================================
//function : Set
//purpose : Set user defined attribute with specific ID
//=======================================================================
Handle(TDataStd_BooleanList) TDataStd_BooleanList::Set(const TDF_Label& label,
const Standard_GUID& theGuid)
{
return SetAttr(label, theGuid);
}
//=======================================================================
//function : IsEmpty
//purpose :
@ -207,7 +227,30 @@ Standard_Boolean TDataStd_BooleanList::Remove(const Standard_Integer index)
//=======================================================================
const Standard_GUID& TDataStd_BooleanList::ID () const
{
return GetID();
return myID;
}
//=======================================================================
//function : SetID
//purpose :
//=======================================================================
void TDataStd_BooleanList::SetID( const Standard_GUID& theGuid)
{
if(myID == theGuid) return;
Backup();
myID = theGuid;
}
//=======================================================================
//function : SetID
//purpose : sets default ID
//=======================================================================
void TDataStd_BooleanList::SetID()
{
Backup();
myID = GetID();
}
//=======================================================================
@ -232,6 +275,7 @@ void TDataStd_BooleanList::Restore(const Handle(TDF_Attribute)& With)
{
myList.Append (itr.Value() ? 1 : 0);
}
myID = aList->ID();
}
//=======================================================================
@ -248,6 +292,7 @@ void TDataStd_BooleanList::Paste (const Handle(TDF_Attribute)& Into,
{
aList->Append (itr.Value() != 0);
}
aList->SetID(myID);
}
//=======================================================================
@ -256,6 +301,10 @@ void TDataStd_BooleanList::Paste (const Handle(TDF_Attribute)& Into,
//=======================================================================
Standard_OStream& TDataStd_BooleanList::Dump (Standard_OStream& anOS) const
{
anOS << "BooleanList";
anOS << "\nBooleanList: ";
Standard_Character sguid[Standard_GUID_SIZE_ALLOC];
myID.ToCString(sguid);
anOS << sguid;
anOS << endl;
return anOS;
}

View File

@ -24,6 +24,8 @@
#include <Standard_Boolean.hxx>
#include <Standard_Integer.hxx>
#include <Standard_OStream.hxx>
#include <Standard_GUID.hxx>
class Standard_GUID;
class TDF_Label;
class TDF_Attribute;
@ -47,6 +49,9 @@ public:
//! Finds or creates a list of boolean values attribute.
Standard_EXPORT static Handle(TDataStd_BooleanList) Set (const TDF_Label& label);
//! Finds or creates a list of boolean values attribute with explicit user defined <guid>.
Standard_EXPORT static Handle(TDataStd_BooleanList) Set (const TDF_Label& label, const Standard_GUID& theGuid);
Standard_EXPORT TDataStd_BooleanList();
@ -78,7 +83,13 @@ public:
//! Removes a value at <index> position.
Standard_EXPORT Standard_Boolean Remove (const Standard_Integer index);
//! Sets the explicit GUID (user defined) for the attribute.
Standard_EXPORT void SetID( const Standard_GUID& theGuid) Standard_OVERRIDE;
//! Sets default GUID for the attribute.
Standard_EXPORT void SetID() Standard_OVERRIDE;
Standard_EXPORT const Standard_GUID& ID() const Standard_OVERRIDE;
Standard_EXPORT void Restore (const Handle(TDF_Attribute)& With) Standard_OVERRIDE;
@ -103,7 +114,7 @@ private:
TDataStd_ListOfByte myList;
Standard_GUID myID;
};

View File

@ -40,20 +40,44 @@ const Standard_GUID& TDataStd_ByteArray::GetID()
//function : TDataStd_ByteArray
//purpose : Empty Constructor
//=======================================================================
TDataStd_ByteArray::TDataStd_ByteArray() : myIsDelta(Standard_False){}
TDataStd_ByteArray::TDataStd_ByteArray() : myIsDelta(Standard_False)
{}
//=======================================================================
//function : SetAttr
//purpose : Implements Set functionality
//=======================================================================
static Handle(TDataStd_ByteArray) SetAttr(const TDF_Label& label,
const Standard_Integer lower,
const Standard_Integer upper,
const Standard_Boolean isDelta,
const Standard_GUID& theGuid)
{
Handle(TDataStd_ByteArray) A;
if (!label.FindAttribute (theGuid, A))
{
A = new TDataStd_ByteArray;
A->Init (lower, upper);
A->SetDelta(isDelta);
A->SetID(theGuid);
label.AddAttribute(A);
}
else if (lower != A->Lower() || upper != A->Upper())
{
A->Init(lower, upper);
}
return A;
}
//=======================================================================
//function : Init
//purpose :
//=======================================================================
void TDataStd_ByteArray::Init(const Standard_Integer lower,
const Standard_Integer upper)
const Standard_Integer upper)
{
Standard_RangeError_Raise_if(upper < lower,"TDataStd_ByteArray::Init");
Backup();
if (upper >= lower)
myValue = new TColStd_HArray1OfByte(lower, upper, 0x00);
myValue = new TColStd_HArray1OfByte(lower, upper, 0x00);
}
//=======================================================================
@ -61,19 +85,24 @@ void TDataStd_ByteArray::Init(const Standard_Integer lower,
//purpose :
//=======================================================================
Handle(TDataStd_ByteArray) TDataStd_ByteArray::Set(const TDF_Label& label,
const Standard_Integer lower,
const Standard_Integer upper,
const Standard_Boolean isDelta)
const Standard_Integer lower,
const Standard_Integer upper,
const Standard_Boolean isDelta)
{
Handle(TDataStd_ByteArray) A;
if (!label.FindAttribute (TDataStd_ByteArray::GetID(), A))
{
A = new TDataStd_ByteArray;
A->Init (lower, upper);
A->SetDelta(isDelta);
label.AddAttribute(A);
}
return A;
return SetAttr(label, lower, upper, isDelta, GetID());
}
//=======================================================================
//function : Set
//purpose : Set user defined attribute with specific ID
//=======================================================================
Handle(TDataStd_ByteArray) TDataStd_ByteArray::Set(const TDF_Label& label,
const Standard_GUID& theGuid,
const Standard_Integer lower,
const Standard_Integer upper,
const Standard_Boolean isDelta)
{
return SetAttr(label, lower, upper, isDelta, theGuid);
}
//=======================================================================
@ -81,7 +110,7 @@ Handle(TDataStd_ByteArray) TDataStd_ByteArray::Set(const TDF_Label& label,
//purpose :
//=======================================================================
void TDataStd_ByteArray::SetValue (const Standard_Integer index,
const Standard_Byte value)
const Standard_Byte value)
{
if (myValue.IsNull())
return;
@ -140,7 +169,7 @@ Standard_Integer TDataStd_ByteArray::Length (void) const
// : that holds <newArray>
//=======================================================================
void TDataStd_ByteArray::ChangeArray (const Handle(TColStd_HArray1OfByte)& newArray,
const Standard_Boolean isCheckItems)
const Standard_Boolean isCheckItems)
{
Standard_Integer aLower = newArray->Lower();
@ -153,13 +182,13 @@ void TDataStd_ByteArray::ChangeArray (const Handle(TColStd_HArray1OfByte)& newAr
if(isCheckItems) {
Standard_Boolean isEqual = Standard_True;
for(i = aLower; i <= anUpper; i++) {
if(myValue->Value(i) != newArray->Value(i)) {
isEqual = Standard_False;
break;
}
if(myValue->Value(i) != newArray->Value(i)) {
isEqual = Standard_False;
break;
}
}
if(isEqual)
return;
return;
}
}
@ -178,7 +207,30 @@ void TDataStd_ByteArray::ChangeArray (const Handle(TColStd_HArray1OfByte)& newAr
//=======================================================================
const Standard_GUID& TDataStd_ByteArray::ID () const
{
return GetID();
return myID;
}
//=======================================================================
//function : SetID
//purpose :
//=======================================================================
void TDataStd_ByteArray::SetID( const Standard_GUID& theGuid)
{
if(myID == theGuid) return;
Backup();
myID = theGuid;
}
//=======================================================================
//function : SetID
//purpose : sets default ID
//=======================================================================
void TDataStd_ByteArray::SetID()
{
Backup();
myID = GetID();
}
//=======================================================================
@ -205,6 +257,7 @@ void TDataStd_ByteArray::Restore(const Handle(TDF_Attribute)& With)
for (; i <= upper; i++)
myValue->SetValue(i, with_array.Value(i));
myIsDelta = anArray->myIsDelta;
myID = anArray->ID();
}
else
myValue.Nullify();
@ -215,7 +268,7 @@ void TDataStd_ByteArray::Restore(const Handle(TDF_Attribute)& With)
//purpose :
//=======================================================================
void TDataStd_ByteArray::Paste (const Handle(TDF_Attribute)& Into,
const Handle(TDF_RelocationTable)& ) const
const Handle(TDF_RelocationTable)& ) const
{
if (!myValue.IsNull())
{
@ -224,6 +277,7 @@ void TDataStd_ByteArray::Paste (const Handle(TDF_Attribute)& Into,
{
anAtt->ChangeArray( myValue, Standard_False);
anAtt->SetDelta(myIsDelta);
anAtt->SetID(myID);
}
}
}
@ -234,7 +288,10 @@ void TDataStd_ByteArray::Paste (const Handle(TDF_Attribute)& Into,
//=======================================================================
Standard_OStream& TDataStd_ByteArray::Dump (Standard_OStream& anOS) const
{
anOS << "ByteArray";
anOS << "\nByteArray: ";
Standard_Character sguid[Standard_GUID_SIZE_ALLOC];
myID.ToCString(sguid);
anOS << sguid << endl;
return anOS;
}

View File

@ -25,6 +25,8 @@
#include <Standard_Integer.hxx>
#include <Standard_Byte.hxx>
#include <Standard_OStream.hxx>
#include <Standard_GUID.hxx>
class TDataStd_DeltaOnModificationOfByteArray;
class Standard_GUID;
class TDF_Label;
@ -43,6 +45,7 @@ class TDataStd_ByteArray : public TDF_Attribute
DEFINE_STANDARD_RTTIEXT(TDataStd_ByteArray, TDF_Attribute)
public:
//! Static methods
//! ==============
//! Returns an ID for array.
@ -55,6 +58,11 @@ public:
//! attribute is returned.
Standard_EXPORT static Handle(TDataStd_ByteArray) Set (const TDF_Label& label, const Standard_Integer lower, const Standard_Integer upper, const Standard_Boolean isDelta = Standard_False);
//! Finds or creates an attribute with byte array and explicit user defined <guid> on the specified label.
Standard_EXPORT static Handle(TDataStd_ByteArray) Set (const TDF_Label& label, const Standard_GUID& theGuid,
const Standard_Integer lower, const Standard_Integer upper,
const Standard_Boolean isDelta = Standard_False);
//! Initialize the inner array with bounds from <lower> to <upper>
Standard_EXPORT void Init (const Standard_Integer lower, const Standard_Integer upper);
@ -62,12 +70,19 @@ public:
//! OutOfRange exception is raised if <Index> doesn't respect Lower and Upper bounds of the internal array.
Standard_EXPORT void SetValue (const Standard_Integer index, const Standard_Byte value);
//! Sets the explicit GUID (user defined) for the attribute.
Standard_EXPORT void SetID( const Standard_GUID& theGuid) Standard_OVERRIDE;
//! Sets default GUID for the attribute.
Standard_EXPORT void SetID() Standard_OVERRIDE;
//! Return the value of the <Index>th element of the array.
Standard_EXPORT Standard_Byte Value (const Standard_Integer Index) const;
Standard_Byte operator () (const Standard_Integer Index) const
{
return Value(Index);
}
Standard_Byte operator () (const Standard_Integer Index) const
{
return Value(Index);
}
//! Returns the lower boundary of the array.
Standard_EXPORT Standard_Integer Lower() const;
@ -117,6 +132,7 @@ private:
Handle(TColStd_HArray1OfByte) myValue;
Standard_Boolean myIsDelta;
Standard_GUID myID;
};

View File

@ -37,7 +37,31 @@ const Standard_GUID& TDataStd_ExtStringArray::GetID()
return anExtStringArrayID;
}
//=======================================================================
//function : SetAttr
//purpose : Implements Set functionality
//=======================================================================
Handle(TDataStd_ExtStringArray) SetAttr(const TDF_Label& label,
const Standard_Integer lower,
const Standard_Integer upper,
const Standard_Boolean isDelta,
const Standard_GUID& theGuid)
{
Handle(TDataStd_ExtStringArray) A;
if (!label.FindAttribute (theGuid, A))
{
A = new TDataStd_ExtStringArray;
A->SetID(theGuid);
A->Init (lower, upper);
A->SetDelta(isDelta);
label.AddAttribute(A);
}
else if (lower != A->Lower() || upper != A->Upper())
{
A->Init(lower, upper);
}
return A;
}
//=======================================================================
//function : TDataStd_ExtStringArray::TDataStd_ExtStringArray
//purpose :
@ -52,8 +76,9 @@ TDataStd_ExtStringArray::TDataStd_ExtStringArray()
//=======================================================================
void TDataStd_ExtStringArray::Init(const Standard_Integer lower,
const Standard_Integer upper)
const Standard_Integer upper)
{
Standard_RangeError_Raise_if(upper < lower,"TDataStd_ExtStringArray::Init");
Backup();
myValue = new TColStd_HArray1OfExtendedString(lower, upper, "");
}
@ -64,27 +89,30 @@ void TDataStd_ExtStringArray::Init(const Standard_Integer lower,
//=======================================================================
Handle(TDataStd_ExtStringArray) TDataStd_ExtStringArray::Set (
const TDF_Label& label,
const Standard_Integer lower,
const Standard_Integer upper,
const Standard_Boolean isDelta)
const TDF_Label& label,
const Standard_Integer lower,
const Standard_Integer upper,
const Standard_Boolean isDelta)
{
Handle(TDataStd_ExtStringArray) A;
if (!label.FindAttribute (TDataStd_ExtStringArray::GetID(), A)) {
A = new TDataStd_ExtStringArray;
A->Init (lower, upper);
A->SetDelta(isDelta);
label.AddAttribute(A);
}
else if (lower != A->Lower() || upper != A->Upper())
{
A->Init (lower, upper);
}
return A;
return SetAttr(label, lower, upper, isDelta, GetID());
}
//=======================================================================
//function : Set
//purpose : Set user defined attribute with specific ID
//=======================================================================
Handle(TDataStd_ExtStringArray) TDataStd_ExtStringArray::Set (
const TDF_Label& label,
const Standard_GUID& theGuid,
const Standard_Integer lower,
const Standard_Integer upper,
const Standard_Boolean isDelta)
{
return SetAttr(label, lower, upper, isDelta, theGuid);
}
//=======================================================================
//function : SetValue
//purpose :
@ -108,12 +136,12 @@ void TDataStd_ExtStringArray::SetValue(const Standard_Integer index, const TColl
const TCollection_ExtendedString& TDataStd_ExtStringArray::Value (const Standard_Integer index) const
{
if (myValue.IsNull())
{
static TCollection_ExtendedString staticEmptyValue;
return staticEmptyValue;
}
return myValue->Value(index);
if (myValue.IsNull())
{
static TCollection_ExtendedString staticEmptyValue;
return staticEmptyValue;
}
return myValue->Value(index);
}
//=======================================================================
@ -158,7 +186,7 @@ Standard_Integer TDataStd_ExtStringArray::Length (void) const
//=======================================================================
void TDataStd_ExtStringArray::ChangeArray(const Handle(TColStd_HArray1OfExtendedString)& newArray,
const Standard_Boolean isCheckItems)
const Standard_Boolean isCheckItems)
{
Standard_Integer aLower = newArray->Lower();
Standard_Integer anUpper = newArray->Upper();
@ -170,13 +198,13 @@ void TDataStd_ExtStringArray::ChangeArray(const Handle(TColStd_HArray1OfExtended
Standard_Boolean isEqual = Standard_True;
if(isCheckItems) {
for(i = aLower; i <= anUpper; i++) {
if(myValue->Value(i) != newArray->Value(i)) {
isEqual = Standard_False;
break;
}
if(myValue->Value(i) != newArray->Value(i)) {
isEqual = Standard_False;
break;
}
}
if(isEqual)
return;
return;
}
}
@ -195,8 +223,30 @@ void TDataStd_ExtStringArray::ChangeArray(const Handle(TColStd_HArray1OfExtended
//purpose :
//=======================================================================
const Standard_GUID& TDataStd_ExtStringArray::ID () const { return GetID(); }
const Standard_GUID& TDataStd_ExtStringArray::ID () const { return myID; }
//=======================================================================
//function : SetID
//purpose :
//=======================================================================
void TDataStd_ExtStringArray::SetID( const Standard_GUID& theGuid)
{
if(myID == theGuid) return;
Backup();
myID = theGuid;
}
//=======================================================================
//function : SetID
//purpose : sets default ID
//=======================================================================
void TDataStd_ExtStringArray::SetID()
{
Backup();
myID = GetID();
}
//=======================================================================
//function : NewEmpty
@ -224,6 +274,7 @@ void TDataStd_ExtStringArray::Restore(const Handle(TDF_Attribute)& With)
for(i = lower; i<=upper; i++)
myValue->SetValue(i, anArray->Value(i));
myIsDelta = anArray->myIsDelta;
myID = anArray->ID();
}
else
myValue.Nullify();
@ -235,13 +286,14 @@ void TDataStd_ExtStringArray::Restore(const Handle(TDF_Attribute)& With)
//=======================================================================
void TDataStd_ExtStringArray::Paste (const Handle(TDF_Attribute)& Into,
const Handle(TDF_RelocationTable)& ) const
const Handle(TDF_RelocationTable)& ) const
{
if(!myValue.IsNull()) {
Handle(TDataStd_ExtStringArray) anAtt = Handle(TDataStd_ExtStringArray)::DownCast(Into);
if(!anAtt.IsNull()) {
anAtt->ChangeArray( myValue, Standard_False );
anAtt->SetDelta(myIsDelta);
anAtt->SetID(myID);
}
}
}
@ -253,7 +305,7 @@ void TDataStd_ExtStringArray::Paste (const Handle(TDF_Attribute)& Into,
Standard_OStream& TDataStd_ExtStringArray::Dump (Standard_OStream& anOS) const
{
anOS << "ExtStringArray :";
anOS << "\nExtStringArray :";
if(!myValue.IsNull()) {
Standard_Integer i, lower, upper;
lower = myValue->Lower();
@ -262,6 +314,9 @@ Standard_OStream& TDataStd_ExtStringArray::Dump (Standard_OStream& anOS) const
anOS << "\t" <<myValue->Value(i)<<endl;
}
anOS << " Delta is " << (myIsDelta ? "ON":"OFF");
Standard_Character sguid[Standard_GUID_SIZE_ALLOC];
myID.ToCString(sguid);
anOS << sguid;
anOS << endl;
return anOS;
}

View File

@ -24,6 +24,8 @@
#include <TDF_Attribute.hxx>
#include <Standard_Integer.hxx>
#include <Standard_OStream.hxx>
#include <Standard_GUID.hxx>
class TDataStd_DeltaOnModificationOfExtStringArray;
class Standard_GUID;
class TDF_Label;
@ -55,20 +57,34 @@ public:
//! If attribute is already set, all input parameters are refused and the found
//! attribute is returned.
Standard_EXPORT static Handle(TDataStd_ExtStringArray) Set (const TDF_Label& label, const Standard_Integer lower, const Standard_Integer upper, const Standard_Boolean isDelta = Standard_False);
//! Finds, or creates, an ExtStringArray attribute with explicit user defined <guid>.
//! The ExtStringArray attribute is returned.
Standard_EXPORT static Handle(TDataStd_ExtStringArray) Set (const TDF_Label& label, const Standard_GUID& theGuid,
const Standard_Integer lower, const Standard_Integer upper,
const Standard_Boolean isDelta = Standard_False);
//! Initializes the inner array with bounds from <lower> to <upper>
Standard_EXPORT void Init (const Standard_Integer lower, const Standard_Integer upper);
//! Sets the <Index>th element of the array to <Value>
//! OutOfRange exception is raised if <Index> doesn't respect Lower and Upper bounds of the internal array.
Standard_EXPORT void SetValue (const Standard_Integer Index, const TCollection_ExtendedString& Value);
//! Sets the explicit GUID (user defined) for the attribute.
Standard_EXPORT void SetID( const Standard_GUID& theGuid) Standard_OVERRIDE;
//! Sets default GUID for the attribute.
Standard_EXPORT void SetID() Standard_OVERRIDE;
//! Returns the value of the <Index>th element of the array
Standard_EXPORT const TCollection_ExtendedString& Value (const Standard_Integer Index) const;
const TCollection_ExtendedString& operator () (const Standard_Integer Index) const
{
return Value(Index);
}
const TCollection_ExtendedString& operator () (const Standard_Integer Index) const
{
return Value(Index);
}
//! Return the lower bound.
Standard_EXPORT Standard_Integer Lower() const;
@ -118,6 +134,7 @@ private:
Handle(TColStd_HArray1OfExtendedString) myValue;
Standard_Boolean myIsDelta;
Standard_GUID myID;
};

View File

@ -35,14 +35,29 @@ const Standard_GUID& TDataStd_ExtStringList::GetID()
return TDataStd_ExtStringListID;
}
//=======================================================================
//function : SetAttr
//purpose : Implements Set functionality
//=======================================================================
static Handle(TDataStd_ExtStringList) SetAttr(const TDF_Label& label,
const Standard_GUID& theGuid)
{
Handle(TDataStd_ExtStringList) A;
if (!label.FindAttribute (theGuid, A))
{
A = new TDataStd_ExtStringList;
A->SetID(theGuid);
label.AddAttribute(A);
}
return A;
}
//=======================================================================
//function : TDataStd_ExtStringList
//purpose : Empty Constructor
//=======================================================================
TDataStd_ExtStringList::TDataStd_ExtStringList()
{
}
TDataStd_ExtStringList::TDataStd_ExtStringList()
{}
//=======================================================================
//function : Set
@ -50,13 +65,17 @@ TDataStd_ExtStringList::TDataStd_ExtStringList()
//=======================================================================
Handle(TDataStd_ExtStringList) TDataStd_ExtStringList::Set(const TDF_Label& label)
{
Handle(TDataStd_ExtStringList) A;
if (!label.FindAttribute (TDataStd_ExtStringList::GetID(), A))
{
A = new TDataStd_ExtStringList;
label.AddAttribute(A);
}
return A;
return SetAttr(label, GetID());
}
//=======================================================================
//function : Set
//purpose : Set user defined attribute with specific ID
//=======================================================================
Handle(TDataStd_ExtStringList) TDataStd_ExtStringList::Set(const TDF_Label& label,
const Standard_GUID& theGuid)
{
return SetAttr(label, theGuid);
}
//=======================================================================
@ -102,7 +121,7 @@ void TDataStd_ExtStringList::Append(const TCollection_ExtendedString& value)
//purpose :
//=======================================================================
Standard_Boolean TDataStd_ExtStringList::InsertBefore(const TCollection_ExtendedString& value,
const TCollection_ExtendedString& before_value)
const TCollection_ExtendedString& before_value)
{
TDataStd_ListIteratorOfListOfExtendedString itr(myList);
for (; itr.More(); itr.Next())
@ -145,7 +164,7 @@ Standard_Boolean TDataStd_ExtStringList::InsertBefore(const Standard_Integer ind
//purpose :
//=======================================================================
Standard_Boolean TDataStd_ExtStringList::InsertAfter(const TCollection_ExtendedString& value,
const TCollection_ExtendedString& after_value)
const TCollection_ExtendedString& after_value)
{
TDataStd_ListIteratorOfListOfExtendedString itr(myList);
for (; itr.More(); itr.Next())
@ -267,9 +286,31 @@ const TDataStd_ListOfExtendedString& TDataStd_ExtStringList::List() const
//=======================================================================
const Standard_GUID& TDataStd_ExtStringList::ID () const
{
return GetID();
return myID;
}
//=======================================================================
//function : SetID
//purpose :
//=======================================================================
void TDataStd_ExtStringList::SetID( const Standard_GUID& theGuid)
{
if(myID == theGuid) return;
Backup();
myID = theGuid;
}
//=======================================================================
//function : SetID
//purpose : sets default ID
//=======================================================================
void TDataStd_ExtStringList::SetID()
{
Backup();
myID = GetID();
}
//=======================================================================
//function : NewEmpty
//purpose :
@ -292,6 +333,7 @@ void TDataStd_ExtStringList::Restore(const Handle(TDF_Attribute)& With)
{
myList.Append(itr.Value());
}
myID = aList->ID();
}
//=======================================================================
@ -299,7 +341,7 @@ void TDataStd_ExtStringList::Restore(const Handle(TDF_Attribute)& With)
//purpose :
//=======================================================================
void TDataStd_ExtStringList::Paste (const Handle(TDF_Attribute)& Into,
const Handle(TDF_RelocationTable)& ) const
const Handle(TDF_RelocationTable)& ) const
{
Handle(TDataStd_ExtStringList) aList = Handle(TDataStd_ExtStringList)::DownCast(Into);
aList->Clear();
@ -308,6 +350,7 @@ void TDataStd_ExtStringList::Paste (const Handle(TDF_Attribute)& Into,
{
aList->Append(itr.Value());
}
aList->SetID(myID);
}
//=======================================================================
@ -316,6 +359,10 @@ void TDataStd_ExtStringList::Paste (const Handle(TDF_Attribute)& Into,
//=======================================================================
Standard_OStream& TDataStd_ExtStringList::Dump (Standard_OStream& anOS) const
{
anOS << "ExtStringList";
anOS << "\nExtStringList: ";
Standard_Character sguid[Standard_GUID_SIZE_ALLOC];
myID.ToCString(sguid);
anOS << sguid;
anOS << endl;
return anOS;
}

View File

@ -24,6 +24,8 @@
#include <Standard_Boolean.hxx>
#include <Standard_Integer.hxx>
#include <Standard_OStream.hxx>
#include <Standard_GUID.hxx>
class Standard_GUID;
class TDF_Label;
class TCollection_ExtendedString;
@ -46,8 +48,11 @@ public:
//! Returns the ID of the list of strings attribute.
Standard_EXPORT static const Standard_GUID& GetID();
//! Finds or creates a list of string values attribute.
//! Finds or creates a list of string values attribute with explicit user defined <guid>.
Standard_EXPORT static Handle(TDataStd_ExtStringList) Set (const TDF_Label& label);
//! Finds or creates a list of string values attribute.
Standard_EXPORT static Handle(TDataStd_ExtStringList) Set (const TDF_Label& label, const Standard_GUID& theGuid);
Standard_EXPORT TDataStd_ExtStringList();
@ -58,7 +63,13 @@ public:
Standard_EXPORT void Prepend (const TCollection_ExtendedString& value);
Standard_EXPORT void Append (const TCollection_ExtendedString& value);
//! Sets the explicit GUID (user defined) for the attribute.
Standard_EXPORT void SetID( const Standard_GUID& theGuid) Standard_OVERRIDE;
//! Sets default GUID for the attribute.
Standard_EXPORT void SetID() Standard_OVERRIDE;
//! Inserts the <value> before the first meet of <before_value>.
Standard_EXPORT Standard_Boolean InsertBefore (const TCollection_ExtendedString& value, const TCollection_ExtendedString& before_value);
@ -111,7 +122,7 @@ private:
TDataStd_ListOfExtendedString myList;
Standard_GUID myID;
};

View File

@ -135,6 +135,17 @@ void TDataStd_Integer::SetID( const Standard_GUID& theGuid)
Backup();
myID = theGuid;
}
//=======================================================================
//function : SetID
//purpose : sets default ID
//=======================================================================
void TDataStd_Integer::SetID()
{
Backup();
myID = GetID();
}
//=======================================================================
//function : NewEmpty
//purpose :

View File

@ -61,7 +61,10 @@ public:
Standard_EXPORT void Set (const Standard_Integer V);
//! Sets the explicit GUID (user defined) for the attribute.
Standard_EXPORT void SetID (const Standard_GUID& guid);
Standard_EXPORT void SetID (const Standard_GUID& guid) Standard_OVERRIDE;
//! Sets default GUID for the attribute.
Standard_EXPORT void SetID() Standard_OVERRIDE;
//! Returns the integer value contained in the attribute.
Standard_EXPORT Standard_Integer Get() const;

View File

@ -37,6 +37,31 @@ const Standard_GUID& TDataStd_IntegerArray::GetID()
return TDataStd_IntegerArrayID;
}
//=======================================================================
//function : SetAttr
//purpose : Implements Set functionality
//=======================================================================
static Handle(TDataStd_IntegerArray) SetAttr(const TDF_Label& label,
const Standard_Integer lower,
const Standard_Integer upper,
const Standard_Boolean isDelta,
const Standard_GUID& theGuid)
{
Handle(TDataStd_IntegerArray) A;
if (!label.FindAttribute (theGuid, A))
{
A = new TDataStd_IntegerArray;
A->Init (lower, upper);
A->SetDelta(isDelta);
A->SetID(theGuid);
label.AddAttribute(A);
}
else if (lower != A->Lower() || upper != A->Upper())
{
A->Init(lower, upper);
}
return A;
}
//=======================================================================
//function : TDataStd_IntegerArray
@ -44,7 +69,8 @@ const Standard_GUID& TDataStd_IntegerArray::GetID()
//=======================================================================
TDataStd_IntegerArray::TDataStd_IntegerArray()
:myIsDelta(Standard_False) {}
:myIsDelta(Standard_False)
{}
//=======================================================================
//function : Init
@ -54,6 +80,7 @@ TDataStd_IntegerArray::TDataStd_IntegerArray()
void TDataStd_IntegerArray::Init(const Standard_Integer lower,
const Standard_Integer upper)
{
Standard_RangeError_Raise_if(upper < lower,"TDataStd_IntegerArray::Init");
Backup();
myValue = new TColStd_HArray1OfInteger(lower, upper, 0);
}
@ -67,23 +94,27 @@ Handle(TDataStd_IntegerArray) TDataStd_IntegerArray::Set
(const TDF_Label& label,
const Standard_Integer lower,
const Standard_Integer upper,
const Standard_Boolean isDelta)
const Standard_Boolean isDelta)
{
Handle(TDataStd_IntegerArray) A;
if (!label.FindAttribute (TDataStd_IntegerArray::GetID(), A)) {
A = new TDataStd_IntegerArray;
A->Init (lower, upper);
A->SetDelta(isDelta);
label.AddAttribute(A);
}
else if (lower != A->Lower() || upper != A->Upper())
{
A->Init (lower, upper);
}
return A;
return SetAttr(label, lower, upper, isDelta, GetID());
}
//=======================================================================
//function : Set
//purpose : Set user defined attribute with specific ID
//=======================================================================
Handle(TDataStd_IntegerArray) TDataStd_IntegerArray::Set
(const TDF_Label& label,
const Standard_GUID& theGuid,
const Standard_Integer lower,
const Standard_Integer upper,
const Standard_Boolean isDelta)
{
return SetAttr(label, lower, upper, isDelta, theGuid);
}
//=======================================================================
//function : SetValue
//purpose :
@ -153,7 +184,7 @@ Standard_Integer TDataStd_IntegerArray::Length (void) const
//=======================================================================
void TDataStd_IntegerArray::ChangeArray(const Handle(TColStd_HArray1OfInteger)& newArray,
const Standard_Boolean isCheckItems)
const Standard_Boolean isCheckItems)
{
Standard_Integer aLower = newArray->Lower();
Standard_Integer anUpper = newArray->Upper();
@ -165,16 +196,16 @@ void TDataStd_IntegerArray::ChangeArray(const Handle(TColStd_HArray1OfInteger)&
if(isCheckItems) {
Standard_Boolean isEqual = Standard_True;
for(i = aLower; i <= anUpper; i++) {
if(myValue->Value(i) != newArray->Value(i)) {
isEqual = Standard_False;
break;
}
if(myValue->Value(i) != newArray->Value(i)) {
isEqual = Standard_False;
break;
}
}
if(isEqual)
return;
return;
}
}
Backup();
// Handles of myValue of current and backuped attributes will be different!
if(myValue.IsNull() || !aDimEqual)
@ -190,8 +221,30 @@ void TDataStd_IntegerArray::ChangeArray(const Handle(TColStd_HArray1OfInteger)&
//purpose :
//=======================================================================
const Standard_GUID& TDataStd_IntegerArray::ID () const { return GetID(); }
const Standard_GUID& TDataStd_IntegerArray::ID () const { return myID; }
//=======================================================================
//function : SetID
//purpose :
//=======================================================================
void TDataStd_IntegerArray::SetID( const Standard_GUID& theGuid)
{
if(myID == theGuid) return;
Backup();
myID = theGuid;
}
//=======================================================================
//function : SetID
//purpose : sets default ID
//=======================================================================
void TDataStd_IntegerArray::SetID()
{
Backup();
myID = GetID();
}
//=======================================================================
//function : NewEmpty
@ -219,6 +272,7 @@ void TDataStd_IntegerArray::Restore(const Handle(TDF_Attribute)& With)
for(i = lower; i<=upper; i++)
myValue->SetValue(i, anArray->Value(i));
myIsDelta = anArray->myIsDelta;
myID = anArray->ID();
}
else
myValue.Nullify();
@ -238,6 +292,7 @@ void TDataStd_IntegerArray::Paste (const Handle(TDF_Attribute)& Into,
if(!anAtt.IsNull()) {
anAtt->ChangeArray( myValue, Standard_False );
anAtt->SetDelta(myIsDelta);
anAtt->SetID(myID);
}
}
}
@ -258,6 +313,9 @@ Standard_OStream& TDataStd_IntegerArray::Dump (Standard_OStream& anOS) const
anOS << " " <<myValue->Value(i);
}
anOS << " Delta is " << (myIsDelta ? "ON":"OFF");
Standard_Character sguid[Standard_GUID_SIZE_ALLOC];
myID.ToCString(sguid);
anOS << sguid;
anOS << endl;
// anOS <<"\nAttribute fields: ";
@ -278,5 +336,3 @@ Handle(TDF_DeltaOnModification) TDataStd_IntegerArray::DeltaOnModification
return new TDataStd_DeltaOnModificationOfIntArray(Handle(TDataStd_IntegerArray)::DownCast (OldAttribute));
else return new TDF_DefaultDeltaOnModification(OldAttribute);
}

View File

@ -25,6 +25,8 @@
#include <TDF_Attribute.hxx>
#include <Standard_Integer.hxx>
#include <Standard_OStream.hxx>
#include <Standard_GUID.hxx>
class TDataStd_DeltaOnModificationOfIntArray;
class Standard_GUID;
class TDF_Label;
@ -54,8 +56,16 @@ public:
//! If <isDelta> == True, DeltaOnModification of the current attribute is used.
//! If attribute is already set, all input parameters are refused and the found
//! attribute is returned.
Standard_EXPORT static Handle(TDataStd_IntegerArray) Set (const TDF_Label& label, const Standard_Integer lower, const Standard_Integer upper, const Standard_Boolean isDelta = Standard_False);
Standard_EXPORT static Handle(TDataStd_IntegerArray) Set (const TDF_Label& label, const Standard_Integer lower,
const Standard_Integer upper,
const Standard_Boolean isDelta = Standard_False);
//! Finds, or creates, an IntegerArray attribute with explicit user defined <guid>.
//! The IntegerArray attribute is returned.
Standard_EXPORT static Handle(TDataStd_IntegerArray) Set (const TDF_Label& label, const Standard_GUID& theGuid,
const Standard_Integer lower, const Standard_Integer upper,
const Standard_Boolean isDelta = Standard_False);
//! Initialize the inner array with bounds from <lower> to <upper>
Standard_EXPORT void Init (const Standard_Integer lower, const Standard_Integer upper);
@ -63,12 +73,19 @@ public:
//! OutOfRange exception is raised if <Index> doesn't respect Lower and Upper bounds of the internal array.
Standard_EXPORT void SetValue (const Standard_Integer Index, const Standard_Integer Value);
//! Sets the explicit GUID (user defined) for the attribute.
Standard_EXPORT void SetID( const Standard_GUID& theGuid) Standard_OVERRIDE;
//! Sets default GUID for the attribute.
Standard_EXPORT void SetID() Standard_OVERRIDE;
//! Return the value of the <Index>th element of the array
Standard_EXPORT Standard_Integer Value (const Standard_Integer Index) const;
Standard_Integer operator () (const Standard_Integer Index) const
{
return Value(Index);
}
Standard_Integer operator () (const Standard_Integer Index) const
{
return Value(Index);
}
//! Returns the lower boundary of this array of integers.
Standard_EXPORT Standard_Integer Lower() const;
@ -121,6 +138,8 @@ private:
Handle(TColStd_HArray1OfInteger) myValue;
Standard_Boolean myIsDelta;
Standard_GUID myID;
};

View File

@ -34,6 +34,23 @@ const Standard_GUID& TDataStd_IntegerList::GetID()
return TDataStd_IntegerListID;
}
//=======================================================================
//function : SetAttr
//purpose : Implements Set functionality
//=======================================================================
static Handle(TDataStd_IntegerList) SetAttr(const TDF_Label& label,
const Standard_GUID& theGuid)
{
Handle(TDataStd_IntegerList) A;
if (!label.FindAttribute (theGuid, A))
{
A = new TDataStd_IntegerList;
A->SetID(theGuid);
label.AddAttribute(A);
}
return A;
}
//=======================================================================
//function : TDataStd_IntegerList
//purpose : Empty Constructor
@ -49,13 +66,17 @@ TDataStd_IntegerList::TDataStd_IntegerList()
//=======================================================================
Handle(TDataStd_IntegerList) TDataStd_IntegerList::Set(const TDF_Label& label)
{
Handle(TDataStd_IntegerList) A;
if (!label.FindAttribute (TDataStd_IntegerList::GetID(), A))
{
A = new TDataStd_IntegerList;
label.AddAttribute(A);
}
return A;
return SetAttr(label, GetID());
}
//=======================================================================
//function : Set
//purpose : Set user defined attribute with specific ID
//=======================================================================
Handle(TDataStd_IntegerList) TDataStd_IntegerList::Set(const TDF_Label& label,
const Standard_GUID& theGuid)
{
return SetAttr(label, theGuid);
}
//=======================================================================
@ -101,7 +122,7 @@ void TDataStd_IntegerList::Append(const Standard_Integer value)
//purpose :
//=======================================================================
Standard_Boolean TDataStd_IntegerList::InsertBefore(const Standard_Integer value,
const Standard_Integer before_value)
const Standard_Integer before_value)
{
TColStd_ListIteratorOfListOfInteger itr(myList);
for (; itr.More(); itr.Next())
@ -142,7 +163,7 @@ Standard_Boolean TDataStd_IntegerList::InsertBeforeByIndex (const Standard_Integ
//purpose :
//=======================================================================
Standard_Boolean TDataStd_IntegerList::InsertAfter(const Standard_Integer value,
const Standard_Integer after_value)
const Standard_Integer after_value)
{
TColStd_ListIteratorOfListOfInteger itr(myList);
for (; itr.More(); itr.Next())
@ -262,7 +283,30 @@ const TColStd_ListOfInteger& TDataStd_IntegerList::List() const
//=======================================================================
const Standard_GUID& TDataStd_IntegerList::ID () const
{
return GetID();
return myID;
}
//=======================================================================
//function : SetID
//purpose :
//=======================================================================
void TDataStd_IntegerList::SetID( const Standard_GUID& theGuid)
{
if(myID == theGuid) return;
Backup();
myID = theGuid;
}
//=======================================================================
//function : SetID
//purpose : sets default ID
//=======================================================================
void TDataStd_IntegerList::SetID()
{
Backup();
myID = GetID();
}
//=======================================================================
@ -287,6 +331,7 @@ void TDataStd_IntegerList::Restore(const Handle(TDF_Attribute)& With)
{
myList.Append(itr.Value());
}
myID = aList->ID();
}
//=======================================================================
@ -294,7 +339,7 @@ void TDataStd_IntegerList::Restore(const Handle(TDF_Attribute)& With)
//purpose :
//=======================================================================
void TDataStd_IntegerList::Paste (const Handle(TDF_Attribute)& Into,
const Handle(TDF_RelocationTable)& ) const
const Handle(TDF_RelocationTable)& ) const
{
Handle(TDataStd_IntegerList) aList = Handle(TDataStd_IntegerList)::DownCast(Into);
aList->Clear();
@ -303,6 +348,7 @@ void TDataStd_IntegerList::Paste (const Handle(TDF_Attribute)& Into,
{
aList->Append(itr.Value());
}
aList->SetID(myID);
}
//=======================================================================
@ -311,6 +357,10 @@ void TDataStd_IntegerList::Paste (const Handle(TDF_Attribute)& Into,
//=======================================================================
Standard_OStream& TDataStd_IntegerList::Dump (Standard_OStream& anOS) const
{
anOS << "IntegerList";
anOS << "\nIntegerList: ";
Standard_Character sguid[Standard_GUID_SIZE_ALLOC];
myID.ToCString(sguid);
anOS << sguid;
anOS << endl;
return anOS;
}

View File

@ -24,6 +24,8 @@
#include <Standard_Boolean.hxx>
#include <Standard_Integer.hxx>
#include <Standard_OStream.hxx>
#include <Standard_GUID.hxx>
class Standard_GUID;
class TDF_Label;
class TDF_Attribute;
@ -47,7 +49,10 @@ public:
//! Finds or creates a list of integer values attribute.
Standard_EXPORT static Handle(TDataStd_IntegerList) Set (const TDF_Label& label);
//! Finds or creates a list of integer values attribute with explicit user defined <guid>.
Standard_EXPORT static Handle(TDataStd_IntegerList) Set (const TDF_Label& label, const Standard_GUID& theGuid);
Standard_EXPORT TDataStd_IntegerList();
Standard_EXPORT Standard_Boolean IsEmpty() const;
@ -57,7 +62,13 @@ public:
Standard_EXPORT void Prepend (const Standard_Integer value);
Standard_EXPORT void Append (const Standard_Integer value);
//! Sets the explicit GUID (user defined) for the attribute.
Standard_EXPORT void SetID( const Standard_GUID& theGuid) Standard_OVERRIDE;
//! Sets default GUID for the attribute.
Standard_EXPORT void SetID() Standard_OVERRIDE;
//! Inserts the <value> before the first meet of <before_value>.
Standard_EXPORT Standard_Boolean InsertBefore (const Standard_Integer value, const Standard_Integer before_value);
@ -110,7 +121,7 @@ private:
TColStd_ListOfInteger myList;
Standard_GUID myID;
};

View File

@ -119,6 +119,16 @@ void TDataStd_Name::SetID( const Standard_GUID& theGuid)
myID = theGuid;
}
//=======================================================================
//function : SetID
//purpose : sets default ID
//=======================================================================
void TDataStd_Name::SetID()
{
Backup();
myID = GetID();
}
// TDF_Attribute methods
//=======================================================================
//function : ID

View File

@ -81,7 +81,10 @@ public:
Standard_EXPORT void Set (const TCollection_ExtendedString& S);
//! Sets the explicit user defined GUID to the attribute.
Standard_EXPORT void SetID (const Standard_GUID& guid);
Standard_EXPORT void SetID (const Standard_GUID& guid) Standard_OVERRIDE;
//! Sets default GUID for the attribute.
Standard_EXPORT void SetID() Standard_OVERRIDE;
//! Returns the name contained in this name attribute.
Standard_EXPORT const TCollection_ExtendedString& Get() const;

View File

@ -172,6 +172,16 @@ void TDataStd_Real::SetID( const Standard_GUID& theGuid)
Backup();
myID = theGuid;
}
//=======================================================================
//function : SetID
//purpose : sets default ID
//=======================================================================
void TDataStd_Real::SetID()
{
Backup();
myID = GetID();
}
//=======================================================================
//function : NewEmpty
//purpose :

View File

@ -72,7 +72,10 @@ public:
Standard_EXPORT void Set (const Standard_Real V);
//! Sets the explicit GUID for the attribute.
Standard_EXPORT void SetID (const Standard_GUID& guid);
Standard_EXPORT void SetID (const Standard_GUID& guid) Standard_OVERRIDE;
//! Sets default GUID for the attribute.
Standard_EXPORT void SetID() Standard_OVERRIDE;
//! Returns the real number value contained in the attribute.
Standard_EXPORT Standard_Real Get() const;

View File

@ -37,13 +37,39 @@ const Standard_GUID& TDataStd_RealArray::GetID()
return TDataStd_RealArrayID;
}
//=======================================================================
//function : SetAttr
//purpose : Implements Set functionality
//=======================================================================
static Handle(TDataStd_RealArray) SetAttr(const TDF_Label& label,
const Standard_Integer lower,
const Standard_Integer upper,
const Standard_Boolean isDelta,
const Standard_GUID& theGuid)
{
Handle(TDataStd_RealArray) A;
if (!label.FindAttribute (theGuid, A))
{
A = new TDataStd_RealArray;
A->Init (lower, upper);
A->SetDelta(isDelta);
A->SetID(theGuid);
label.AddAttribute(A);
}
else if (lower != A->Lower() || upper != A->Upper())
{
A->Init(lower, upper);
}
return A;
}
//=======================================================================
//function : TDataStd_RealArray
//purpose : Empty Constructor
//=======================================================================
TDataStd_RealArray::TDataStd_RealArray() : myIsDelta(Standard_False){}
TDataStd_RealArray::TDataStd_RealArray() : myIsDelta(Standard_False)
{}
//=======================================================================
//function : Init
@ -53,8 +79,8 @@ TDataStd_RealArray::TDataStd_RealArray() : myIsDelta(Standard_False){}
void TDataStd_RealArray::Init(const Standard_Integer lower,
const Standard_Integer upper)
{
Standard_RangeError_Raise_if(upper < lower,"TDataStd_RealArray::Init");
Backup(); // jfa 15.01.2003 for LH3D1378
myValue = new TColStd_HArray1OfReal(lower, upper, 0.);
}
@ -67,23 +93,25 @@ Handle(TDataStd_RealArray) TDataStd_RealArray::Set
(const TDF_Label& label,
const Standard_Integer lower,
const Standard_Integer upper,
const Standard_Boolean isDelta)
const Standard_Boolean isDelta)
{
Handle(TDataStd_RealArray) A;
if (!label.FindAttribute (TDataStd_RealArray::GetID(), A)) {
A = new TDataStd_RealArray;
A->Init (lower, upper);
A->SetDelta(isDelta);
label.AddAttribute(A);
}
else if (lower != A->Lower() || upper != A->Upper())
{
A->Init (lower, upper);
}
return A;
return SetAttr(label, lower, upper, isDelta, GetID());
}
//=======================================================================
//function : Set
//purpose : Set user defined attribute with specific ID
//=======================================================================
Handle(TDataStd_RealArray) TDataStd_RealArray::Set
(const TDF_Label& label,
const Standard_GUID& theGuid,
const Standard_Integer lower,
const Standard_Integer upper,
const Standard_Boolean isDelta)
{
return SetAttr(label, lower, upper, isDelta, theGuid);
}
//=======================================================================
//function : SetValue
//purpose :
@ -95,7 +123,7 @@ void TDataStd_RealArray::SetValue (const Standard_Integer index,
// OCC2932 correction
if(myValue.IsNull()) return;
if(myValue->Value(index) == value)
return;
return;
Backup();
myValue->SetValue(index, value);
}
@ -155,7 +183,7 @@ Standard_Integer TDataStd_RealArray::Length (void) const
//=======================================================================
void TDataStd_RealArray::ChangeArray(const Handle(TColStd_HArray1OfReal)& newArray,
const Standard_Boolean isCheckItems)
const Standard_Boolean isCheckItems)
{
Standard_Integer aLower = newArray->Lower();
Standard_Integer anUpper = newArray->Upper();
@ -167,13 +195,13 @@ void TDataStd_RealArray::ChangeArray(const Handle(TColStd_HArray1OfReal)& newArr
Standard_Boolean isEqual = Standard_True;
if(isCheckItems) {
for(i = aLower; i <= anUpper; i++) {
if(myValue->Value(i) != newArray->Value(i)) {
isEqual = Standard_False;
break;
}
if(myValue->Value(i) != newArray->Value(i)) {
isEqual = Standard_False;
break;
}
}
if(isEqual)
return;
return;
}
}
@ -191,8 +219,30 @@ void TDataStd_RealArray::ChangeArray(const Handle(TColStd_HArray1OfReal)& newArr
//purpose :
//=======================================================================
const Standard_GUID& TDataStd_RealArray::ID () const { return GetID(); }
const Standard_GUID& TDataStd_RealArray::ID () const { return myID; }
//=======================================================================
//function : SetID
//purpose :
//=======================================================================
void TDataStd_RealArray::SetID( const Standard_GUID& theGuid)
{
if(myID == theGuid) return;
Backup();
myID = theGuid;
}
//=======================================================================
//function : SetID
//purpose : sets default ID
//=======================================================================
void TDataStd_RealArray::SetID()
{
Backup();
myID = GetID();
}
//=======================================================================
//function : NewEmpty
@ -220,6 +270,7 @@ void TDataStd_RealArray::Restore(const Handle(TDF_Attribute)& With)
myValue = new TColStd_HArray1OfReal(lower, upper);
for(i = lower; i<=upper; i++)
myValue->SetValue(i, anArray->Value(i));
myID = anArray->ID();
}
else
myValue.Nullify();
@ -238,6 +289,7 @@ void TDataStd_RealArray::Paste (const Handle(TDF_Attribute)& Into,
if(!anAtt.IsNull()) {
anAtt->ChangeArray( myValue, Standard_False );
anAtt->SetDelta(myIsDelta);
anAtt->SetID(myID);
}
}
}
@ -258,6 +310,9 @@ Standard_OStream& TDataStd_RealArray::Dump (Standard_OStream& anOS) const
anOS << " " <<myValue->Value(i);
}
anOS << " Delta is " << (myIsDelta ? "ON":"OFF");
Standard_Character sguid[Standard_GUID_SIZE_ALLOC];
myID.ToCString(sguid);
anOS << sguid;
anOS << endl;
return anOS;
}

View File

@ -26,6 +26,8 @@
#include <Standard_Integer.hxx>
#include <Standard_Real.hxx>
#include <Standard_OStream.hxx>
#include <Standard_GUID.hxx>
class TDataStd_DeltaOnModificationOfRealArray;
class Standard_GUID;
class TDF_Label;
@ -56,20 +58,33 @@ public:
//! If attribute is already set, input parameter <isDelta> is refused and the found
//! attribute returned.
Standard_EXPORT static Handle(TDataStd_RealArray) Set (const TDF_Label& label, const Standard_Integer lower, const Standard_Integer upper, const Standard_Boolean isDelta = Standard_False);
//! Finds, or creates, an RealArray attribute with explicit user defined <guid>.
//! The RealArray attribute is returned.
Standard_EXPORT static Handle(TDataStd_RealArray) Set (const TDF_Label& label, const Standard_GUID& theGuid,
const Standard_Integer lower, const Standard_Integer upper,
const Standard_Boolean isDelta = Standard_False);
//! Initialize the inner array with bounds from <lower> to <upper>
Standard_EXPORT void Init (const Standard_Integer lower, const Standard_Integer upper);
//! Sets the explicit GUID (user defined) for the attribute.
Standard_EXPORT void SetID( const Standard_GUID& theGuid) Standard_OVERRIDE;
//! Sets default GUID for the attribute.
Standard_EXPORT void SetID() Standard_OVERRIDE;
//! Sets the <Index>th element of the array to <Value>
//! OutOfRange exception is raised if <Index> doesn't respect Lower and Upper bounds of the internal array.
Standard_EXPORT void SetValue (const Standard_Integer Index, const Standard_Real Value);
//! Return the value of the <Index>th element of the array
Standard_EXPORT Standard_Real Value (const Standard_Integer Index) const;
Standard_Real operator () (const Standard_Integer Index) const
{
return Value(Index);
}
Standard_Real operator () (const Standard_Integer Index) const
{
return Value(Index);
}
//! Returns the lower boundary of the array.
Standard_EXPORT Standard_Integer Lower() const;
@ -122,6 +137,7 @@ private:
Handle(TColStd_HArray1OfReal) myValue;
Standard_Boolean myIsDelta;
Standard_GUID myID;
};

View File

@ -34,6 +34,23 @@ const Standard_GUID& TDataStd_RealList::GetID()
return TDataStd_RealListID;
}
//=======================================================================
//function : SetAttr
//purpose : Implements Set functionality
//=======================================================================
static Handle(TDataStd_RealList) SetAttr(const TDF_Label& label,
const Standard_GUID& theGuid)
{
Handle(TDataStd_RealList) A;
if (!label.FindAttribute (theGuid, A))
{
A = new TDataStd_RealList;
A->SetID(theGuid);
label.AddAttribute(A);
}
return A;
}
//=======================================================================
//function : TDataStd_RealList
//purpose : Empty Constructor
@ -49,13 +66,17 @@ TDataStd_RealList::TDataStd_RealList()
//=======================================================================
Handle(TDataStd_RealList) TDataStd_RealList::Set(const TDF_Label& label)
{
Handle(TDataStd_RealList) A;
if (!label.FindAttribute (TDataStd_RealList::GetID(), A))
{
A = new TDataStd_RealList;
label.AddAttribute(A);
}
return A;
return SetAttr(label, GetID());
}
//=======================================================================
//function : Set
//purpose : Set user defined attribute with specific ID
//=======================================================================
Handle(TDataStd_RealList) TDataStd_RealList::Set(const TDF_Label& label,
const Standard_GUID& theGuid)
{
return SetAttr(label, theGuid);
}
//=======================================================================
@ -101,7 +122,7 @@ void TDataStd_RealList::Append(const Standard_Real value)
//purpose :
//=======================================================================
Standard_Boolean TDataStd_RealList::InsertBefore(const Standard_Real value,
const Standard_Real before_value)
const Standard_Real before_value)
{
TColStd_ListIteratorOfListOfReal itr(myList);
for (; itr.More(); itr.Next())
@ -142,7 +163,7 @@ Standard_Boolean TDataStd_RealList::InsertBeforeByIndex (const Standard_Integer
//purpose :
//=======================================================================
Standard_Boolean TDataStd_RealList::InsertAfter(const Standard_Real value,
const Standard_Real after_value)
const Standard_Real after_value)
{
TColStd_ListIteratorOfListOfReal itr(myList);
for (; itr.More(); itr.Next())
@ -262,7 +283,28 @@ const TColStd_ListOfReal& TDataStd_RealList::List() const
//=======================================================================
const Standard_GUID& TDataStd_RealList::ID () const
{
return GetID();
return myID;
}
//=======================================================================
//function : SetID
//purpose :
//=======================================================================
void TDataStd_RealList::SetID( const Standard_GUID& theGuid)
{
if(myID == theGuid) return;
Backup();
myID = theGuid;
}
//=======================================================================
//function : SetID
//purpose : sets default ID
//=======================================================================
void TDataStd_RealList::SetID()
{
Backup();
myID = GetID();
}
//=======================================================================
@ -287,6 +329,7 @@ void TDataStd_RealList::Restore(const Handle(TDF_Attribute)& With)
{
myList.Append(itr.Value());
}
myID = aList->ID();
}
//=======================================================================
@ -294,7 +337,7 @@ void TDataStd_RealList::Restore(const Handle(TDF_Attribute)& With)
//purpose :
//=======================================================================
void TDataStd_RealList::Paste (const Handle(TDF_Attribute)& Into,
const Handle(TDF_RelocationTable)& ) const
const Handle(TDF_RelocationTable)& ) const
{
Handle(TDataStd_RealList) aList = Handle(TDataStd_RealList)::DownCast(Into);
aList->Clear();
@ -303,6 +346,7 @@ void TDataStd_RealList::Paste (const Handle(TDF_Attribute)& Into,
{
aList->Append(itr.Value());
}
aList->SetID(myID);
}
//=======================================================================
@ -311,6 +355,10 @@ void TDataStd_RealList::Paste (const Handle(TDF_Attribute)& Into,
//=======================================================================
Standard_OStream& TDataStd_RealList::Dump (Standard_OStream& anOS) const
{
anOS << "RealList";
anOS << "\nRealList: ";
Standard_Character sguid[Standard_GUID_SIZE_ALLOC];
myID.ToCString(sguid);
anOS << sguid;
anOS << endl;
return anOS;
}

View File

@ -25,6 +25,8 @@
#include <Standard_Integer.hxx>
#include <Standard_Real.hxx>
#include <Standard_OStream.hxx>
#include <Standard_GUID.hxx>
class Standard_GUID;
class TDF_Label;
class TDF_Attribute;
@ -48,7 +50,10 @@ public:
//! Finds or creates a list of double values attribute.
Standard_EXPORT static Handle(TDataStd_RealList) Set (const TDF_Label& label);
//! Finds or creates a list of double values attribute with explicit user defined <guid>.
Standard_EXPORT static Handle(TDataStd_RealList) Set (const TDF_Label& label, const Standard_GUID& theGuid);
Standard_EXPORT TDataStd_RealList();
Standard_EXPORT Standard_Boolean IsEmpty() const;
@ -58,7 +63,13 @@ public:
Standard_EXPORT void Prepend (const Standard_Real value);
Standard_EXPORT void Append (const Standard_Real value);
//! Sets the explicit GUID (user defined) for the attribute.
Standard_EXPORT void SetID( const Standard_GUID& theGuid) Standard_OVERRIDE;
//! Sets default GUID for the attribute.
Standard_EXPORT void SetID() Standard_OVERRIDE;
//! Inserts the <value> before the first meet of <before_value>.
Standard_EXPORT Standard_Boolean InsertBefore (const Standard_Real value, const Standard_Real before_value);
@ -111,7 +122,7 @@ private:
TColStd_ListOfReal myList;
Standard_GUID myID;
};

View File

@ -34,6 +34,30 @@ const Standard_GUID& TDataStd_ReferenceArray::GetID()
return TDataStd_ReferenceArrayID;
}
//=======================================================================
//function : SetAttr
//purpose : Implements Set functionality
//=======================================================================
static Handle(TDataStd_ReferenceArray) SetAttr(const TDF_Label& label,
const Standard_Integer lower,
const Standard_Integer upper,
const Standard_GUID& theGuid)
{
Handle(TDataStd_ReferenceArray) A;
if (!label.FindAttribute (theGuid, A))
{
A = new TDataStd_ReferenceArray;
A->Init (lower, upper);
A->SetID(theGuid);
label.AddAttribute(A);
}
else if (lower != A->Lower() || upper != A->Upper())
{
A->Init(lower, upper);
}
return A;
}
//=======================================================================
//function : TDataStd_ReferenceArray
//purpose : Empty Constructor
@ -48,7 +72,7 @@ TDataStd_ReferenceArray::TDataStd_ReferenceArray()
//purpose :
//=======================================================================
void TDataStd_ReferenceArray::Init(const Standard_Integer lower,
const Standard_Integer upper)
const Standard_Integer upper)
{
Standard_RangeError_Raise_if(upper < lower,"TDataStd_ReferenceArray::Init");
Backup();
@ -60,29 +84,30 @@ void TDataStd_ReferenceArray::Init(const Standard_Integer lower,
//purpose :
//=======================================================================
Handle(TDataStd_ReferenceArray) TDataStd_ReferenceArray::Set(const TDF_Label& label,
const Standard_Integer lower,
const Standard_Integer upper)
const Standard_Integer lower,
const Standard_Integer upper)
{
Handle(TDataStd_ReferenceArray) A;
if (!label.FindAttribute (TDataStd_ReferenceArray::GetID(), A))
{
A = new TDataStd_ReferenceArray;
A->Init (lower, upper);
label.AddAttribute(A);
}
else if (lower != A->Lower() || upper != A->Upper())
{
A->Init(lower, upper);
}
return A;
return SetAttr(label, lower, upper, GetID());
}
//=======================================================================
//function : Set
//purpose : Set user defined attribute with specific ID
//=======================================================================
Handle(TDataStd_ReferenceArray) TDataStd_ReferenceArray::Set(const TDF_Label& label,
const Standard_GUID& theGuid,
const Standard_Integer lower,
const Standard_Integer upper)
{
return SetAttr(label, lower, upper, theGuid);
}
//=======================================================================
//function : SetValue
//purpose :
//=======================================================================
void TDataStd_ReferenceArray::SetValue (const Standard_Integer index,
const TDF_Label& value)
const TDF_Label& value)
{
if(myArray.IsNull()) return;
if (value == myArray->Value(index))
@ -162,13 +187,13 @@ void TDataStd_ReferenceArray::SetInternalArray (const Handle(TDataStd_HLabelArra
Standard_Boolean isEqual = Standard_True;
if(isCheckItems) {
for(i = aLower; i <= anUpper; i++) {
if(myArray->Value(i) != values->Value(i)) {
isEqual = Standard_False;
break;
}
if(myArray->Value(i) != values->Value(i)) {
isEqual = Standard_False;
break;
}
}
if(isEqual)
return;
return;
}
}
#endif
@ -188,7 +213,30 @@ void TDataStd_ReferenceArray::SetInternalArray (const Handle(TDataStd_HLabelArra
//=======================================================================
const Standard_GUID& TDataStd_ReferenceArray::ID () const
{
return GetID();
return myID;
}
//=======================================================================
//function : SetID
//purpose :
//=======================================================================
void TDataStd_ReferenceArray::SetID( const Standard_GUID& theGuid)
{
if(myID == theGuid) return;
Backup();
myID = theGuid;
}
//=======================================================================
//function : SetID
//purpose : sets default ID
//=======================================================================
void TDataStd_ReferenceArray::SetID()
{
Backup();
myID = GetID();
}
//=======================================================================
@ -216,6 +264,7 @@ void TDataStd_ReferenceArray::Restore(const Handle(TDF_Attribute)& With)
{
myArray->SetValue(i, arr.Value(i));
}
myID = anArray->ID();
}
else
{
@ -228,7 +277,7 @@ void TDataStd_ReferenceArray::Restore(const Handle(TDF_Attribute)& With)
//purpose :
//=======================================================================
void TDataStd_ReferenceArray::Paste (const Handle(TDF_Attribute)& Into,
const Handle(TDF_RelocationTable)& RT) const
const Handle(TDF_RelocationTable)& RT) const
{
Handle(TDataStd_ReferenceArray) anArray = Handle(TDataStd_ReferenceArray)::DownCast(Into);
if (myArray.IsNull())
@ -246,10 +295,11 @@ void TDataStd_ReferenceArray::Paste (const Handle(TDF_Attribute)& Into,
if (!L.IsNull())
{
if (!RT->HasRelocation(L, rL))
rL = L;
rL = L;
anArray->myArray->SetValue(i, rL);
}
}
anArray->SetID(myID);
}
//=======================================================================
@ -265,7 +315,7 @@ void TDataStd_ReferenceArray::References(const Handle(TDF_DataSet)& aDataSet) co
for (; i <= upper; i++)
{
if (!arr.Value(i).IsNull())
aDataSet->AddLabel(arr.Value(i));
aDataSet->AddLabel(arr.Value(i));
}
}
}
@ -276,6 +326,9 @@ void TDataStd_ReferenceArray::References(const Handle(TDF_DataSet)& aDataSet) co
//=======================================================================
Standard_OStream& TDataStd_ReferenceArray::Dump (Standard_OStream& anOS) const
{
anOS << "ReferenceArray";
anOS << "\nReferenceArray: ";
Standard_Character sguid[Standard_GUID_SIZE_ALLOC];
myID.ToCString(sguid);
anOS << sguid << endl;
return anOS;
}

View File

@ -25,6 +25,8 @@
#include <TDF_Label.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_OStream.hxx>
#include <Standard_GUID.hxx>
class Standard_GUID;
class TDF_Label;
class TDF_Attribute;
@ -49,6 +51,10 @@ public:
//! Finds or creates an array of reference values (labels) attribute.
Standard_EXPORT static Handle(TDataStd_ReferenceArray) Set (const TDF_Label& label, const Standard_Integer lower, const Standard_Integer upper);
//! Finds or creates an array of reference values (labels) attribute with explicit user defined <guid>.
Standard_EXPORT static Handle(TDataStd_ReferenceArray) Set (const TDF_Label& label, const Standard_GUID& theGuid,
const Standard_Integer lower, const Standard_Integer upper);
//! Initialize the inner array with bounds from <lower> to <upper>
Standard_EXPORT void Init (const Standard_Integer lower, const Standard_Integer upper);
@ -56,13 +62,20 @@ public:
//! Sets the <Index>th element of the array to <Value>
//! OutOfRange exception is raised if <Index> doesn't respect Lower and Upper bounds of the internal array.
Standard_EXPORT void SetValue (const Standard_Integer index, const TDF_Label& value);
//! Sets the explicit GUID (user defined) for the attribute.
Standard_EXPORT void SetID( const Standard_GUID& theGuid) Standard_OVERRIDE;
//! Sets default GUID for the attribute.
Standard_EXPORT void SetID() Standard_OVERRIDE;
//! Returns the value of the <Index>th element of the array.
Standard_EXPORT TDF_Label Value (const Standard_Integer Index) const;
TDF_Label operator () (const Standard_Integer Index) const
{
return Value(Index);
}
TDF_Label operator () (const Standard_Integer Index) const
{
return Value(Index);
}
//! Returns the lower boundary of the array.
Standard_EXPORT Standard_Integer Lower() const;
@ -105,7 +118,7 @@ private:
Handle(TDataStd_HLabelArray1) myArray;
Standard_GUID myID;
};

View File

@ -35,6 +35,23 @@ const Standard_GUID& TDataStd_ReferenceList::GetID()
return TDataStd_ReferenceListID;
}
//=======================================================================
//function : SetAttr
//purpose : Implements Set functionality
//=======================================================================
static Handle(TDataStd_ReferenceList) SetAttr(const TDF_Label& label,
const Standard_GUID& theGuid)
{
Handle(TDataStd_ReferenceList) A;
if (!label.FindAttribute (theGuid, A))
{
A = new TDataStd_ReferenceList;
A->SetID(theGuid);
label.AddAttribute(A);
}
return A;
}
//=======================================================================
//function : TDataStd_ReferenceList
//purpose : Empty Constructor
@ -50,13 +67,17 @@ TDataStd_ReferenceList::TDataStd_ReferenceList()
//=======================================================================
Handle(TDataStd_ReferenceList) TDataStd_ReferenceList::Set(const TDF_Label& label)
{
Handle(TDataStd_ReferenceList) A;
if (!label.FindAttribute (TDataStd_ReferenceList::GetID(), A))
{
A = new TDataStd_ReferenceList;
label.AddAttribute(A);
}
return A;
return SetAttr(label, GetID());
}
//=======================================================================
//function : Set
//purpose : Set user defined attribute with specific ID
//=======================================================================
Handle(TDataStd_ReferenceList) TDataStd_ReferenceList::Set(const TDF_Label& label,
const Standard_GUID& theGuid)
{
return SetAttr(label, theGuid);
}
//=======================================================================
@ -102,7 +123,7 @@ void TDataStd_ReferenceList::Append(const TDF_Label& value)
//purpose :
//=======================================================================
Standard_Boolean TDataStd_ReferenceList::InsertBefore(const TDF_Label& value,
const TDF_Label& before_value)
const TDF_Label& before_value)
{
TDF_ListIteratorOfLabelList itr(myList);
for (; itr.More(); itr.Next())
@ -143,7 +164,7 @@ Standard_Boolean TDataStd_ReferenceList::InsertBefore (const Standard_Integer in
//purpose :
//=======================================================================
Standard_Boolean TDataStd_ReferenceList::InsertAfter(const TDF_Label& value,
const TDF_Label& after_value)
const TDF_Label& after_value)
{
TDF_ListIteratorOfLabelList itr(myList);
for (; itr.More(); itr.Next())
@ -263,7 +284,28 @@ const TDF_LabelList& TDataStd_ReferenceList::List() const
//=======================================================================
const Standard_GUID& TDataStd_ReferenceList::ID () const
{
return GetID();
return myID;
}
//=======================================================================
//function : SetID
//purpose :
//=======================================================================
void TDataStd_ReferenceList::SetID( const Standard_GUID& theGuid)
{
if(myID == theGuid) return;
Backup();
myID = theGuid;
}
//=======================================================================
//function : SetID
//purpose : sets default ID
//=======================================================================
void TDataStd_ReferenceList::SetID()
{
Backup();
myID = GetID();
}
//=======================================================================
@ -271,7 +313,7 @@ const Standard_GUID& TDataStd_ReferenceList::ID () const
//purpose :
//=======================================================================
Handle(TDF_Attribute) TDataStd_ReferenceList::NewEmpty () const
{
{
return new TDataStd_ReferenceList();
}
@ -288,6 +330,7 @@ void TDataStd_ReferenceList::Restore(const Handle(TDF_Attribute)& With)
{
myList.Append(itr.Value());
}
myID = aList->ID();
}
//=======================================================================
@ -295,7 +338,7 @@ void TDataStd_ReferenceList::Restore(const Handle(TDF_Attribute)& With)
//purpose :
//=======================================================================
void TDataStd_ReferenceList::Paste (const Handle(TDF_Attribute)& Into,
const Handle(TDF_RelocationTable)& RT) const
const Handle(TDF_RelocationTable)& RT) const
{
Handle(TDataStd_ReferenceList) aList = Handle(TDataStd_ReferenceList)::DownCast(Into);
aList->Clear();
@ -306,10 +349,11 @@ void TDataStd_ReferenceList::Paste (const Handle(TDF_Attribute)& Into,
if (!L.IsNull())
{
if (!RT->HasRelocation(L, rL))
rL = L;
rL = L;
aList->Append(rL);
}
}
aList->SetID(myID);
}
//=======================================================================
@ -334,6 +378,10 @@ void TDataStd_ReferenceList::References(const Handle(TDF_DataSet)& aDataSet) con
//=======================================================================
Standard_OStream& TDataStd_ReferenceList::Dump (Standard_OStream& anOS) const
{
anOS << "ReferenceList";
anOS << "\nReferenceList: ";
Standard_Character sguid[Standard_GUID_SIZE_ALLOC];
myID.ToCString(sguid);
anOS << sguid;
anOS << endl;
return anOS;
}

View File

@ -24,6 +24,8 @@
#include <Standard_Boolean.hxx>
#include <Standard_Integer.hxx>
#include <Standard_OStream.hxx>
#include <Standard_GUID.hxx>
class Standard_GUID;
class TDF_Label;
class TDF_Attribute;
@ -48,6 +50,9 @@ public:
//! Finds or creates a list of reference values (labels) attribute.
Standard_EXPORT static Handle(TDataStd_ReferenceList) Set (const TDF_Label& label);
//! Finds or creates a list of reference values (labels) attribute with explicit user defined <guid>.
Standard_EXPORT static Handle(TDataStd_ReferenceList) Set (const TDF_Label& label, const Standard_GUID& theGuid);
Standard_EXPORT TDataStd_ReferenceList();
@ -58,7 +63,13 @@ public:
Standard_EXPORT void Prepend (const TDF_Label& value);
Standard_EXPORT void Append (const TDF_Label& value);
//! Sets the explicit GUID (user defined) for the attribute.
Standard_EXPORT void SetID( const Standard_GUID& theGuid) Standard_OVERRIDE;
//! Sets default GUID for the attribute.
Standard_EXPORT void SetID() Standard_OVERRIDE;
//! Inserts the <value> before the first meet of <before_value>.
Standard_EXPORT Standard_Boolean InsertBefore (const TDF_Label& value, const TDF_Label& before_value);
@ -113,7 +124,7 @@ private:
TDF_LabelList myList;
Standard_GUID myID;
};

View File

@ -50,7 +50,7 @@ public:
Standard_EXPORT TDataStd_UAttribute();
Standard_EXPORT void SetID (const Standard_GUID& LocalID);
Standard_EXPORT void SetID (const Standard_GUID& LocalID) Standard_OVERRIDE;
Standard_EXPORT const Standard_GUID& ID() const Standard_OVERRIDE;

View File

@ -178,24 +178,21 @@ void XCAFDoc_Datum::SetObject(const Handle(XCAFDimTolObjects_DatumObject)& theOb
anIter.Value().ForgetAllAttributes();
}
if (!theObject->GetName().IsNull() && !theObject->GetName()->IsEmpty())
Handle(TDataStd_AsciiString) anAttName = TDataStd_AsciiString::Set(Label().FindChild(ChildLab_Name),
theObject->GetName()->String());
Handle(TDataStd_AsciiString) anAttName = TDataStd_AsciiString::Set(Label().FindChild(ChildLab_Name),
theObject->GetName()->String());
Handle(TDataStd_Integer) aPosition = TDataStd_Integer::Set(Label().FindChild(ChildLab_Position),
theObject->GetPosition());
theObject->GetPosition());
if(theObject->GetModifiers().Length() > 0)
{
Handle(TDataStd_IntegerArray) aModifiers;
if(!Label().FindChild(ChildLab_Modifiers).FindAttribute(TDataStd_IntegerArray::GetID(), aModifiers))
{
aModifiers = new TDataStd_IntegerArray();
Label().FindChild(ChildLab_Modifiers).AddAttribute(aModifiers);
}
{
Handle(TColStd_HArray1OfInteger) anArr = new TColStd_HArray1OfInteger(1,theObject->GetModifiers().Length());
for(Standard_Integer i = 1; i <= theObject->GetModifiers().Length(); i++)
anArr->SetValue(i,theObject->GetModifiers().Value(i));
aModifiers->ChangeArray(anArr);
Handle(TDataStd_IntegerArray) aModifiers = TDataStd_IntegerArray::Set(Label().FindChild(ChildLab_Modifiers),
1, theObject->GetModifiers().Length());
if(!aModifiers.IsNull())
aModifiers->ChangeArray(anArr);
}
XCAFDimTolObjects_DatumModifWithValue aM;
@ -204,19 +201,19 @@ void XCAFDoc_Datum::SetObject(const Handle(XCAFDimTolObjects_DatumObject)& theOb
if(aM != XCAFDimTolObjects_DatumModifWithValue_None)
{
Handle(TDataStd_Integer) aModifierWithValueM =
TDataStd_Integer::Set(Label().FindChild(ChildLab_ModifierWithValue), aM);
TDataStd_Integer::Set(Label().FindChild(ChildLab_ModifierWithValue), aM);
Handle(TDataStd_Real) aModifierWithValueV =
TDataStd_Real::Set(Label().FindChild(ChildLab_ModifierWithValue), aV);
TDataStd_Real::Set(Label().FindChild(ChildLab_ModifierWithValue), aV);
}
Handle(TDataStd_Integer) aIsTarget = TDataStd_Integer::Set(Label().FindChild(ChildLab_IsDTarget),
theObject->IsDatumTarget());
theObject->IsDatumTarget());
if(theObject->IsDatumTarget())
{
Handle(TDataStd_Integer) aType = TDataStd_Integer::Set(Label().FindChild(ChildLab_DTargetType),
theObject->GetDatumTargetType());
theObject->GetDatumTargetType());
if(theObject->GetDatumTargetType() == XCAFDimTolObjects_DatumTargetType_Area)
{
@ -228,94 +225,90 @@ void XCAFDoc_Datum::SetObject(const Handle(XCAFDimTolObjects_DatumObject)& theOb
}
else if (theObject->HasDatumTargetParams())
{
Handle(TDataStd_RealArray) aLoc = new TDataStd_RealArray();
Handle(TDataStd_RealArray) aN = new TDataStd_RealArray();
Handle(TDataStd_RealArray) aR = new TDataStd_RealArray();
gp_Ax2 anAx = theObject->GetDatumTargetAxis();
Handle(TColStd_HArray1OfReal) aLocArr = new TColStd_HArray1OfReal(1, 3);
for (Standard_Integer i = 1; i <= 3; i++)
aLocArr->SetValue(i, anAx.Location().Coord(i));
aLoc->ChangeArray(aLocArr);
Handle(TDataStd_RealArray) aLoc = TDataStd_RealArray::Set(Label().FindChild(ChildLab_AxisLoc), 1, 3);
if(!aLoc.IsNull())
aLoc->ChangeArray(aLocArr);
Handle(TColStd_HArray1OfReal) aNArr = new TColStd_HArray1OfReal(1, 3);
for (Standard_Integer i = 1; i <= 3; i++)
aNArr->SetValue(i, anAx.Direction().Coord(i));
aN->ChangeArray(aNArr);
Handle(TDataStd_RealArray) aN = TDataStd_RealArray::Set(Label().FindChild(ChildLab_AxisN), 1, 3);
if(!aN.IsNull())
aN->ChangeArray(aNArr);
Handle(TColStd_HArray1OfReal) aRArr = new TColStd_HArray1OfReal(1, 3);
for (Standard_Integer i = 1; i <= 3; i++)
aRArr->SetValue(i, anAx.XDirection().Coord(i));
aR->ChangeArray(aRArr);
Label().FindChild(ChildLab_AxisLoc).AddAttribute(aLoc);
Label().FindChild(ChildLab_AxisN).AddAttribute(aN);
Label().FindChild(ChildLab_AxisRef).AddAttribute(aR);
Handle(TDataStd_RealArray) aR = TDataStd_RealArray::Set(Label().FindChild(ChildLab_AxisRef), 1, 3);
if(!aR.IsNull())
aR->ChangeArray(aRArr);
if(theObject->GetDatumTargetType() != XCAFDimTolObjects_DatumTargetType_Point)
{
Handle(TDataStd_Real) aLen = TDataStd_Real::Set(Label().FindChild(ChildLab_DTargetLength),
theObject->GetDatumTargetLength());
theObject->GetDatumTargetLength());
if(theObject->GetDatumTargetType() == XCAFDimTolObjects_DatumTargetType_Rectangle)
Handle(TDataStd_Real) aWidth = TDataStd_Real::Set(Label().FindChild(ChildLab_DTargetWidth),
theObject->GetDatumTargetWidth());
theObject->GetDatumTargetWidth());
}
}
Handle(TDataStd_Integer) aNum = TDataStd_Integer::Set(Label().FindChild(ChildLab_DTargetNumber),
theObject->GetDatumTargetNumber());
theObject->GetDatumTargetNumber());
}
if (theObject->HasPlane())
{
Handle(TDataStd_RealArray) aLoc = new TDataStd_RealArray();
Handle(TDataStd_RealArray) aN = new TDataStd_RealArray();
Handle(TDataStd_RealArray) aR = new TDataStd_RealArray();
gp_Ax2 anAx = theObject->GetPlane();
Handle(TColStd_HArray1OfReal) aLocArr = new TColStd_HArray1OfReal(1, 3);
for (Standard_Integer i = 1; i <= 3; i++)
aLocArr->SetValue(i, anAx.Location().Coord(i));
aLoc->ChangeArray(aLocArr);
Handle(TDataStd_RealArray) aLoc = TDataStd_RealArray::Set(Label().FindChild(ChildLab_PlaneLoc), 1, 3);
if(!aLoc.IsNull())
aLoc->ChangeArray(aLocArr);
Handle(TColStd_HArray1OfReal) aNArr = new TColStd_HArray1OfReal(1, 3);
for (Standard_Integer i = 1; i <= 3; i++)
aNArr->SetValue(i, anAx.Direction().Coord(i));
aN->ChangeArray(aNArr);
Handle(TDataStd_RealArray) aN = TDataStd_RealArray::Set(Label().FindChild(ChildLab_PlaneN), 1, 3);
if(!aN.IsNull())
aN->ChangeArray(aNArr);
Handle(TColStd_HArray1OfReal) aRArr = new TColStd_HArray1OfReal(1, 3);
for (Standard_Integer i = 1; i <= 3; i++)
aRArr->SetValue(i, anAx.XDirection().Coord(i));
aR->ChangeArray(aRArr);
Label().FindChild(ChildLab_PlaneLoc).AddAttribute(aLoc);
Label().FindChild(ChildLab_PlaneN).AddAttribute(aN);
Label().FindChild(ChildLab_PlaneRef).AddAttribute(aR);
Handle(TDataStd_RealArray) aR = TDataStd_RealArray::Set(Label().FindChild(ChildLab_PlaneRef), 1, 3);
if(!aR.IsNull())
aR->ChangeArray(aRArr);
}
if (theObject->HasPoint())
{
Handle(TDataStd_RealArray) aLoc = new TDataStd_RealArray();
gp_Pnt aPnt = theObject->GetPoint();
Handle(TColStd_HArray1OfReal) aLocArr = new TColStd_HArray1OfReal(1, 3);
for (Standard_Integer i = 1; i <= 3; i++)
aLocArr->SetValue(i, aPnt.Coord(i));
aLoc->ChangeArray(aLocArr);
Label().FindChild(ChildLab_Pnt).AddAttribute(aLoc);
Handle(TDataStd_RealArray) aLoc = TDataStd_RealArray::Set(Label().FindChild(ChildLab_Pnt), 1, 3);
if(!aLoc.IsNull())
aLoc->ChangeArray(aLocArr);
}
if (theObject->HasPointText())
{
Handle(TDataStd_RealArray) aLoc = new TDataStd_RealArray();
gp_Pnt aPntText = theObject->GetPointTextAttach();
Handle(TColStd_HArray1OfReal) aLocArr = new TColStd_HArray1OfReal(1, 3);
for (Standard_Integer i = 1; i <= 3; i++)
aLocArr->SetValue(i, aPntText.Coord(i));
aLoc->ChangeArray(aLocArr);
Label().FindChild(ChildLab_PntText).AddAttribute(aLoc);
Handle(TDataStd_RealArray) aLoc = TDataStd_RealArray::Set(Label().FindChild(ChildLab_PntText), 1, 3);
if(!aLoc.IsNull())
aLoc->ChangeArray(aLocArr);
}
TopoDS_Shape aPresentation = theObject->GetPresentation();
if( !aPresentation.IsNull())

View File

@ -110,9 +110,10 @@ void XCAFDoc_Dimension::SetObject (const Handle(XCAFDimTolObjects_DimensionObjec
if(!theObject->GetValues().IsNull())
{
Handle(TDataStd_RealArray) aVal = new TDataStd_RealArray();
Label().FindChild(ChildLab_Value).AddAttribute(aVal);
aVal->ChangeArray(theObject->GetValues());
Handle(TDataStd_RealArray) aVal = TDataStd_RealArray::Set(Label().FindChild(ChildLab_Value), theObject->GetValues()->Lower(),
theObject->GetValues()->Lower() + theObject->GetValues()->Length() - 1);
if(!aVal.IsNull())
aVal->ChangeArray(theObject->GetValues());
}
Handle(TDataStd_Integer) aQualifier = TDataStd_Integer::Set(Label().FindChild(ChildLab_Qualifier), theObject->GetQualifier());
@ -124,35 +125,36 @@ void XCAFDoc_Dimension::SetObject (const Handle(XCAFDimTolObjects_DimensionObjec
Handle(TColStd_HArray1OfInteger) anArrI;
if(aF != XCAFDimTolObjects_DimensionFormVariance_None)
{
Handle(TDataStd_IntegerArray) aClass = new TDataStd_IntegerArray();
Label().FindChild(ChildLab_Class).AddAttribute(aClass);
anArrI = new TColStd_HArray1OfInteger(1,3);
anArrI->SetValue(1,aH);
anArrI->SetValue(2,aF);
anArrI->SetValue(3,aG);
aClass->ChangeArray(anArrI);
Handle(TDataStd_IntegerArray) aClass = TDataStd_IntegerArray::Set(Label().FindChild(ChildLab_Class), 1, 3);
if(!aClass.IsNull())
aClass->ChangeArray(anArrI);
}
Standard_Integer aL, aR;
theObject->GetNbOfDecimalPlaces(aL, aR);
if (aL > 0 || aR > 0)
{
Handle(TDataStd_IntegerArray) aDec = new TDataStd_IntegerArray();
Label().FindChild(ChildLab_Dec).AddAttribute(aDec);
anArrI = new TColStd_HArray1OfInteger(1,2);
anArrI->SetValue(1,aL);
anArrI->SetValue(2,aR);
aDec->ChangeArray(anArrI);
Handle(TDataStd_IntegerArray) aDec = TDataStd_IntegerArray::Set(Label().FindChild(ChildLab_Dec), 1, 2);
if(!aDec.IsNull())
aDec->ChangeArray(anArrI);
}
if(theObject->GetModifiers().Length() > 0)
{
Handle(TDataStd_IntegerArray) aModifiers = new TDataStd_IntegerArray();
Label().FindChild(ChildLab_Modifiers).AddAttribute(aModifiers);
anArrI = new TColStd_HArray1OfInteger(1,theObject->GetModifiers().Length());
for(Standard_Integer i = 1; i <= theObject->GetModifiers().Length(); i++)
anArrI->SetValue(i,theObject->GetModifiers().Value(i));
aModifiers->ChangeArray(anArrI);
Handle(TDataStd_IntegerArray) aModifiers = TDataStd_IntegerArray::Set(Label().FindChild(ChildLab_Modifiers),
1, theObject->GetModifiers().Length());
if(!aModifiers.IsNull())
aModifiers->ChangeArray(anArrI);
}
if(!theObject->GetPath().IsNull())
@ -166,79 +168,75 @@ void XCAFDoc_Dimension::SetObject (const Handle(XCAFDimTolObjects_DimensionObjec
{
gp_Dir aD;
theObject->GetDirection(aD);
Handle(TDataStd_RealArray) aDir = new TDataStd_RealArray();
Label().FindChild(ChildLab_Dir).AddAttribute(aDir);
anArrR = new TColStd_HArray1OfReal(1,3);
anArrR->SetValue(1,aD.X());
anArrR->SetValue(2,aD.Y());
anArrR->SetValue(3,aD.Z());
aDir->ChangeArray(anArrR);
Handle(TDataStd_RealArray) aDir = TDataStd_RealArray::Set(Label().FindChild(ChildLab_Dir), 1, 3);
if(!aDir.IsNull())
aDir->ChangeArray(anArrR);
}
if (theObject->HasPoint())
{
Handle(TDataStd_RealArray) aPnt = new TDataStd_RealArray();
gp_Pnt aPnt1 = theObject->GetPoint();
Handle(TColStd_HArray1OfReal) aPntArr = new TColStd_HArray1OfReal(1, 3);
for (Standard_Integer i = 1; i <= 3; i++)
aPntArr->SetValue(i, aPnt1.Coord(i));
aPnt->ChangeArray(aPntArr);
Label().FindChild(ChildLab_Pnt1).AddAttribute(aPnt);
Handle(TDataStd_RealArray) aPnt = TDataStd_RealArray::Set(Label().FindChild(ChildLab_Pnt1), 1, 3);
if(!aPnt.IsNull())
aPnt->ChangeArray(aPntArr);
}
if (theObject->HasPoint2())
{
Handle(TDataStd_RealArray) aPnt = new TDataStd_RealArray();
gp_Pnt aPnt2 = theObject->GetPoint2();
Handle(TColStd_HArray1OfReal) aPntArr = new TColStd_HArray1OfReal(1, 3);
for (Standard_Integer i = 1; i <= 3; i++)
aPntArr->SetValue(i, aPnt2.Coord(i));
aPnt->ChangeArray(aPntArr);
Label().FindChild(ChildLab_Pnt2).AddAttribute(aPnt);
Handle(TDataStd_RealArray) aPnt = TDataStd_RealArray::Set(Label().FindChild(ChildLab_Pnt2), 1, 3);
if(!aPnt.IsNull())
aPnt->ChangeArray(aPntArr);
}
if (theObject->HasPlane())
{
Handle(TDataStd_RealArray) aLoc = new TDataStd_RealArray();
Handle(TDataStd_RealArray) aN = new TDataStd_RealArray();
Handle(TDataStd_RealArray) aRAtt = new TDataStd_RealArray();
gp_Ax2 anAx = theObject->GetPlane();
Handle(TColStd_HArray1OfReal) aLocArr = new TColStd_HArray1OfReal(1, 3);
for (Standard_Integer i = 1; i <= 3; i++)
aLocArr->SetValue(i, anAx.Location().Coord(i));
aLoc->ChangeArray(aLocArr);
Handle(TDataStd_RealArray) aLoc = TDataStd_RealArray::Set(Label().FindChild(ChildLab_PlaneLoc), 1, 3);
if(!aLoc.IsNull())
aLoc->ChangeArray(aLocArr);
Handle(TColStd_HArray1OfReal) aNArr = new TColStd_HArray1OfReal(1, 3);
for (Standard_Integer i = 1; i <= 3; i++)
aNArr->SetValue(i, anAx.Direction().Coord(i));
aN->ChangeArray(aNArr);
Handle(TDataStd_RealArray) aN = TDataStd_RealArray::Set(Label().FindChild(ChildLab_PlaneN), 1, 3);
if(!aN.IsNull())
aN->ChangeArray(aNArr);
Handle(TColStd_HArray1OfReal) aRArr = new TColStd_HArray1OfReal(1, 3);
for (Standard_Integer i = 1; i <= 3; i++)
aRArr->SetValue(i, anAx.XDirection().Coord(i));
aRAtt->ChangeArray(aRArr);
Label().FindChild(ChildLab_PlaneLoc).AddAttribute(aLoc);
Label().FindChild(ChildLab_PlaneN).AddAttribute(aN);
Label().FindChild(ChildLab_PlaneRef).AddAttribute(aRAtt);
Handle(TDataStd_RealArray) aRAtt = TDataStd_RealArray::Set(Label().FindChild(ChildLab_PlaneRef), 1, 3);
if(!aRAtt.IsNull())
aRAtt->ChangeArray(aRArr);
}
if (theObject->HasTextPoint())
{
Handle(TDataStd_RealArray) aLoc = new TDataStd_RealArray();
gp_Pnt aPntText = theObject->GetPointTextAttach();
Handle(TColStd_HArray1OfReal) aLocArr = new TColStd_HArray1OfReal(1, 3);
for (Standard_Integer i = 1; i <= 3; i++)
aLocArr->SetValue(i, aPntText.Coord(i));
aLoc->ChangeArray(aLocArr);
Label().FindChild(ChildLab_PntText).AddAttribute(aLoc);
Handle(TDataStd_RealArray) aLoc = TDataStd_RealArray::Set(Label().FindChild(ChildLab_PntText), 1, 3);
if(!aLoc.IsNull())
aLoc->ChangeArray(aLocArr);
}
TopoDS_Shape aPresentation = theObject->GetPresentation();
@ -257,8 +255,6 @@ void XCAFDoc_Dimension::SetObject (const Handle(XCAFDimTolObjects_DimensionObjec
if (theObject->HasDescriptions())
{
Handle(TDataStd_ExtStringArray) aDescriptions = new TDataStd_ExtStringArray();
Handle(TDataStd_ExtStringArray) aDescriptionNames = new TDataStd_ExtStringArray();
Handle(TColStd_HArray1OfExtendedString) aDescrArr = new TColStd_HArray1OfExtendedString(1, theObject->NbDescriptions());
Handle(TColStd_HArray1OfExtendedString) aDescrNameArr = new TColStd_HArray1OfExtendedString(1, theObject->NbDescriptions());
for (Standard_Integer i = 0; i < theObject->NbDescriptions(); i++) {
@ -267,10 +263,14 @@ void XCAFDoc_Dimension::SetObject (const Handle(XCAFDimTolObjects_DimensionObjec
TCollection_ExtendedString aDescrName(theObject->GetDescriptionName(i)->String());
aDescrNameArr->SetValue(i + 1, aDescrName);
}
aDescriptions->ChangeArray(aDescrArr);
aDescriptionNames->ChangeArray(aDescrNameArr);
Label().FindChild(ChildLab_Descriptions).AddAttribute(aDescriptions);
Label().FindChild(ChildLab_DescriptionNames).AddAttribute(aDescriptionNames);
Handle(TDataStd_ExtStringArray) aDescriptions = TDataStd_ExtStringArray::Set(Label().FindChild(ChildLab_Descriptions),
1, theObject->NbDescriptions());
Handle(TDataStd_ExtStringArray) aDescriptionNames = TDataStd_ExtStringArray::Set(Label().FindChild(ChildLab_DescriptionNames),
1, theObject->NbDescriptions());
if(!aDescriptions.IsNull())
aDescriptions->ChangeArray(aDescrArr);
if(!aDescriptionNames.IsNull())
aDescriptionNames->ChangeArray(aDescrNameArr);
}
}

View File

@ -108,115 +108,112 @@ void XCAFDoc_GeomTolerance::SetObject (const Handle(XCAFDimTolObjects_GeomTolera
if(theObject->GetTypeOfValue() != XCAFDimTolObjects_GeomToleranceTypeValue_None)
Handle(TDataStd_Integer) aTypeOfValue = TDataStd_Integer::Set(Label().FindChild(ChildLab_TypeOfValue),
theObject->GetTypeOfValue());
theObject->GetTypeOfValue());
Handle(TDataStd_Real) aValue = TDataStd_Real::Set(Label().FindChild(ChildLab_Value), theObject->GetValue());
Handle(TDataStd_Integer) aMatReqModif;
if(theObject->GetMaterialRequirementModifier() != XCAFDimTolObjects_GeomToleranceMatReqModif_None)
aMatReqModif = TDataStd_Integer::Set(Label().FindChild(ChildLab_MatReqModif),
theObject->GetMaterialRequirementModifier());
aMatReqModif = TDataStd_Integer::Set(Label().FindChild(ChildLab_MatReqModif),
theObject->GetMaterialRequirementModifier());
if(theObject->GetZoneModifier() != XCAFDimTolObjects_GeomToleranceZoneModif_None)
Handle(TDataStd_Integer) aZoneModif = TDataStd_Integer::Set(Label().FindChild(ChildLab_ZoneModif),
theObject->GetZoneModifier());
theObject->GetZoneModifier());
if(theObject->GetValueOfZoneModifier() > 0)
Handle(TDataStd_Real) aValueOfZoneModif = TDataStd_Real::Set(Label().FindChild(ChildLab_ValueOfZoneModif),
theObject->GetValueOfZoneModifier());
theObject->GetValueOfZoneModifier());
if(theObject->GetModifiers().Length() > 0)
{
Handle(TDataStd_IntegerArray) aModifiers = new TDataStd_IntegerArray();
Handle(TColStd_HArray1OfInteger) anArr = new TColStd_HArray1OfInteger(1,theObject->GetModifiers().Length());
for(Standard_Integer i = 1; i <= theObject->GetModifiers().Length(); i++)
anArr->SetValue(i,theObject->GetModifiers().Value(i));
aModifiers->ChangeArray(anArr);
Label().FindChild(ChildLab_Modifiers).AddAttribute(aModifiers);
Handle(TDataStd_IntegerArray) aModifiers = TDataStd_IntegerArray::Set(Label().FindChild(ChildLab_Modifiers),
1, theObject->GetModifiers().Length());
if(!aModifiers.IsNull())
aModifiers->ChangeArray(anArr);
}
if(theObject->GetMaxValueModifier() > 0)
Handle(TDataStd_Real) aMaxValueModif = TDataStd_Real::Set(Label().FindChild(ChildLab_aMaxValueModif),
theObject->GetMaxValueModifier());
theObject->GetMaxValueModifier());
if(theObject->HasAxis())
{
Handle(TDataStd_RealArray) aLoc = new TDataStd_RealArray();
Handle(TDataStd_RealArray) aN = new TDataStd_RealArray();
Handle(TDataStd_RealArray) aR = new TDataStd_RealArray();
gp_Ax2 anAx = theObject->GetAxis();
Handle(TColStd_HArray1OfReal) aLocArr = new TColStd_HArray1OfReal(1, 3);
for (Standard_Integer i = 1; i <= 3; i++)
aLocArr->SetValue(i, anAx.Location().Coord(i));
aLoc->ChangeArray(aLocArr);
Handle(TDataStd_RealArray) aLoc = TDataStd_RealArray::Set(Label().FindChild(ChildLab_AxisLoc), 1, 3);
if(!aLoc.IsNull())
aLoc->ChangeArray(aLocArr);
Handle(TColStd_HArray1OfReal) aNArr = new TColStd_HArray1OfReal(1, 3);
for (Standard_Integer i = 1; i <= 3; i++)
aNArr->SetValue(i, anAx.Direction().Coord(i));
aN->ChangeArray(aNArr);
Handle(TDataStd_RealArray) aN = TDataStd_RealArray::Set(Label().FindChild(ChildLab_AxisN), 1, 3);
if(!aN.IsNull())
aN->ChangeArray(aNArr);
Handle(TColStd_HArray1OfReal) aRArr = new TColStd_HArray1OfReal(1, 3);
for (Standard_Integer i = 1; i <= 3; i++)
aRArr->SetValue(i, anAx.XDirection().Coord(i));
aR->ChangeArray(aRArr);
Label().FindChild(ChildLab_AxisLoc).AddAttribute(aLoc);
Label().FindChild(ChildLab_AxisN).AddAttribute(aN);
Label().FindChild(ChildLab_AxisRef).AddAttribute(aR);
Handle(TDataStd_RealArray) aR = TDataStd_RealArray::Set(Label().FindChild(ChildLab_AxisRef), 1, 3);
if(!aR.IsNull())
aR->ChangeArray(aRArr);
}
if (theObject->HasPlane())
{
Handle(TDataStd_RealArray) aLoc = new TDataStd_RealArray();
Handle(TDataStd_RealArray) aN = new TDataStd_RealArray();
Handle(TDataStd_RealArray) aR = new TDataStd_RealArray();
gp_Ax2 anAx = theObject->GetPlane();
Handle(TColStd_HArray1OfReal) aLocArr = new TColStd_HArray1OfReal(1, 3);
for (Standard_Integer i = 1; i <= 3; i++)
aLocArr->SetValue(i, anAx.Location().Coord(i));
aLoc->ChangeArray(aLocArr);
Handle(TDataStd_RealArray) aLoc = TDataStd_RealArray::Set(Label().FindChild(ChildLab_PlaneLoc), 1, 3);
if(!aLoc.IsNull())
aLoc->ChangeArray(aLocArr);
Handle(TColStd_HArray1OfReal) aNArr = new TColStd_HArray1OfReal(1, 3);
for (Standard_Integer i = 1; i <= 3; i++)
aNArr->SetValue(i, anAx.Direction().Coord(i));
aN->ChangeArray(aNArr);
Handle(TDataStd_RealArray) aN = TDataStd_RealArray::Set(Label().FindChild(ChildLab_PlaneN), 1, 3);
if(!aN.IsNull())
aN->ChangeArray(aNArr);
Handle(TColStd_HArray1OfReal) aRArr = new TColStd_HArray1OfReal(1, 3);
for (Standard_Integer i = 1; i <= 3; i++)
aRArr->SetValue(i, anAx.XDirection().Coord(i));
aR->ChangeArray(aRArr);
Label().FindChild(ChildLab_PlaneLoc).AddAttribute(aLoc);
Label().FindChild(ChildLab_PlaneN).AddAttribute(aN);
Label().FindChild(ChildLab_PlaneRef).AddAttribute(aR);
Handle(TDataStd_RealArray) aR = TDataStd_RealArray::Set(Label().FindChild(ChildLab_PlaneRef), 1, 3);
if(!aR.IsNull())
aR->ChangeArray(aRArr);
}
if (theObject->HasPoint())
{
Handle(TDataStd_RealArray) aLoc = new TDataStd_RealArray();
gp_Pnt aPnt = theObject->GetPoint();
Handle(TColStd_HArray1OfReal) aLocArr = new TColStd_HArray1OfReal(1, 3);
for (Standard_Integer i = 1; i <= 3; i++)
aLocArr->SetValue(i, aPnt.Coord(i));
aLoc->ChangeArray(aLocArr);
Label().FindChild(ChildLab_Pnt).AddAttribute(aLoc);
Handle(TDataStd_RealArray) aLoc = TDataStd_RealArray::Set(Label().FindChild(ChildLab_Pnt), 1, 3);
if(!aLoc.IsNull())
aLoc->ChangeArray(aLocArr);
}
if (theObject->HasPointText())
{
Handle(TDataStd_RealArray) aLoc = new TDataStd_RealArray();
gp_Pnt aPntText = theObject->GetPointTextAttach();
Handle(TColStd_HArray1OfReal) aLocArr = new TColStd_HArray1OfReal(1, 3);
for (Standard_Integer i = 1; i <= 3; i++)
aLocArr->SetValue(i, aPntText.Coord(i));
aLoc->ChangeArray(aLocArr);
Label().FindChild(ChildLab_PntText).AddAttribute(aLoc);
Handle(TDataStd_RealArray) aLoc = TDataStd_RealArray::Set(Label().FindChild(ChildLab_PntText), 1, 3);
if(!aLoc.IsNull())
aLoc->ChangeArray(aLocArr);
}
TopoDS_Shape aPresentation = theObject->GetPresentation();

View File

@ -27,7 +27,7 @@
IMPLEMENT_STANDARD_RTTIEXT(XmlMDataStd_BooleanArrayDriver,XmlMDF_ADriver)
IMPLEMENT_DOMSTRING (FirstIndexString, "first")
IMPLEMENT_DOMSTRING (LastIndexString, "last")
IMPLEMENT_DOMSTRING (AttributeIDString, "boolarrattguid")
//=======================================================================
//function : XmlMDataStd_BooleanArrayDriver
//purpose : Constructor
@ -52,8 +52,8 @@ Handle(TDF_Attribute) XmlMDataStd_BooleanArrayDriver::NewEmpty() const
//purpose : persistent -> transient (retrieve)
//=======================================================================
Standard_Boolean XmlMDataStd_BooleanArrayDriver::Paste(const XmlObjMgt_Persistent& theSource,
const Handle(TDF_Attribute)& theTarget,
XmlObjMgt_RRelocationTable& ) const
const Handle(TDF_Attribute)& theTarget,
XmlObjMgt_RRelocationTable& ) const
{
Standard_Integer aFirstInd, aLastInd, aValue;
const XmlObjMgt_Element& anElement = theSource;
@ -105,16 +105,24 @@ Standard_Boolean XmlMDataStd_BooleanArrayDriver::Paste(const XmlObjMgt_Persisten
if (!XmlObjMgt::GetInteger(aValueStr, aValue))
{
TCollection_ExtendedString aMessageString =
TCollection_ExtendedString("Cannot retrieve integer member"
" for BooleanArray attribute as \"")
+ aValueStr + "\"";
TCollection_ExtendedString("Cannot retrieve integer member"
" for BooleanArray attribute as \"")
+ aValueStr + "\"";
WriteMessage (aMessageString);
return Standard_False;
}
arr.SetValue(i, (Standard_Byte) aValue);
}
aBooleanArray->SetInternalArray(hArr);
// attribute id
Standard_GUID aGUID;
XmlObjMgt_DOMString aGUIDStr = anElement.getAttribute(::AttributeIDString());
if (aGUIDStr.Type() == XmlObjMgt_DOMString::LDOM_NULL)
aGUID = TDataStd_BooleanArray::GetID(); //default case
else
aGUID = Standard_GUID(Standard_CString(aGUIDStr.GetString())); // user defined case
aBooleanArray->SetID(aGUID);
return Standard_True;
}
@ -123,8 +131,8 @@ Standard_Boolean XmlMDataStd_BooleanArrayDriver::Paste(const XmlObjMgt_Persisten
//purpose : transient -> persistent (store)
//=======================================================================
void XmlMDataStd_BooleanArrayDriver::Paste(const Handle(TDF_Attribute)& theSource,
XmlObjMgt_Persistent& theTarget,
XmlObjMgt_SRelocationTable& ) const
XmlObjMgt_Persistent& theTarget,
XmlObjMgt_SRelocationTable& ) const
{
Handle(TDataStd_BooleanArray) aBooleanArray = Handle(TDataStd_BooleanArray)::DownCast(theSource);
@ -153,4 +161,11 @@ void XmlMDataStd_BooleanArrayDriver::Paste(const Handle(TDF_Attribute)& theSourc
if (arr.Length())
XmlObjMgt::SetStringValue (theTarget, (Standard_Character*)str, Standard_True);
if(aBooleanArray->ID() != TDataStd_BooleanArray::GetID()) {
//convert GUID
Standard_Character aGuidStr [Standard_GUID_SIZE_ALLOC];
Standard_PCharacter pGuidStr = aGuidStr;
aBooleanArray->ID().ToCString (pGuidStr);
theTarget.Element().setAttribute (::AttributeIDString(), aGuidStr);
}
}

View File

@ -27,6 +27,7 @@
IMPLEMENT_STANDARD_RTTIEXT(XmlMDataStd_BooleanListDriver,XmlMDF_ADriver)
IMPLEMENT_DOMSTRING (FirstIndexString, "first")
IMPLEMENT_DOMSTRING (LastIndexString, "last")
IMPLEMENT_DOMSTRING (AttributeIDString, "boollistattguid")
//=======================================================================
//function : XmlMDataStd_BooleanListDriver
@ -52,8 +53,8 @@ Handle(TDF_Attribute) XmlMDataStd_BooleanListDriver::NewEmpty() const
//purpose : persistent -> transient (retrieve)
//=======================================================================
Standard_Boolean XmlMDataStd_BooleanListDriver::Paste(const XmlObjMgt_Persistent& theSource,
const Handle(TDF_Attribute)& theTarget,
XmlObjMgt_RRelocationTable& ) const
const Handle(TDF_Attribute)& theTarget,
XmlObjMgt_RRelocationTable& ) const
{
Standard_Integer aFirstInd, aLastInd, aValue, ind;
const XmlObjMgt_Element& anElement = theSource;
@ -115,7 +116,17 @@ Standard_Boolean XmlMDataStd_BooleanListDriver::Paste(const XmlObjMgt_Persistent
aBooleanList->Append(aValue ? Standard_True : Standard_False);
}
}
// attribute id
Standard_GUID aGUID;
XmlObjMgt_DOMString aGUIDStr = anElement.getAttribute(::AttributeIDString());
if (aGUIDStr.Type() == XmlObjMgt_DOMString::LDOM_NULL)
aGUID = TDataStd_BooleanList::GetID(); //default case
else
aGUID = Standard_GUID(Standard_CString(aGUIDStr.GetString())); // user defined case
aBooleanList->SetID(aGUID);
return Standard_True;
}
@ -124,8 +135,8 @@ Standard_Boolean XmlMDataStd_BooleanListDriver::Paste(const XmlObjMgt_Persistent
//purpose : transient -> persistent (store)
//=======================================================================
void XmlMDataStd_BooleanListDriver::Paste(const Handle(TDF_Attribute)& theSource,
XmlObjMgt_Persistent& theTarget,
XmlObjMgt_SRelocationTable& ) const
XmlObjMgt_Persistent& theTarget,
XmlObjMgt_SRelocationTable& ) const
{
const Handle(TDataStd_BooleanList) aBooleanList = Handle(TDataStd_BooleanList)::DownCast(theSource);
@ -145,4 +156,12 @@ void XmlMDataStd_BooleanListDriver::Paste(const Handle(TDF_Attribute)& theSource
}
}
XmlObjMgt::SetStringValue (theTarget, (Standard_Character*)str, Standard_True);
if(aBooleanList->ID() != TDataStd_BooleanList::GetID()) {
//convert GUID
Standard_Character aGuidStr [Standard_GUID_SIZE_ALLOC];
Standard_PCharacter pGuidStr = aGuidStr;
aBooleanList->ID().ToCString (pGuidStr);
theTarget.Element().setAttribute (::AttributeIDString(), aGuidStr);
}
}

View File

@ -24,6 +24,7 @@
#include <XmlMDataStd_ByteArrayDriver.hxx>
#include <XmlObjMgt.hxx>
#include <XmlObjMgt_Persistent.hxx>
IMPLEMENT_DOMSTRING (AttributeIDString, "bytearrattguid")
IMPLEMENT_STANDARD_RTTIEXT(XmlMDataStd_ByteArrayDriver,XmlMDF_ADriver)
IMPLEMENT_DOMSTRING (FirstIndexString, "first")
@ -53,8 +54,8 @@ Handle(TDF_Attribute) XmlMDataStd_ByteArrayDriver::NewEmpty() const
//purpose : persistent -> transient (retrieve)
//=======================================================================
Standard_Boolean XmlMDataStd_ByteArrayDriver::Paste(const XmlObjMgt_Persistent& theSource,
const Handle(TDF_Attribute)& theTarget,
XmlObjMgt_RRelocationTable& ) const
const Handle(TDF_Attribute)& theTarget,
XmlObjMgt_RRelocationTable& ) const
{
Standard_Integer aFirstInd, aLastInd, aValue;
const XmlObjMgt_Element& anElement = theSource;
@ -105,9 +106,9 @@ Standard_Boolean XmlMDataStd_ByteArrayDriver::Paste(const XmlObjMgt_Persistent&
if (!XmlObjMgt::GetInteger(aValueStr, aValue))
{
TCollection_ExtendedString aMessageString =
TCollection_ExtendedString("Cannot retrieve integer member"
" for ByteArray attribute as \"")
+ aValueStr + "\"";
TCollection_ExtendedString("Cannot retrieve integer member"
" for ByteArray attribute as \"")
+ aValueStr + "\"";
WriteMessage (aMessageString);
return Standard_False;
}
@ -120,14 +121,14 @@ Standard_Boolean XmlMDataStd_ByteArrayDriver::Paste(const XmlObjMgt_Persistent&
if(XmlMDataStd::DocumentVersion() > 2) {
Standard_Integer aDeltaValue;
if (!anElement.getAttribute(::IsDeltaOn()).GetInteger(aDeltaValue))
{
TCollection_ExtendedString aMessageString =
TCollection_ExtendedString("Cannot retrieve the isDelta value"
" for ByteArray attribute as \"")
+ aDeltaValue + "\"";
WriteMessage (aMessageString);
return Standard_False;
}
{
TCollection_ExtendedString aMessageString =
TCollection_ExtendedString("Cannot retrieve the isDelta value"
" for ByteArray attribute as \"")
+ aDeltaValue + "\"";
WriteMessage (aMessageString);
return Standard_False;
}
else
aDelta = aDeltaValue != 0;
}
@ -137,6 +138,16 @@ Standard_Boolean XmlMDataStd_ByteArrayDriver::Paste(const XmlObjMgt_Persistent&
#endif
aByteArray->SetDelta(aDelta);
// attribute id
Standard_GUID aGUID;
XmlObjMgt_DOMString aGUIDStr = anElement.getAttribute(::AttributeIDString());
if (aGUIDStr.Type() == XmlObjMgt_DOMString::LDOM_NULL)
aGUID = TDataStd_ByteArray::GetID(); //default case
else
aGUID = Standard_GUID(Standard_CString(aGUIDStr.GetString())); // user defined case
aByteArray->SetID(aGUID);
return Standard_True;
}
@ -145,8 +156,8 @@ Standard_Boolean XmlMDataStd_ByteArrayDriver::Paste(const XmlObjMgt_Persistent&
//purpose : transient -> persistent (store)
//=======================================================================
void XmlMDataStd_ByteArrayDriver::Paste(const Handle(TDF_Attribute)& theSource,
XmlObjMgt_Persistent& theTarget,
XmlObjMgt_SRelocationTable& ) const
XmlObjMgt_Persistent& theTarget,
XmlObjMgt_SRelocationTable& ) const
{
Handle(TDataStd_ByteArray) aByteArray = Handle(TDataStd_ByteArray)::DownCast(theSource);
@ -180,4 +191,11 @@ void XmlMDataStd_ByteArrayDriver::Paste(const Handle(TDF_Attribute)& theSource,
// Transfer the string (array of chars) to XML.
XmlObjMgt::SetStringValue (theTarget, (Standard_Character*)str, Standard_True);
}
if(aByteArray->ID() != TDataStd_ByteArray::GetID()) {
//convert GUID
Standard_Character aGuidStr [Standard_GUID_SIZE_ALLOC];
Standard_PCharacter pGuidStr = aGuidStr;
aByteArray->ID().ToCString (pGuidStr);
theTarget.Element().setAttribute (::AttributeIDString(), aGuidStr);
}
}

View File

@ -24,7 +24,6 @@
#include <XmlObjMgt.hxx>
#include <XmlObjMgt_Document.hxx>
#include <XmlObjMgt_Persistent.hxx>
#include <XmlLDrivers.hxx>
IMPLEMENT_STANDARD_RTTIEXT(XmlMDataStd_ExtStringArrayDriver,XmlMDF_ADriver)
IMPLEMENT_DOMSTRING (FirstIndexString, "first")
@ -32,6 +31,7 @@ IMPLEMENT_DOMSTRING (LastIndexString, "last")
IMPLEMENT_DOMSTRING (ExtString, "string")
IMPLEMENT_DOMSTRING (IsDeltaOn, "delta")
IMPLEMENT_DOMSTRING (Separator, "separator")
IMPLEMENT_DOMSTRING (AttributeIDString, "extstrarrattguid")
// Searches for a symbol within an array of strings.
// Returns TRUE if the symbol is found.
@ -73,9 +73,9 @@ Handle(TDF_Attribute) XmlMDataStd_ExtStringArrayDriver::NewEmpty() const
//purpose : persistent -> transient (retrieve)
//=======================================================================
Standard_Boolean XmlMDataStd_ExtStringArrayDriver::Paste
( const XmlObjMgt_Persistent& theSource,
const Handle(TDF_Attribute)& theTarget,
XmlObjMgt_RRelocationTable& ) const
(const XmlObjMgt_Persistent& theSource,
const Handle(TDF_Attribute)& theTarget,
XmlObjMgt_RRelocationTable& ) const
{
Standard_Integer aFirstInd, aLastInd, ind;
TCollection_ExtendedString aValue;
@ -188,12 +188,12 @@ Standard_Boolean XmlMDataStd_ExtStringArrayDriver::Paste
Standard_Integer aDeltaValue;
if (!anElement.getAttribute(::IsDeltaOn()).GetInteger(aDeltaValue))
{
TCollection_ExtendedString aMessageString =
TCollection_ExtendedString("Cannot retrieve the isDelta value"
" for IntegerArray attribute as \"")
+ aDeltaValue + "\"";
WriteMessage (aMessageString);
return Standard_False;
TCollection_ExtendedString aMessageString =
TCollection_ExtendedString("Cannot retrieve the isDelta value"
" for IntegerArray attribute as \"")
+ aDeltaValue + "\"";
WriteMessage (aMessageString);
return Standard_False;
}
else
aDelta = aDeltaValue != 0;
@ -204,6 +204,16 @@ Standard_Boolean XmlMDataStd_ExtStringArrayDriver::Paste
#endif
aExtStringArray->SetDelta(aDelta);
// attribute id
Standard_GUID aGUID;
XmlObjMgt_DOMString aGUIDStr = anElement.getAttribute(::AttributeIDString());
if (aGUIDStr.Type() == XmlObjMgt_DOMString::LDOM_NULL)
aGUID = TDataStd_ExtStringArray::GetID(); //default case
else
aGUID = Standard_GUID(Standard_CString(aGUIDStr.GetString())); // user defined case
aExtStringArray->SetID(aGUID);
return Standard_True;
}
@ -228,44 +238,39 @@ void XmlMDataStd_ExtStringArrayDriver::Paste (const Handle(TDF_Attribute)& theSo
// Find a separator.
Standard_Boolean found(Standard_True);
// Optimization of storage of string array elements.
// It is applied since the storage version 8 and newer.
// Preferrable symbols for the separator: - _ . : ^ ~
// Don't use a space as a separator: XML low-level parser sometimes "eats" it.
Standard_Character c = '-';
if (XmlLDrivers::StorageVersion() > 7)
static Standard_Character aPreferable[] = "-_.:^~";
for (i = 0; found && aPreferable[i]; i++)
{
// Preferrable symbols for the separator: - _ . : ^ ~
// Don't use a space as a separator: XML low-level parser sometimes "eats" it.
static Standard_Character aPreferable[] = "-_.:^~";
for (i = 0; found && aPreferable[i]; i++)
c = aPreferable[i];
found = Contains(aExtStringArray, TCollection_ExtendedString(c));
}
// If all prefferable symbols exist in the array,
// try to use any other simple symbols.
if (found)
{
c = '!';
while (found && c < '~')
{
c = aPreferable[i];
found = Contains(aExtStringArray, TCollection_ExtendedString(c));
}
// If all prefferable symbols exist in the array,
// try to use any other simple symbols.
if (found)
{
c = '!';
while (found && c < '~')
{
found = Standard_False;
found = Standard_False;
#ifdef _DEBUG
TCollection_AsciiString cseparator(c); // deb
TCollection_AsciiString cseparator(c); // deb
#endif
TCollection_ExtendedString separator(c);
found = Contains(aExtStringArray, separator);
if (found)
TCollection_ExtendedString separator(c);
found = Contains(aExtStringArray, separator);
if (found)
{
c++;
// Skip forbidden symbols for XML.
while (c < '~' && (c == '&' || c == '<'))
{
c++;
// Skip forbidden symbols for XML.
while (c < '~' && (c == '&' || c == '<'))
{
c++;
}
}
}
}
}// check doc version
}
if (found)
{
@ -320,4 +325,11 @@ void XmlMDataStd_ExtStringArrayDriver::Paste (const Handle(TDF_Attribute)& theSo
// Set UNICODE value.
XmlObjMgt::SetExtendedString(theTarget, xstr);
}
if(aExtStringArray->ID() != TDataStd_ExtStringArray::GetID()) {
//convert GUID
Standard_Character aGuidStr [Standard_GUID_SIZE_ALLOC];
Standard_PCharacter pGuidStr = aGuidStr;
aExtStringArray->ID().ToCString (pGuidStr);
theTarget.Element().setAttribute (::AttributeIDString(), aGuidStr);
}
}

View File

@ -29,6 +29,7 @@ IMPLEMENT_STANDARD_RTTIEXT(XmlMDataStd_ExtStringListDriver,XmlMDF_ADriver)
IMPLEMENT_DOMSTRING (FirstIndexString, "first")
IMPLEMENT_DOMSTRING (LastIndexString, "last")
IMPLEMENT_DOMSTRING (ExtString, "string")
IMPLEMENT_DOMSTRING (AttributeIDString, "extstrlistattguid")
//=======================================================================
//function : XmlMDataStd_ExtStringListDriver
@ -54,8 +55,8 @@ Handle(TDF_Attribute) XmlMDataStd_ExtStringListDriver::NewEmpty() const
//purpose : persistent -> transient (retrieve)
//=======================================================================
Standard_Boolean XmlMDataStd_ExtStringListDriver::Paste(const XmlObjMgt_Persistent& theSource,
const Handle(TDF_Attribute)& theTarget,
XmlObjMgt_RRelocationTable& ) const
const Handle(TDF_Attribute)& theTarget,
XmlObjMgt_RRelocationTable& ) const
{
Standard_Integer aFirstInd, aLastInd;
const XmlObjMgt_Element& anElement = theSource;
@ -85,30 +86,39 @@ Standard_Boolean XmlMDataStd_ExtStringListDriver::Paste(const XmlObjMgt_Persiste
return Standard_False;
}
if(aLastInd == 0) return Standard_True;
const Handle(TDataStd_ExtStringList) anExtStringList = Handle(TDataStd_ExtStringList)::DownCast(theTarget);
if (!anElement.hasChildNodes())
{
TCollection_ExtendedString aMessageString =
TCollection_ExtendedString("Cannot retrieve a list of extended strings");
WriteMessage (aMessageString);
return Standard_False;
}
if(aLastInd > 0) {
if (!anElement.hasChildNodes())
{
TCollection_ExtendedString aMessageString =
TCollection_ExtendedString("Cannot retrieve a list of extended strings");
WriteMessage (aMessageString);
return Standard_False;
}
LDOM_Node aCurNode = anElement.getFirstChild();
LDOM_Element* aCurElement = (LDOM_Element*)&aCurNode;
TCollection_ExtendedString aValueStr;
while (*aCurElement != anElement.getLastChild())
{
XmlObjMgt::GetExtendedString( *aCurElement, aValueStr );
anExtStringList->Append(aValueStr);
aCurNode = aCurElement->getNextSibling();
aCurElement = (LDOM_Element*)&aCurNode;
}
LDOM_Node aCurNode = anElement.getFirstChild();
LDOM_Element* aCurElement = (LDOM_Element*)&aCurNode;
TCollection_ExtendedString aValueStr;
while (*aCurElement != anElement.getLastChild())
{
XmlObjMgt::GetExtendedString( *aCurElement, aValueStr );
anExtStringList->Append(aValueStr);
aCurNode = aCurElement->getNextSibling();
aCurElement = (LDOM_Element*)&aCurNode;
}
// attribute id
Standard_GUID aGUID;
XmlObjMgt_DOMString aGUIDStr = anElement.getAttribute(::AttributeIDString());
if (aGUIDStr.Type() == XmlObjMgt_DOMString::LDOM_NULL)
aGUID = TDataStd_ExtStringList::GetID(); //default case
else
aGUID = Standard_GUID(Standard_CString(aGUIDStr.GetString())); // user defined case
XmlObjMgt::GetExtendedString( *aCurElement, aValueStr );
anExtStringList->Append(aValueStr);
anExtStringList->SetID(aGUID);
return Standard_True;
}
@ -118,8 +128,8 @@ Standard_Boolean XmlMDataStd_ExtStringListDriver::Paste(const XmlObjMgt_Persiste
//purpose : transient -> persistent (store)
//=======================================================================
void XmlMDataStd_ExtStringListDriver::Paste(const Handle(TDF_Attribute)& theSource,
XmlObjMgt_Persistent& theTarget,
XmlObjMgt_SRelocationTable& ) const
XmlObjMgt_Persistent& theTarget,
XmlObjMgt_SRelocationTable& ) const
{
const Handle(TDataStd_ExtStringList) anExtStringList = Handle(TDataStd_ExtStringList)::DownCast(theSource);
@ -137,4 +147,12 @@ void XmlMDataStd_ExtStringListDriver::Paste(const Handle(TDF_Attribute)& theSour
XmlObjMgt::SetExtendedString( aCurTarget, aValueStr );
anElement.appendChild( aCurTarget );
}
if(anExtStringList->ID() != TDataStd_ExtStringList::GetID()) {
//convert GUID
Standard_Character aGuidStr [Standard_GUID_SIZE_ALLOC];
Standard_PCharacter pGuidStr = aGuidStr;
anExtStringList->ID().ToCString (pGuidStr);
theTarget.Element().setAttribute (::AttributeIDString(), aGuidStr);
}
}

View File

@ -29,6 +29,8 @@ IMPLEMENT_STANDARD_RTTIEXT(XmlMDataStd_IntegerArrayDriver,XmlMDF_ADriver)
IMPLEMENT_DOMSTRING (FirstIndexString, "first")
IMPLEMENT_DOMSTRING (LastIndexString, "last")
IMPLEMENT_DOMSTRING (IsDeltaOn, "delta")
IMPLEMENT_DOMSTRING (AttributeIDString, "intarrattguid")
//=======================================================================
//function : XmlMDataStd_IntegerArrayDriver
//purpose : Constructor
@ -123,12 +125,12 @@ Standard_Boolean XmlMDataStd_IntegerArrayDriver::Paste
Standard_Integer aDeltaValue;
if (!anElement.getAttribute(::IsDeltaOn()).GetInteger(aDeltaValue))
{
TCollection_ExtendedString aMessageString =
TCollection_ExtendedString("Cannot retrieve the isDelta value"
" for IntegerArray attribute as \"")
+ aDeltaValue + "\"";
WriteMessage (aMessageString);
return Standard_False;
TCollection_ExtendedString aMessageString =
TCollection_ExtendedString("Cannot retrieve the isDelta value"
" for IntegerArray attribute as \"")
+ aDeltaValue + "\"";
WriteMessage (aMessageString);
return Standard_False;
}
else
aDelta = aDeltaValue != 0;
@ -138,7 +140,17 @@ Standard_Boolean XmlMDataStd_IntegerArrayDriver::Paste
cout << "Current DocVersion field is not initialized. " <<endl;
#endif
anIntArray->SetDelta(aDelta);
// attribute id
Standard_GUID aGUID;
XmlObjMgt_DOMString aGUIDStr = anElement.getAttribute(::AttributeIDString());
if (aGUIDStr.Type() == XmlObjMgt_DOMString::LDOM_NULL)
aGUID = TDataStd_IntegerArray::GetID(); //default case
else
aGUID = Standard_GUID(Standard_CString(aGUIDStr.GetString())); // user defined case
anIntArray->SetID(aGUID);
return Standard_True;
}
@ -184,4 +196,11 @@ void XmlMDataStd_IntegerArrayDriver::Paste
str[iChar - 1] = '\0';
XmlObjMgt::SetStringValue (theTarget, (Standard_Character*)str, Standard_True);
}
if(anIntArray->ID() != TDataStd_IntegerArray::GetID()) {
//convert GUID
Standard_Character aGuidStr [Standard_GUID_SIZE_ALLOC];
Standard_PCharacter pGuidStr = aGuidStr;
anIntArray->ID().ToCString (pGuidStr);
theTarget.Element().setAttribute (::AttributeIDString(), aGuidStr);
}
}

View File

@ -27,13 +27,14 @@
IMPLEMENT_STANDARD_RTTIEXT(XmlMDataStd_IntegerListDriver,XmlMDF_ADriver)
IMPLEMENT_DOMSTRING (FirstIndexString, "first")
IMPLEMENT_DOMSTRING (LastIndexString, "last")
IMPLEMENT_DOMSTRING (AttributeIDString, "intlistattguid")
//=======================================================================
//function : XmlMDataStd_IntegerListDriver
//purpose : Constructor
//=======================================================================
XmlMDataStd_IntegerListDriver::XmlMDataStd_IntegerListDriver(const Handle(CDM_MessageDriver)& theMsgDriver)
: XmlMDF_ADriver (theMsgDriver, NULL)
: XmlMDF_ADriver (theMsgDriver, NULL)
{
}
@ -52,8 +53,8 @@ Handle(TDF_Attribute) XmlMDataStd_IntegerListDriver::NewEmpty() const
//purpose : persistent -> transient (retrieve)
//=======================================================================
Standard_Boolean XmlMDataStd_IntegerListDriver::Paste(const XmlObjMgt_Persistent& theSource,
const Handle(TDF_Attribute)& theTarget,
XmlObjMgt_RRelocationTable& ) const
const Handle(TDF_Attribute)& theTarget,
XmlObjMgt_RRelocationTable& ) const
{
Standard_Integer aFirstInd, aLastInd, aValue, ind;
const XmlObjMgt_Element& anElement = theSource;
@ -115,7 +116,17 @@ Standard_Boolean XmlMDataStd_IntegerListDriver::Paste(const XmlObjMgt_Persistent
anIntList->Append(aValue);
}
}
// attribute id
Standard_GUID aGUID;
XmlObjMgt_DOMString aGUIDStr = anElement.getAttribute(::AttributeIDString());
if (aGUIDStr.Type() == XmlObjMgt_DOMString::LDOM_NULL)
aGUID = TDataStd_IntegerList::GetID(); //default case
else
aGUID = Standard_GUID(Standard_CString(aGUIDStr.GetString())); // user defined case
anIntList->SetID(aGUID);
return Standard_True;
}
@ -124,8 +135,8 @@ Standard_Boolean XmlMDataStd_IntegerListDriver::Paste(const XmlObjMgt_Persistent
//purpose : transient -> persistent (store)
//=======================================================================
void XmlMDataStd_IntegerListDriver::Paste(const Handle(TDF_Attribute)& theSource,
XmlObjMgt_Persistent& theTarget,
XmlObjMgt_SRelocationTable& ) const
XmlObjMgt_Persistent& theTarget,
XmlObjMgt_SRelocationTable& ) const
{
const Handle(TDataStd_IntegerList) anIntList = Handle(TDataStd_IntegerList)::DownCast(theSource);
@ -148,4 +159,12 @@ void XmlMDataStd_IntegerListDriver::Paste(const Handle(TDF_Attribute)& theSource
}
// No occurrence of '&', '<' and other irregular XML characters
XmlObjMgt::SetStringValue (theTarget, (Standard_Character*)str, Standard_True);
if(anIntList->ID() != TDataStd_IntegerList::GetID()) {
//convert GUID
Standard_Character aGuidStr [Standard_GUID_SIZE_ALLOC];
Standard_PCharacter pGuidStr = aGuidStr;
anIntList->ID().ToCString (pGuidStr);
theTarget.Element().setAttribute (::AttributeIDString(), aGuidStr);
}
}

View File

@ -33,7 +33,7 @@ IMPLEMENT_STANDARD_RTTIEXT(XmlMDataStd_RealArrayDriver,XmlMDF_ADriver)
IMPLEMENT_DOMSTRING (FirstIndexString, "first")
IMPLEMENT_DOMSTRING (LastIndexString, "last")
IMPLEMENT_DOMSTRING (IsDeltaOn, "delta")
IMPLEMENT_DOMSTRING (AttributeIDString, "realarrattguid")
//=======================================================================
//function : XmlMDataStd_RealArrayDriver
//purpose : Constructor
@ -129,12 +129,12 @@ Standard_Boolean XmlMDataStd_RealArrayDriver::Paste
Standard_Integer aDeltaValue;
if (!anElement.getAttribute(::IsDeltaOn()).GetInteger(aDeltaValue))
{
TCollection_ExtendedString aMessageString =
TCollection_ExtendedString("Cannot retrieve the isDelta value"
" for RealArray attribute as \"")
+ aDeltaValue + "\"";
WriteMessage (aMessageString);
return Standard_False;
TCollection_ExtendedString aMessageString =
TCollection_ExtendedString("Cannot retrieve the isDelta value"
" for RealArray attribute as \"")
+ aDeltaValue + "\"";
WriteMessage (aMessageString);
return Standard_False;
}
else
aDelta = aDeltaValue != 0;
@ -145,6 +145,15 @@ Standard_Boolean XmlMDataStd_RealArrayDriver::Paste
#endif
aRealArray->SetDelta(aDelta);
// attribute id
Standard_GUID aGUID;
XmlObjMgt_DOMString aGUIDStr = anElement.getAttribute(::AttributeIDString());
if (aGUIDStr.Type() == XmlObjMgt_DOMString::LDOM_NULL)
aGUID = TDataStd_RealArray::GetID(); //default case
else
aGUID = Standard_GUID(Standard_CString(aGUIDStr.GetString())); // user defined case
aRealArray->SetID(aGUID);
return Standard_True;
}
@ -209,4 +218,11 @@ void XmlMDataStd_RealArrayDriver::Paste (const Handle(TDF_Attribute)& theSource,
str[iChar - 1] = '\0';
XmlObjMgt::SetStringValue (theTarget, (Standard_Character*)str, Standard_True);
}
if(aRealArray->ID() != TDataStd_RealArray::GetID()) {
//convert GUID
Standard_Character aGuidStr [Standard_GUID_SIZE_ALLOC];
Standard_PCharacter pGuidStr = aGuidStr;
aRealArray->ID().ToCString (pGuidStr);
theTarget.Element().setAttribute (::AttributeIDString(), aGuidStr);
}
}

View File

@ -27,7 +27,7 @@
IMPLEMENT_STANDARD_RTTIEXT(XmlMDataStd_RealListDriver,XmlMDF_ADriver)
IMPLEMENT_DOMSTRING (FirstIndexString, "first")
IMPLEMENT_DOMSTRING (LastIndexString, "last")
IMPLEMENT_DOMSTRING (AttributeIDString, "reallistattguid")
//=======================================================================
//function : XmlMDataStd_RealListDriver
//purpose : Constructor
@ -52,8 +52,8 @@ Handle(TDF_Attribute) XmlMDataStd_RealListDriver::NewEmpty() const
//purpose : persistent -> transient (retrieve)
//=======================================================================
Standard_Boolean XmlMDataStd_RealListDriver::Paste(const XmlObjMgt_Persistent& theSource,
const Handle(TDF_Attribute)& theTarget,
XmlObjMgt_RRelocationTable& ) const
const Handle(TDF_Attribute)& theTarget,
XmlObjMgt_RRelocationTable& ) const
{
Standard_Real aValue;
Standard_Integer aFirstInd, aLastInd, ind;
@ -123,6 +123,16 @@ Standard_Boolean XmlMDataStd_RealListDriver::Paste(const XmlObjMgt_Persistent&
}
}
// attribute id
Standard_GUID aGUID;
XmlObjMgt_DOMString aGUIDStr = anElement.getAttribute(::AttributeIDString());
if (aGUIDStr.Type() == XmlObjMgt_DOMString::LDOM_NULL)
aGUID = TDataStd_RealList::GetID(); //default case
else
aGUID = Standard_GUID(Standard_CString(aGUIDStr.GetString())); // user defined case
aRealList->SetID(aGUID);
return Standard_True;
}
@ -131,8 +141,8 @@ Standard_Boolean XmlMDataStd_RealListDriver::Paste(const XmlObjMgt_Persistent&
//purpose : transient -> persistent (store)
//=======================================================================
void XmlMDataStd_RealListDriver::Paste(const Handle(TDF_Attribute)& theSource,
XmlObjMgt_Persistent& theTarget,
XmlObjMgt_SRelocationTable& ) const
XmlObjMgt_Persistent& theTarget,
XmlObjMgt_SRelocationTable& ) const
{
const Handle(TDataStd_RealList) aRealList = Handle(TDataStd_RealList)::DownCast(theSource);
@ -153,4 +163,12 @@ void XmlMDataStd_RealListDriver::Paste(const Handle(TDF_Attribute)& theSource,
}
}
XmlObjMgt::SetStringValue (theTarget, (Standard_Character*)str, Standard_True);
if(aRealList->ID() != TDataStd_RealList::GetID()) {
//convert GUID
Standard_Character aGuidStr [Standard_GUID_SIZE_ALLOC];
Standard_PCharacter pGuidStr = aGuidStr;
aRealList->ID().ToCString (pGuidStr);
theTarget.Element().setAttribute (::AttributeIDString(), aGuidStr);
}
}

View File

@ -30,7 +30,7 @@ IMPLEMENT_STANDARD_RTTIEXT(XmlMDataStd_ReferenceArrayDriver,XmlMDF_ADriver)
IMPLEMENT_DOMSTRING (FirstIndexString, "first")
IMPLEMENT_DOMSTRING (LastIndexString, "last")
IMPLEMENT_DOMSTRING (ExtString, "string")
IMPLEMENT_DOMSTRING (AttributeIDString, "refarrattguid")
//=======================================================================
//function : XmlMDataStd_ReferenceArrayDriver
//purpose : Constructor
@ -55,8 +55,8 @@ Handle(TDF_Attribute) XmlMDataStd_ReferenceArrayDriver::NewEmpty() const
//purpose : persistent -> transient (retrieve)
//=======================================================================
Standard_Boolean XmlMDataStd_ReferenceArrayDriver::Paste(const XmlObjMgt_Persistent& theSource,
const Handle(TDF_Attribute)& theTarget,
XmlObjMgt_RRelocationTable& ) const
const Handle(TDF_Attribute)& theTarget,
XmlObjMgt_RRelocationTable& ) const
{
Standard_Integer aFirstInd, aLastInd;
const XmlObjMgt_Element& anElement = theSource;
@ -113,8 +113,8 @@ Standard_Boolean XmlMDataStd_ReferenceArrayDriver::Paste(const XmlObjMgt_Persist
if (XmlObjMgt::GetTagEntryString (aValueStr, anEntry) == Standard_False)
{
TCollection_ExtendedString aMessage =
TCollection_ExtendedString ("Cannot retrieve reference from \"")
+ aValueStr + '\"';
TCollection_ExtendedString ("Cannot retrieve reference from \"")
+ aValueStr + '\"';
WriteMessage (aMessage);
return Standard_False;
}
@ -141,7 +141,7 @@ Standard_Boolean XmlMDataStd_ReferenceArrayDriver::Paste(const XmlObjMgt_Persist
{
TCollection_ExtendedString aMessage =
TCollection_ExtendedString ("Cannot retrieve reference from \"")
+ aValueStr + '\"';
+ aValueStr + '\"';
WriteMessage (aMessage);
return Standard_False;
}
@ -153,6 +153,16 @@ Standard_Boolean XmlMDataStd_ReferenceArrayDriver::Paste(const XmlObjMgt_Persist
}
aReferenceArray->SetValue(i, tLab);
// attribute id
Standard_GUID aGUID;
XmlObjMgt_DOMString aGUIDStr = anElement.getAttribute(::AttributeIDString());
if (aGUIDStr.Type() == XmlObjMgt_DOMString::LDOM_NULL)
aGUID = TDataStd_ReferenceArray::GetID(); //default case
else
aGUID = Standard_GUID(Standard_CString(aGUIDStr.GetString())); // user defined case
aReferenceArray->SetID(aGUID);
return Standard_True;
}
@ -161,8 +171,8 @@ Standard_Boolean XmlMDataStd_ReferenceArrayDriver::Paste(const XmlObjMgt_Persist
//purpose : transient -> persistent (store)
//=======================================================================
void XmlMDataStd_ReferenceArrayDriver::Paste(const Handle(TDF_Attribute)& theSource,
XmlObjMgt_Persistent& theTarget,
XmlObjMgt_SRelocationTable& ) const
XmlObjMgt_Persistent& theTarget,
XmlObjMgt_SRelocationTable& ) const
{
Handle(TDataStd_ReferenceArray) aReferenceArray = Handle(TDataStd_ReferenceArray)::DownCast(theSource);
TDF_Label L = aReferenceArray->Label();
@ -195,4 +205,11 @@ void XmlMDataStd_ReferenceArrayDriver::Paste(const Handle(TDF_Attribute)& theSou
anElement.appendChild( aCurTarget );
}
}
if(aReferenceArray->ID() != TDataStd_ReferenceArray::GetID()) {
//convert GUID
Standard_Character aGuidStr [Standard_GUID_SIZE_ALLOC];
Standard_PCharacter pGuidStr = aGuidStr;
aReferenceArray->ID().ToCString (pGuidStr);
theTarget.Element().setAttribute (::AttributeIDString(), aGuidStr);
}
}

View File

@ -31,7 +31,7 @@ IMPLEMENT_STANDARD_RTTIEXT(XmlMDataStd_ReferenceListDriver,XmlMDF_ADriver)
IMPLEMENT_DOMSTRING (FirstIndexString, "first")
IMPLEMENT_DOMSTRING (LastIndexString, "last")
IMPLEMENT_DOMSTRING (ExtString, "string")
IMPLEMENT_DOMSTRING (AttributeIDString, "reflistattguid")
//=======================================================================
//function : XmlMDataStd_ReferenceListDriver
//purpose : Constructor
@ -56,8 +56,8 @@ Handle(TDF_Attribute) XmlMDataStd_ReferenceListDriver::NewEmpty() const
//purpose : persistent -> transient (retrieve)
//=======================================================================
Standard_Boolean XmlMDataStd_ReferenceListDriver::Paste(const XmlObjMgt_Persistent& theSource,
const Handle(TDF_Attribute)& theTarget,
XmlObjMgt_RRelocationTable& ) const
const Handle(TDF_Attribute)& theTarget,
XmlObjMgt_RRelocationTable& ) const
{
Standard_Integer aFirstInd, aLastInd;
const XmlObjMgt_Element& anElement = theSource;
@ -87,47 +87,45 @@ Standard_Boolean XmlMDataStd_ReferenceListDriver::Paste(const XmlObjMgt_Persiste
return Standard_False;
}
if(aLastInd == 0) return Standard_True;
const Handle(TDataStd_ReferenceList) aReferenceList = Handle(TDataStd_ReferenceList)::DownCast(theTarget);
if (!anElement.hasChildNodes())
{
TCollection_ExtendedString aMessageString =
TCollection_ExtendedString("Cannot retrieve a list of reference");
WriteMessage (aMessageString);
return Standard_False;
}
if(aLastInd > 0) {
if (!anElement.hasChildNodes())
{
TCollection_ExtendedString aMessageString =
TCollection_ExtendedString("Cannot retrieve a list of reference");
WriteMessage (aMessageString);
return Standard_False;
}
LDOM_Node aCurNode = anElement.getFirstChild();
LDOM_Element* aCurElement = (LDOM_Element*)&aCurNode;
XmlObjMgt_DOMString aValueStr;
while (*aCurElement != anElement.getLastChild())
{
aValueStr = XmlObjMgt::GetStringValue( *aCurElement );
if (aValueStr == NULL)
LDOM_Node aCurNode = anElement.getFirstChild();
LDOM_Element* aCurElement = (LDOM_Element*)&aCurNode;
XmlObjMgt_DOMString aValueStr;
while (*aCurElement != anElement.getLastChild())
{
WriteMessage ("Cannot retrieve reference string from element");
return Standard_False;
aValueStr = XmlObjMgt::GetStringValue( *aCurElement );
if (aValueStr == NULL)
{
WriteMessage ("Cannot retrieve reference string from element");
return Standard_False;
}
TCollection_AsciiString anEntry;
if (XmlObjMgt::GetTagEntryString (aValueStr, anEntry) == Standard_False)
{
TCollection_ExtendedString aMessage =
TCollection_ExtendedString ("Cannot retrieve reference from \"")
+ aValueStr + '\"';
WriteMessage (aMessage);
return Standard_False;
}
// Find label by entry
TDF_Label tLab; // Null label.
if (anEntry.Length() > 0)
TDF_Tool::Label(aReferenceList->Label().Data(), anEntry, tLab, Standard_True);
aReferenceList->Append(tLab);
aCurNode = aCurElement->getNextSibling();
aCurElement = (LDOM_Element*)&aCurNode;
}
TCollection_AsciiString anEntry;
if (XmlObjMgt::GetTagEntryString (aValueStr, anEntry) == Standard_False)
{
TCollection_ExtendedString aMessage =
TCollection_ExtendedString ("Cannot retrieve reference from \"")
+ aValueStr + '\"';
WriteMessage (aMessage);
return Standard_False;
}
// Find label by entry
TDF_Label tLab; // Null label.
if (anEntry.Length() > 0)
{
TDF_Tool::Label(aReferenceList->Label().Data(), anEntry, tLab, Standard_True);
}
aReferenceList->Append(tLab);
aCurNode = aCurElement->getNextSibling();
aCurElement = (LDOM_Element*)&aCurNode;
}
// Last reference
aValueStr = XmlObjMgt::GetStringValue( *aCurElement );
@ -152,6 +150,16 @@ Standard_Boolean XmlMDataStd_ReferenceListDriver::Paste(const XmlObjMgt_Persiste
TDF_Tool::Label(aReferenceList->Label().Data(), anEntry, tLab, Standard_True);
}
aReferenceList->Append(tLab);
}
// attribute id
Standard_GUID aGUID;
XmlObjMgt_DOMString aGUIDStr = anElement.getAttribute(::AttributeIDString());
if (aGUIDStr.Type() == XmlObjMgt_DOMString::LDOM_NULL)
aGUID = TDataStd_ReferenceList::GetID(); //default case
else
aGUID = Standard_GUID(Standard_CString(aGUIDStr.GetString())); // user defined case
aReferenceList->SetID(aGUID);
return Standard_True;
}
@ -161,8 +169,8 @@ Standard_Boolean XmlMDataStd_ReferenceListDriver::Paste(const XmlObjMgt_Persiste
//purpose : transient -> persistent (store)
//=======================================================================
void XmlMDataStd_ReferenceListDriver::Paste(const Handle(TDF_Attribute)& theSource,
XmlObjMgt_Persistent& theTarget,
XmlObjMgt_SRelocationTable& ) const
XmlObjMgt_Persistent& theTarget,
XmlObjMgt_SRelocationTable& ) const
{
const Handle(TDataStd_ReferenceList) aReferenceList = Handle(TDataStd_ReferenceList)::DownCast(theSource);
TDF_Label L = aReferenceList->Label();
@ -194,4 +202,12 @@ void XmlMDataStd_ReferenceListDriver::Paste(const Handle(TDF_Attribute)& theSour
anElement.appendChild( aCurTarget );
}
}
if(aReferenceList->ID() != TDataStd_ReferenceList::GetID()) {
//convert GUID
Standard_Character aGuidStr [Standard_GUID_SIZE_ALLOC];
Standard_PCharacter pGuidStr = aGuidStr;
aReferenceList->ID().ToCString (pGuidStr);
theTarget.Element().setAttribute (::AttributeIDString(), aGuidStr);
}
}

View File

@ -29,7 +29,7 @@ set modified_attribute TDataStd_Real
############################################
# Set TDataStd_RealArray
SetRealArray D ${Label} ${From} ${To} ${RealArray1} ${RealArray2} 0
SetRealArray D ${Label} 0 ${From} ${To} ${RealArray1} ${RealArray2}
############################################
SetReal D ${Label} ${Real1}
@ -41,7 +41,7 @@ set list [DumpCommand D]
############################################
# Set old value for TDataStd_RealArray
SetRealArray D ${Label} ${From} ${To} ${RealArray1} ${RealArray2} 0
SetRealArray D ${Label} 0 ${From} ${To} ${RealArray1} ${RealArray2}
############################################
# Set new value for TDataStd_Real

79
tests/caf/basic/C4 Normal file
View File

@ -0,0 +1,79 @@
#INTERFACE CAF
# Basic attributes
# TDataStd_RealArray
#
# Testing attribute: User defined (additional GUID) TDataStd_RealArray
#
# Testing command: SetRealArray, GetRealArray
#
puts "caf001-C4"
set QA_DUP 0
# Add an attribute to a data framework
set aFrom1 1
set aTo1 2
set aSetAttr11 3.
set aSetAttr12 4.
set aLabel 0:2
set isDelta 0
set aGuid1 "12e94511-6dbc-11d4-b9c8-0060b0ee281b"
SetRealArray D ${aLabel} ${isDelta} ${aFrom1} ${aTo1} ${aSetAttr11} ${aSetAttr12}
SetRealArray D ${aLabel} ${isDelta} -g ${aGuid1} ${aFrom1} ${aTo1} ${aSetAttr11} ${aSetAttr12}
# Close/Open the transaction
NewCommand D
# Forget the attribute
ForgetAll D ${aLabel}
# Close/Open the transaction
NewCommand D
# Undo-Redo-Undo
Undo D
Redo D
Undo D
# Get a value of the attribute
set IsGood 1
set aMessage1 "Add TDataStd_RealArray attribute: Error"
set aGetAttr1 [GetRealArray D ${aLabel}]
set aLen1 [llength ${aGetAttr1}]
set aGetAttr2 [GetRealArray D ${aLabel} ${aGuid1}]
set aLen2 [llength ${aGetAttr2}]
if { ${aLen1} != [expr ${aTo1} - ${aFrom1} + 1] } {
set IsGood 0
puts "aLen1=${aLen1}"
puts ${aMessage1}
}
if { ${aLen2} != [expr ${aTo1} - ${aFrom1} + 1] } {
set IsGood 0
puts "aLen2=${aLen2}"
puts ${aMessage1}
}
set aGetAttr11 [lindex ${aGetAttr1} 0]
set aGetAttr21 [lindex ${aGetAttr2} 0]
if { ${aGetAttr11} != ${aGetAttr21} } {
set IsGood 0
puts "aGetAttr11=${aGetAttr11}"
puts "aGetAttr21=${aGetAttr21}"
puts ${aMessage1}
}
set aGetAttr12 [lindex ${aGetAttr1} 1]
set aGetAttr22 [lindex ${aGetAttr2} 1]
if { ${aGetAttr12} != ${aGetAttr22} } {
set IsGood 0
puts "aGetAttr12=${aGetAttr12}"
puts "aGetAttr22=${aGetAttr22}"
puts ${aMessage1}
}
if { ${IsGood} == 0} {
puts "Add TDataStd_RealArray attribute: Error"
} else {
puts "Add TDataStd_RealArray attribute: OK"
}

88
tests/caf/basic/C5 Normal file
View File

@ -0,0 +1,88 @@
#INTERFACE CAF
# Basic attributes
# TDataStd_RealArray
#
# Testing attribute: User defined (additional GUID) TDataStd_RealArray
#
# Testing command: SetRealArray
# Testing command: GetRealArray
#
puts "caf001-C5"
set QA_DUP 0
# Add an attributes to a data framework
set aFrom1 1
set aTo1 2
set aSetAttr11 3.
set aSetAttr12 4.
set aLabel 0:2
set isDelta 0
set aGuid1 "12e94511-6dbc-11d4-b9c8-0060b0ee281b"
SetRealArray D ${aLabel} ${isDelta} ${aFrom1} ${aTo1} ${aSetAttr11} ${aSetAttr12}
SetRealArray D ${aLabel} ${isDelta} -g ${aGuid1} ${aFrom1} ${aTo1} ${aSetAttr11} ${aSetAttr12}
# Close/Open the transaction
NewCommand D
# Forget the attribute
ForgetAll D ${aLabel}
# Close/Open the transaction
NewCommand D
# Undo-Redo-Undo
Undo D
Redo D
Undo D
# Save Document
set aFile ${imagedir}/caf001-C5.cbf
SaveAs D ${aFile};
Close D
#Open a document
Open ${aFile} D
# Get a value of the attribute
set IsGood 1
set aMessage1 "Add TDataStd_RealArray attribute: Error"
set aGetAttr1 [GetRealArray D ${aLabel}]
set aLen1 [llength ${aGetAttr1}]
set aGetAttr2 [GetRealArray D ${aLabel} ${aGuid1}]
set aLen2 [llength ${aGetAttr2}]
if { ${aLen1} != [expr ${aTo1} - ${aFrom1} + 1] } {
set IsGood 0
puts "aLen1=${aLen1}"
puts ${aMessage1}
}
if { ${aLen2} != [expr ${aTo1} - ${aFrom1} + 1] } {
set IsGood 0
puts "aLen2=${aLen2}"
puts ${aMessage1}
}
set aGetAttr11 [lindex ${aGetAttr1} 0]
set aGetAttr21 [lindex ${aGetAttr2} 0]
if { ${aGetAttr11} != ${aGetAttr21} } {
set IsGood 0
puts "aGetAttr11=${aGetAttr11}"
puts "aGetAttr21=${aGetAttr21}"
puts ${aMessage1}
}
set aGetAttr12 [lindex ${aGetAttr1} 1]
set aGetAttr22 [lindex ${aGetAttr2} 1]
if { ${aGetAttr12} != ${aGetAttr22} } {
set IsGood 0
puts "aGetAttr12=${aGetAttr12}"
puts "aGetAttr22=${aGetAttr22}"
puts ${aMessage1}
}
if { ${IsGood} == 0} {
puts "Add TDataStd_RealArray attribute: Error"
} else {
puts "Add TDataStd_RealArray attribute: OK"
}

89
tests/caf/basic/C6 Normal file
View File

@ -0,0 +1,89 @@
#INTERFACE CAF
# Basic attributes
# TDataStd_RealArray
#
# Testing attribute: User defined (additional GUID) TDataStd_RealArray
#
# Testing command: SetRealArray
# Testing command: GetRealArray
#
puts "caf001-C6"
set QA_DUP 0
# Add an attributes to a data framework
set aFrom1 1
set aTo1 2
set aSetAttr11 3.
set aSetAttr12 4.
set aLabel 0:2
set isDelta 0
set aGuid1 "12e94511-6dbc-11d4-b9c8-0060b0ee281b"
SetRealArray D ${aLabel} ${isDelta} ${aFrom1} ${aTo1} ${aSetAttr11} ${aSetAttr12}
SetRealArray D ${aLabel} ${isDelta} -g ${aGuid1} ${aFrom1} ${aTo1} ${aSetAttr11} ${aSetAttr12}
# Close/Open the transaction
NewCommand D
# Forget the attribute
ForgetAll D ${aLabel}
# Close/Open the transaction
NewCommand D
# Undo-Redo-Undo
Undo D
Redo D
Undo D
# Save Document
Format D XmlOcaf
set aFile ${imagedir}/caf001-C6.xml
SaveAs D ${aFile};
Close D
#Open a document
Open ${aFile} D
# Get a value of the attribute
set IsGood 1
set aMessage1 "Add TDataStd_RealArray attribute: Error"
set aGetAttr1 [GetRealArray D ${aLabel}]
set aLen1 [llength ${aGetAttr1}]
set aGetAttr2 [GetRealArray D ${aLabel} ${aGuid1}]
set aLen2 [llength ${aGetAttr2}]
if { ${aLen1} != [expr ${aTo1} - ${aFrom1} + 1] } {
set IsGood 0
puts "aLen1=${aLen1}"
puts ${aMessage1}
}
if { ${aLen2} != [expr ${aTo1} - ${aFrom1} + 1] } {
set IsGood 0
puts "aLen2=${aLen2}"
puts ${aMessage1}
}
set aGetAttr11 [lindex ${aGetAttr1} 0]
set aGetAttr21 [lindex ${aGetAttr2} 0]
if { ${aGetAttr11} != ${aGetAttr21} } {
set IsGood 0
puts "aGetAttr11=${aGetAttr11}"
puts "aGetAttr21=${aGetAttr21}"
puts ${aMessage1}
}
set aGetAttr12 [lindex ${aGetAttr1} 1]
set aGetAttr22 [lindex ${aGetAttr2} 1]
if { ${aGetAttr12} != ${aGetAttr22} } {
set IsGood 0
puts "aGetAttr12=${aGetAttr12}"
puts "aGetAttr22=${aGetAttr22}"
puts ${aMessage1}
}
if { ${IsGood} == 0} {
puts "Add TDataStd_RealArray attribute: Error"
} else {
puts "Add TDataStd_RealArray attribute: OK"
}

66
tests/caf/basic/D4 Normal file
View File

@ -0,0 +1,66 @@
#INTERFACE CAF
# Basic attributes
#
# Testing attribute: TDataStd_IntegerArray
#
# Testing command: SetIntArray
# Testing command: GetIntArray
#
puts "caf001-D1"
set QA_DUP 0
# Add an attribute to a data framework
set aFrom1 1
set aTo1 2
set aSetAttr11 3
set aSetAttr12 4
set aLabel 0:2
set isDelta 0
SetIntArray D ${aLabel} ${isDelta} ${aFrom1} ${aTo1} ${aSetAttr11} ${aSetAttr12}
# Close/Open the transaction
NewCommand D
# Forget the attribute
ForgetAll D ${aLabel}
# Close/Open the transaction
NewCommand D
# Undo-Redo-Undo
Undo D
Redo D
Undo D
# Get a value of the attribute
set IsGood 1
set aMessage1 "Add TDataStd_IntegerArray attribute: Error"
set aGetAttr1 [GetIntArray D ${aLabel}]
set aLen1 [llength ${aGetAttr1}]
if { ${aLen1} != [expr ${aTo1} - ${aFrom1} + 1] } {
set IsGood 0
puts "aLen1=${aLen1}"
puts ${aMessage1}
### return
}
set aGetAttr21 [lindex ${aGetAttr1} 0]
if { ${aSetAttr11} != ${aGetAttr21} } {
set IsGood 0
puts "aGetAttr21=${aGetAttr21}"
puts ${aMessage1}
### return
}
set aGetAttr22 [lindex ${aGetAttr1} 1]
if { ${aSetAttr12} != ${aGetAttr22} } {
set IsGood 0
puts "aGetAttr22=${aGetAttr22}"
puts ${aMessage1}
### return
}
if { ${IsGood} == 0} {
puts "Add TDataStd_IntegerArray attribute: Error"
} else {
puts "Add TDataStd_IntegerArray attribute: OK"
}

80
tests/caf/basic/D5 Normal file
View File

@ -0,0 +1,80 @@
#INTERFACE CAF
# Basic attributes
# TDataStd_IntegerArray
#
# Testing attribute: User defined (additional GUID) TDataStd_IntegerArray
#
# Testing command: SetIntArray
# Testing command: GetIntArray
#
puts "caf001-D5"
set QA_DUP 0
# Add an attribute to a data framework
set aFrom1 1
set aTo1 2
set aSetAttr11 3
set aSetAttr12 4
set aLabel 0:2
set isDelta 0
set aGuid1 "12e94511-6dbc-11d4-b9c8-0060b0ee281b"
SetIntArray D ${aLabel} ${isDelta} ${aFrom1} ${aTo1} ${aSetAttr11} ${aSetAttr12}
SetIntArray D ${aLabel} ${isDelta} -g ${aGuid1} ${aFrom1} ${aTo1} ${aSetAttr11} ${aSetAttr12}
# Close/Open the transaction
NewCommand D
# Forget the attribute
ForgetAll D ${aLabel}
# Close/Open the transaction
NewCommand D
# Undo-Redo-Undo
Undo D
Redo D
Undo D
# Get a value of the attribute
set IsGood 1
set aMessage1 "Add TDataStd_IntegerArray attribute: Error"
set aGetAttr1 [GetIntArray D ${aLabel}]
set aLen1 [llength ${aGetAttr1}]
set aGetAttr2 [GetIntArray D ${aLabel} ${aGuid1}]
set aLen2 [llength ${aGetAttr2}]
if { ${aLen1} != [expr ${aTo1} - ${aFrom1} + 1] } {
set IsGood 0
puts "aLen1=${aLen1}"
puts ${aMessage1}
}
if { ${aLen2} != [expr ${aTo1} - ${aFrom1} + 1] } {
set IsGood 0
puts "aLen2=${aLen2}"
puts ${aMessage1}
}
set aGetAttr11 [lindex ${aGetAttr1} 0]
set aGetAttr21 [lindex ${aGetAttr2} 0]
if { ${aGetAttr11} != ${aGetAttr21} } {
set IsGood 0
puts "aGetAttr11=${aGetAttr11}"
puts "aGetAttr21=${aGetAttr21}"
puts ${aMessage1}
}
set aGetAttr12 [lindex ${aGetAttr1} 1]
set aGetAttr22 [lindex ${aGetAttr2} 1]
if { ${aGetAttr12} != ${aGetAttr22} } {
set IsGood 0
puts "aGetAttr12=${aGetAttr12}"
puts "aGetAttr22=${aGetAttr22}"
puts ${aMessage1}
}
if { ${IsGood} == 0} {
puts "Add TDataStd_IntegerArray attribute: Error"
} else {
puts "Add TDataStd_IntegerArray attribute: OK"
}

89
tests/caf/basic/D6 Normal file
View File

@ -0,0 +1,89 @@
#INTERFACE CAF
# Basic attributes
# TDataStd_IntegerArray
#
# Testing attribute: User defined (additional GUID) TDataStd_IntegerArray
#
# Testing command: SetIntArray
# Testing command: GetIntArray
#
puts "caf001-D6"
set QA_DUP 0
# Add an attribute to a data framework
set aFrom1 1
set aTo1 2
set aSetAttr11 3
set aSetAttr12 4
set aLabel 0:2
set isDelta 0
set aGuid1 "12e94511-6dbc-11d4-b9c8-0060b0ee281b"
SetIntArray D ${aLabel} ${isDelta} ${aFrom1} ${aTo1} ${aSetAttr11} ${aSetAttr12}
SetIntArray D ${aLabel} ${isDelta} -g ${aGuid1} ${aFrom1} ${aTo1} ${aSetAttr11} ${aSetAttr12}
# Close/Open the transaction
NewCommand D
# Forget the attribute
ForgetAll D ${aLabel}
# Close/Open the transaction
NewCommand D
# Undo-Redo-Undo
Undo D
Redo D
Undo D
# Save Document
set aFile ${imagedir}/caf001-D6.cbf
SaveAs D ${aFile}
Close D
#Open a document
Open ${aFile} D
# Get a value of the attribute
set IsGood 1
set aMessage1 "Add TDataStd_IntegerArray attribute: Error"
set aGetAttr1 [GetIntArray D ${aLabel}]
set aLen1 [llength ${aGetAttr1}]
set aGetAttr2 [GetIntArray D ${aLabel} ${aGuid1}]
set aLen2 [llength ${aGetAttr2}]
if { ${aLen1} != [expr ${aTo1} - ${aFrom1} + 1] } {
set IsGood 0
puts "aLen1=${aLen1}"
puts ${aMessage1}
}
if { ${aLen2} != [expr ${aTo1} - ${aFrom1} + 1] } {
set IsGood 0
puts "aLen2=${aLen2}"
puts ${aMessage1}
}
set aGetAttr11 [lindex ${aGetAttr1} 0]
set aGetAttr21 [lindex ${aGetAttr2} 0]
if { ${aGetAttr11} != ${aGetAttr21} } {
set IsGood 0
puts "aGetAttr11=${aGetAttr11}"
puts "aGetAttr21=${aGetAttr21}"
puts ${aMessage1}
}
set aGetAttr12 [lindex ${aGetAttr1} 1]
set aGetAttr22 [lindex ${aGetAttr2} 1]
if { ${aGetAttr12} != ${aGetAttr22} } {
set IsGood 0
puts "aGetAttr12=${aGetAttr12}"
puts "aGetAttr22=${aGetAttr22}"
puts ${aMessage1}
}
if { ${IsGood} == 0} {
puts "Add TDataStd_IntegerArray attribute: Error"
} else {
puts "Add TDataStd_IntegerArray attribute: OK"
}

90
tests/caf/basic/D7 Normal file
View File

@ -0,0 +1,90 @@
#INTERFACE CAF
# Basic attributes
# TDataStd_RealArray
#
# Testing attribute: User defined (additional GUID) TDataStd_IntegerArray
#
# Testing command: SetIntArray
# Testing command: GetIntArray
#
puts "caf001-D7"
set QA_DUP 0
# Add an attribute to a data framework
set aFrom1 1
set aTo1 2
set aSetAttr11 3
set aSetAttr12 4
set aLabel 0:2
set isDelta 0
set aGuid1 "12e94511-6dbc-11d4-b9c8-0060b0ee281b"
SetIntArray D ${aLabel} ${isDelta} ${aFrom1} ${aTo1} ${aSetAttr11} ${aSetAttr12}
SetIntArray D ${aLabel} ${isDelta} -g ${aGuid1} ${aFrom1} ${aTo1} ${aSetAttr11} ${aSetAttr12}
# Close/Open the transaction
NewCommand D
# Forget the attribute
ForgetAll D ${aLabel}
# Close/Open the transaction
NewCommand D
# Undo-Redo-Undo
Undo D
Redo D
Undo D
# Save Document
Format D XmlOcaf
set aFile ${imagedir}/caf001-D7.xml
SaveAs D ${aFile}
Close D
#Open a document
Open ${aFile} D
# Get a value of the attribute
set IsGood 1
set aMessage1 "Add TDataStd_IntegerArray attribute: Error"
set aGetAttr1 [GetIntArray D ${aLabel}]
set aLen1 [llength ${aGetAttr1}]
set aGetAttr2 [GetIntArray D ${aLabel} ${aGuid1}]
set aLen2 [llength ${aGetAttr2}]
if { ${aLen1} != [expr ${aTo1} - ${aFrom1} + 1] } {
set IsGood 0
puts "aLen1=${aLen1}"
puts ${aMessage1}
}
if { ${aLen2} != [expr ${aTo1} - ${aFrom1} + 1] } {
set IsGood 0
puts "aLen2=${aLen2}"
puts ${aMessage1}
}
set aGetAttr11 [lindex ${aGetAttr1} 0]
set aGetAttr21 [lindex ${aGetAttr2} 0]
if { ${aGetAttr11} != ${aGetAttr21} } {
set IsGood 0
puts "aGetAttr11=${aGetAttr11}"
puts "aGetAttr21=${aGetAttr21}"
puts ${aMessage1}
}
set aGetAttr12 [lindex ${aGetAttr1} 1]
set aGetAttr22 [lindex ${aGetAttr2} 1]
if { ${aGetAttr12} != ${aGetAttr22} } {
set IsGood 0
puts "aGetAttr12=${aGetAttr12}"
puts "aGetAttr22=${aGetAttr22}"
puts ${aMessage1}
}
if { ${IsGood} == 0} {
puts "Add TDataStd_IntegerArray attribute: Error"
} else {
puts "Add TDataStd_IntegerArray attribute: OK"
}

80
tests/caf/basic/M5 Normal file
View File

@ -0,0 +1,80 @@
#INTERFACE CAF
# Basic attributes
# TDataStd_ExtStringArray
#
# Testing attribute: User defined (additional GUID) TDataStd_ExtStringArray
#
# Testing command: SetExtStringArray
# Testing command: GetExtStringArray
#
puts "caf001-M5"
set QA_DUP 0
# Add an attribute to a data framework
set aFrom1 1
set aTo1 2
set aSetAttr11 aaaaa
set aSetAttr12 bbbbbbb
set aLabel 0:2
set isDelta 0
set aGuid1 "12e94515-6dbc-11d4-b9c8-0060b0ee281b"
SetExtStringArray D ${aLabel} ${isDelta} ${aFrom1} ${aTo1} ${aSetAttr11} ${aSetAttr12}
SetExtStringArray D ${aLabel} ${isDelta} -g ${aGuid1} ${aFrom1} ${aTo1} ${aSetAttr11} ${aSetAttr12}
# Close/Open the transaction
NewCommand D
# Forget the attribute
ForgetAll D ${aLabel}
# Close/Open the transaction
NewCommand D
# Undo-Redo-Undo
Undo D
Redo D
Undo D
# Get a value of the attribute
set IsGood 1
set aMessage1 "Add TDataStd_ExtStringArray attribute: Error"
set aGetAttr1 [GetExtStringArray D ${aLabel}]
set aLen1 [llength ${aGetAttr1}]
set aGetAttr2 [GetExtStringArray D ${aLabel} ${aGuid1}]
set aLen2 [llength ${aGetAttr2}]
if { ${aLen1} != [expr ${aTo1} - ${aFrom1} + 1] } {
set IsGood 0
puts "aLen1=${aLen1}"
puts ${aMessage1}
}
if { ${aLen2} != [expr ${aTo1} - ${aFrom1} + 1] } {
set IsGood 0
puts "aLen2=${aLen2}"
puts ${aMessage1}
}
set aGetAttr11 [lindex ${aGetAttr1} 0]
set aGetAttr21 [lindex ${aGetAttr2} 0]
if { ${aGetAttr11} != ${aGetAttr21} } {
set IsGood 0
puts "aGetAttr11=${aGetAttr11}"
puts "aGetAttr21=${aGetAttr21}"
puts ${aMessage1}
}
set aGetAttr12 [lindex ${aGetAttr1} 1]
set aGetAttr22 [lindex ${aGetAttr2} 1]
if { ${aGetAttr12} != ${aGetAttr22} } {
set IsGood 0
puts "aGetAttr12=${aGetAttr12}"
puts "aGetAttr22=${aGetAttr22}"
puts ${aMessage1}
}
if { ${IsGood} == 0} {
puts "Add TDataStd_ExtStringArray attribute: Error"
} else {
puts "Add TDataStd_ExtStringArray attribute: OK"
}

89
tests/caf/basic/M6 Normal file
View File

@ -0,0 +1,89 @@
#INTERFACE CAF
# Basic attributes
# TDataStd_ExtStringArray
#
# Testing attribute: User defined (additional GUID) TDataStd_IntegerArray
#
# Testing command: SetExtStringArray
# Testing command: GetExtStringArray
#
puts "caf001-M6"
set QA_DUP 0
# Add an attribute to a data framework
set aFrom1 1
set aTo1 2
set aSetAttr11 xxxxxxxx
set aSetAttr12 yyyyyyy
set aLabel 0:2
set isDelta 0
set aGuid1 "12e94515-6dbc-11d4-b9c8-0060b0ee281b"
SetExtStringArray D ${aLabel} ${isDelta} ${aFrom1} ${aTo1} ${aSetAttr11} ${aSetAttr12}
SetExtStringArray D ${aLabel} ${isDelta} -g ${aGuid1} ${aFrom1} ${aTo1} ${aSetAttr11} ${aSetAttr12}
# Close/Open the transaction
NewCommand D
# Forget the attribute
ForgetAll D ${aLabel}
# Close/Open the transaction
NewCommand D
# Undo-Redo-Undo
Undo D
Redo D
Undo D
# Save Document
set aFile ${imagedir}/caf001-M6.cbf
SaveAs D ${aFile}
Close D
#Open a document
Open ${aFile} D
# Get a value of the attribute
set IsGood 1
set aMessage1 "Add TDataStd_ExtStringArray attribute: Error"
set aGetAttr1 [GetExtStringArray D ${aLabel}]
set aLen1 [llength ${aGetAttr1}]
set aGetAttr2 [GetExtStringArray D ${aLabel} ${aGuid1}]
set aLen2 [llength ${aGetAttr2}]
if { ${aLen1} != [expr ${aTo1} - ${aFrom1} + 1] } {
set IsGood 0
puts "aLen1=${aLen1}"
puts ${aMessage1}
}
if { ${aLen2} != [expr ${aTo1} - ${aFrom1} + 1] } {
set IsGood 0
puts "aLen2=${aLen2}"
puts ${aMessage1}
}
set aGetAttr11 [lindex ${aGetAttr1} 0]
set aGetAttr21 [lindex ${aGetAttr2} 0]
if { ${aGetAttr11} != ${aGetAttr21} } {
set IsGood 0
puts "aGetAttr11=${aGetAttr11}"
puts "aGetAttr21=${aGetAttr21}"
puts ${aMessage1}
}
set aGetAttr12 [lindex ${aGetAttr1} 1]
set aGetAttr22 [lindex ${aGetAttr2} 1]
if { ${aGetAttr12} != ${aGetAttr22} } {
set IsGood 0
puts "aGetAttr12=${aGetAttr12}"
puts "aGetAttr22=${aGetAttr22}"
puts ${aMessage1}
}
if { ${IsGood} == 0} {
puts "Add TDataStd_ExtStringArray attribute: Error"
} else {
puts "Add TDataStd_ExtStringArray attribute: OK"
}

90
tests/caf/basic/M7 Normal file
View File

@ -0,0 +1,90 @@
#INTERFACE CAF
# Basic attributes
# TDataStd_ExtStringArray
#
# Testing attribute: User defined (additional GUID) TDataStd_ExtStringArray
#
# Testing command: SetExtStringArray
# Testing command: GetExtStringArray
#
puts "caf001-M7"
set QA_DUP 0
# Add an attribute to a data framework
set aFrom1 1
set aTo1 2
set aSetAttr11 xxxxx
set aSetAttr12 zzzzzzz
set aLabel 0:2
set isDelta 0
set aGuid1 "12e94515-6dbc-11d4-b9c8-0060b0ee281b"
SetExtStringArray D ${aLabel} ${isDelta} ${aFrom1} ${aTo1} ${aSetAttr11} ${aSetAttr12}
SetExtStringArray D ${aLabel} ${isDelta} -g ${aGuid1} ${aFrom1} ${aTo1} ${aSetAttr11} ${aSetAttr12}
# Close/Open the transaction
NewCommand D
# Forget the attribute
ForgetAll D ${aLabel}
# Close/Open the transaction
NewCommand D
# Undo-Redo-Undo
Undo D
Redo D
Undo D
# Save Document
Format D XmlOcaf
set aFile ${imagedir}/caf001-M7.xml
SaveAs D ${aFile}
Close D
#Open a document
Open ${aFile} D
# Get a value of the attribute
set IsGood 1
set aMessage1 "Add TDataStd_ExtStringArray attribute: Error"
set aGetAttr1 [GetExtStringArray D ${aLabel}]
set aLen1 [llength ${aGetAttr1}]
set aGetAttr2 [GetExtStringArray D ${aLabel} ${aGuid1}]
set aLen2 [llength ${aGetAttr2}]
if { ${aLen1} != [expr ${aTo1} - ${aFrom1} + 1] } {
set IsGood 0
puts "aLen1=${aLen1}"
puts ${aMessage1}
}
if { ${aLen2} != [expr ${aTo1} - ${aFrom1} + 1] } {
set IsGood 0
puts "aLen2=${aLen2}"
puts ${aMessage1}
}
set aGetAttr11 [lindex ${aGetAttr1} 0]
set aGetAttr21 [lindex ${aGetAttr2} 0]
if { ${aGetAttr11} != ${aGetAttr21} } {
set IsGood 0
puts "aGetAttr11=${aGetAttr11}"
puts "aGetAttr21=${aGetAttr21}"
puts ${aMessage1}
}
set aGetAttr12 [lindex ${aGetAttr1} 1]
set aGetAttr22 [lindex ${aGetAttr2} 1]
if { ${aGetAttr12} != ${aGetAttr22} } {
set IsGood 0
puts "aGetAttr12=${aGetAttr12}"
puts "aGetAttr22=${aGetAttr22}"
puts ${aMessage1}
}
if { ${IsGood} == 0} {
puts "Add TDataStd_ExtStringArray attribute: Error"
} else {
puts "Add TDataStd_ExtStringArray attribute: OK"
}

80
tests/caf/basic/O5 Normal file
View File

@ -0,0 +1,80 @@
#INTERFACE CAF
# Basic attributes
# TDataStd_BooleanArray
#
# Testing attribute: User defined (additional GUID) TDataStd_BooleanArray
#
# Testing command: SetBooleanArray
# Testing command: GetBooleanArray
#
puts "caf001-O5"
set QA_DUP 0
# Add an attribute to a data framework
set aFrom1 1
set aTo1 2
set aSetAttr11 0
set aSetAttr12 1
set aLabel 0:2
set aGuid1 "12e94516-6dbc-11d4-b9c8-0060b0ee281b"
SetBooleanArray D ${aLabel} ${aFrom1} ${aTo1} ${aSetAttr11} ${aSetAttr12}
SetBooleanArray D ${aLabel} -g ${aGuid1} ${aFrom1} ${aTo1} ${aSetAttr11} ${aSetAttr12}
# Close/Open the transaction
NewCommand D
# Forget the attribute
ForgetAll D ${aLabel}
# Close/Open the transaction
NewCommand D
# Undo-Redo-Undo
Undo D
Redo D
Undo D
# Get a value of the attribute
set IsGood 1
set aMessage1 "Add TDataStd_BooleanArray attribute: Error"
set aGetAttr1 [GetBooleanArray D ${aLabel}]
set aLen1 [llength ${aGetAttr1}]
set aGetAttr2 [GetBooleanArray D ${aLabel} ${aGuid1}]
set aLen2 [llength ${aGetAttr2}]
if { ${aLen1} != [expr ${aTo1} - ${aFrom1} + 1] } {
set IsGood 0
puts "aLen1=${aLen1}"
puts ${aMessage1}
}
if { ${aLen2} != [expr ${aTo1} - ${aFrom1} + 1] } {
set IsGood 0
puts "aLen2=${aLen2}"
puts ${aMessage1}
}
set aGetAttr11 [lindex ${aGetAttr1} 0]
set aGetAttr21 [lindex ${aGetAttr2} 0]
if { ${aGetAttr11} != ${aGetAttr21} } {
set IsGood 0
puts "aGetAttr11=${aGetAttr11}"
puts "aGetAttr21=${aGetAttr21}"
puts ${aMessage1}
}
set aGetAttr12 [lindex ${aGetAttr1} 1]
set aGetAttr22 [lindex ${aGetAttr2} 1]
if { ${aGetAttr12} != ${aGetAttr22} } {
set IsGood 0
puts "aGetAttr12=${aGetAttr12}"
puts "aGetAttr22=${aGetAttr22}"
puts ${aMessage1}
}
if { ${IsGood} == 0} {
puts "Add TDataStd_BooleanArray attribute: Error"
} else {
puts "Add TDataStd_BooleanArray attribute: OK"
}

89
tests/caf/basic/O6 Normal file
View File

@ -0,0 +1,89 @@
#INTERFACE CAF
# Basic attributes
# TDataStd_BooleanArray
#
# Testing attribute: User defined (additional GUID) TDataStd_BooleanArray
#
# Testing command: SetBooleanArray
# Testing command: GetBooleanArray
#
puts "caf001-O6"
set QA_DUP 0
# Add an attribute to a data framework
set aFrom1 1
set aTo1 2
set aSetAttr11 0
set aSetAttr12 1
set aLabel 0:2
set aGuid1 "12e94516-6dbc-11d4-b9c8-0060b0ee281b"
SetBooleanArray D ${aLabel} ${aFrom1} ${aTo1} ${aSetAttr11} ${aSetAttr12}
SetBooleanArray D ${aLabel} -g ${aGuid1} ${aFrom1} ${aTo1} ${aSetAttr11} ${aSetAttr12}
# Close/Open the transaction
NewCommand D
# Forget the attribute
ForgetAll D ${aLabel}
# Close/Open the transaction
NewCommand D
# Undo-Redo-Undo
Undo D
Redo D
Undo D
# Save Document
set aFile ${imagedir}/caf001-O6.cbf
SaveAs D ${aFile}
Close D
#Open a document
Open ${aFile} D
# Get a value of the attribute
set IsGood 1
set aMessage1 "Add TDataStd_BooleanArray attribute: Error"
set aGetAttr1 [GetBooleanArray D ${aLabel}]
set aLen1 [llength ${aGetAttr1}]
set aGetAttr2 [GetBooleanArray D ${aLabel} ${aGuid1}]
set aLen2 [llength ${aGetAttr2}]
if { ${aLen1} != [expr ${aTo1} - ${aFrom1} + 1] } {
set IsGood 0
puts "aLen1=${aLen1}"
puts ${aMessage1}
}
if { ${aLen2} != [expr ${aTo1} - ${aFrom1} + 1] } {
set IsGood 0
puts "aLen2=${aLen2}"
puts ${aMessage1}
}
set aGetAttr11 [lindex ${aGetAttr1} 0]
set aGetAttr21 [lindex ${aGetAttr2} 0]
if { ${aGetAttr11} != ${aGetAttr21} } {
set IsGood 0
puts "aGetAttr11=${aGetAttr11}"
puts "aGetAttr21=${aGetAttr21}"
puts ${aMessage1}
}
set aGetAttr12 [lindex ${aGetAttr1} 1]
set aGetAttr22 [lindex ${aGetAttr2} 1]
if { ${aGetAttr12} != ${aGetAttr22} } {
set IsGood 0
puts "aGetAttr12=${aGetAttr12}"
puts "aGetAttr22=${aGetAttr22}"
puts ${aMessage1}
}
if { ${IsGood} == 0} {
puts "Add TDataStd_BooleanArray attribute: Error"
} else {
puts "Add TDataStd_BooleanArray attribute: OK"
}

90
tests/caf/basic/O7 Normal file
View File

@ -0,0 +1,90 @@
#INTERFACE CAF
# Basic attributes
# TDataStd_BooleanArray
#
# Testing attribute: User defined (additional GUID) TDataStd_BooleanArray
#
# Testing command: SetBooleanArray
# Testing command: GetBooleanArray
#
puts "caf001-O7"
set QA_DUP 0
# Add an attribute to a data framework
set aFrom1 1
set aTo1 2
set aSetAttr11 0
set aSetAttr12 1
set aLabel 0:2
set aGuid1 "12e94516-6dbc-11d4-b9c8-0060b0ee281b"
SetBooleanArray D ${aLabel} ${aFrom1} ${aTo1} ${aSetAttr11} ${aSetAttr12}
SetBooleanArray D ${aLabel} -g ${aGuid1} ${aFrom1} ${aTo1} ${aSetAttr11} ${aSetAttr12}
# Close/Open the transaction
NewCommand D
# Forget the attribute
ForgetAll D ${aLabel}
# Close/Open the transaction
NewCommand D
# Undo-Redo-Undo
Undo D
Redo D
Undo D
# Save Document
Format D XmlOcaf
set aFile ${imagedir}/caf001-O7.xml
SaveAs D ${aFile}
Close D
#Open a document
Open ${aFile} D
# Get a value of the attribute
set IsGood 1
set aMessage1 "Add TDataStd_BooleanArray attribute: Error"
set aGetAttr1 [GetBooleanArray D ${aLabel}]
set aLen1 [llength ${aGetAttr1}]
set aGetAttr2 [GetBooleanArray D ${aLabel} ${aGuid1}]
set aLen2 [llength ${aGetAttr2}]
if { ${aLen1} != [expr ${aTo1} - ${aFrom1} + 1] } {
set IsGood 0
puts "aLen1=${aLen1}"
puts ${aMessage1}
}
if { ${aLen2} != [expr ${aTo1} - ${aFrom1} + 1] } {
set IsGood 0
puts "aLen2=${aLen2}"
puts ${aMessage1}
}
set aGetAttr11 [lindex ${aGetAttr1} 0]
set aGetAttr21 [lindex ${aGetAttr2} 0]
if { ${aGetAttr11} != ${aGetAttr21} } {
set IsGood 0
puts "aGetAttr11=${aGetAttr11}"
puts "aGetAttr21=${aGetAttr21}"
puts ${aMessage1}
}
set aGetAttr12 [lindex ${aGetAttr1} 1]
set aGetAttr22 [lindex ${aGetAttr2} 1]
if { ${aGetAttr12} != ${aGetAttr22} } {
set IsGood 0
puts "aGetAttr12=${aGetAttr12}"
puts "aGetAttr22=${aGetAttr22}"
puts ${aMessage1}
}
if { ${IsGood} == 0} {
puts "Add TDataStd_BooleanArray attribute: Error"
} else {
puts "Add TDataStd_BooleanArray attribute: OK"
}

80
tests/caf/basic/P5 Normal file
View File

@ -0,0 +1,80 @@
#INTERFACE CAF
# Basic attributes
# TDataStd_ByteArray
#
# Testing attribute: User defined (additional GUID) TDataStd_ByteArray
#
# Testing command: SetByteArray
# Testing command: GetByteArray
#
puts "caf001-P5"
set QA_DUP 0
# Add an attribute to a data framework
set aFrom1 1
set aTo1 2
set aSetAttr11 10
set aSetAttr12 12
set aLabel 0:2
set isDelta 0
set aGuid1 "12e94517-6dbc-11d4-b9c8-0060b0ee281b"
SetByteArray D ${aLabel} ${isDelta} ${aFrom1} ${aTo1} ${aSetAttr11} ${aSetAttr12}
SetByteArray D ${aLabel} ${isDelta} -g ${aGuid1} ${aFrom1} ${aTo1} ${aSetAttr11} ${aSetAttr12}
# Close/Open the transaction
NewCommand D
# Forget the attribute
ForgetAll D ${aLabel}
# Close/Open the transaction
NewCommand D
# Undo-Redo-Undo
Undo D
Redo D
Undo D
# Get a value of the attribute
set IsGood 1
set aMessage1 "Add TDataStd_ByteArray attribute: Error"
set aGetAttr1 [GetByteArray D ${aLabel}]
set aLen1 [llength ${aGetAttr1}]
set aGetAttr2 [GetByteArray D ${aLabel} ${aGuid1}]
set aLen2 [llength ${aGetAttr2}]
if { ${aLen1} != [expr ${aTo1} - ${aFrom1} + 1] } {
set IsGood 0
puts "aLen1=${aLen1}"
puts ${aMessage1}
}
if { ${aLen2} != [expr ${aTo1} - ${aFrom1} + 1] } {
set IsGood 0
puts "aLen2=${aLen2}"
puts ${aMessage1}
}
set aGetAttr11 [lindex ${aGetAttr1} 0]
set aGetAttr21 [lindex ${aGetAttr2} 0]
if { ${aGetAttr11} != ${aGetAttr21} } {
set IsGood 0
puts "aGetAttr11=${aGetAttr11}"
puts "aGetAttr21=${aGetAttr21}"
puts ${aMessage1}
}
set aGetAttr12 [lindex ${aGetAttr1} 1]
set aGetAttr22 [lindex ${aGetAttr2} 1]
if { ${aGetAttr12} != ${aGetAttr22} } {
set IsGood 0
puts "aGetAttr12=${aGetAttr12}"
puts "aGetAttr22=${aGetAttr22}"
puts ${aMessage1}
}
if { ${IsGood} == 0} {
puts "Add TDataStd_ByteArray attribute: Error"
} else {
puts "Add TDataStd_ByteArray attribute: OK"
}

89
tests/caf/basic/P6 Normal file
View File

@ -0,0 +1,89 @@
#INTERFACE CAF
# Basic attributes
# TDataStd_ByteArray
#
# Testing attribute: User defined (additional GUID) TDataStd_ByteArray
#
# Testing command: SetByteArray
# Testing command: GetByteArray
#
puts "caf001-P6"
set QA_DUP 0
# Add an attribute to a data framework
set aFrom1 1
set aTo1 2
set aSetAttr11 10
set aSetAttr12 12
set aLabel 0:2
set isDelta 0
set aGuid1 "12e94517-6dbc-11d4-b9c8-0060b0ee281b"
SetByteArray D ${aLabel} ${isDelta} ${aFrom1} ${aTo1} ${aSetAttr11} ${aSetAttr12}
SetByteArray D ${aLabel} ${isDelta} -g ${aGuid1} ${aFrom1} ${aTo1} ${aSetAttr11} ${aSetAttr12}
# Close/Open the transaction
NewCommand D
# Forget the attribute
ForgetAll D ${aLabel}
# Close/Open the transaction
NewCommand D
# Undo-Redo-Undo
Undo D
Redo D
Undo D
# Save Document
set aFile ${imagedir}/caf001-P6.cbf
SaveAs D ${aFile}
Close D
#Open a document
Open ${aFile} D
# Get a value of the attribute
set IsGood 1
set aMessage1 "Add TDataStd_ByteArray attribute: Error"
set aGetAttr1 [GetByteArray D ${aLabel}]
set aLen1 [llength ${aGetAttr1}]
set aGetAttr2 [GetByteArray D ${aLabel} ${aGuid1}]
set aLen2 [llength ${aGetAttr2}]
if { ${aLen1} != [expr ${aTo1} - ${aFrom1} + 1] } {
set IsGood 0
puts "aLen1=${aLen1}"
puts ${aMessage1}
}
if { ${aLen2} != [expr ${aTo1} - ${aFrom1} + 1] } {
set IsGood 0
puts "aLen2=${aLen2}"
puts ${aMessage1}
}
set aGetAttr11 [lindex ${aGetAttr1} 0]
set aGetAttr21 [lindex ${aGetAttr2} 0]
if { ${aGetAttr11} != ${aGetAttr21} } {
set IsGood 0
puts "aGetAttr11=${aGetAttr11}"
puts "aGetAttr21=${aGetAttr21}"
puts ${aMessage1}
}
set aGetAttr12 [lindex ${aGetAttr1} 1]
set aGetAttr22 [lindex ${aGetAttr2} 1]
if { ${aGetAttr12} != ${aGetAttr22} } {
set IsGood 0
puts "aGetAttr12=${aGetAttr12}"
puts "aGetAttr22=${aGetAttr22}"
puts ${aMessage1}
}
if { ${IsGood} == 0} {
puts "Add TDataStd_ByteArray attribute: Error"
} else {
puts "Add TDataStd_ByteArray attribute: OK"
}

90
tests/caf/basic/P7 Normal file
View File

@ -0,0 +1,90 @@
#INTERFACE CAF
# Basic attributes
# TDataStd_ByteArray
#
# Testing attribute: User defined (additional GUID) TDataStd_ByteArray
#
# Testing command: SetByteArray
# Testing command: GetByteArray
#
puts "caf001-P7"
set QA_DUP 0
# Add an attribute to a data framework
set aFrom1 1
set aTo1 2
set aSetAttr11 10
set aSetAttr12 12
set aLabel 0:2
set isDelta 0
set aGuid1 "12e94517-6dbc-11d4-b9c8-0060b0ee281b"
SetByteArray D ${aLabel} ${isDelta} ${aFrom1} ${aTo1} ${aSetAttr11} ${aSetAttr12}
SetByteArray D ${aLabel} ${isDelta} -g ${aGuid1} ${aFrom1} ${aTo1} ${aSetAttr11} ${aSetAttr12}
# Close/Open the transaction
NewCommand D
# Forget the attribute
ForgetAll D ${aLabel}
# Close/Open the transaction
NewCommand D
# Undo-Redo-Undo
Undo D
Redo D
Undo D
# Save Document
Format D XmlOcaf
set aFile ${imagedir}/caf001-P7.xml
SaveAs D ${aFile}
Close D
#Open a document
Open ${aFile} D
# Get a value of the attribute
set IsGood 1
set aMessage1 "Add TDataStd_ByteArray attribute: Error"
set aGetAttr1 [GetByteArray D ${aLabel}]
set aLen1 [llength ${aGetAttr1}]
set aGetAttr2 [GetByteArray D ${aLabel} ${aGuid1}]
set aLen2 [llength ${aGetAttr2}]
if { ${aLen1} != [expr ${aTo1} - ${aFrom1} + 1] } {
set IsGood 0
puts "aLen1=${aLen1}"
puts ${aMessage1}
}
if { ${aLen2} != [expr ${aTo1} - ${aFrom1} + 1] } {
set IsGood 0
puts "aLen2=${aLen2}"
puts ${aMessage1}
}
set aGetAttr11 [lindex ${aGetAttr1} 0]
set aGetAttr21 [lindex ${aGetAttr2} 0]
if { ${aGetAttr11} != ${aGetAttr21} } {
set IsGood 0
puts "aGetAttr11=${aGetAttr11}"
puts "aGetAttr21=${aGetAttr21}"
puts ${aMessage1}
}
set aGetAttr12 [lindex ${aGetAttr1} 1]
set aGetAttr22 [lindex ${aGetAttr2} 1]
if { ${aGetAttr12} != ${aGetAttr22} } {
set IsGood 0
puts "aGetAttr12=${aGetAttr12}"
puts "aGetAttr22=${aGetAttr22}"
puts ${aMessage1}
}
if { ${IsGood} == 0} {
puts "Add TDataStd_ByteArray attribute: Error"
} else {
puts "Add TDataStd_ByteArray attribute: OK"
}

80
tests/caf/basic/Q5 Normal file
View File

@ -0,0 +1,80 @@
#INTERFACE CAF
# Basic attributes
# TDataStd_ReferenceArray
#
# Testing attribute: User defined (additional GUID) TDataStd_ReferenceArray
#
# Testing command: SetRefArray
# Testing command: GetRefArray
#
puts "caf001-Q5"
set QA_DUP 0
# Add an attribute to a data framework
set aFrom1 1
set aTo1 2
set aSetAttr11 0:3
set aSetAttr12 0:4
set aLabel 0:2
set aGuid1 "12e94518-6dbc-11d4-b9c8-0060b0ee281b"
SetRefArray D ${aLabel} ${aFrom1} ${aTo1} ${aSetAttr11} ${aSetAttr12}
SetRefArray D ${aLabel} -g ${aGuid1} ${aFrom1} ${aTo1} ${aSetAttr11} ${aSetAttr12}
# Close/Open the transaction
NewCommand D
# Forget the attribute
ForgetAll D ${aLabel}
# Close/Open the transaction
NewCommand D
# Undo-Redo-Undo
Undo D
Redo D
Undo D
# Get a value of the attribute
set IsGood 1
set aMessage1 "Add TDataStd_ReferenceArray attribute: Error"
set aGetAttr1 [GetRefArray D ${aLabel}]
set aLen1 [llength ${aGetAttr1}]
set aGetAttr2 [GetRefArray D ${aLabel} ${aGuid1}]
set aLen2 [llength ${aGetAttr2}]
if { ${aLen1} != [expr ${aTo1} - ${aFrom1} + 1] } {
set IsGood 0
puts "aLen1=${aLen1}"
puts ${aMessage1}
}
if { ${aLen2} != [expr ${aTo1} - ${aFrom1} + 1] } {
set IsGood 0
puts "aLen2=${aLen2}"
puts ${aMessage1}
}
set aGetAttr11 [lindex ${aGetAttr1} 0]
set aGetAttr21 [lindex ${aGetAttr2} 0]
if { ${aGetAttr11} != ${aGetAttr21} } {
set IsGood 0
puts "aGetAttr11=${aGetAttr11}"
puts "aGetAttr21=${aGetAttr21}"
puts ${aMessage1}
}
set aGetAttr12 [lindex ${aGetAttr1} 1]
set aGetAttr22 [lindex ${aGetAttr2} 1]
if { ${aGetAttr12} != ${aGetAttr22} } {
set IsGood 0
puts "aGetAttr12=${aGetAttr12}"
puts "aGetAttr22=${aGetAttr22}"
puts ${aMessage1}
}
if { ${IsGood} == 0} {
puts "Add TDataStd_ReferenceArray attribute: Error"
} else {
puts "Add TDataStd_ReferenceArray attribute: OK"
}

89
tests/caf/basic/Q6 Normal file
View File

@ -0,0 +1,89 @@
#INTERFACE CAF
# Basic attributes
# TDataStd_ReferenceArray
#
# Testing attribute: User defined (additional GUID) TDataStd_ReferenceArray
#
# Testing command: SetRefArray
# Testing command: GetRefArray
#
puts "caf001-Q6"
set QA_DUP 0
# Add an attribute to a data framework
set aFrom1 1
set aTo1 2
set aSetAttr11 0:3
set aSetAttr12 0:4
set aLabel 0:2
set aGuid1 "12e94518-6dbc-11d4-b9c8-0060b0ee281b"
SetRefArray D ${aLabel} ${aFrom1} ${aTo1} ${aSetAttr11} ${aSetAttr12}
SetRefArray D ${aLabel} -g ${aGuid1} ${aFrom1} ${aTo1} ${aSetAttr11} ${aSetAttr12}
# Close/Open the transaction
NewCommand D
# Forget the attribute
ForgetAll D ${aLabel}
# Close/Open the transaction
NewCommand D
# Undo-Redo-Undo
Undo D
Redo D
Undo D
# Save Document
set aFile ${imagedir}/caf001-Q6.cbf
SaveAs D ${aFile}
Close D
#Open a document
Open ${aFile} D
# Get a value of the attribute
set IsGood 1
set aMessage1 "Add TDataStd_ReferenceArray attribute: Error"
set aGetAttr1 [GetRefArray D ${aLabel}]
set aLen1 [llength ${aGetAttr1}]
set aGetAttr2 [GetRefArray D ${aLabel} ${aGuid1}]
set aLen2 [llength ${aGetAttr2}]
if { ${aLen1} != [expr ${aTo1} - ${aFrom1} + 1] } {
set IsGood 0
puts "aLen1=${aLen1}"
puts ${aMessage1}
}
if { ${aLen2} != [expr ${aTo1} - ${aFrom1} + 1] } {
set IsGood 0
puts "aLen2=${aLen2}"
puts ${aMessage1}
}
set aGetAttr11 [lindex ${aGetAttr1} 0]
set aGetAttr21 [lindex ${aGetAttr2} 0]
if { ${aGetAttr11} != ${aGetAttr21} } {
set IsGood 0
puts "aGetAttr11=${aGetAttr11}"
puts "aGetAttr21=${aGetAttr21}"
puts ${aMessage1}
}
set aGetAttr12 [lindex ${aGetAttr1} 1]
set aGetAttr22 [lindex ${aGetAttr2} 1]
if { ${aGetAttr12} != ${aGetAttr22} } {
set IsGood 0
puts "aGetAttr12=${aGetAttr12}"
puts "aGetAttr22=${aGetAttr22}"
puts ${aMessage1}
}
if { ${IsGood} == 0} {
puts "Add TDataStd_ReferenceArray attribute: Error"
} else {
puts "Add TDataStd_ReferenceArray attribute: OK"
}

90
tests/caf/basic/Q7 Normal file
View File

@ -0,0 +1,90 @@
#INTERFACE CAF
# Basic attributes
# TDataStd_ReferenceArray
#
# Testing attribute: User defined (additional GUID) TDataStd_ReferenceArray
#
# Testing command: SetRefArray
# Testing command: GetRefArray
#
puts "caf001-Q7"
set QA_DUP 0
# Add an attribute to a data framework
set aFrom1 1
set aTo1 2
set aSetAttr11 0:3
set aSetAttr12 0:4
set aLabel 0:2
set aGuid1 "12e94518-6dbc-11d4-b9c8-0060b0ee281b"
SetRefArray D ${aLabel} ${aFrom1} ${aTo1} ${aSetAttr11} ${aSetAttr12}
SetRefArray D ${aLabel} -g ${aGuid1} ${aFrom1} ${aTo1} ${aSetAttr11} ${aSetAttr12}
# Close/Open the transaction
NewCommand D
# Forget the attribute
ForgetAll D ${aLabel}
# Close/Open the transaction
NewCommand D
# Undo-Redo-Undo
Undo D
Redo D
Undo D
# Save Document
Format D XmlOcaf
set aFile ${imagedir}/caf001-Q7.xml
SaveAs D ${aFile}
Close D
#Open a document
Open ${aFile} D
# Get a value of the attribute
set IsGood 1
set aMessage1 "Add TDataStd_BooleanArray attribute: Error"
set aGetAttr1 [GetRefArray D ${aLabel}]
set aLen1 [llength ${aGetAttr1}]
set aGetAttr2 [GetRefArray D ${aLabel} ${aGuid1}]
set aLen2 [llength ${aGetAttr2}]
if { ${aLen1} != [expr ${aTo1} - ${aFrom1} + 1] } {
set IsGood 0
puts "aLen1=${aLen1}"
puts ${aMessage1}
}
if { ${aLen2} != [expr ${aTo1} - ${aFrom1} + 1] } {
set IsGood 0
puts "aLen2=${aLen2}"
puts ${aMessage1}
}
set aGetAttr11 [lindex ${aGetAttr1} 0]
set aGetAttr21 [lindex ${aGetAttr2} 0]
if { ${aGetAttr11} != ${aGetAttr21} } {
set IsGood 0
puts "aGetAttr11=${aGetAttr11}"
puts "aGetAttr21=${aGetAttr21}"
puts ${aMessage1}
}
set aGetAttr12 [lindex ${aGetAttr1} 1]
set aGetAttr22 [lindex ${aGetAttr2} 1]
if { ${aGetAttr12} != ${aGetAttr22} } {
set IsGood 0
puts "aGetAttr12=${aGetAttr12}"
puts "aGetAttr22=${aGetAttr22}"
puts ${aMessage1}
}
if { ${IsGood} == 0} {
puts "Add TDataStd_ReferenceArray attribute: Error"
} else {
puts "Add TDataStd_ReferenceArray attribute: OK"
}

74
tests/caf/basic/R5 Normal file
View File

@ -0,0 +1,74 @@
#INTERFACE CAF
# Basic attributes
# TDataStd_RealList
#
# Testing attribute: User defined (additional GUID) TDataStd_RealList
#
# Testing command: SetRealList
# Testing command: GetRealList
#
puts "caf001-R5"
set QA_DUP 0
# Add an attribute to a data framework
set aSetAttr11 3.
set aSetAttr12 4.
set aLabel 0:2
set aGuid1 "12e94521-6dbc-11d4-b9c8-0060b0ee281b"
SetRealList D ${aLabel} ${aSetAttr11} ${aSetAttr12}
SetRealList D ${aLabel} -g ${aGuid1} ${aSetAttr11} ${aSetAttr12}
# Close/Open the transaction
NewCommand D
# Forget the attribute
ForgetAll D ${aLabel}
# Close/Open the transaction
NewCommand D
# Undo-Redo-Undo
Undo D
Redo D
Undo D
# Get a value of the attribute
set IsGood 1
set aMessage1 "Add TDataStd_RealList attribute: Error"
set aGetAttr1 [GetRealList D ${aLabel}]
set aLen1 [llength ${aGetAttr1}]
set aGetAttr2 [GetRealList D ${aLabel} ${aGuid1}]
set aLen2 [llength ${aGetAttr2}]
if { ${aLen1} != ${aLen2}} {
set IsGood 0
puts "aLen1=${aLen1}"
puts "aLen2=${aLen2}"
puts ${aMessage1}
}
set aGetAttr11 [lindex ${aGetAttr1} 0]
set aGetAttr21 [lindex ${aGetAttr2} 0]
if { ${aGetAttr11} != ${aGetAttr21} } {
set IsGood 0
puts "aGetAttr11=${aGetAttr11}"
puts "aGetAttr21=${aGetAttr21}"
puts ${aMessage1}
}
set aGetAttr12 [lindex ${aGetAttr1} 1]
set aGetAttr22 [lindex ${aGetAttr2} 1]
if { ${aGetAttr12} != ${aGetAttr22} } {
set IsGood 0
puts "aGetAttr12=${aGetAttr12}"
puts "aGetAttr22=${aGetAttr22}"
puts ${aMessage1}
}
if { ${IsGood} == 0} {
puts "Add TDataStd_RealList attribute: Error"
} else {
puts "Add TDataStd_RealList attribute: OK"
}

82
tests/caf/basic/R6 Normal file
View File

@ -0,0 +1,82 @@
#INTERFACE CAF
# Basic attributes
# TDataStd_RealList
#
# Testing attribute: User defined (additional GUID) TDataStd_RealList
#
# Testing command: SetRealList
# Testing command: GetRealList
#
puts "caf001-R6"
set QA_DUP 0
# Add an attributes to a data framework
set aSetAttr11 3.
set aSetAttr12 4.
set aLabel 0:2
set aGuid1 "12e94521-6dbc-11d4-b9c8-0060b0ee281b"
SetRealList D ${aLabel} ${aSetAttr11} ${aSetAttr12}
SetRealList D ${aLabel} -g ${aGuid1} ${aSetAttr11} ${aSetAttr12}
# Close/Open the transaction
NewCommand D
# Forget the attribute
ForgetAll D ${aLabel}
# Close/Open the transaction
NewCommand D
# Undo-Redo-Undo
Undo D
Redo D
Undo D
# Save Document
set aFile ${imagedir}/caf001-R6.cbf
SaveAs D ${aFile};
Close D
#Open a document
Open ${aFile} D
# Get a value of the attribute
set IsGood 1
set aMessage1 "Add TDataStd_RealList attribute: Error"
set aGetAttr1 [GetRealList D ${aLabel}]
set aLen1 [llength ${aGetAttr1}]
set aGetAttr2 [GetRealList D ${aLabel} ${aGuid1}]
set aLen2 [llength ${aGetAttr2}]
if { ${aLen1} != ${aLen2}} {
set IsGood 0
puts "aLen1=${aLen1}"
puts "aLen2=${aLen2}"
puts ${aMessage1}
}
set aGetAttr11 [lindex ${aGetAttr1} 0]
set aGetAttr21 [lindex ${aGetAttr2} 0]
if { ${aGetAttr11} != ${aGetAttr21} } {
set IsGood 0
puts "aGetAttr11=${aGetAttr11}"
puts "aGetAttr21=${aGetAttr21}"
puts ${aMessage1}
}
set aGetAttr12 [lindex ${aGetAttr1} 1]
set aGetAttr22 [lindex ${aGetAttr2} 1]
if { ${aGetAttr12} != ${aGetAttr22} } {
set IsGood 0
puts "aGetAttr12=${aGetAttr12}"
puts "aGetAttr22=${aGetAttr22}"
puts ${aMessage1}
}
if { ${IsGood} == 0} {
puts "Add TDataStd_RealList attribute: Error"
} else {
puts "Add TDataStd_RealList attribute: OK"
}

83
tests/caf/basic/R7 Normal file
View File

@ -0,0 +1,83 @@
#INTERFACE CAF
# Basic attributes
# TDataStd_RealList
#
# Testing attribute: User defined (additional GUID) TDataStd_RealList
#
# Testing command: SetRealList
# Testing command: GetRealList
#
puts "caf001-R7"
set QA_DUP 0
# Add an attributes to a data framework
set aSetAttr11 3.
set aSetAttr12 4.
set aLabel 0:2
set aGuid1 "12e94521-6dbc-11d4-b9c8-0060b0ee281b"
SetRealList D ${aLabel} ${aSetAttr11} ${aSetAttr12}
SetRealList D ${aLabel} -g ${aGuid1} ${aSetAttr11} ${aSetAttr12}
# Close/Open the transaction
NewCommand D
# Forget the attribute
ForgetAll D ${aLabel}
# Close/Open the transaction
NewCommand D
# Undo-Redo-Undo
Undo D
Redo D
Undo D
# Save Document
Format D XmlOcaf
set aFile ${imagedir}/caf001-R7.xml
SaveAs D ${aFile};
Close D
#Open a document
Open ${aFile} D
# Get a value of the attribute
set IsGood 1
set aMessage1 "Add TDataStd_RealList attribute: Error"
set aGetAttr1 [GetRealList D ${aLabel}]
set aLen1 [llength ${aGetAttr1}]
set aGetAttr2 [GetRealList D ${aLabel} ${aGuid1}]
set aLen2 [llength ${aGetAttr2}]
if { ${aLen1} != ${aLen2}} {
set IsGood 0
puts "aLen1=${aLen1}"
puts "aLen2=${aLen2}"
puts ${aMessage1}
}
set aGetAttr11 [lindex ${aGetAttr1} 0]
set aGetAttr21 [lindex ${aGetAttr2} 0]
if { ${aGetAttr11} != ${aGetAttr21} } {
set IsGood 0
puts "aGetAttr11=${aGetAttr11}"
puts "aGetAttr21=${aGetAttr21}"
puts ${aMessage1}
}
set aGetAttr12 [lindex ${aGetAttr1} 1]
set aGetAttr22 [lindex ${aGetAttr2} 1]
if { ${aGetAttr12} != ${aGetAttr22} } {
set IsGood 0
puts "aGetAttr12=${aGetAttr12}"
puts "aGetAttr22=${aGetAttr22}"
puts ${aMessage1}
}
if { ${IsGood} == 0} {
puts "Add TDataStd_RealList attribute: Error"
} else {
puts "Add TDataStd_RealList attribute: OK"
}

74
tests/caf/basic/S5 Normal file
View File

@ -0,0 +1,74 @@
#INTERFACE CAF
# Basic attributes
# TDataStd_IntegerList
#
# Testing attribute: User defined (additional GUID) TDataStd_IntegerList
#
# Testing command: SetIntegerList
# Testing command: GetIntegerList
#
puts "caf001-S5"
set QA_DUP 0
# Add an attribute to a data framework
set aSetAttr11 33
set aSetAttr12 44
set aLabel 0:2
set aGuid1 "12e94531-6dbc-11d4-b9c8-0060b0ee281b"
SetIntegerList D ${aLabel} ${aSetAttr11} ${aSetAttr12}
SetIntegerList D ${aLabel} -g ${aGuid1} ${aSetAttr11} ${aSetAttr12}
# Close/Open the transaction
NewCommand D
# Forget the attribute
ForgetAll D ${aLabel}
# Close/Open the transaction
NewCommand D
# Undo-Redo-Undo
Undo D
Redo D
Undo D
# Get a value of the attribute
set IsGood 1
set aMessage1 "Add TDataStd_IntegerList attribute: Error"
set aGetAttr1 [GetIntegerList D ${aLabel}]
set aLen1 [llength ${aGetAttr1}]
set aGetAttr2 [GetIntegerList D ${aLabel} ${aGuid1}]
set aLen2 [llength ${aGetAttr2}]
if { ${aLen1} != ${aLen2}} {
set IsGood 0
puts "aLen1=${aLen1}"
puts "aLen2=${aLen2}"
puts ${aMessage1}
}
set aGetAttr11 [lindex ${aGetAttr1} 0]
set aGetAttr21 [lindex ${aGetAttr2} 0]
if { ${aGetAttr11} != ${aGetAttr21} } {
set IsGood 0
puts "aGetAttr11=${aGetAttr11}"
puts "aGetAttr21=${aGetAttr21}"
puts ${aMessage1}
}
set aGetAttr12 [lindex ${aGetAttr1} 1]
set aGetAttr22 [lindex ${aGetAttr2} 1]
if { ${aGetAttr12} != ${aGetAttr22} } {
set IsGood 0
puts "aGetAttr12=${aGetAttr12}"
puts "aGetAttr22=${aGetAttr22}"
puts ${aMessage1}
}
if { ${IsGood} == 0} {
puts "Add TDataStd_IntegerList attribute: Error"
} else {
puts "Add TDataStd_IntegerList attribute: OK"
}

82
tests/caf/basic/S6 Normal file
View File

@ -0,0 +1,82 @@
#INTERFACE CAF
# Basic attributes
# TDataStd_IntegerList
#
# Testing attribute: User defined (additional GUID) TDataStd_IntegerList
#
# Testing command: SetIntegerList
# Testing command: GetIntegerList
#
puts "caf001-S6"
set QA_DUP 0
# Add an attributes to a data framework
set aSetAttr11 33
set aSetAttr12 44
set aLabel 0:2
set aGuid1 "12e94531-6dbc-11d4-b9c8-0060b0ee281b"
SetIntegerList D ${aLabel} ${aSetAttr11} ${aSetAttr12}
SetIntegerList D ${aLabel} -g ${aGuid1} ${aSetAttr11} ${aSetAttr12}
# Close/Open the transaction
NewCommand D
# Forget the attribute
ForgetAll D ${aLabel}
# Close/Open the transaction
NewCommand D
# Undo-Redo-Undo
Undo D
Redo D
Undo D
# Save Document
set aFile ${imagedir}/caf001-S6.cbf
SaveAs D ${aFile};
Close D
#Open a document
Open ${aFile} D
# Get a value of the attribute
set IsGood 1
set aMessage1 "Add TDataStd_IntegerList attribute: Error"
set aGetAttr1 [GetIntegerList D ${aLabel}]
set aLen1 [llength ${aGetAttr1}]
set aGetAttr2 [GetIntegerList D ${aLabel} ${aGuid1}]
set aLen2 [llength ${aGetAttr2}]
if { ${aLen1} != ${aLen2}} {
set IsGood 0
puts "aLen1=${aLen1}"
puts "aLen2=${aLen2}"
puts ${aMessage1}
}
set aGetAttr11 [lindex ${aGetAttr1} 0]
set aGetAttr21 [lindex ${aGetAttr2} 0]
if { ${aGetAttr11} != ${aGetAttr21} } {
set IsGood 0
puts "aGetAttr11=${aGetAttr11}"
puts "aGetAttr21=${aGetAttr21}"
puts ${aMessage1}
}
set aGetAttr12 [lindex ${aGetAttr1} 1]
set aGetAttr22 [lindex ${aGetAttr2} 1]
if { ${aGetAttr12} != ${aGetAttr22} } {
set IsGood 0
puts "aGetAttr12=${aGetAttr12}"
puts "aGetAttr22=${aGetAttr22}"
puts ${aMessage1}
}
if { ${IsGood} == 0} {
puts "Add TDataStd_IntegerList attribute: Error"
} else {
puts "Add TDataStd_IntegerList attribute: OK"
}

83
tests/caf/basic/S7 Normal file
View File

@ -0,0 +1,83 @@
#INTERFACE CAF
# Basic attributes
# TDataStd_IntegerList
#
# Testing attribute: User defined (additional GUID) TDataStd_IntegerList
#
# Testing command: SetIntegerList
# Testing command: GetIntegerList
#
puts "caf001-S7"
set QA_DUP 0
# Add an attributes to a data framework
set aSetAttr11 33
set aSetAttr12 44
set aLabel 0:2
set aGuid1 "12e94531-6dbc-11d4-b9c8-0060b0ee281b"
SetIntegerList D ${aLabel} ${aSetAttr11} ${aSetAttr12}
SetIntegerList D ${aLabel} -g ${aGuid1} ${aSetAttr11} ${aSetAttr12}
# Close/Open the transaction
NewCommand D
# Forget the attribute
ForgetAll D ${aLabel}
# Close/Open the transaction
NewCommand D
# Undo-Redo-Undo
Undo D
Redo D
Undo D
# Save Document
Format D XmlOcaf
set aFile ${imagedir}/caf001-S7.xml
SaveAs D ${aFile};
Close D
#Open a document
Open ${aFile} D
# Get a value of the attribute
set IsGood 1
set aMessage1 "Add TDataStd_IntegerList attribute: Error"
set aGetAttr1 [GetIntegerList D ${aLabel}]
set aLen1 [llength ${aGetAttr1}]
set aGetAttr2 [GetIntegerList D ${aLabel} ${aGuid1}]
set aLen2 [llength ${aGetAttr2}]
if { ${aLen1} != ${aLen2}} {
set IsGood 0
puts "aLen1=${aLen1}"
puts "aLen2=${aLen2}"
puts ${aMessage1}
}
set aGetAttr11 [lindex ${aGetAttr1} 0]
set aGetAttr21 [lindex ${aGetAttr2} 0]
if { ${aGetAttr11} != ${aGetAttr21} } {
set IsGood 0
puts "aGetAttr11=${aGetAttr11}"
puts "aGetAttr21=${aGetAttr21}"
puts ${aMessage1}
}
set aGetAttr12 [lindex ${aGetAttr1} 1]
set aGetAttr22 [lindex ${aGetAttr2} 1]
if { ${aGetAttr12} != ${aGetAttr22} } {
set IsGood 0
puts "aGetAttr12=${aGetAttr12}"
puts "aGetAttr22=${aGetAttr22}"
puts ${aMessage1}
}
if { ${IsGood} == 0} {
puts "Add TDataStd_IntegerList attribute: Error"
} else {
puts "Add TDataStd_IntegerList attribute: OK"
}

74
tests/caf/basic/T5 Normal file
View File

@ -0,0 +1,74 @@
#INTERFACE CAF
# Basic attributes
# TDataStd_ExtStringList
#
# Testing attribute: User defined (additional GUID) TDataStd_ExtStringList
#
# Testing command: SetExtStringList
# Testing command: GetExtStringList
#
puts "caf001-T5"
set QA_DUP 0
# Add an attribute to a data framework
set aSetAttr11 aaaaa
set aSetAttr12 bbbbbb
set aLabel 0:2
set aGuid1 "12e94541-6dbc-11d4-b9c8-0060b0ee281b"
SetExtStringList D ${aLabel} ${aSetAttr11} ${aSetAttr12}
SetExtStringList D ${aLabel} -g ${aGuid1} ${aSetAttr11} ${aSetAttr12}
# Close/Open the transaction
NewCommand D
# Forget the attribute
ForgetAll D ${aLabel}
# Close/Open the transaction
NewCommand D
# Undo-Redo-Undo
Undo D
Redo D
Undo D
# Get a value of the attribute
set IsGood 1
set aMessage1 "Add TDataStd_ExtStringList attribute: Error"
set aGetAttr1 [GetExtStringList D ${aLabel}]
set aLen1 [llength ${aGetAttr1}]
set aGetAttr2 [GetExtStringList D ${aLabel} ${aGuid1}]
set aLen2 [llength ${aGetAttr2}]
if { ${aLen1} != ${aLen2}} {
set IsGood 0
puts "aLen1=${aLen1}"
puts "aLen2=${aLen2}"
puts ${aMessage1}
}
set aGetAttr11 [lindex ${aGetAttr1} 0]
set aGetAttr21 [lindex ${aGetAttr2} 0]
if { ${aGetAttr11} != ${aGetAttr21} } {
set IsGood 0
puts "aGetAttr11=${aGetAttr11}"
puts "aGetAttr21=${aGetAttr21}"
puts ${aMessage1}
}
set aGetAttr12 [lindex ${aGetAttr1} 1]
set aGetAttr22 [lindex ${aGetAttr2} 1]
if { ${aGetAttr12} != ${aGetAttr22} } {
set IsGood 0
puts "aGetAttr12=${aGetAttr12}"
puts "aGetAttr22=${aGetAttr22}"
puts ${aMessage1}
}
if { ${IsGood} == 0} {
puts "Add TDataStd_ExtStringList attribute: Error"
} else {
puts "Add TDataStd_ExtStringList attribute: OK"
}

82
tests/caf/basic/T6 Normal file
View File

@ -0,0 +1,82 @@
#INTERFACE CAF
# Basic attributes
# TDataStd_ExtStringList
#
# Testing attribute: User defined (additional GUID) TDataStd_ExtStringList
#
# Testing command: SetExtStringList
# Testing command: GetExtStringList
#
puts "caf001-T6"
set QA_DUP 0
# Add an attributes to a data framework
set aSetAttr11 xxxx
set aSetAttr12 yyyyy
set aLabel 0:2
set aGuid1 "12e94541-6dbc-11d4-b9c8-0060b0ee281b"
SetExtStringList D ${aLabel} ${aSetAttr11} ${aSetAttr12}
SetExtStringList D ${aLabel} -g ${aGuid1} ${aSetAttr11} ${aSetAttr12}
# Close/Open the transaction
NewCommand D
# Forget the attribute
ForgetAll D ${aLabel}
# Close/Open the transaction
NewCommand D
# Undo-Redo-Undo
Undo D
Redo D
Undo D
# Save Document
set aFile ${imagedir}/caf001-T6.cbf
SaveAs D ${aFile};
Close D
#Open a document
Open ${aFile} D
# Get a value of the attribute
set IsGood 1
set aMessage1 "Add TDataStd_ExtStringList attribute: Error"
set aGetAttr1 [GetExtStringList D ${aLabel}]
set aLen1 [llength ${aGetAttr1}]
set aGetAttr2 [GetExtStringList D ${aLabel} ${aGuid1}]
set aLen2 [llength ${aGetAttr2}]
if { ${aLen1} != ${aLen2}} {
set IsGood 0
puts "aLen1=${aLen1}"
puts "aLen2=${aLen2}"
puts ${aMessage1}
}
set aGetAttr11 [lindex ${aGetAttr1} 0]
set aGetAttr21 [lindex ${aGetAttr2} 0]
if { ${aGetAttr11} != ${aGetAttr21} } {
set IsGood 0
puts "aGetAttr11=${aGetAttr11}"
puts "aGetAttr21=${aGetAttr21}"
puts ${aMessage1}
}
set aGetAttr12 [lindex ${aGetAttr1} 1]
set aGetAttr22 [lindex ${aGetAttr2} 1]
if { ${aGetAttr12} != ${aGetAttr22} } {
set IsGood 0
puts "aGetAttr12=${aGetAttr12}"
puts "aGetAttr22=${aGetAttr22}"
puts ${aMessage1}
}
if { ${IsGood} == 0} {
puts "Add TDataStd_ExtStringList attribute: Error"
} else {
puts "Add TDataStd_ExtStringList attribute: OK"
}

83
tests/caf/basic/T7 Normal file
View File

@ -0,0 +1,83 @@
#INTERFACE CAF
# Basic attributes
# TDataStd_ExtStringList
#
# Testing attribute: User defined (additional GUID) TDataStd_ExtStringList
#
# Testing command: SetExtStringList
# Testing command: GetExtStringList
#
puts "caf001-T7"
set QA_DUP 0
# Add an attributes to a data framework
set aSetAttr11 xxxx
set aSetAttr12 yyyyy
set aLabel 0:2
set aGuid1 "12e94541-6dbc-11d4-b9c8-0060b0ee281b"
SetExtStringList D ${aLabel} ${aSetAttr11} ${aSetAttr12}
SetExtStringList D ${aLabel} -g ${aGuid1} ${aSetAttr11} ${aSetAttr12}
# Close/Open the transaction
NewCommand D
# Forget the attribute
ForgetAll D ${aLabel}
# Close/Open the transaction
NewCommand D
# Undo-Redo-Undo
Undo D
Redo D
Undo D
# Save Document
Format D XmlOcaf
set aFile ${imagedir}/caf001-T7.xml
SaveAs D ${aFile};
Close D
#Open a document
Open ${aFile} D
# Get a value of the attribute
set IsGood 1
set aMessage1 "Add TDataStd_ExtStringList attribute: Error"
set aGetAttr1 [GetExtStringList D ${aLabel}]
set aLen1 [llength ${aGetAttr1}]
set aGetAttr2 [GetExtStringList D ${aLabel} ${aGuid1}]
set aLen2 [llength ${aGetAttr2}]
if { ${aLen1} != ${aLen2}} {
set IsGood 0
puts "aLen1=${aLen1}"
puts "aLen2=${aLen2}"
puts ${aMessage1}
}
set aGetAttr11 [lindex ${aGetAttr1} 0]
set aGetAttr21 [lindex ${aGetAttr2} 0]
if { ${aGetAttr11} != ${aGetAttr21} } {
set IsGood 0
puts "aGetAttr11=${aGetAttr11}"
puts "aGetAttr21=${aGetAttr21}"
puts ${aMessage1}
}
set aGetAttr12 [lindex ${aGetAttr1} 1]
set aGetAttr22 [lindex ${aGetAttr2} 1]
if { ${aGetAttr12} != ${aGetAttr22} } {
set IsGood 0
puts "aGetAttr12=${aGetAttr12}"
puts "aGetAttr22=${aGetAttr22}"
puts ${aMessage1}
}
if { ${IsGood} == 0} {
puts "Add TDataStd_ExtStringList attribute: Error"
} else {
puts "Add TDataStd_ExtStringList attribute: OK"
}

74
tests/caf/basic/U5 Normal file
View File

@ -0,0 +1,74 @@
#INTERFACE CAF
# Basic attributes
# TDataStd_BooleanList
#
# Testing attribute: User defined (additional GUID) TDataStd_BooleanList
#
# Testing command: SetBooleanList
# Testing command: GetBooleanList
#
puts "caf001-U5"
set QA_DUP 0
# Add an attribute to a data framework
set aSetAttr11 0
set aSetAttr12 1
set aLabel 0:2
set aGuid1 "12e94551-6dbc-11d4-b9c8-0060b0ee281b"
SetBooleanList D ${aLabel} ${aSetAttr11} ${aSetAttr12}
SetBooleanList D ${aLabel} -g ${aGuid1} ${aSetAttr11} ${aSetAttr12}
# Close/Open the transaction
NewCommand D
# Forget the attribute
ForgetAll D ${aLabel}
# Close/Open the transaction
NewCommand D
# Undo-Redo-Undo
Undo D
Redo D
Undo D
# Get a value of the attribute
set IsGood 1
set aMessage1 "Add TDataStd_BooleanList attribute: Error"
set aGetAttr1 [GetBooleanList D ${aLabel}]
set aLen1 [llength ${aGetAttr1}]
set aGetAttr2 [GetBooleanList D ${aLabel} ${aGuid1}]
set aLen2 [llength ${aGetAttr2}]
if { ${aLen1} != ${aLen2}} {
set IsGood 0
puts "aLen1=${aLen1}"
puts "aLen2=${aLen2}"
puts ${aMessage1}
}
set aGetAttr11 [lindex ${aGetAttr1} 0]
set aGetAttr21 [lindex ${aGetAttr2} 0]
if { ${aGetAttr11} != ${aGetAttr21} } {
set IsGood 0
puts "aGetAttr11=${aGetAttr11}"
puts "aGetAttr21=${aGetAttr21}"
puts ${aMessage1}
}
set aGetAttr12 [lindex ${aGetAttr1} 1]
set aGetAttr22 [lindex ${aGetAttr2} 1]
if { ${aGetAttr12} != ${aGetAttr22} } {
set IsGood 0
puts "aGetAttr12=${aGetAttr12}"
puts "aGetAttr22=${aGetAttr22}"
puts ${aMessage1}
}
if { ${IsGood} == 0} {
puts "Add TDataStd_BooleanList attribute: Error"
} else {
puts "Add TDataStd_BooleanList attribute: OK"
}

82
tests/caf/basic/U6 Normal file
View File

@ -0,0 +1,82 @@
#INTERFACE CAF
# Basic attributes
# TDataStd_BooleanList
#
# Testing attribute: User defined (additional GUID) TDataStd_BooleanList
#
# Testing command: SetBooleanList
# Testing command: GetBooleanList
#
puts "caf001-U6"
set QA_DUP 0
# Add an attributes to a data framework
set aSetAttr11 0
set aSetAttr12 1
set aLabel 0:2
set aGuid1 "12e94551-6dbc-11d4-b9c8-0060b0ee281b"
SetBooleanList D ${aLabel} ${aSetAttr11} ${aSetAttr12}
SetBooleanList D ${aLabel} -g ${aGuid1} ${aSetAttr11} ${aSetAttr12}
# Close/Open the transaction
NewCommand D
# Forget the attribute
ForgetAll D ${aLabel}
# Close/Open the transaction
NewCommand D
# Undo-Redo-Undo
Undo D
Redo D
Undo D
# Save Document
set aFile ${imagedir}/caf001-U6.cbf
SaveAs D ${aFile};
Close D
#Open a document
Open ${aFile} D
# Get a value of the attribute
set IsGood 1
set aMessage1 "Add TDataStd_BooleanList attribute: Error"
set aGetAttr1 [GetBooleanList D ${aLabel}]
set aLen1 [llength ${aGetAttr1}]
set aGetAttr2 [GetBooleanList D ${aLabel} ${aGuid1}]
set aLen2 [llength ${aGetAttr2}]
if { ${aLen1} != ${aLen2}} {
set IsGood 0
puts "aLen1=${aLen1}"
puts "aLen2=${aLen2}"
puts ${aMessage1}
}
set aGetAttr11 [lindex ${aGetAttr1} 0]
set aGetAttr21 [lindex ${aGetAttr2} 0]
if { ${aGetAttr11} != ${aGetAttr21} } {
set IsGood 0
puts "aGetAttr11=${aGetAttr11}"
puts "aGetAttr21=${aGetAttr21}"
puts ${aMessage1}
}
set aGetAttr12 [lindex ${aGetAttr1} 1]
set aGetAttr22 [lindex ${aGetAttr2} 1]
if { ${aGetAttr12} != ${aGetAttr22} } {
set IsGood 0
puts "aGetAttr12=${aGetAttr12}"
puts "aGetAttr22=${aGetAttr22}"
puts ${aMessage1}
}
if { ${IsGood} == 0} {
puts "Add TDataStd_BooleanList attribute: Error"
} else {
puts "Add TDataStd_BooleanList attribute: OK"
}

83
tests/caf/basic/U7 Normal file
View File

@ -0,0 +1,83 @@
#INTERFACE CAF
# Basic attributes
# TDataStd_BooleanList
#
# Testing attribute: User defined (additional GUID) TDataStd_BooleanList
#
# Testing command: SetBooleanList
# Testing command: GetBooleanList
#
puts "caf001-U7"
set QA_DUP 0
# Add an attributes to a data framework
set aSetAttr11 0
set aSetAttr12 1
set aLabel 0:2
set aGuid1 "12e94551-6dbc-11d4-b9c8-0060b0ee281b"
SetBooleanList D ${aLabel} ${aSetAttr11} ${aSetAttr12}
SetBooleanList D ${aLabel} -g ${aGuid1} ${aSetAttr11} ${aSetAttr12}
# Close/Open the transaction
NewCommand D
# Forget the attribute
ForgetAll D ${aLabel}
# Close/Open the transaction
NewCommand D
# Undo-Redo-Undo
Undo D
Redo D
Undo D
# Save Document
Format D XmlOcaf
set aFile ${imagedir}/caf001-U7.xml
SaveAs D ${aFile};
Close D
#Open a document
Open ${aFile} D
# Get a value of the attribute
set IsGood 1
set aMessage1 "Add TDataStd_BooleanList attribute: Error"
set aGetAttr1 [GetBooleanList D ${aLabel}]
set aLen1 [llength ${aGetAttr1}]
set aGetAttr2 [GetBooleanList D ${aLabel} ${aGuid1}]
set aLen2 [llength ${aGetAttr2}]
if { ${aLen1} != ${aLen2}} {
set IsGood 0
puts "aLen1=${aLen1}"
puts "aLen2=${aLen2}"
puts ${aMessage1}
}
set aGetAttr11 [lindex ${aGetAttr1} 0]
set aGetAttr21 [lindex ${aGetAttr2} 0]
if { ${aGetAttr11} != ${aGetAttr21} } {
set IsGood 0
puts "aGetAttr11=${aGetAttr11}"
puts "aGetAttr21=${aGetAttr21}"
puts ${aMessage1}
}
set aGetAttr12 [lindex ${aGetAttr1} 1]
set aGetAttr22 [lindex ${aGetAttr2} 1]
if { ${aGetAttr12} != ${aGetAttr22} } {
set IsGood 0
puts "aGetAttr12=${aGetAttr12}"
puts "aGetAttr22=${aGetAttr22}"
puts ${aMessage1}
}
if { ${IsGood} == 0} {
puts "Add TDataStd_BooleanList attribute: Error"
} else {
puts "Add TDataStd_BooleanList attribute: OK"
}

74
tests/caf/basic/V5 Normal file
View File

@ -0,0 +1,74 @@
#INTERFACE CAF
# Basic attributes
# TDataStd_ReferenceList
#
# Testing attribute: User defined (additional GUID) TDataStd_ReferenceList
#
# Testing command: SetReferenceList
# Testing command: GetReferenceList
#
puts "caf001-V5"
set QA_DUP 0
# Add an attribute to a data framework
set aSetAttr11 0:3
set aSetAttr12 0:4
set aLabel 0:2
set aGuid1 "12e94561-6dbc-11d4-b9c8-0060b0ee281b"
SetReferenceList D ${aLabel} ${aSetAttr11} ${aSetAttr12}
SetReferenceList D ${aLabel} -g ${aGuid1} ${aSetAttr11} ${aSetAttr12}
# Close/Open the transaction
NewCommand D
# Forget the attribute
ForgetAll D ${aLabel}
# Close/Open the transaction
NewCommand D
# Undo-Redo-Undo
Undo D
Redo D
Undo D
# Get a value of the attribute
set IsGood 1
set aMessage1 "Add TDataStd_ReferenceList attribute: Error"
set aGetAttr1 [GetReferenceList D ${aLabel}]
set aLen1 [llength ${aGetAttr1}]
set aGetAttr2 [GetReferenceList D ${aLabel} ${aGuid1}]
set aLen2 [llength ${aGetAttr2}]
if { ${aLen1} != ${aLen2}} {
set IsGood 0
puts "aLen1=${aLen1}"
puts "aLen2=${aLen2}"
puts ${aMessage1}
}
set aGetAttr11 [lindex ${aGetAttr1} 0]
set aGetAttr21 [lindex ${aGetAttr2} 0]
if { ${aGetAttr11} != ${aGetAttr21} } {
set IsGood 0
puts "aGetAttr11=${aGetAttr11}"
puts "aGetAttr21=${aGetAttr21}"
puts ${aMessage1}
}
set aGetAttr12 [lindex ${aGetAttr1} 1]
set aGetAttr22 [lindex ${aGetAttr2} 1]
if { ${aGetAttr12} != ${aGetAttr22} } {
set IsGood 0
puts "aGetAttr12=${aGetAttr12}"
puts "aGetAttr22=${aGetAttr22}"
puts ${aMessage1}
}
if { ${IsGood} == 0} {
puts "Add TDataStd_ReferenceList attribute: Error"
} else {
puts "Add TDataStd_ReferenceList attribute: OK"
}

83
tests/caf/basic/V6 Normal file
View File

@ -0,0 +1,83 @@
#INTERFACE CAF
# Basic attributes
# TDataStd_ReferenceList
#
# Testing attribute: User defined (additional GUID) TDataStd_ReferenceList
#
# Testing command: SetReferenceList
# Testing command: GetReferenceList
#
puts "caf001-V6"
set QA_DUP 0
# Add an attribute to a data framework
set aSetAttr11 0:3
set aSetAttr12 0:4
set aLabel 0:2
set aGuid1 "12e94561-6dbc-11d4-b9c8-0060b0ee281b"
SetReferenceList D ${aLabel} ${aSetAttr11} ${aSetAttr12}
SetReferenceList D ${aLabel} -g ${aGuid1} ${aSetAttr11} ${aSetAttr12}
# Close/Open the transaction
NewCommand D
# Forget the attribute
ForgetAll D ${aLabel}
# Close/Open the transaction
NewCommand D
# Undo-Redo-Undo
Undo D
Redo D
Undo D
# Save Document
set aFile ${imagedir}/caf001-V6.cbf
SaveAs D ${aFile}
Close D
#Open a document
Open ${aFile} D
# Get a value of the attribute
set IsGood 1
set aMessage1 "Add TDataStd_ReferenceList attribute: Error"
set aGetAttr1 [GetReferenceList D ${aLabel}]
set aLen1 [llength ${aGetAttr1}]
set aGetAttr2 [GetReferenceList D ${aLabel} ${aGuid1}]
set aLen2 [llength ${aGetAttr2}]
if { ${aLen1} != ${aLen2}} {
set IsGood 0
puts "aLen1=${aLen1}"
puts "aLen2=${aLen2}"
puts ${aMessage1}
}
set aGetAttr11 [lindex ${aGetAttr1} 0]
set aGetAttr21 [lindex ${aGetAttr2} 0]
if { ${aGetAttr11} != ${aGetAttr21} } {
set IsGood 0
puts "aGetAttr11=${aGetAttr11}"
puts "aGetAttr21=${aGetAttr21}"
puts ${aMessage1}
}
set aGetAttr12 [lindex ${aGetAttr1} 1]
set aGetAttr22 [lindex ${aGetAttr2} 1]
if { ${aGetAttr12} != ${aGetAttr22} } {
set IsGood 0
puts "aGetAttr12=${aGetAttr12}"
puts "aGetAttr22=${aGetAttr22}"
puts ${aMessage1}
}
if { ${IsGood} == 0} {
puts "Add TDataStd_ReferenceList attribute: Error"
} else {
puts "Add TDataStd_ReferenceList attribute: OK"
}

84
tests/caf/basic/V7 Normal file
View File

@ -0,0 +1,84 @@
#INTERFACE CAF
# Basic attributes
# TDataStd_ReferenceList
#
# Testing attribute: User defined (additional GUID) TDataStd_ReferenceList
#
# Testing command: SetReferenceList
# Testing command: GetReferenceList
#
puts "caf001-V7"
set QA_DUP 0
# Add an attribute to a data framework
set aSetAttr11 0:3
set aSetAttr12 0:4
set aLabel 0:2
set aGuid1 "12e94561-6dbc-11d4-b9c8-0060b0ee281b"
SetReferenceList D ${aLabel} ${aSetAttr11} ${aSetAttr12}
SetReferenceList D ${aLabel} -g ${aGuid1} ${aSetAttr11} ${aSetAttr12}
# Close/Open the transaction
NewCommand D
# Forget the attribute
ForgetAll D ${aLabel}
# Close/Open the transaction
NewCommand D
# Undo-Redo-Undo
Undo D
Redo D
Undo D
# Save Document
Format D XmlOcaf
set aFile ${imagedir}/caf001-V7.xml
SaveAs D ${aFile}
Close D
#Open a document
Open ${aFile} D
# Get a value of the attribute
set IsGood 1
set aMessage1 "Add TDataStd_ReferenceList attribute: Error"
set aGetAttr1 [GetReferenceList D ${aLabel}]
set aLen1 [llength ${aGetAttr1}]
set aGetAttr2 [GetReferenceList D ${aLabel} ${aGuid1}]
set aLen2 [llength ${aGetAttr2}]
if { ${aLen1} != ${aLen2}} {
set IsGood 0
puts "aLen1=${aLen1}"
puts "aLen2=${aLen2}"
puts ${aMessage1}
}
set aGetAttr11 [lindex ${aGetAttr1} 0]
set aGetAttr21 [lindex ${aGetAttr2} 0]
if { ${aGetAttr11} != ${aGetAttr21} } {
set IsGood 0
puts "aGetAttr11=${aGetAttr11}"
puts "aGetAttr21=${aGetAttr21}"
puts ${aMessage1}
}
set aGetAttr12 [lindex ${aGetAttr1} 1]
set aGetAttr22 [lindex ${aGetAttr2} 1]
if { ${aGetAttr12} != ${aGetAttr22} } {
set IsGood 0
puts "aGetAttr12=${aGetAttr12}"
puts "aGetAttr22=${aGetAttr22}"
puts ${aMessage1}
}
if { ${IsGood} == 0} {
puts "Add TDataStd_ReferenceList attribute: Error"
} else {
puts "Add TDataStd_ReferenceList attribute: OK"
}

53
tests/caf/basic/W1 Normal file
View File

@ -0,0 +1,53 @@
#INTERFACE CAF
# Basic attributes
# Std documents
#
# Testing support of std format: reading standard attributes
# BooleanArray, ByteArray, ExtStringArray, IntegerArray, RealArray, ReferenceArray
# BooleanList, ExtStringList, IntegerList, RealList, ReferenceList
#
# Testing command: Open, GetBooleanArray, GetByteArray, GetExtStringArray, GetIntArray, GetRealArray, GetRefArray.
# Testing command: GetBooleanList, GetExtStringArray, GetIntegerList, GetRealList, GetReferenceList
#
puts "caf001-W1"
set QA_DUP 0
# Add an attribute to a data framework
set aSetAttr1 {1 0 0 1 1}
set aLabel 0:1
set aFile [locate_data_file caf001_boolAr.std]
#Open a document
Open ${aFile} D
# Get a value of the attribute
set IsGood 1
set aMessage1 "Add TDataStd_BooleanArray attribute: Error"
set aGetAttr1 [GetBooleanArray D ${aLabel}]
set aLenRead [llength ${aGetAttr1}]
set aLenSet [llength ${aSetAttr1}]
if { ${aLenRead} != ${aLenSet} } {
set IsGood 0
puts "aLenRead=${aLenRead}"
puts ${aMessage1}
}
if { ${IsGood} == 0} return
for {set i 0} {$i < $aLenRead} {incr i} {
set aGetAttr11 [lindex ${aGetAttr1} $i]
set aGetAttr21 [lindex ${aSetAttr1} $i]
if { ${aGetAttr11} != ${aGetAttr21} } {
set IsGood 0;puts "i=${i}"
puts "aGetAttr11=${aGetAttr11}"
puts "aGetAttr21=${aGetAttr21}"
break
}
}
if { ${IsGood} == 0} {
puts ${aMessage1}
} else {
puts "Add TDataStd_BooleanArray attribute: OK"
}

Some files were not shown because too many files have changed in this diff Show More