1 // SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
3 // Copyright (C) 2003 CEA/DEN, EDF R&D
7 // File : SALOMEDS_PythonObjectAttribute.cxx
8 // Author : Michael Ponikarov
12 #include "SALOMEDS_PythonObjectAttribute.ixx"
16 const Standard_GUID& SALOMEDS_PythonObjectAttribute::GetID()
18 static Standard_GUID SALOMEDS_PythonObjectAttributeID ("128371A3-8F52-11d6-A8A3-0001021E8C7F");
19 return SALOMEDS_PythonObjectAttributeID;
22 Handle(SALOMEDS_PythonObjectAttribute) SALOMEDS_PythonObjectAttribute::Set(const TDF_Label& label)
24 Handle(SALOMEDS_PythonObjectAttribute) anAttr;
25 if (!label.FindAttribute(SALOMEDS_PythonObjectAttribute::GetID(),anAttr)) {
26 anAttr = new SALOMEDS_PythonObjectAttribute();
27 label.AddAttribute(anAttr);
32 SALOMEDS_PythonObjectAttribute::SALOMEDS_PythonObjectAttribute()
36 void SALOMEDS_PythonObjectAttribute::SetObject(const Standard_CString theSequence,
37 const Standard_Boolean theScript)
40 if(mySequence != NULL) delete mySequence;
41 if (theSequence == NULL) {
44 mySequence = new char[strlen(theSequence)+1];
45 strcpy(mySequence, theSequence);
48 myIsScript = theScript;
51 Standard_CString SALOMEDS_PythonObjectAttribute::GetObject() const
56 Standard_Boolean SALOMEDS_PythonObjectAttribute::IsScript() const
61 Standard_Integer SALOMEDS_PythonObjectAttribute::GetLength() const
63 if (mySequence == NULL) return 0;
64 return (strlen(mySequence)+1);
67 const Standard_GUID& SALOMEDS_PythonObjectAttribute::ID() const
72 void SALOMEDS_PythonObjectAttribute::Restore(const Handle(TDF_Attribute)& with)
74 Handle(SALOMEDS_PythonObjectAttribute) anObj = Handle(SALOMEDS_PythonObjectAttribute)::DownCast(with);
75 SetObject(anObj->GetObject(),anObj->IsScript());
78 Handle(TDF_Attribute) SALOMEDS_PythonObjectAttribute::NewEmpty() const
80 return new SALOMEDS_PythonObjectAttribute();
83 void SALOMEDS_PythonObjectAttribute::Paste(const Handle(TDF_Attribute)& into,
84 const Handle(TDF_RelocationTable)&) const
86 Handle(SALOMEDS_PythonObjectAttribute) anObj = Handle(SALOMEDS_PythonObjectAttribute)::DownCast(into);
87 anObj->SetObject(GetObject(),IsScript());