Salome HOME
ENV: Windows porting.
[modules/kernel.git] / src / SALOMEDS / SALOMEDS_AttributePythonObject.cxx
1 //  File   : SALOMEDS_AttributePythonObject.cxx
2 //  Author : Sergey RUIN
3 //  Module : SALOME
4
5 #include "SALOMEDS_AttributePythonObject.hxx"
6
7 #include <string>
8 #include <TCollection_AsciiString.hxx> 
9 #include <TCollection_ExtendedString.hxx>
10
11 SALOMEDS_AttributePythonObject::SALOMEDS_AttributePythonObject(const Handle(SALOMEDSImpl_AttributePythonObject)& theAttr)
12 :SALOMEDS_GenericAttribute(theAttr)
13 {}
14
15 SALOMEDS_AttributePythonObject::SALOMEDS_AttributePythonObject(SALOMEDS::AttributePythonObject_ptr theAttr)
16 :SALOMEDS_GenericAttribute(theAttr)
17 {}
18
19 SALOMEDS_AttributePythonObject::~SALOMEDS_AttributePythonObject()
20 {}
21
22 bool SALOMEDS_AttributePythonObject::IsScript()
23 {
24   bool ret;
25   if(_isLocal) ret = Handle(SALOMEDSImpl_AttributePythonObject)::DownCast(_local_impl)->IsScript();
26   else ret = SALOMEDS::AttributePythonObject::_narrow(_corba_impl)->IsScript();
27   return ret;
28 }
29
30 std::string SALOMEDS_AttributePythonObject::GetObject()
31 {
32   std::string aValue;
33   if(_isLocal) 
34     aValue = TCollection_AsciiString(Handle(SALOMEDSImpl_AttributePythonObject)::DownCast(_local_impl)->GetObject()).ToCString();
35   else aValue = SALOMEDS::AttributePythonObject::_narrow(_corba_impl)->GetObject();
36   return aValue;
37 }
38  
39 void SALOMEDS_AttributePythonObject::SetObject(const std::string& theSequence, bool IsScript)
40 {
41   CheckLocked();
42   if(_isLocal) Handle(SALOMEDSImpl_AttributePythonObject)::DownCast(_local_impl)->SetObject((char*)theSequence.c_str(), IsScript);
43   else SALOMEDS::AttributePythonObject::_narrow(_corba_impl)->SetObject(theSequence.c_str(), IsScript);
44 }