Salome HOME
488b03ef973faf061417d121b977fce416089cfa
[modules/hydro.git] / src / HYDROData / HYDROData_Object.cxx
1 #include <HYDROData_Object.h>
2
3 #include <TDataStd_Name.hxx>
4 #include <TDF_CopyLabel.hxx>
5
6 IMPLEMENT_STANDARD_HANDLE(HYDROData_Object,MMgt_TShared)
7 IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Object,MMgt_TShared)
8
9 // is equal function for unique object mapping
10 bool IsEqual(const Handle_HYDROData_Object& theObj1, const Handle_HYDROData_Object& theObj2)
11 {
12   return (theObj1->ID() == theObj2->ID());
13 }
14
15 QString HYDROData_Object::GetName() const
16 {
17   Handle(TDataStd_Name) aName;
18   if (myLab.FindAttribute(TDataStd_Name::GetID(), aName)) {
19     TCollection_AsciiString aStr(aName->Get());
20     return QString(aStr.ToCString());
21   }
22   return QString();
23 }
24
25 void HYDROData_Object::SetName(const QString& theName)
26 {
27   TDataStd_Name::Set(myLab, TCollection_ExtendedString(theName.toLatin1().constData()));
28 }
29
30 bool HYDROData_Object::IsRemoved() const
31 {
32   return !myLab.HasAttribute();
33 }
34
35 void HYDROData_Object::Remove()
36 {
37   return myLab.ForgetAllAttributes(Standard_True);
38 }
39
40 HYDROData_Object::HYDROData_Object()
41 {
42 }
43
44 HYDROData_Object::~HYDROData_Object()
45 {
46 }
47
48 void HYDROData_Object::CopyTo(Handle_HYDROData_Object theDestination) const
49 {
50   TDF_CopyLabel aCopy(myLab, theDestination->Label());
51   aCopy.Perform();
52 }
53
54 void HYDROData_Object::SetLabel(TDF_Label theLabel)
55 {
56   myLab = theLabel;
57 }