#include <BinMDataStd_IntegerListDriver.hxx>
+#include <BinMDataStd.hxx>
#include <BinObjMgt_Persistent.hxx>
#include <CDM_MessageDriver.hxx>
#include <Standard_Type.hxx>
//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;
}
Standard_Integer *aPtr = (Standard_Integer *) &aSourceArray(aFirstInd);
theTarget.PutIntArray(aPtr, aLength);
}
+
+ // process user defined guid
+ if(anAtt->ID() != TDataStd_IntegerList::GetID())
+ theTarget << anAtt->ID();
}