Salome HOME
0022626: EDF 8453 GEOM: order with SubShapeAllSortedCentres
[modules/geom.git] / src / GEOM / GEOM_Function.cxx
index 146863614f6c54b3964e090546166e45dc74efb7..db4658cf2c61b9f263a5173e611e045f46ccfcf1 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2014  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
@@ -6,7 +6,7 @@
 // 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.
+// 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
@@ -555,9 +555,9 @@ void GEOM_Function::SetStringArray(int thePosition, const Handle(TColStd_HArray1
   if(thePosition <= 0 || theArray.IsNull()) return;
   TDF_Label anArgLabel = ARGUMENT(thePosition);
 
-  Handle(TDataStd_ExtStringArray) anArray = new TDataStd_ExtStringArray;
+  Handle(TDataStd_ExtStringArray) anArray =
+    TDataStd_ExtStringArray::Set(anArgLabel, theArray->Lower(), theArray->Upper());
   anArray->ChangeArray(theArray);
-  anArgLabel.AddAttribute(anArray);
 
   _isDone = true;
 }
@@ -580,6 +580,18 @@ Handle(TColStd_HArray1OfExtendedString) GEOM_Function::GetStringArray(int thePos
   return anArray->Array();
 }
 
+//=======================================================================
+//function : HasData
+//purpose  : Returns true if data of given type already exists
+//=======================================================================
+
+bool GEOM_Function::HasData(int thePosition, const Standard_GUID& dataID)
+{
+  if(thePosition <= 0) return false;
+  TDF_Label anArgLabel = ARGUMENT(thePosition);
+  return anArgLabel.IsAttribute( dataID );
+}
+
 //=======================================================================
 //function : GetReferencesTreeID
 //purpose  :
@@ -848,42 +860,5 @@ TDF_Label GEOM_Function::GetNamingEntry (const Standard_Boolean create)
   return _label.FindChild(NAMING_LABEL, create);
 }
 
-//=======================================================================
-//function :  GEOM_Function_Type_
-//purpose  :
-//=======================================================================
-Standard_EXPORT Handle_Standard_Type& GEOM_Function_Type_()
-{
-
-  static Handle_Standard_Type aType1 = STANDARD_TYPE(MMgt_TShared);
-  if (aType1.IsNull()) aType1 = STANDARD_TYPE(MMgt_TShared);
-  static Handle_Standard_Type aType2 = STANDARD_TYPE(Standard_Transient);
-  if (aType2.IsNull()) aType2 = STANDARD_TYPE(Standard_Transient);
-
-  static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,NULL};
-  static Handle_Standard_Type _aType = new Standard_Type("GEOM_Function",
-                                                         sizeof(GEOM_Function),
-                                                         1,
-                                                         (Standard_Address)_Ancestors,
-                                                         (Standard_Address)NULL);
-
-  return _aType;
-}
-
-//=======================================================================
-//function : DownCast
-//purpose  :
-//=======================================================================
-
-const Handle(GEOM_Function) Handle(GEOM_Function)::DownCast(const Handle(Standard_Transient)& AnObject)
-{
-  Handle(GEOM_Function) _anOtherObject;
-
-  if (!AnObject.IsNull()) {
-     if (AnObject->IsKind(STANDARD_TYPE(GEOM_Function))) {
-       _anOtherObject = Handle(GEOM_Function)((Handle(GEOM_Function)&)AnObject);
-     }
-  }
-
-  return _anOtherObject;
-}
+IMPLEMENT_STANDARD_HANDLE (GEOM_Function, Standard_Transient);
+IMPLEMENT_STANDARD_RTTIEXT(GEOM_Function, Standard_Transient );