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