Salome HOME
Moved some functionality to VTKViewer_Utilities.h
[modules/kernel.git] / src / SALOMEDS / SALOMEDS_AttributePythonObject_i.cxx
index ca3f7d731d3345982b55831c439cbe27b5e5a11e..2faab629daf2678ed678212a5c9c01908b5827d2 100644 (file)
 #include "SALOMEDS_AttributePythonObject_i.hxx"
 #include <TCollection_ExtendedString.hxx>
 #include <TColStd_HArray1OfCharacter.hxx>
-#include "SALOMEDS_SObject_i.hxx"
+
 using namespace std;
 
 void SALOMEDS_AttributePythonObject_i::SetObject(const char* theSequence, CORBA::Boolean IsScript) {
   CheckLocked();
-  char *aSeq = CORBA::string_dup(theSequence);
-  Handle(SALOMEDS_PythonObjectAttribute)::DownCast(_myAttr)->SetObject(aSeq, IsScript);
+  Handle(SALOMEDS_PythonObjectAttribute)::DownCast(_myAttr)->SetObject(const_cast<char*>(theSequence), IsScript);
 }
 
 char* SALOMEDS_AttributePythonObject_i::GetObject() {
@@ -30,3 +29,15 @@ char* SALOMEDS_AttributePythonObject_i::GetObject() {
 CORBA::Boolean SALOMEDS_AttributePythonObject_i::IsScript() {
   return Handle(SALOMEDS_PythonObjectAttribute)::DownCast(_myAttr)->IsScript();
 }
+
+char* SALOMEDS_AttributePythonObject_i::Store() {
+  CORBA::String_var aString = GetObject();
+  char* aResult = new char[strlen(aString) + 2];
+  aResult[0] = IsScript()?'s':'n';
+  strcpy(aResult+1, aString);
+  return aResult;
+}
+
+void SALOMEDS_AttributePythonObject_i::Restore(const char* theValue) {
+  SetObject(&theValue[1], theValue[0]=='s');
+}