-// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
+//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
// File : SALOMEDSImpl_AttributeInteger.cxx
// Author : Sergey RUIN
// Module : SALOME
-
+//
#include "SALOMEDSImpl_AttributeInteger.hxx"
-#ifndef WNT
-using namespace std;
-#endif
-
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeInteger, SALOMEDSImpl_GenericAttribute)
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeInteger, SALOMEDSImpl_GenericAttribute )
-
+#include <stdlib.h>
//=======================================================================
//function : GetID
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeInteger::GetID ()
+const std::string& SALOMEDSImpl_AttributeInteger::GetID ()
{
- static Standard_GUID IntegerID ("8CC3E213-C9B4-47e4-8496-DD5E62E22018");
+ static std::string IntegerID ("8CC3E213-C9B4-47e4-8496-DD5E62E22018");
return IntegerID;
}
-Handle(SALOMEDSImpl_AttributeInteger) SALOMEDSImpl_AttributeInteger::Set (const TDF_Label& L, Standard_Integer Val)
+SALOMEDSImpl_AttributeInteger* SALOMEDSImpl_AttributeInteger::Set (const DF_Label& L, int Val)
{
- Handle(SALOMEDSImpl_AttributeInteger) A;
- if (!L.FindAttribute(SALOMEDSImpl_AttributeInteger::GetID(), A)) {
+ SALOMEDSImpl_AttributeInteger* A = NULL;
+ if (!(A = (SALOMEDSImpl_AttributeInteger*)L.FindAttribute(SALOMEDSImpl_AttributeInteger::GetID()))) {
A = new SALOMEDSImpl_AttributeInteger();
L.AddAttribute(A);
}
return A;
}
+//=======================================================================
+//function : Value
+//purpose :
+//=======================================================================
+int SALOMEDSImpl_AttributeInteger::Value() const
+{
+ return myValue;
+}
+
//=======================================================================
//function : SetValue
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeInteger::SetValue(const Standard_Integer v)
+void SALOMEDSImpl_AttributeInteger::SetValue(const int v)
{
if(myValue == v) return;
//function : ID
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeInteger::ID () const { return GetID(); }
+const std::string& SALOMEDSImpl_AttributeInteger::ID () const { return GetID(); }
//=======================================================================
//function : NewEmpty
//purpose :
//=======================================================================
-Handle(TDF_Attribute) SALOMEDSImpl_AttributeInteger::NewEmpty () const
+DF_Attribute* SALOMEDSImpl_AttributeInteger::NewEmpty () const
{
return new SALOMEDSImpl_AttributeInteger();
}
//function : Restore
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeInteger::Restore(const Handle(TDF_Attribute)& With)
+void SALOMEDSImpl_AttributeInteger::Restore(DF_Attribute* With)
{
- myValue = Handle(SALOMEDSImpl_AttributeInteger)::DownCast (With)->Value();
+ myValue = dynamic_cast<SALOMEDSImpl_AttributeInteger*>(With)->Value();
}
//=======================================================================
//function : Paste
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeInteger::Paste (const Handle(TDF_Attribute)& Into,
- const Handle(TDF_RelocationTable)& RT) const
+void SALOMEDSImpl_AttributeInteger::Paste (DF_Attribute* Into)
{
- Handle(SALOMEDSImpl_AttributeInteger)::DownCast(Into)->SetValue(myValue);
+ dynamic_cast<SALOMEDSImpl_AttributeInteger*>(Into)->SetValue(myValue);
}
+
+//=======================================================================
+//function : Save
+//purpose :
+//=======================================================================
+std::string SALOMEDSImpl_AttributeInteger::Save()
+{
+ char buffer[128];
+ sprintf(buffer, "%d", myValue);
+ return std::string(buffer);
+}
+
+//=======================================================================
+//function : Load
+//purpose :
+//=======================================================================
+void SALOMEDSImpl_AttributeInteger::Load(const std::string& theValue)
+{
+ myValue = atoi(theValue.c_str());
+}