From: srn Date: Mon, 4 Apr 2005 07:02:38 +0000 (+0000) Subject: Proxy classe's implementations for SALOMEDS X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=38659270d0f9db6cbc4de3c4910a9a3037f07381;p=modules%2Fkernel.git Proxy classe's implementations for SALOMEDS --- diff --git a/src/SALOMEDS/SALOMEDS_AttributeComment.cxx b/src/SALOMEDS/SALOMEDS_AttributeComment.cxx new file mode 100644 index 000000000..e86e4d5fe --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_AttributeComment.cxx @@ -0,0 +1,35 @@ +// File : SALOMEDS_AttributeComment.cxx +// Author : Sergey RUIN +// Module : SALOME + +#include "SALOMEDS_AttributeComment.hxx" + +#include +#include + +SALOMEDS_AttributeComment::SALOMEDS_AttributeComment(const Handle(SALOMEDSImpl_AttributeComment)& theAttr) +:SALOMEDS_GenericAttribute(theAttr) +{} + +SALOMEDS_AttributeComment::SALOMEDS_AttributeComment(SALOMEDS::AttributeComment_ptr theAttr) +:SALOMEDS_GenericAttribute(theAttr) +{} + +SALOMEDS_AttributeComment::~SALOMEDS_AttributeComment() +{} + +char* SALOMEDS_AttributeComment::Value() +{ + TCollection_AsciiString aValue; + if(_isLocal) aValue = Handle(SALOMEDSImpl_AttributeComment)::DownCast(_local_impl)->Value(); + else aValue = SALOMEDS::AttributeComment::_narrow(_corba_impl)->Value(); + return aValue.ToCString(); +} + +void SALOMEDS_AttributeComment::SetValue(const char* value) +{ + CheckLocked(); + TCollection_AsciiString aValue((char*)value); + if(_isLocal) Handle(SALOMEDSImpl_AttributeComment)::DownCast(_local_impl)->SetValue(aValue); + else SALOMEDS::AttributeComment::_narrow(_corba_impl)->SetValue(aValue.ToCString()); +} diff --git a/src/SALOMEDS/SALOMEDS_AttributeComment.hxx b/src/SALOMEDS/SALOMEDS_AttributeComment.hxx new file mode 100644 index 000000000..fa05f630a --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_AttributeComment.hxx @@ -0,0 +1,28 @@ +// File : SALOMEDS_AttributeComment.hxx +// Author : Sergey RUIN +// Module : SALOME + +#ifndef SALOMEDS_AttributeComment_HeaderFile +#define SALOMEDS_AttributeComment_HeaderFile + +#include "SALOMEDSClient_AttributeComment.hxx" +#include "SALOMEDS_GenericAttribute.hxx" +#include "SALOMEDSImpl_AttributeComment.hxx" + +// IDL headers +#include +#include CORBA_SERVER_HEADER(SALOMEDS) +#include CORBA_SERVER_HEADER(SALOMEDS_Attributes) + +class SALOMEDS_AttributeComment: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeComment +{ +public: + SALOMEDS_AttributeComment(const Handle(SALOMEDSImpl_AttributeComment)& theAttr); + SALOMEDS_AttributeComment(SALOMEDS::AttributeComment_ptr theAttr); + ~SALOMEDS_AttributeComment(); + + virtual char* Value(); + virtual void SetValue(const char* value); +}; + +#endif diff --git a/src/SALOMEDS/SALOMEDS_AttributeDrawable.cxx b/src/SALOMEDS/SALOMEDS_AttributeDrawable.cxx new file mode 100644 index 000000000..0c4972ec2 --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_AttributeDrawable.cxx @@ -0,0 +1,34 @@ +// File : SALOMEDS_AttributeDrawable.cxx +// Author : Sergey RUIN +// Module : SALOME + +#include "SALOMEDS_AttributeDrawable.hxx" + +#include +#include + +SALOMEDS_AttributeDrawable::SALOMEDS_AttributeDrawable(const Handle(SALOMEDSImpl_AttributeDrawable)& theAttr) +:SALOMEDS_GenericAttribute(theAttr) +{} + +SALOMEDS_AttributeDrawable::SALOMEDS_AttributeDrawable(SALOMEDS::AttributeDrawable_ptr theAttr) +:SALOMEDS_GenericAttribute(theAttr) +{} + +SALOMEDS_AttributeDrawable::~SALOMEDS_AttributeDrawable() +{} + +bool SALOMEDS_AttributeDrawable::IsDrawable() +{ + bool aValue; + if(_isLocal) aValue = (bool)Handle(SALOMEDSImpl_AttributeDrawable)::DownCast(_local_impl)->IsDrawable(); + else aValue = SALOMEDS::AttributeDrawable::_narrow(_corba_impl)->IsDrawable(); + return aValue; +} + +void SALOMEDS_AttributeDrawable::SetDrawable(bool value) +{ + CheckLocked(); + if(_isLocal) Handle(SALOMEDSImpl_AttributeDrawable)::DownCast(_local_impl)->SetDrawable((int)value); + else SALOMEDS::AttributeDrawable::_narrow(_corba_impl)->SetDrawable(value); +} diff --git a/src/SALOMEDS/SALOMEDS_AttributeDrawable.hxx b/src/SALOMEDS/SALOMEDS_AttributeDrawable.hxx new file mode 100644 index 000000000..fdc0b369a --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_AttributeDrawable.hxx @@ -0,0 +1,28 @@ +// File : SALOMEDS_AttributeDrawable.hxx +// Author : Sergey RUIN +// Module : SALOME + +#ifndef SALOMEDS_AttributeDrawable_HeaderFile +#define SALOMEDS_AttributeDrawable_HeaderFile + +#include "SALOMEDSClient_AttributeDrawable.hxx" +#include "SALOMEDS_GenericAttribute.hxx" +#include "SALOMEDSImpl_AttributeDrawable.hxx" + +// IDL headers +#include +#include CORBA_SERVER_HEADER(SALOMEDS) +#include CORBA_SERVER_HEADER(SALOMEDS_Attributes) + +class SALOMEDS_AttributeDrawable: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeDrawable +{ +public: + SALOMEDS_AttributeDrawable(const Handle(SALOMEDSImpl_AttributeDrawable)& theAttr); + SALOMEDS_AttributeDrawable(SALOMEDS::AttributeDrawable_ptr theAttr); + ~SALOMEDS_AttributeDrawable(); + + virtual bool IsDrawable(); + virtual void SetDrawable(bool value); +}; + +#endif diff --git a/src/SALOMEDS/SALOMEDS_AttributeExpandable.cxx b/src/SALOMEDS/SALOMEDS_AttributeExpandable.cxx new file mode 100644 index 000000000..f14eca0de --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_AttributeExpandable.cxx @@ -0,0 +1,34 @@ +// File : SALOMEDS_AttributeExpandable.cxx +// Author : Sergey RUIN +// Module : SALOME + +#include "SALOMEDS_AttributeExpandable.hxx" + +#include +#include + +SALOMEDS_AttributeExpandable::SALOMEDS_AttributeExpandable(const Handle(SALOMEDSImpl_AttributeExpandable)& theAttr) +:SALOMEDS_GenericAttribute(theAttr) +{} + +SALOMEDS_AttributeExpandable::SALOMEDS_AttributeExpandable(SALOMEDS::AttributeExpandable_ptr theAttr) +:SALOMEDS_GenericAttribute(theAttr) +{} + +SALOMEDS_AttributeExpandable::~SALOMEDS_AttributeExpandable() +{} + +bool SALOMEDS_AttributeExpandable::IsExpandable() +{ + bool aValue; + if(_isLocal) aValue = (bool)Handle(SALOMEDSImpl_AttributeExpandable)::DownCast(_local_impl)->IsExpandable(); + else aValue = SALOMEDS::AttributeExpandable::_narrow(_corba_impl)->IsExpandable(); + return aValue; +} + +void SALOMEDS_AttributeExpandable::SetExpandable(bool value) +{ + CheckLocked(); + if(_isLocal) Handle(SALOMEDSImpl_AttributeExpandable)::DownCast(_local_impl)->SetExpandable((int)value); + else SALOMEDS::AttributeExpandable::_narrow(_corba_impl)->SetExpandable(value); +} diff --git a/src/SALOMEDS/SALOMEDS_AttributeExpandable.hxx b/src/SALOMEDS/SALOMEDS_AttributeExpandable.hxx new file mode 100644 index 000000000..550e2890e --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_AttributeExpandable.hxx @@ -0,0 +1,28 @@ +// File : SALOMEDS_AttributeExpandable.hxx +// Author : Sergey RUIN +// Module : SALOME + +#ifndef SALOMEDS_AttributeExpandable_HeaderFile +#define SALOMEDS_AttributeExpandable_HeaderFile + +#include "SALOMEDSClient_AttributeExpandable.hxx" +#include "SALOMEDS_GenericAttribute.hxx" +#include "SALOMEDSImpl_AttributeExpandable.hxx" + +// IDL headers +#include +#include CORBA_SERVER_HEADER(SALOMEDS) +#include CORBA_SERVER_HEADER(SALOMEDS_Attributes) + +class SALOMEDS_AttributeExpandable: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeExpandable +{ +public: + SALOMEDS_AttributeExpandable(const Handle(SALOMEDSImpl_AttributeExpandable)& theAttr); + SALOMEDS_AttributeExpandable(SALOMEDS::AttributeExpandable_ptr theAttr); + ~SALOMEDS_AttributeExpandable(); + + virtual bool IsExpandable(); + virtual void SetExpandable(bool value); +}; + +#endif diff --git a/src/SALOMEDS/SALOMEDS_AttributeExternalFileDef.cxx b/src/SALOMEDS/SALOMEDS_AttributeExternalFileDef.cxx new file mode 100644 index 000000000..9864773bf --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_AttributeExternalFileDef.cxx @@ -0,0 +1,35 @@ +// File : SALOMEDS_AttributeExternalFileDef.cxx +// Author : Sergey RUIN +// Module : SALOME + +#include "SALOMEDS_AttributeExternalFileDef.hxx" + +#include +#include + +SALOMEDS_AttributeExternalFileDef::SALOMEDS_AttributeExternalFileDef(const Handle(SALOMEDSImpl_AttributeExternalFileDef)& theAttr) +:SALOMEDS_GenericAttribute(theAttr) +{} + +SALOMEDS_AttributeExternalFileDef::SALOMEDS_AttributeExternalFileDef(SALOMEDS::AttributeExternalFileDef_ptr theAttr) +:SALOMEDS_GenericAttribute(theAttr) +{} + +SALOMEDS_AttributeExternalFileDef::~SALOMEDS_AttributeExternalFileDef() +{} + +char* SALOMEDS_AttributeExternalFileDef::Value() +{ + TCollection_AsciiString aValue; + if(_isLocal) aValue = Handle(SALOMEDSImpl_AttributeExternalFileDef)::DownCast(_local_impl)->Value(); + else aValue = SALOMEDS::AttributeExternalFileDef::_narrow(_corba_impl)->Value(); + return aValue.ToCString(); +} + +void SALOMEDS_AttributeExternalFileDef::SetValue(const char* value) +{ + CheckLocked(); + TCollection_AsciiString aValue((char*)value); + if(_isLocal) Handle(SALOMEDSImpl_AttributeExternalFileDef)::DownCast(_local_impl)->SetValue(aValue); + else SALOMEDS::AttributeExternalFileDef::_narrow(_corba_impl)->SetValue(aValue.ToCString()); +} diff --git a/src/SALOMEDS/SALOMEDS_AttributeExternalFileDef.hxx b/src/SALOMEDS/SALOMEDS_AttributeExternalFileDef.hxx new file mode 100644 index 000000000..916295745 --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_AttributeExternalFileDef.hxx @@ -0,0 +1,28 @@ +// File : SALOMEDS_AttributeExternalFileDef.hxx +// Author : Sergey RUIN +// Module : SALOME + +#ifndef SALOMEDS_AttributeExternalFileDef_HeaderFile +#define SALOMEDS_AttributeExternalFileDef_HeaderFile + +#include "SALOMEDSClient_AttributeExternalFileDef.hxx" +#include "SALOMEDS_GenericAttribute.hxx" +#include "SALOMEDSImpl_AttributeExternalFileDef.hxx" + +// IDL headers +#include +#include CORBA_SERVER_HEADER(SALOMEDS) +#include CORBA_SERVER_HEADER(SALOMEDS_Attributes) + +class SALOMEDS_AttributeExternalFileDef: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeExternalFileDef +{ +public: + SALOMEDS_AttributeExternalFileDef(const Handle(SALOMEDSImpl_AttributeExternalFileDef)& theAttr); + SALOMEDS_AttributeExternalFileDef(SALOMEDS::AttributeExternalFileDef_ptr theAttr); + ~SALOMEDS_AttributeExternalFileDef(); + + virtual char* Value(); + virtual void SetValue(const char* value); +}; + +#endif diff --git a/src/SALOMEDS/SALOMEDS_AttributeFileType.cxx b/src/SALOMEDS/SALOMEDS_AttributeFileType.cxx new file mode 100644 index 000000000..895edf284 --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_AttributeFileType.cxx @@ -0,0 +1,35 @@ +// File : SALOMEDS_AttributeFileType.cxx +// Author : Sergey RUIN +// Module : SALOME + +#include "SALOMEDS_AttributeFileType.hxx" + +#include +#include + +SALOMEDS_AttributeFileType::SALOMEDS_AttributeFileType(const Handle(SALOMEDSImpl_AttributeFileType)& theAttr) +:SALOMEDS_GenericAttribute(theAttr) +{} + +SALOMEDS_AttributeFileType::SALOMEDS_AttributeFileType(SALOMEDS::AttributeFileType_ptr theAttr) +:SALOMEDS_GenericAttribute(theAttr) +{} + +SALOMEDS_AttributeFileType::~SALOMEDS_AttributeFileType() +{} + +char* SALOMEDS_AttributeFileType::Value() +{ + TCollection_AsciiString aValue; + if(_isLocal) aValue = Handle(SALOMEDSImpl_AttributeFileType)::DownCast(_local_impl)->Value(); + else aValue = SALOMEDS::AttributeFileType::_narrow(_corba_impl)->Value(); + return aValue.ToCString(); +} + +void SALOMEDS_AttributeFileType::SetValue(const char* value) +{ + CheckLocked(); + TCollection_AsciiString aValue((char*)value); + if(_isLocal) Handle(SALOMEDSImpl_AttributeFileType)::DownCast(_local_impl)->SetValue(aValue); + else SALOMEDS::AttributeFileType::_narrow(_corba_impl)->SetValue(aValue.ToCString()); +} diff --git a/src/SALOMEDS/SALOMEDS_AttributeFileType.hxx b/src/SALOMEDS/SALOMEDS_AttributeFileType.hxx new file mode 100644 index 000000000..39476e2ee --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_AttributeFileType.hxx @@ -0,0 +1,28 @@ +// File : SALOMEDS_AttributeFileType.hxx +// Author : Sergey RUIN +// Module : SALOME + +#ifndef SALOMEDS_AttributeFileType_HeaderFile +#define SALOMEDS_AttributeFileType_HeaderFile + +#include "SALOMEDSClient_AttributeFileType.hxx" +#include "SALOMEDS_GenericAttribute.hxx" +#include "SALOMEDSImpl_AttributeFileType.hxx" + +// IDL headers +#include +#include CORBA_SERVER_HEADER(SALOMEDS) +#include CORBA_SERVER_HEADER(SALOMEDS_Attributes) + +class SALOMEDS_AttributeFileType: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeFileType +{ +public: + SALOMEDS_AttributeFileType(const Handle(SALOMEDSImpl_AttributeFileType)& theAttr); + SALOMEDS_AttributeFileType(SALOMEDS::AttributeFileType_ptr theAttr); + ~SALOMEDS_AttributeFileType(); + + virtual char* Value(); + virtual void SetValue(const char* value); +}; + +#endif diff --git a/src/SALOMEDS/SALOMEDS_AttributeFlags.cxx b/src/SALOMEDS/SALOMEDS_AttributeFlags.cxx new file mode 100644 index 000000000..ff7044943 --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_AttributeFlags.cxx @@ -0,0 +1,50 @@ +// File : SALOMEDS_AttributeFlags.cxx +// Author : Sergey RUIN +// Module : SALOME + +#include "SALOMEDS_AttributeFlags.hxx" + +#include +#include + +SALOMEDS_AttributeFlags::SALOMEDS_AttributeFlags(const Handle(SALOMEDSImpl_AttributeFlags)& theAttr) +:SALOMEDS_GenericAttribute(theAttr) +{} + +SALOMEDS_AttributeFlags::SALOMEDS_AttributeFlags(SALOMEDS::AttributeFlags_ptr theAttr) +:SALOMEDS_GenericAttribute(theAttr) +{} + +SALOMEDS_AttributeFlags::~SALOMEDS_AttributeFlags() +{} + +int SALOMEDS_AttributeFlags::GetFlags() +{ + int aValue; + if(_isLocal) aValue = Handle(SALOMEDSImpl_AttributeFlags)::DownCast(_local_impl)->Get(); + else aValue = SALOMEDS::AttributeFlags::_narrow(_corba_impl)->GetFlags(); + return aValue; +} + +void SALOMEDS_AttributeFlags::SetFlags(int theFlags) +{ + if(_isLocal) Handle(SALOMEDSImpl_AttributeFlags)::DownCast(_local_impl)->Set(theFlags); + else SALOMEDS::AttributeFlags::_narrow(_corba_impl)->SetFlags(theFlags); +} + +bool SALOMEDS_AttributeFlags::Get(int theFlag) +{ + return (GetFlags() & theFlag) ? true : false; +} + +void SALOMEDS_AttributeFlags::Set(int theFlag, bool theValue) +{ + if(_isLocal) { + Handle(SALOMEDSImpl_AttributeFlags) anAttr = Handle(SALOMEDSImpl_AttributeFlags)::DownCast(_local_impl); + if ( theValue ) + anAttr->Set( anAttr->Get() | theFlag ); + else + anAttr->Set( anAttr->Get() & ~theFlag ); + } + else SALOMEDS::AttributeFlags::_narrow(_corba_impl)->Set(theFlag, theValue); +} diff --git a/src/SALOMEDS/SALOMEDS_AttributeFlags.hxx b/src/SALOMEDS/SALOMEDS_AttributeFlags.hxx new file mode 100644 index 000000000..8bd9f5797 --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_AttributeFlags.hxx @@ -0,0 +1,31 @@ +// File : SALOMEDS_AttributeFlags.hxx +// Author : Sergey RUIN +// Module : SALOME + +#ifndef SALOMEDS_AttributeFlags_HeaderFile +#define SALOMEDS_AttributeFlags_HeaderFile + +#include "SALOMEDSClient_AttributeFlags.hxx" +#include "SALOMEDS_GenericAttribute.hxx" +#include "SALOMEDSImpl_AttributeFlags.hxx" + +// IDL headers +#include +#include CORBA_SERVER_HEADER(SALOMEDS) +#include CORBA_SERVER_HEADER(SALOMEDS_Attributes) + +class SALOMEDS_AttributeFlags: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeFlags +{ +public: + SALOMEDS_AttributeFlags(const Handle(SALOMEDSImpl_AttributeFlags)& theAttr); + SALOMEDS_AttributeFlags(SALOMEDS::AttributeFlags_ptr theAttr); + ~SALOMEDS_AttributeFlags(); + + virtual int GetFlags(); + virtual void SetFlags(int theFlags); + + virtual bool Get(int theFlag); + virtual void Set(int theFlag, bool theValue); +}; + +#endif diff --git a/src/SALOMEDS/SALOMEDS_AttributeGraphic.cxx b/src/SALOMEDS/SALOMEDS_AttributeGraphic.cxx new file mode 100644 index 000000000..896502927 --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_AttributeGraphic.cxx @@ -0,0 +1,34 @@ +// File : SALOMEDS_AttributeGraphic.cxx +// Author : Sergey RUIN +// Module : SALOME + +#include "SALOMEDS_AttributeGraphic.hxx" + +#include +#include + +SALOMEDS_AttributeGraphic::SALOMEDS_AttributeGraphic(const Handle(SALOMEDSImpl_AttributeGraphic)& theAttr) +:SALOMEDS_GenericAttribute(theAttr) +{} + +SALOMEDS_AttributeGraphic::SALOMEDS_AttributeGraphic(SALOMEDS::AttributeGraphic_ptr theAttr) +:SALOMEDS_GenericAttribute(theAttr) +{} + +SALOMEDS_AttributeGraphic::~SALOMEDS_AttributeGraphic() +{} + + +bool SALOMEDS_AttributeGraphic:: GetVisibility(int theViewId) +{ + bool aValue; + if(_isLocal) aValue = (bool)Handle(SALOMEDSImpl_AttributeGraphic)::DownCast(_local_impl)->GetVisibility(theViewId); + else aValue = SALOMEDS::AttributeGraphic::_narrow(_corba_impl)->GetVisibility(theViewId); + return aValue; +} + +void SALOMEDS_AttributeGraphic::SetVisibility(int theViewId, bool theValue) +{ + if(_isLocal) Handle(SALOMEDSImpl_AttributeGraphic)::DownCast(_local_impl)->SetVisibility(theViewId, theValue); + else SALOMEDS::AttributeGraphic::_narrow(_corba_impl)->SetVisibility(theViewId, theValue); +} diff --git a/src/SALOMEDS/SALOMEDS_AttributeGraphic.hxx b/src/SALOMEDS/SALOMEDS_AttributeGraphic.hxx new file mode 100644 index 000000000..f684c45dd --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_AttributeGraphic.hxx @@ -0,0 +1,28 @@ +// File : SALOMEDS_AttributeGraphic.hxx +// Author : Sergey RUIN +// Module : SALOME + +#ifndef SALOMEDS_AttributeGraphic_HeaderFile +#define SALOMEDS_AttributeGraphic_HeaderFile + +#include "SALOMEDSClient_AttributeGraphic.hxx" +#include "SALOMEDS_GenericAttribute.hxx" +#include "SALOMEDSImpl_AttributeGraphic.hxx" + +// IDL headers +#include +#include CORBA_SERVER_HEADER(SALOMEDS) +#include CORBA_SERVER_HEADER(SALOMEDS_Attributes) + +class SALOMEDS_AttributeGraphic: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeGraphic +{ +public: + SALOMEDS_AttributeGraphic(const Handle(SALOMEDSImpl_AttributeGraphic)& theAttr); + SALOMEDS_AttributeGraphic(SALOMEDS::AttributeGraphic_ptr theAttr); + ~SALOMEDS_AttributeGraphic(); + + virtual void SetVisibility(int theViewId, bool theValue); + virtual bool GetVisibility(int theViewId); +}; + +#endif diff --git a/src/SALOMEDS/SALOMEDS_AttributeIOR.cxx b/src/SALOMEDS/SALOMEDS_AttributeIOR.cxx new file mode 100644 index 000000000..b8828a9b5 --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_AttributeIOR.cxx @@ -0,0 +1,35 @@ +// File : SALOMEDS_AttributeIOR.cxx +// Author : Sergey RUIN +// Module : SALOME + +#include "SALOMEDS_AttributeIOR.hxx" + +#include +#include + +SALOMEDS_AttributeIOR::SALOMEDS_AttributeIOR(const Handle(SALOMEDSImpl_AttributeIOR)& theAttr) +:SALOMEDS_GenericAttribute(theAttr) +{} + +SALOMEDS_AttributeIOR::SALOMEDS_AttributeIOR(SALOMEDS::AttributeIOR_ptr theAttr) +:SALOMEDS_GenericAttribute(theAttr) +{} + +SALOMEDS_AttributeIOR::~SALOMEDS_AttributeIOR() +{} + +char* SALOMEDS_AttributeIOR::Value() +{ + TCollection_AsciiString aValue; + if(_isLocal) aValue = Handle(SALOMEDSImpl_AttributeIOR)::DownCast(_local_impl)->Value(); + else aValue = SALOMEDS::AttributeIOR::_narrow(_corba_impl)->Value(); + return aValue.ToCString(); +} + +void SALOMEDS_AttributeIOR::SetValue(const char* value) +{ + CheckLocked(); + TCollection_AsciiString aValue((char*)value); + if(_isLocal) Handle(SALOMEDSImpl_AttributeIOR)::DownCast(_local_impl)->SetValue(aValue); + else SALOMEDS::AttributeIOR::_narrow(_corba_impl)->SetValue(aValue.ToCString()); +} diff --git a/src/SALOMEDS/SALOMEDS_AttributeIOR.hxx b/src/SALOMEDS/SALOMEDS_AttributeIOR.hxx new file mode 100644 index 000000000..d46c4515c --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_AttributeIOR.hxx @@ -0,0 +1,28 @@ +// File : SALOMEDS_AttributeIOR.hxx +// Author : Sergey RUIN +// Module : SALOME + +#ifndef SALOMEDS_AttributeIOR_HeaderFile +#define SALOMEDS_AttributeIOR_HeaderFile + +#include "SALOMEDSClient_AttributeIOR.hxx" +#include "SALOMEDS_GenericAttribute.hxx" +#include "SALOMEDSImpl_AttributeIOR.hxx" + +// IDL headers +#include +#include CORBA_SERVER_HEADER(SALOMEDS) +#include CORBA_SERVER_HEADER(SALOMEDS_Attributes) + +class SALOMEDS_AttributeIOR: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeIOR +{ +public: + SALOMEDS_AttributeIOR(const Handle(SALOMEDSImpl_AttributeIOR)& theAttr); + SALOMEDS_AttributeIOR(SALOMEDS::AttributeIOR_ptr theAttr); + ~SALOMEDS_AttributeIOR(); + + virtual char* Value(); + virtual void SetValue(const char* value); +}; + +#endif diff --git a/src/SALOMEDS/SALOMEDS_AttributeInteger.cxx b/src/SALOMEDS/SALOMEDS_AttributeInteger.cxx new file mode 100644 index 000000000..4fb2b3038 --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_AttributeInteger.cxx @@ -0,0 +1,34 @@ +// File : SALOMEDS_AttributeInteger.cxx +// Author : Sergey RUIN +// Module : SALOME + +#include "SALOMEDS_AttributeInteger.hxx" + +#include +#include + +SALOMEDS_AttributeInteger::SALOMEDS_AttributeInteger(const Handle(SALOMEDSImpl_AttributeInteger)& theAttr) +:SALOMEDS_GenericAttribute(theAttr) +{} + +SALOMEDS_AttributeInteger::SALOMEDS_AttributeInteger(SALOMEDS::AttributeInteger_ptr theAttr) +:SALOMEDS_GenericAttribute(theAttr) +{} + +SALOMEDS_AttributeInteger::~SALOMEDS_AttributeInteger() +{} + +int SALOMEDS_AttributeInteger::Value() +{ + int aValue; + if(_isLocal) aValue = Handle(SALOMEDSImpl_AttributeInteger)::DownCast(_local_impl)->Value(); + else aValue = SALOMEDS::AttributeInteger::_narrow(_corba_impl)->Value(); + return aValue; +} + +void SALOMEDS_AttributeInteger::SetValue(int value) +{ + CheckLocked(); + if(_isLocal) Handle(SALOMEDSImpl_AttributeInteger)::DownCast(_local_impl)->SetValue(value); + else SALOMEDS::AttributeInteger::_narrow(_corba_impl)->SetValue(value); +} diff --git a/src/SALOMEDS/SALOMEDS_AttributeInteger.hxx b/src/SALOMEDS/SALOMEDS_AttributeInteger.hxx new file mode 100644 index 000000000..1ebe36627 --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_AttributeInteger.hxx @@ -0,0 +1,28 @@ +// File : SALOMEDS_AttributeInteger.hxx +// Author : Sergey RUIN +// Module : SALOME + +#ifndef SALOMEDS_AttributeInteger_HeaderFile +#define SALOMEDS_AttributeInteger_HeaderFile + +#include "SALOMEDSClient_AttributeInteger.hxx" +#include "SALOMEDS_GenericAttribute.hxx" +#include "SALOMEDSImpl_AttributeInteger.hxx" + +// IDL headers +#include +#include CORBA_SERVER_HEADER(SALOMEDS) +#include CORBA_SERVER_HEADER(SALOMEDS_Attributes) + +class SALOMEDS_AttributeInteger: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeInteger +{ +public: + SALOMEDS_AttributeInteger(const Handle(SALOMEDSImpl_AttributeInteger)& theAttr); + SALOMEDS_AttributeInteger(SALOMEDS::AttributeInteger_ptr theAttr); + ~SALOMEDS_AttributeInteger(); + + virtual int Value(); + virtual void SetValue(int value); +}; + +#endif diff --git a/src/SALOMEDS/SALOMEDS_AttributeLocalID.cxx b/src/SALOMEDS/SALOMEDS_AttributeLocalID.cxx new file mode 100644 index 000000000..4efc2ac3f --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_AttributeLocalID.cxx @@ -0,0 +1,34 @@ +// File : SALOMEDS_AttributeLocalID.cxx +// Author : Sergey RUIN +// Module : SALOME + +#include "SALOMEDS_AttributeLocalID.hxx" + +#include +#include + +SALOMEDS_AttributeLocalID::SALOMEDS_AttributeLocalID(const Handle(SALOMEDSImpl_AttributeLocalID)& theAttr) +:SALOMEDS_GenericAttribute(theAttr) +{} + +SALOMEDS_AttributeLocalID::SALOMEDS_AttributeLocalID(SALOMEDS::AttributeLocalID_ptr theAttr) +:SALOMEDS_GenericAttribute(theAttr) +{} + +SALOMEDS_AttributeLocalID::~SALOMEDS_AttributeLocalID() +{} + +int SALOMEDS_AttributeLocalID::Value() +{ + int aValue; + if(_isLocal) aValue = (bool)Handle(SALOMEDSImpl_AttributeLocalID)::DownCast(_local_impl)->Value(); + else aValue = SALOMEDS::AttributeLocalID::_narrow(_corba_impl)->Value(); + return aValue; +} + +void SALOMEDS_AttributeLocalID::SetValue(int value) +{ + CheckLocked(); + if(_isLocal) Handle(SALOMEDSImpl_AttributeLocalID)::DownCast(_local_impl)->SetValue(value); + else SALOMEDS::AttributeLocalID::_narrow(_corba_impl)->SetValue(value); +} diff --git a/src/SALOMEDS/SALOMEDS_AttributeLocalID.hxx b/src/SALOMEDS/SALOMEDS_AttributeLocalID.hxx new file mode 100644 index 000000000..d62a94178 --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_AttributeLocalID.hxx @@ -0,0 +1,28 @@ +// File : SALOMEDS_AttributeLocalID.hxx +// Author : Sergey RUIN +// Module : SALOME + +#ifndef SALOMEDS_AttributeLocalID_HeaderFile +#define SALOMEDS_AttributeLocalID_HeaderFile + +#include "SALOMEDSClient_AttributeLocalID.hxx" +#include "SALOMEDS_GenericAttribute.hxx" +#include "SALOMEDSImpl_AttributeLocalID.hxx" + +// IDL headers +#include +#include CORBA_SERVER_HEADER(SALOMEDS) +#include CORBA_SERVER_HEADER(SALOMEDS_Attributes) + +class SALOMEDS_AttributeLocalID: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeLocalID +{ +public: + SALOMEDS_AttributeLocalID(const Handle(SALOMEDSImpl_AttributeLocalID)& theAttr); + SALOMEDS_AttributeLocalID(SALOMEDS::AttributeLocalID_ptr theAttr); + ~SALOMEDS_AttributeLocalID(); + + virtual int Value(); + virtual void SetValue(int value); +}; + +#endif diff --git a/src/SALOMEDS/SALOMEDS_AttributeName.cxx b/src/SALOMEDS/SALOMEDS_AttributeName.cxx new file mode 100644 index 000000000..e06d74ce5 --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_AttributeName.cxx @@ -0,0 +1,39 @@ +// File : SALOMEDS_AttributeName.cxx +// Author : Sergey RUIN +// Module : SALOME + +#include "SALOMEDS_AttributeName.hxx" + +#include +#include + +SALOMEDS_AttributeName::SALOMEDS_AttributeName(const Handle(SALOMEDSImpl_AttributeName)& theAttr) +:SALOMEDS_GenericAttribute(theAttr) +{ + cout <<"Creation of NAME attr : local" << endl; +} + +SALOMEDS_AttributeName::SALOMEDS_AttributeName(SALOMEDS::AttributeName_ptr theAttr) +:SALOMEDS_GenericAttribute(theAttr) +{ + cout <<"Creation of NAME attr : corba" << endl; +} + +SALOMEDS_AttributeName::~SALOMEDS_AttributeName() +{} + +char* SALOMEDS_AttributeName::Value() +{ + TCollection_AsciiString aValue; + if(_isLocal) aValue = Handle(SALOMEDSImpl_AttributeName)::DownCast(_local_impl)->Value(); + else aValue = SALOMEDS::AttributeName::_narrow(_corba_impl)->Value(); + return aValue.ToCString(); +} + +void SALOMEDS_AttributeName::SetValue(const char* value) +{ + CheckLocked(); + TCollection_AsciiString aValue((char*)value); + if(_isLocal) Handle(SALOMEDSImpl_AttributeName)::DownCast(_local_impl)->SetValue(aValue); + else SALOMEDS::AttributeName::_narrow(_corba_impl)->SetValue(aValue.ToCString()); +} diff --git a/src/SALOMEDS/SALOMEDS_AttributeName.hxx b/src/SALOMEDS/SALOMEDS_AttributeName.hxx new file mode 100644 index 000000000..9599ce5f4 --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_AttributeName.hxx @@ -0,0 +1,28 @@ +// File : SALOMEDS_AttributeName.hxx +// Author : Sergey RUIN +// Module : SALOME + +#ifndef SALOMEDS_AttributeName_HeaderFile +#define SALOMEDS_AttributeName_HeaderFile + +#include "SALOMEDSClient_AttributeName.hxx" +#include "SALOMEDS_GenericAttribute.hxx" +#include "SALOMEDSImpl_AttributeName.hxx" + +// IDL headers +#include +#include CORBA_SERVER_HEADER(SALOMEDS) +#include CORBA_SERVER_HEADER(SALOMEDS_Attributes) + +class SALOMEDS_AttributeName: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeName +{ +public: + SALOMEDS_AttributeName(const Handle(SALOMEDSImpl_AttributeName)& theAttr); + SALOMEDS_AttributeName(SALOMEDS::AttributeName_ptr theAttr); + ~SALOMEDS_AttributeName(); + + virtual char* Value(); + virtual void SetValue(const char* value); +}; + +#endif diff --git a/src/SALOMEDS/SALOMEDS_AttributeOpened.cxx b/src/SALOMEDS/SALOMEDS_AttributeOpened.cxx new file mode 100644 index 000000000..0f4f29df2 --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_AttributeOpened.cxx @@ -0,0 +1,33 @@ +// File : SALOMEDS_AttributeOpened.cxx +// Author : Sergey RUIN +// Module : SALOME + +#include "SALOMEDS_AttributeOpened.hxx" + +#include +#include + +SALOMEDS_AttributeOpened::SALOMEDS_AttributeOpened(const Handle(SALOMEDSImpl_AttributeOpened)& theAttr) +:SALOMEDS_GenericAttribute(theAttr) +{} + +SALOMEDS_AttributeOpened::SALOMEDS_AttributeOpened(SALOMEDS::AttributeOpened_ptr theAttr) +:SALOMEDS_GenericAttribute(theAttr) +{} + +SALOMEDS_AttributeOpened::~SALOMEDS_AttributeOpened() +{} + +bool SALOMEDS_AttributeOpened::IsOpened() +{ + bool aValue; + if(_isLocal) aValue = (bool)Handle(SALOMEDSImpl_AttributeOpened)::DownCast(_local_impl)->IsOpened(); + else aValue = SALOMEDS::AttributeOpened::_narrow(_corba_impl)->IsOpened(); + return aValue; +} + +void SALOMEDS_AttributeOpened::SetOpened(bool value) +{ + if(_isLocal) Handle(SALOMEDSImpl_AttributeOpened)::DownCast(_local_impl)->SetOpened((int)value); + else SALOMEDS::AttributeOpened::_narrow(_corba_impl)->SetOpened(value); +} diff --git a/src/SALOMEDS/SALOMEDS_AttributeOpened.hxx b/src/SALOMEDS/SALOMEDS_AttributeOpened.hxx new file mode 100644 index 000000000..653bfad45 --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_AttributeOpened.hxx @@ -0,0 +1,28 @@ +// File : SALOMEDS_AttributeOpened.hxx +// Author : Sergey RUIN +// Module : SALOME + +#ifndef SALOMEDS_AttributeOpened_HeaderFile +#define SALOMEDS_AttributeOpened_HeaderFile + +#include "SALOMEDSClient_AttributeOpened.hxx" +#include "SALOMEDS_GenericAttribute.hxx" +#include "SALOMEDSImpl_AttributeOpened.hxx" + +// IDL headers +#include +#include CORBA_SERVER_HEADER(SALOMEDS) +#include CORBA_SERVER_HEADER(SALOMEDS_Attributes) + +class SALOMEDS_AttributeOpened: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeOpened +{ +public: + SALOMEDS_AttributeOpened(const Handle(SALOMEDSImpl_AttributeOpened)& theAttr); + SALOMEDS_AttributeOpened(SALOMEDS::AttributeOpened_ptr theAttr); + ~SALOMEDS_AttributeOpened(); + + virtual bool IsOpened(); + virtual void SetOpened(bool value); +}; + +#endif diff --git a/src/SALOMEDS/SALOMEDS_AttributePersistentRef.cxx b/src/SALOMEDS/SALOMEDS_AttributePersistentRef.cxx new file mode 100644 index 000000000..96a7cc187 --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_AttributePersistentRef.cxx @@ -0,0 +1,35 @@ +// File : SALOMEDS_AttributePersistentRef.cxx +// Author : Sergey RUIN +// Module : SALOME + +#include "SALOMEDS_AttributePersistentRef.hxx" + +#include +#include + +SALOMEDS_AttributePersistentRef::SALOMEDS_AttributePersistentRef(const Handle(SALOMEDSImpl_AttributePersistentRef)& theAttr) +:SALOMEDS_GenericAttribute(theAttr) +{} + +SALOMEDS_AttributePersistentRef::SALOMEDS_AttributePersistentRef(SALOMEDS::AttributePersistentRef_ptr theAttr) +:SALOMEDS_GenericAttribute(theAttr) +{} + +SALOMEDS_AttributePersistentRef::~SALOMEDS_AttributePersistentRef() +{} + +char* SALOMEDS_AttributePersistentRef::Value() +{ + TCollection_AsciiString aValue; + if(_isLocal) aValue = Handle(SALOMEDSImpl_AttributePersistentRef)::DownCast(_local_impl)->Value(); + else aValue = SALOMEDS::AttributePersistentRef::_narrow(_corba_impl)->Value(); + return aValue.ToCString(); +} + +void SALOMEDS_AttributePersistentRef::SetValue(const char* value) +{ + CheckLocked(); + TCollection_AsciiString aValue((char*)value); + if(_isLocal) Handle(SALOMEDSImpl_AttributePersistentRef)::DownCast(_local_impl)->SetValue(aValue); + else SALOMEDS::AttributePersistentRef::_narrow(_corba_impl)->SetValue(aValue.ToCString()); +} diff --git a/src/SALOMEDS/SALOMEDS_AttributePersistentRef.hxx b/src/SALOMEDS/SALOMEDS_AttributePersistentRef.hxx new file mode 100644 index 000000000..dab4ff333 --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_AttributePersistentRef.hxx @@ -0,0 +1,28 @@ +// File : SALOMEDS_AttributePersistentRef.hxx +// Author : Sergey RUIN +// Module : SALOME + +#ifndef SALOMEDS_AttributePersistentRef_HeaderFile +#define SALOMEDS_AttributePersistentRef_HeaderFile + +#include "SALOMEDSClient_AttributePersistentRef.hxx" +#include "SALOMEDS_GenericAttribute.hxx" +#include "SALOMEDSImpl_AttributePersistentRef.hxx" + +// IDL headers +#include +#include CORBA_SERVER_HEADER(SALOMEDS) +#include CORBA_SERVER_HEADER(SALOMEDS_Attributes) + +class SALOMEDS_AttributePersistentRef: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributePersistentRef +{ +public: + SALOMEDS_AttributePersistentRef(const Handle(SALOMEDSImpl_AttributePersistentRef)& theAttr); + SALOMEDS_AttributePersistentRef(SALOMEDS::AttributePersistentRef_ptr theAttr); + ~SALOMEDS_AttributePersistentRef(); + + virtual char* Value(); + virtual void SetValue(const char* value); +}; + +#endif diff --git a/src/SALOMEDS/SALOMEDS_AttributePixMap.cxx b/src/SALOMEDS/SALOMEDS_AttributePixMap.cxx new file mode 100644 index 000000000..a0e037a37 --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_AttributePixMap.cxx @@ -0,0 +1,42 @@ +// File : SALOMEDS_AttributePixMap.cxx +// Author : Sergey RUIN +// Module : SALOME + +#include "SALOMEDS_AttributePixMap.hxx" + +#include +#include + +SALOMEDS_AttributePixMap::SALOMEDS_AttributePixMap(const Handle(SALOMEDSImpl_AttributePixMap)& theAttr) +:SALOMEDS_GenericAttribute(theAttr) +{} + +SALOMEDS_AttributePixMap::SALOMEDS_AttributePixMap(SALOMEDS::AttributePixMap_ptr theAttr) +:SALOMEDS_GenericAttribute(theAttr) +{} + +SALOMEDS_AttributePixMap::~SALOMEDS_AttributePixMap() +{} + +bool SALOMEDS_AttributePixMap::HasPixMap() +{ + bool ret; + if(_isLocal) ret = Handle(SALOMEDSImpl_AttributePixMap)::DownCast(_local_impl)->HasPixMap(); + else ret = SALOMEDS::AttributePixMap::_narrow(_corba_impl)->HasPixMap(); +} + +char* SALOMEDS_AttributePixMap::GetPixMap() +{ + TCollection_AsciiString aValue; + if(_isLocal) aValue = Handle(SALOMEDSImpl_AttributePixMap)::DownCast(_local_impl)->GetPixMap(); + else aValue = SALOMEDS::AttributePixMap::_narrow(_corba_impl)->GetPixMap(); + return aValue.ToCString(); +} + +void SALOMEDS_AttributePixMap::SetPixMap(const char* value) +{ + CheckLocked(); + TCollection_AsciiString aValue((char*)value); + if(_isLocal) Handle(SALOMEDSImpl_AttributePixMap)::DownCast(_local_impl)->SetPixMap(aValue); + else SALOMEDS::AttributePixMap::_narrow(_corba_impl)->SetPixMap(aValue.ToCString()); +} diff --git a/src/SALOMEDS/SALOMEDS_AttributePixMap.hxx b/src/SALOMEDS/SALOMEDS_AttributePixMap.hxx new file mode 100644 index 000000000..882b9b29d --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_AttributePixMap.hxx @@ -0,0 +1,30 @@ +// File : SALOMEDS_AttributePixMap.hxx +// Author : Sergey RUIN +// Module : SALOME + +#ifndef SALOMEDS_AttributePixMap_HeaderFile +#define SALOMEDS_AttributePixMap_HeaderFile + +#include "SALOMEDSClient_AttributePixMap.hxx" +#include "SALOMEDS_GenericAttribute.hxx" +#include "SALOMEDSImpl_AttributePixMap.hxx" + +// IDL headers +#include +#include CORBA_SERVER_HEADER(SALOMEDS) +#include CORBA_SERVER_HEADER(SALOMEDS_Attributes) + +class SALOMEDS_AttributePixMap: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributePixMap +{ +public: + SALOMEDS_AttributePixMap(const Handle(SALOMEDSImpl_AttributePixMap)& theAttr); + SALOMEDS_AttributePixMap(SALOMEDS::AttributePixMap_ptr theAttr); + ~SALOMEDS_AttributePixMap(); + + virtual bool HasPixMap(); + virtual char* GetPixMap(); + virtual void SetPixMap(const char* value); + +}; + +#endif diff --git a/src/SALOMEDS/SALOMEDS_AttributePythonObject.cxx b/src/SALOMEDS/SALOMEDS_AttributePythonObject.cxx new file mode 100644 index 000000000..85b630542 --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_AttributePythonObject.cxx @@ -0,0 +1,43 @@ +// File : SALOMEDS_AttributePythonObject.cxx +// Author : Sergey RUIN +// Module : SALOME + +#include "SALOMEDS_AttributePythonObject.hxx" + +#include +#include + +SALOMEDS_AttributePythonObject::SALOMEDS_AttributePythonObject(const Handle(SALOMEDSImpl_AttributePythonObject)& theAttr) +:SALOMEDS_GenericAttribute(theAttr) +{} + +SALOMEDS_AttributePythonObject::SALOMEDS_AttributePythonObject(SALOMEDS::AttributePythonObject_ptr theAttr) +:SALOMEDS_GenericAttribute(theAttr) +{} + +SALOMEDS_AttributePythonObject::~SALOMEDS_AttributePythonObject() +{} + +bool SALOMEDS_AttributePythonObject::IsScript() +{ + bool ret; + if(_isLocal) ret = Handle(SALOMEDSImpl_AttributePythonObject)::DownCast(_local_impl)->IsScript(); + else ret = SALOMEDS::AttributePythonObject::_narrow(_corba_impl)->IsScript(); + return ret; +} + +char* SALOMEDS_AttributePythonObject::GetObject() +{ + TCollection_AsciiString aValue; + if(_isLocal) aValue = Handle(SALOMEDSImpl_AttributePythonObject)::DownCast(_local_impl)->GetObject(); + else aValue = SALOMEDS::AttributePythonObject::_narrow(_corba_impl)->GetObject(); + return aValue.ToCString(); +} + +void SALOMEDS_AttributePythonObject::SetObject(const char* theSequence, bool IsScript) +{ + CheckLocked(); + TCollection_AsciiString aValue((char*)theSequence); + if(_isLocal) Handle(SALOMEDSImpl_AttributePythonObject)::DownCast(_local_impl)->SetObject(aValue, IsScript); + else SALOMEDS::AttributePythonObject::_narrow(_corba_impl)->SetObject(aValue.ToCString(), IsScript); +} diff --git a/src/SALOMEDS/SALOMEDS_AttributePythonObject.hxx b/src/SALOMEDS/SALOMEDS_AttributePythonObject.hxx new file mode 100644 index 000000000..a798fb996 --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_AttributePythonObject.hxx @@ -0,0 +1,30 @@ +// File : SALOMEDS_AttributePythonObject.hxx +// Author : Sergey RUIN +// Module : SALOME + +#ifndef SALOMEDS_AttributePythonObject_HeaderFile +#define SALOMEDS_AttributePythonObject_HeaderFile + +#include "SALOMEDSClient_AttributePythonObject.hxx" +#include "SALOMEDS_GenericAttribute.hxx" +#include "SALOMEDSImpl_AttributePythonObject.hxx" + +// IDL headers +#include +#include CORBA_SERVER_HEADER(SALOMEDS) +#include CORBA_SERVER_HEADER(SALOMEDS_Attributes) + +class SALOMEDS_AttributePythonObject: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributePythonObject +{ +public: + SALOMEDS_AttributePythonObject(const Handle(SALOMEDSImpl_AttributePythonObject)& theAttr); + SALOMEDS_AttributePythonObject(SALOMEDS::AttributePythonObject_ptr theAttr); + ~SALOMEDS_AttributePythonObject(); + + virtual void SetObject(const char* theSequence, bool IsScript); + virtual char* GetObject(); + virtual bool IsScript(); + +}; + +#endif diff --git a/src/SALOMEDS/SALOMEDS_AttributeReal.cxx b/src/SALOMEDS/SALOMEDS_AttributeReal.cxx new file mode 100644 index 000000000..67071e461 --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_AttributeReal.cxx @@ -0,0 +1,34 @@ +// File : SALOMEDS_AttributeReal.cxx +// Author : Sergey RUIN +// Module : SALOME + +#include "SALOMEDS_AttributeReal.hxx" + +#include +#include + +SALOMEDS_AttributeReal::SALOMEDS_AttributeReal(const Handle(SALOMEDSImpl_AttributeReal)& theAttr) +:SALOMEDS_GenericAttribute(theAttr) +{} + +SALOMEDS_AttributeReal::SALOMEDS_AttributeReal(SALOMEDS::AttributeReal_ptr theAttr) +:SALOMEDS_GenericAttribute(theAttr) +{} + +SALOMEDS_AttributeReal::~SALOMEDS_AttributeReal() +{} + +double SALOMEDS_AttributeReal::Value() +{ + double aValue; + if(_isLocal) aValue = (bool)Handle(SALOMEDSImpl_AttributeReal)::DownCast(_local_impl)->Value(); + else aValue = SALOMEDS::AttributeReal::_narrow(_corba_impl)->Value(); + return aValue; +} + +void SALOMEDS_AttributeReal::SetValue(double value) +{ + CheckLocked(); + if(_isLocal) Handle(SALOMEDSImpl_AttributeReal)::DownCast(_local_impl)->SetValue(value); + else SALOMEDS::AttributeReal::_narrow(_corba_impl)->SetValue(value); +} diff --git a/src/SALOMEDS/SALOMEDS_AttributeReal.hxx b/src/SALOMEDS/SALOMEDS_AttributeReal.hxx new file mode 100644 index 000000000..dd26b5345 --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_AttributeReal.hxx @@ -0,0 +1,28 @@ +// File : SALOMEDS_AttributeReal.hxx +// Author : Sergey RUIN +// Module : SALOME + +#ifndef SALOMEDS_AttributeReal_HeaderFile +#define SALOMEDS_AttributeReal_HeaderFile + +#include "SALOMEDSClient_AttributeReal.hxx" +#include "SALOMEDS_GenericAttribute.hxx" +#include "SALOMEDSImpl_AttributeReal.hxx" + +// IDL headers +#include +#include CORBA_SERVER_HEADER(SALOMEDS) +#include CORBA_SERVER_HEADER(SALOMEDS_Attributes) + +class SALOMEDS_AttributeReal: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeReal +{ +public: + SALOMEDS_AttributeReal(const Handle(SALOMEDSImpl_AttributeReal)& theAttr); + SALOMEDS_AttributeReal(SALOMEDS::AttributeReal_ptr theAttr); + ~SALOMEDS_AttributeReal(); + + virtual double Value(); + virtual void SetValue(double value); +}; + +#endif diff --git a/src/SALOMEDS/SALOMEDS_AttributeSelectable.cxx b/src/SALOMEDS/SALOMEDS_AttributeSelectable.cxx new file mode 100644 index 000000000..f9581a03d --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_AttributeSelectable.cxx @@ -0,0 +1,33 @@ +// File : SALOMEDS_AttributeSelectable.cxx +// Author : Sergey RUIN +// Module : SALOME + +#include "SALOMEDS_AttributeSelectable.hxx" + +#include +#include + +SALOMEDS_AttributeSelectable::SALOMEDS_AttributeSelectable(const Handle(SALOMEDSImpl_AttributeSelectable)& theAttr) +:SALOMEDS_GenericAttribute(theAttr) +{} + +SALOMEDS_AttributeSelectable::SALOMEDS_AttributeSelectable(SALOMEDS::AttributeSelectable_ptr theAttr) +:SALOMEDS_GenericAttribute(theAttr) +{} + +SALOMEDS_AttributeSelectable::~SALOMEDS_AttributeSelectable() +{} + +bool SALOMEDS_AttributeSelectable::IsSelectable() +{ + bool aValue; + if(_isLocal) aValue = (bool)Handle(SALOMEDSImpl_AttributeSelectable)::DownCast(_local_impl)->IsSelectable(); + else aValue = SALOMEDS::AttributeSelectable::_narrow(_corba_impl)->IsSelectable(); + return aValue; +} + +void SALOMEDS_AttributeSelectable::SetSelectable(bool value) +{ + if(_isLocal) Handle(SALOMEDSImpl_AttributeSelectable)::DownCast(_local_impl)->SetSelectable((int)value); + else SALOMEDS::AttributeSelectable::_narrow(_corba_impl)->SetSelectable(value); +} diff --git a/src/SALOMEDS/SALOMEDS_AttributeSelectable.hxx b/src/SALOMEDS/SALOMEDS_AttributeSelectable.hxx new file mode 100644 index 000000000..943eafacc --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_AttributeSelectable.hxx @@ -0,0 +1,28 @@ +// File : SALOMEDS_AttributeSelectable.hxx +// Author : Sergey RUIN +// Module : SALOME + +#ifndef SALOMEDS_AttributeSelectable_HeaderFile +#define SALOMEDS_AttributeSelectable_HeaderFile + +#include "SALOMEDSClient_AttributeSelectable.hxx" +#include "SALOMEDS_GenericAttribute.hxx" +#include "SALOMEDSImpl_AttributeSelectable.hxx" + +// IDL headers +#include +#include CORBA_SERVER_HEADER(SALOMEDS) +#include CORBA_SERVER_HEADER(SALOMEDS_Attributes) + +class SALOMEDS_AttributeSelectable: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeSelectable +{ +public: + SALOMEDS_AttributeSelectable(const Handle(SALOMEDSImpl_AttributeSelectable)& theAttr); + SALOMEDS_AttributeSelectable(SALOMEDS::AttributeSelectable_ptr theAttr); + ~SALOMEDS_AttributeSelectable(); + + virtual bool IsSelectable(); + virtual void SetSelectable(bool value); +}; + +#endif diff --git a/src/SALOMEDS/SALOMEDS_AttributeSequenceOfInteger.cxx b/src/SALOMEDS/SALOMEDS_AttributeSequenceOfInteger.cxx new file mode 100644 index 000000000..9623d89f8 --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_AttributeSequenceOfInteger.cxx @@ -0,0 +1,89 @@ +// File : SALOMEDS_AttributeSequenceOfInteger.cxx +// Author : Sergey RUIN +// Module : SALOME + +#include "SALOMEDS_AttributeSequenceOfInteger.hxx" + +#include +#include +#include + +SALOMEDS_AttributeSequenceOfInteger +::SALOMEDS_AttributeSequenceOfInteger(const Handle(SALOMEDSImpl_AttributeSequenceOfInteger)& theAttr) +:SALOMEDS_GenericAttribute(theAttr) +{} + +SALOMEDS_AttributeSequenceOfInteger::SALOMEDS_AttributeSequenceOfInteger(SALOMEDS::AttributeSequenceOfInteger_ptr theAttr) +:SALOMEDS_GenericAttribute(theAttr) +{} + +SALOMEDS_AttributeSequenceOfInteger::~SALOMEDS_AttributeSequenceOfInteger() +{} + +void SALOMEDS_AttributeSequenceOfInteger::Assign(const std::vector& other) +{ + int i, aLength = other.size(); + if(_isLocal) { + Handle(TColStd_HSequenceOfInteger) aSeq = new TColStd_HSequenceOfInteger; + for(i = 0; i < aLength; i++) aSeq->Append(other[i]); + Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_local_impl)->Assign(aSeq); + } + else { + SALOMEDS::LongSeq_var aSeq = new SALOMEDS::LongSeq(); + aSeq->length(aLength); + for(i = 0; i < aLength; i++) aSeq[i] = other[i]; + SALOMEDS::AttributeSequenceOfInteger::_narrow(_corba_impl)->Assign(aSeq); + } +} + +std::vector SALOMEDS_AttributeSequenceOfInteger::CorbaSequence() +{ + std::vector aVector; + int i, aLength; + if(_isLocal) { + Handle(SALOMEDSImpl_AttributeSequenceOfInteger) aSeqAttr; + aSeqAttr = Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_local_impl); + aLength = aSeqAttr->Length(); + for(i = 1; i <=aLength; i++) aVector.push_back(aSeqAttr->Value(i)); + } + else { + SALOMEDS::AttributeSequenceOfInteger_var aSeqAttr = SALOMEDS::AttributeSequenceOfInteger::_narrow(_corba_impl); + aLength = aSeqAttr->Length(); + for(i = 1; i <=aLength; i++) aVector.push_back(aSeqAttr->Value(i)); + } + return aVector; +} + +void SALOMEDS_AttributeSequenceOfInteger::Add(int value) +{ + if(_isLocal) Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_local_impl)->Add(value); + else SALOMEDS::AttributeSequenceOfInteger::_narrow(_corba_impl)->Add(value); +} + +void SALOMEDS_AttributeSequenceOfInteger::Remove(int index) +{ + if(_isLocal) Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_local_impl)->Remove(index); + else SALOMEDS::AttributeSequenceOfInteger::_narrow(_corba_impl)->Remove(index); +} + +void SALOMEDS_AttributeSequenceOfInteger::ChangeValue(int index, int value) +{ + if(_isLocal) Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_local_impl)->ChangeValue(index, value); + else SALOMEDS::AttributeSequenceOfInteger::_narrow(_corba_impl)->ChangeValue(index, value); +} + +int SALOMEDS_AttributeSequenceOfInteger::Value(int index) +{ + int aValue; + if(_isLocal) aValue = Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_local_impl)->Value(index); + else aValue = SALOMEDS::AttributeSequenceOfInteger::_narrow(_corba_impl)->Value(index); + return aValue; +} + +int SALOMEDS_AttributeSequenceOfInteger::Length() +{ + int aValue; + if(_isLocal) aValue = Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_local_impl)-> Length(); + else aValue = SALOMEDS::AttributeSequenceOfInteger::_narrow(_corba_impl)-> Length(); + return aValue; +} diff --git a/src/SALOMEDS/SALOMEDS_AttributeSequenceOfInteger.hxx b/src/SALOMEDS/SALOMEDS_AttributeSequenceOfInteger.hxx new file mode 100644 index 000000000..26fe88e5a --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_AttributeSequenceOfInteger.hxx @@ -0,0 +1,36 @@ +// File : SALOMEDS_AttributeSequenceOfInteger.hxx +// Author : Sergey RUIN +// Module : SALOME + +#ifndef SALOMEDS_AttributeSequenceOfInteger_HeaderFile +#define SALOMEDS_AttributeSequenceOfInteger_HeaderFile + +#include "SALOMEDSClient_AttributeSequenceOfInteger.hxx" +#include "SALOMEDS_GenericAttribute.hxx" +#include "SALOMEDSImpl_AttributeSequenceOfInteger.hxx" + +// IDL headers +#include +#include CORBA_SERVER_HEADER(SALOMEDS) +#include CORBA_SERVER_HEADER(SALOMEDS_Attributes) + +#include + +class SALOMEDS_AttributeSequenceOfInteger: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeSequenceOfInteger +{ +public: + SALOMEDS_AttributeSequenceOfInteger(const Handle(SALOMEDSImpl_AttributeSequenceOfInteger)& theAttr); + SALOMEDS_AttributeSequenceOfInteger(SALOMEDS::AttributeSequenceOfInteger_ptr theAttr); + ~SALOMEDS_AttributeSequenceOfInteger(); + + virtual void Assign(const std::vector& other); + virtual std::vector CorbaSequence(); + virtual void Add(int value); + virtual void Remove(int index); + virtual void ChangeValue(int index, int value); + virtual int Value(int index); + virtual int Length(); + +}; + +#endif diff --git a/src/SALOMEDS/SALOMEDS_AttributeSequenceOfReal.cxx b/src/SALOMEDS/SALOMEDS_AttributeSequenceOfReal.cxx new file mode 100644 index 000000000..f29de16e6 --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_AttributeSequenceOfReal.cxx @@ -0,0 +1,89 @@ +// File : SALOMEDS_AttributeSequenceOfReal.cxx +// Author : Sergey RUIN +// Module : SALOME + +#include "SALOMEDS_AttributeSequenceOfReal.hxx" + +#include +#include +#include + +SALOMEDS_AttributeSequenceOfReal +::SALOMEDS_AttributeSequenceOfReal(const Handle(SALOMEDSImpl_AttributeSequenceOfReal)& theAttr) +:SALOMEDS_GenericAttribute(theAttr) +{} + +SALOMEDS_AttributeSequenceOfReal::SALOMEDS_AttributeSequenceOfReal(SALOMEDS::AttributeSequenceOfReal_ptr theAttr) +:SALOMEDS_GenericAttribute(theAttr) +{} + +SALOMEDS_AttributeSequenceOfReal::~SALOMEDS_AttributeSequenceOfReal() +{} + +void SALOMEDS_AttributeSequenceOfReal::Assign(const std::vector& other) +{ + int i, aLength = other.size(); + if(_isLocal) { + Handle(TColStd_HSequenceOfReal) aSeq = new TColStd_HSequenceOfReal; + for(i = 0; i < aLength; i++) aSeq->Append(other[i]); + Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_local_impl)->Assign(aSeq); + } + else { + SALOMEDS::DoubleSeq_var aSeq = new SALOMEDS::DoubleSeq(); + aSeq->length(aLength); + for(i = 0; i < aLength; i++) aSeq[i] = other[i]; + SALOMEDS::AttributeSequenceOfReal::_narrow(_corba_impl)->Assign(aSeq); + } +} + +std::vector SALOMEDS_AttributeSequenceOfReal::CorbaSequence() +{ + std::vector aVector; + int i, aLength; + if(_isLocal) { + Handle(SALOMEDSImpl_AttributeSequenceOfReal) aSeqAttr; + aSeqAttr = Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_local_impl); + aLength = aSeqAttr->Length(); + for(i = 1; i <=aLength; i++) aVector.push_back(aSeqAttr->Value(i)); + } + else { + SALOMEDS::AttributeSequenceOfReal_var aSeqAttr = SALOMEDS::AttributeSequenceOfReal::_narrow(_corba_impl); + aLength = aSeqAttr->Length(); + for(i = 1; i <=aLength; i++) aVector.push_back(aSeqAttr->Value(i)); + } + return aVector; +} + +void SALOMEDS_AttributeSequenceOfReal::Add(double value) +{ + if(_isLocal) Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_local_impl)->Add(value); + else SALOMEDS::AttributeSequenceOfReal::_narrow(_corba_impl)->Add(value); +} + +void SALOMEDS_AttributeSequenceOfReal::Remove(int index) +{ + if(_isLocal) Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_local_impl)->Remove(index); + else SALOMEDS::AttributeSequenceOfReal::_narrow(_corba_impl)->Remove(index); +} + +void SALOMEDS_AttributeSequenceOfReal::ChangeValue(int index, double value) +{ + if(_isLocal) Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_local_impl)->ChangeValue(index, value); + else SALOMEDS::AttributeSequenceOfReal::_narrow(_corba_impl)->ChangeValue(index, value); +} + +double SALOMEDS_AttributeSequenceOfReal::Value(int index) +{ + double aValue; + if(_isLocal) aValue = Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_local_impl)->Value(index); + else aValue = SALOMEDS::AttributeSequenceOfReal::_narrow(_corba_impl)->Value(index); + return aValue; +} + +int SALOMEDS_AttributeSequenceOfReal::Length() +{ + int aValue; + if(_isLocal) aValue = Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_local_impl)-> Length(); + else aValue = SALOMEDS::AttributeSequenceOfReal::_narrow(_corba_impl)-> Length(); + return aValue; +} diff --git a/src/SALOMEDS/SALOMEDS_AttributeSequenceOfReal.hxx b/src/SALOMEDS/SALOMEDS_AttributeSequenceOfReal.hxx new file mode 100644 index 000000000..31773263f --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_AttributeSequenceOfReal.hxx @@ -0,0 +1,36 @@ +// File : SALOMEDS_AttributeSequenceOfReal.hxx +// Author : Sergey RUIN +// Module : SALOME + +#ifndef SALOMEDS_AttributeSequenceOfReal_HeaderFile +#define SALOMEDS_AttributeSequenceOfReal_HeaderFile + +#include "SALOMEDSClient_AttributeSequenceOfReal.hxx" +#include "SALOMEDS_GenericAttribute.hxx" +#include "SALOMEDSImpl_AttributeSequenceOfReal.hxx" + +// IDL headers +#include +#include CORBA_SERVER_HEADER(SALOMEDS) +#include CORBA_SERVER_HEADER(SALOMEDS_Attributes) + +#include + +class SALOMEDS_AttributeSequenceOfReal: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeSequenceOfReal +{ +public: + SALOMEDS_AttributeSequenceOfReal(const Handle(SALOMEDSImpl_AttributeSequenceOfReal)& theAttr); + SALOMEDS_AttributeSequenceOfReal(SALOMEDS::AttributeSequenceOfReal_ptr theAttr); + ~SALOMEDS_AttributeSequenceOfReal(); + + virtual void Assign(const std::vector& other); + virtual std::vector CorbaSequence(); + virtual void Add(double value); + virtual void Remove(int index); + virtual void ChangeValue(int index, double value); + virtual double Value(int index); + virtual int Length(); + +}; + +#endif diff --git a/src/SALOMEDS/SALOMEDS_AttributeStudyProperties.cxx b/src/SALOMEDS/SALOMEDS_AttributeStudyProperties.cxx new file mode 100644 index 000000000..1e942f01b --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_AttributeStudyProperties.cxx @@ -0,0 +1,219 @@ +// File : SALOMEDS_AttributeStudyProperties.cxx +// Author : Sergey RUIN +// Module : SALOME + +#include "SALOMEDS_AttributeStudyProperties.hxx" + +#include +#include +#include +#include + +SALOMEDS_AttributeStudyProperties +::SALOMEDS_AttributeStudyProperties(const Handle(SALOMEDSImpl_AttributeStudyProperties)& theAttr) +:SALOMEDS_GenericAttribute(theAttr) +{} + +SALOMEDS_AttributeStudyProperties::SALOMEDS_AttributeStudyProperties(SALOMEDS::AttributeStudyProperties_ptr theAttr) +:SALOMEDS_GenericAttribute(theAttr) +{} + +SALOMEDS_AttributeStudyProperties::~SALOMEDS_AttributeStudyProperties() +{ +} + +void SALOMEDS_AttributeStudyProperties::SetUserName(const char* theName) +{ + TCollection_AsciiString aName((char*)theName); + if(_isLocal) Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->SetUserName(aName); + else SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetUserName(aName.ToCString()); +} + +char* SALOMEDS_AttributeStudyProperties::GetUserName() +{ + TCollection_AsciiString aName; + if(_isLocal) aName = Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->GetCreatorName(); + else aName = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->GetUserName(); + return aName.ToCString(); +} + +void SALOMEDS_AttributeStudyProperties::SetCreationDate(int theMinute, int theHour, int theDay, int theMonth, int theYear) +{ + if(_isLocal) + Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->SetModificationDate(theMinute, + theHour, + theDay, + theMonth, + theYear); + else + SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetCreationDate(theMinute, + theHour, + theDay, + theMonth, + theYear); +} + +bool SALOMEDS_AttributeStudyProperties::GetCreationDate(int& theMinute, + int& theHour, + int& theDay, + int& theMonth, + int& theYear) +{ + bool ret; + if(_isLocal) + ret = Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->GetCreationDate(theMinute, + theHour, + theDay, + theMonth, + theYear); + else { + CORBA::Long aMinute, anHour, aDay, aMonth, anYear; + ret = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->GetCreationDate(aMinute, + anHour, + aDay, + aMonth, + anYear); + theMinute = (int)aMinute; theHour = (int)anHour; theDay = (int)aDay; theMonth = (int)aMonth; theYear = (int)anYear; + } + return ret; +} + +void SALOMEDS_AttributeStudyProperties::SetCreationMode(const char* theMode) +{ + TCollection_AsciiString aMode((char*)theMode); + if(_isLocal) { + if(aMode == "from scratch") + Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->SetCreationMode(1); + else if(aMode == "copy from") + Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->SetCreationMode(2); + else //Not defined + Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->SetCreationMode(0); + } + else SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetCreationMode(aMode.ToCString()); +} + +char* SALOMEDS_AttributeStudyProperties::GetCreationMode() +{ + TCollection_AsciiString aMode; + if(_isLocal) { + int mode = Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->GetCreationMode(); + if(mode == 1) aMode = "from scratch"; + if(mode == 2) aMode = "copy from"; + } + else aMode = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->GetCreationMode(); + return aMode.ToCString(); +} + +void SALOMEDS_AttributeStudyProperties::SetModified(int theModified) +{ + if(_isLocal) Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->SetModified(theModified); + else SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetModified(theModified); +} + +bool SALOMEDS_AttributeStudyProperties::IsModified() +{ + bool ret; + if(_isLocal) ret = Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->IsModified(); + else ret = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->IsModified(); + return ret; +} + +int SALOMEDS_AttributeStudyProperties::GetModified() +{ + int isModified; + if(_isLocal) isModified = Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->GetModified(); + else isModified = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->GetModified(); + return isModified; +} + +void SALOMEDS_AttributeStudyProperties::SetLocked(bool theLocked) +{ + if(_isLocal) Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->SetLocked(theLocked); + else SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetLocked(theLocked); +} + +bool SALOMEDS_AttributeStudyProperties::IsLocked() +{ + bool ret; + if(_isLocal) ret = Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->IsLocked(); + else ret = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->IsLocked(); + return ret; +} + +void SALOMEDS_AttributeStudyProperties::SetModification(const char* theName, + int theMinute, + int theHour, + int theDay, + int theMonth, + int theYear) +{ + TCollection_AsciiString aName((char*)theName); + if(_isLocal) { + Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->SetUserName(aName); + Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->SetModificationDate(theMinute, + theHour, + theDay, + theMonth, + theYear); + } + else SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetModification(aName.ToCString(), + theMinute, + theHour, + theDay, + theMonth, + theYear); +} + +void SALOMEDS_AttributeStudyProperties::GetModificationsList(std::vector& theNames, + std::vector& theMinutes, + std::vector& theHours, + std::vector& theDays, + std::vector& theMonths, + std::vector& theYears, + bool theWithCreator) +{ + + int i, aLength; + + if(_isLocal) { + Handle(TColStd_HSequenceOfExtendedString) aNames; + Handle(TColStd_HSequenceOfInteger) aMinutes, aHours, aDays, aMonths, aYears; + aNames = Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->GetUserNames(); + Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->GetModificationDates(aMinutes, + aHours, + aDays, + aMonths, + aYears); + aLength = aNames->Length()-((theWithCreator)?0:1); + for(i = 0; i < aLength; i++) + { + theNames.push_back(TCollection_AsciiString(aNames->Value(i + 1 + ((theWithCreator)?0:1))).ToCString()); + theMinutes.push_back(aMinutes->Value(i + 1 + ((theWithCreator)?0:1))); + theHours.push_back(aHours->Value(i + 1 + ((theWithCreator)?0:1))); + theDays.push_back(aDays->Value(i + 1 + ((theWithCreator)?0:1))); + theMonths.push_back(aMonths->Value(i + 1 + ((theWithCreator)?0:1))); + theYears.push_back(aYears->Value(i + 1 + ((theWithCreator)?0:1))); + } + } + else { + SALOMEDS::StringSeq_var aNames; + SALOMEDS::LongSeq_var aMinutes, aHours, aDays, aMonths, aYears; + SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->GetModificationsList(aNames.out(), + aMinutes.out(), + aHours.out(), + aDays.out(), + aMonths.out(), + aYears.out(), + theWithCreator); + aLength = aNames->length(); + for(i = 0; i +#include + +#include "SALOMEDSClient_AttributeStudyProperties.hxx" +#include "SALOMEDS_GenericAttribute.hxx" +#include "SALOMEDSImpl_AttributeStudyProperties.hxx" + +// IDL headers +#include +#include CORBA_SERVER_HEADER(SALOMEDS) +#include CORBA_SERVER_HEADER(SALOMEDS_Attributes) + +class SALOMEDS_AttributeStudyProperties: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeStudyProperties +{ +public: + + SALOMEDS_AttributeStudyProperties(const Handle(SALOMEDSImpl_AttributeStudyProperties)& theAttr); + SALOMEDS_AttributeStudyProperties(SALOMEDS::AttributeStudyProperties_ptr theAttr); + ~SALOMEDS_AttributeStudyProperties(); + + virtual void SetUserName(const char* theName); + virtual char* GetUserName(); + virtual void SetCreationDate(int theMinute, int theHour, int theDay, int theMonth, int theYear); + virtual bool GetCreationDate(int& theMinute, int& theHour, int& theDay, int& theMonth, int& theYear); + virtual void SetCreationMode(const char* theMode); + virtual char* GetCreationMode(); + virtual void SetModified(int theModified); + virtual bool IsModified(); + virtual int GetModified(); + virtual void SetLocked(bool theLocked); + virtual bool IsLocked(); + virtual void SetModification(const char* theName, + int theMinute, + int theHour, + int theDay, + int theMonth, + int theYear); + virtual void GetModificationsList(std::vector& theNames, + std::vector& theMinutes, + std::vector& theHours, + std::vector& theDays, + std::vector& theMonths, + std::vector& theYears, + bool theWithCreator); + +}; + + +#endif diff --git a/src/SALOMEDS/SALOMEDS_AttributeTableOfInteger.cxx b/src/SALOMEDS/SALOMEDS_AttributeTableOfInteger.cxx new file mode 100644 index 000000000..34652c322 --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_AttributeTableOfInteger.cxx @@ -0,0 +1,382 @@ +// File : SALOMEDS_AttributeTableOfInteger.cxx +// Author : Sergey RUIN +// Module : SALOME + +#include "SALOMEDS_AttributeTableOfInteger.hxx" + +#include +#include +#include +#include + + +SALOMEDS_AttributeTableOfInteger +::SALOMEDS_AttributeTableOfInteger(const Handle(SALOMEDSImpl_AttributeTableOfInteger)& theAttr) +:SALOMEDS_GenericAttribute(theAttr) +{} + +SALOMEDS_AttributeTableOfInteger::SALOMEDS_AttributeTableOfInteger(SALOMEDS::AttributeTableOfInteger_ptr theAttr) +:SALOMEDS_GenericAttribute(theAttr) +{} + +SALOMEDS_AttributeTableOfInteger::~SALOMEDS_AttributeTableOfInteger() +{} + + +void SALOMEDS_AttributeTableOfInteger::SetTitle(const char* theTitle) +{ + CheckLocked(); + TCollection_AsciiString aStr((char*)theTitle); + if(_isLocal) Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->SetTitle(aStr); + else SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->SetTitle(aStr.ToCString()); +} + +char* SALOMEDS_AttributeTableOfInteger::GetTitle() +{ + TCollection_AsciiString aStr; + if(_isLocal) aStr = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->GetTitle(); + else aStr = SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->GetTitle(); + return aStr.ToCString(); +} + +void SALOMEDS_AttributeTableOfInteger::SetRowTitle(int theIndex, const char* theTitle) +{ + CheckLocked(); + TCollection_AsciiString aTitle((char*)theTitle); + if(_isLocal) Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->SetRowTitle(theIndex, aTitle); + else SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->SetRowTitle(theIndex, aTitle.ToCString()); +} + +void SALOMEDS_AttributeTableOfInteger::SetRowTitles(const std::vector& theTitles) +{ + CheckLocked(); + int aLength = theTitles.size(), i; + if(_isLocal) { + Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString; + for(i = 0; i < aLength; i++) aSeq->Append((char*)theTitles[i].c_str()); + Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->SetRowTitles(aSeq); + } + else { + SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq(); + aSeq->length(aLength); + for(i = 0; i < aLength; i++) aSeq[i] = TCollection_AsciiString((char*)theTitles[i].c_str()).ToCString(); + SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->SetRowTitles(aSeq); + } + +} + +std::vector SALOMEDS_AttributeTableOfInteger::GetRowTitles() +{ + std::vector aVector; + int aLength, i; + if(_isLocal) { + Handle(TColStd_HSequenceOfExtendedString) aSeq; + aSeq = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->GetRowTitles(); + aLength = aSeq->Length(); + for(i = 1; i<= aLength; i++) aVector.push_back(TCollection_AsciiString(aSeq->Value(i)).ToCString()); + } + else { + SALOMEDS::StringSeq_var aSeq = SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->GetRowTitles(); + aLength = aSeq->length(); + for(i = 0; iSetColumnTitle(theIndex, aStr); + else SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->SetColumnTitle(theIndex, aStr.ToCString()); +} + +void SALOMEDS_AttributeTableOfInteger::SetColumnTitles(const std::vector& theTitles) +{ + CheckLocked(); + int aLength = theTitles.size(), i; + if(_isLocal) { + Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString; + for(i = 0; i < aLength; i++) aSeq->Append((char*)theTitles[i].c_str()); + Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->SetColumnTitles(aSeq); + } + else { + SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq(); + aSeq->length(aLength); + for(i = 0; i < aLength; i++) aSeq[i] = TCollection_AsciiString((char*)theTitles[i].c_str()).ToCString(); + SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->SetColumnTitles(aSeq); + } +} + +std::vector SALOMEDS_AttributeTableOfInteger::GetColumnTitles() +{ + std::vector aVector; + int aLength, i; + if(_isLocal) { + Handle(TColStd_HSequenceOfExtendedString) aSeq; + aSeq = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->GetColumnTitles(); + aLength = aSeq->Length(); + for(i = 1; i<= aLength; i++) aVector.push_back(TCollection_AsciiString(aSeq->Value(i)).ToCString()); + } + else { + SALOMEDS::StringSeq_var aSeq = SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->GetColumnTitles(); + aLength = aSeq->length(); + for(i = 0; iSetRowUnit(theIndex, aUnit); + else SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->SetRowUnit(theIndex, aUnit.ToCString()); +} + +void SALOMEDS_AttributeTableOfInteger::SetRowUnits(const std::vector& theUnits) +{ + CheckLocked(); + int aLength = theUnits.size(), i; + if(_isLocal) { + Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString; + for(i = 0; i < aLength; i++) aSeq->Append((char*)theUnits[i].c_str()); + Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->SetRowUnits(aSeq); + } + else { + SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq(); + aSeq->length(aLength); + for(i = 0; i < aLength; i++) aSeq[i] = TCollection_AsciiString((char*)theUnits[i].c_str()).ToCString(); + SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->SetRowUnits(aSeq); + } +} + +std::vector SALOMEDS_AttributeTableOfInteger::GetRowUnits() +{ + std::vector aVector; + int aLength, i; + if(_isLocal) { + Handle(TColStd_HSequenceOfExtendedString) aSeq; + aSeq = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->GetRowUnits(); + aLength = aSeq->Length(); + for(i = 1; i<= aLength; i++) aVector.push_back(TCollection_AsciiString(aSeq->Value(i)).ToCString()); + } + else { + SALOMEDS::StringSeq_var aSeq = SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->GetRowUnits(); + aLength = aSeq->length(); + for(i = 0; iGetNbRows(); + else aNb = SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->GetNbRows(); + return aNb; +} + +int SALOMEDS_AttributeTableOfInteger::GetNbColumns() +{ + int aNb; + if(_isLocal) aNb = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->GetNbColumns(); + else aNb = SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->GetNbColumns(); + return aNb; + +} + +void SALOMEDS_AttributeTableOfInteger::AddRow(const std::vector& theData) +{ + CheckLocked(); + int aLength = theData.size(), i; + if(_isLocal) { + Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable; + aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl); + Handle(TColStd_HSequenceOfInteger) aRow = new TColStd_HSequenceOfInteger; + for (int i = 0; i < aLength; i++) aRow->Append(theData[i]); + try { + aTable->SetRowData(aTable->GetNbRows() + 1, aRow); + } + catch(...) { + throw SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength(); + } + } + else { + SALOMEDS::LongSeq_var aSeq = new SALOMEDS::LongSeq(); + aSeq->length(aLength); + for(i = 0; i < aLength; i++) aSeq[i] = theData[i]; + SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->AddRow(aSeq); + } +} + +void SALOMEDS_AttributeTableOfInteger::SetRow(int theRow, const std::vector& theData) +{ + CheckLocked(); + int aLength = theData.size(), i; + if(_isLocal) { + Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable; + aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl); + Handle(TColStd_HSequenceOfInteger) aRow = new TColStd_HSequenceOfInteger; + for (int i = 0; i < aLength; i++) aRow->Append(theData[i]); + try { + aTable->SetRowData(theRow, aRow); + } + catch(...) { + throw SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength(); + } + } + else { + SALOMEDS::LongSeq_var aSeq = new SALOMEDS::LongSeq(); + aSeq->length(aLength); + for(i = 0; i < aLength; i++) aSeq[i] = theData[i]; + SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->SetRow(theRow, aSeq); + } +} + +std::vector SALOMEDS_AttributeTableOfInteger::GetRow(int theRow) +{ + std::vector aVector; + int aLength, i; + if(_isLocal) { + Handle(TColStd_HSequenceOfInteger) aRow; + aRow = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->GetRowData(theRow); + aLength = aRow->Length(); + for(i = 1; i<= aLength; i++) aVector.push_back(aRow->Value(i)); + } + else { + SALOMEDS::LongSeq_var aRow = SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->GetRow(theRow); + for(i = 0; i < aLength; i++) aVector.push_back(aRow[i]); + } + + return aVector; +} + +void SALOMEDS_AttributeTableOfInteger::AddColumn(const std::vector& theData) +{ + CheckLocked(); + int aLength = theData.size(), i; + if(_isLocal) { + Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable; + aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl); + Handle(TColStd_HSequenceOfInteger) aColumn = new TColStd_HSequenceOfInteger; + for (int i = 0; i < aLength; i++) aColumn->Append(theData[i]); + try { + aTable->SetColumnData(aTable->GetNbColumns() + 1, aColumn); + } + catch(...) { + throw SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength(); + } + } + else { + SALOMEDS::LongSeq_var aColumn = new SALOMEDS::LongSeq(); + aColumn->length(aLength); + for(i = 0; i < aLength; i++) aColumn[i] = theData[i]; + SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->AddColumn(aColumn); + } +} + +void SALOMEDS_AttributeTableOfInteger::SetColumn(int theColumn, const std::vector& theData) +{ + CheckLocked(); + int aLength = theData.size(), i; + if(_isLocal) { + Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable; + aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl); + Handle(TColStd_HSequenceOfInteger) aColumn = new TColStd_HSequenceOfInteger; + for (int i = 0; i < aLength; i++) aColumn->Append(theData[i]); + try { + aTable->SetRowData(theColumn, aColumn); + } + catch(...) { + throw SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength(); + } + } + else { + SALOMEDS::LongSeq_var aColumn = new SALOMEDS::LongSeq(); + aColumn->length(aLength); + for(i = 0; i < aLength; i++) aColumn[i] = theData[i]; + SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->SetRow(theColumn, aColumn); + } +} + +std::vector SALOMEDS_AttributeTableOfInteger::GetColumn(int theColumn) +{ + std::vector aVector; + int aLength, i; + if(_isLocal) { + Handle(TColStd_HSequenceOfInteger) aColumn; + aColumn = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->GetColumnData(theColumn); + aLength = aColumn->Length(); + for(i = 1; i<= aLength; i++) aVector.push_back(aColumn->Value(i)); + } + else { + SALOMEDS::LongSeq_var aColumn = SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->GetColumn(theColumn); + for(i = 0; i < aLength; i++) aVector.push_back(aColumn[i]); + } + return aVector; +} + +void SALOMEDS_AttributeTableOfInteger::PutValue(int theValue, int theRow, int theColumn) +{ + CheckLocked(); + if(_isLocal) { + try { + Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->PutValue(theValue, theRow, theColumn); + } + catch(...) { + throw SALOMEDS::AttributeTableOfInteger::IncorrectIndex(); + } + } + else { + SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->PutValue(theValue, theRow, theColumn); + } +} + +bool SALOMEDS_AttributeTableOfInteger::HasValue(int theRow, int theColumn) +{ + bool ret; + if(_isLocal) ret = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->HasValue(theRow, theColumn); + else ret = SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->HasValue(theRow, theColumn); + return ret; +} + +int SALOMEDS_AttributeTableOfInteger::GetValue(int theRow, int theColumn) +{ + int aValue; + if(_isLocal) { + try { + aValue = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->GetValue(theRow, theColumn); + } + catch(...) { + throw SALOMEDS::AttributeTableOfInteger::IncorrectIndex(); + } + } + else { + aValue = SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->GetValue(theRow, theColumn); + } + return aValue; +} + +std::vector SALOMEDS_AttributeTableOfInteger::GetRowSetIndices(int theRow) +{ + std::vector aVector; + int aLength, i; + if(_isLocal) { + Handle(TColStd_HSequenceOfInteger) aSet; + aSet = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->GetSetRowIndices(theRow); + aLength = aSet->Length(); + for(i = 1; i<= aLength; i++) aVector.push_back(aSet->Value(i)); + } + else { + SALOMEDS::LongSeq_var aSet = SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->GetRowSetIndices(theRow); + for(i = 0; i < aLength; i++) aVector.push_back(aSet[i]); + } + return aVector; +} + +void SALOMEDS_AttributeTableOfInteger::SetNbColumns(int theNbColumns) +{ + if(_isLocal) Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->SetNbColumns(theNbColumns); + else SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->SetNbColumns(theNbColumns); +} diff --git a/src/SALOMEDS/SALOMEDS_AttributeTableOfInteger.hxx b/src/SALOMEDS/SALOMEDS_AttributeTableOfInteger.hxx new file mode 100644 index 000000000..dc6d2d77d --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_AttributeTableOfInteger.hxx @@ -0,0 +1,56 @@ +// File : SALOMEDS_AttributeTableOfInteger.hxx +// Author : Sergey RUIN +// Module : SALOME + +#ifndef SALOMEDS_AttributeTableOfInteger_HeaderFile +#define SALOMEDS_AttributeTableOfInteger_HeaderFile + +#include "SALOMEDSClient_AttributeTableOfInteger.hxx" +#include "SALOMEDS_GenericAttribute.hxx" +#include "SALOMEDSImpl_AttributeTableOfInteger.hxx" + +// IDL headers +#include +#include CORBA_SERVER_HEADER(SALOMEDS) +#include CORBA_SERVER_HEADER(SALOMEDS_Attributes) + +#include + +class SALOMEDS_AttributeTableOfInteger: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeTableOfInteger +{ +public: + SALOMEDS_AttributeTableOfInteger(const Handle(SALOMEDSImpl_AttributeTableOfInteger)& theAttr); + SALOMEDS_AttributeTableOfInteger(SALOMEDS::AttributeTableOfInteger_ptr theAttr); + ~SALOMEDS_AttributeTableOfInteger(); + + virtual void SetTitle(const char* theTitle); + virtual char* GetTitle(); + virtual void SetRowTitle(int theIndex, const char* theTitle); + virtual void SetRowTitles(const std::vector& theTitles); + virtual std::vector GetRowTitles(); + virtual void SetColumnTitle(int theIndex, const char* theTitle); + virtual void SetColumnTitles(const std::vector& theTitles); + virtual std::vector GetColumnTitles(); + + virtual void SetRowUnit(int theIndex, const char* theUnit); + virtual void SetRowUnits(const std::vector& theUnits); + virtual std::vector GetRowUnits(); + + virtual int GetNbRows(); + virtual int GetNbColumns(); + virtual void AddRow(const std::vector& theData); + virtual void SetRow(int theRow, const std::vector& theData); + virtual std::vector GetRow(int theRow); + virtual void AddColumn(const std::vector& theData); + virtual void SetColumn(int theColumn, const std::vector& theData); + virtual std::vector GetColumn(int theColumn); + virtual void PutValue(int theValue, int theRow, int theColumn); + virtual bool HasValue(int theRow, int theColumn); + virtual int GetValue(int theRow, int theColumn); + + virtual std::vector GetRowSetIndices(int theRow); + virtual void SetNbColumns(int theNbColumns); + +}; + +#endif diff --git a/src/SALOMEDS/SALOMEDS_AttributeTableOfReal.cxx b/src/SALOMEDS/SALOMEDS_AttributeTableOfReal.cxx new file mode 100644 index 000000000..87cbb573d --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_AttributeTableOfReal.cxx @@ -0,0 +1,383 @@ +// File : SALOMEDS_AttributeTableOfReal.cxx +// Author : Sergey RUIN +// Module : SALOME + +#include "SALOMEDS_AttributeTableOfReal.hxx" + +#include +#include +#include +#include +#include + + +SALOMEDS_AttributeTableOfReal +::SALOMEDS_AttributeTableOfReal(const Handle(SALOMEDSImpl_AttributeTableOfReal)& theAttr) +:SALOMEDS_GenericAttribute(theAttr) +{} + +SALOMEDS_AttributeTableOfReal::SALOMEDS_AttributeTableOfReal(SALOMEDS::AttributeTableOfReal_ptr theAttr) +:SALOMEDS_GenericAttribute(theAttr) +{} + +SALOMEDS_AttributeTableOfReal::~SALOMEDS_AttributeTableOfReal() +{} + + +void SALOMEDS_AttributeTableOfReal::SetTitle(const char* theTitle) +{ + CheckLocked(); + TCollection_AsciiString aStr((char*)theTitle); + if(_isLocal) Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->SetTitle(aStr); + else SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->SetTitle(aStr.ToCString()); +} + +char* SALOMEDS_AttributeTableOfReal::GetTitle() +{ + TCollection_AsciiString aStr; + if(_isLocal) aStr = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->GetTitle(); + else aStr = SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->GetTitle(); + return aStr.ToCString(); +} + +void SALOMEDS_AttributeTableOfReal::SetRowTitle(int theIndex, const char* theTitle) +{ + CheckLocked(); + TCollection_AsciiString aTitle((char*)theTitle); + if(_isLocal) Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->SetRowTitle(theIndex, aTitle); + else SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->SetRowTitle(theIndex, aTitle.ToCString()); +} + +void SALOMEDS_AttributeTableOfReal::SetRowTitles(const std::vector& theTitles) +{ + CheckLocked(); + int aLength = theTitles.size(), i; + if(_isLocal) { + Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString; + for(i = 0; i < aLength; i++) aSeq->Append((char*)theTitles[i].c_str()); + Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->SetRowTitles(aSeq); + } + else { + SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq(); + aSeq->length(aLength); + for(i = 0; i < aLength; i++) aSeq[i] = TCollection_AsciiString((char*)theTitles[i].c_str()).ToCString(); + SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->SetRowTitles(aSeq); + } + +} + +std::vector SALOMEDS_AttributeTableOfReal::GetRowTitles() +{ + std::vector aVector; + int aLength, i; + if(_isLocal) { + Handle(TColStd_HSequenceOfExtendedString) aSeq; + aSeq = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->GetRowTitles(); + aLength = aSeq->Length(); + for(i = 1; i<= aLength; i++) aVector.push_back(TCollection_AsciiString(aSeq->Value(i)).ToCString()); + } + else { + SALOMEDS::StringSeq_var aSeq = SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->GetRowTitles(); + aLength = aSeq->length(); + for(i = 0; iSetColumnTitle(theIndex, aStr); + else SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->SetColumnTitle(theIndex, aStr.ToCString()); +} + +void SALOMEDS_AttributeTableOfReal::SetColumnTitles(const std::vector& theTitles) +{ + CheckLocked(); + int aLength = theTitles.size(), i; + if(_isLocal) { + Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString; + for(i = 0; i < aLength; i++) aSeq->Append((char*)theTitles[i].c_str()); + Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->SetColumnTitles(aSeq); + } + else { + SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq(); + aSeq->length(aLength); + for(i = 0; i < aLength; i++) aSeq[i] = TCollection_AsciiString((char*)theTitles[i].c_str()).ToCString(); + SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->SetColumnTitles(aSeq); + } +} + +std::vector SALOMEDS_AttributeTableOfReal::GetColumnTitles() +{ + std::vector aVector; + int aLength, i; + if(_isLocal) { + Handle(TColStd_HSequenceOfExtendedString) aSeq; + aSeq = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->GetColumnTitles(); + aLength = aSeq->Length(); + for(i = 1; i<= aLength; i++) aVector.push_back(TCollection_AsciiString(aSeq->Value(i)).ToCString()); + } + else { + SALOMEDS::StringSeq_var aSeq = SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->GetColumnTitles(); + aLength = aSeq->length(); + for(i = 0; iSetRowUnit(theIndex, aUnit); + else SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->SetRowUnit(theIndex, aUnit.ToCString()); +} + +void SALOMEDS_AttributeTableOfReal::SetRowUnits(const std::vector& theUnits) +{ + CheckLocked(); + int aLength = theUnits.size(), i; + if(_isLocal) { + Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString; + for(i = 0; i < aLength; i++) aSeq->Append((char*)theUnits[i].c_str()); + Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->SetRowUnits(aSeq); + } + else { + SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq(); + aSeq->length(aLength); + for(i = 0; i < aLength; i++) aSeq[i] = TCollection_AsciiString((char*)theUnits[i].c_str()).ToCString(); + SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->SetRowUnits(aSeq); + } +} + +std::vector SALOMEDS_AttributeTableOfReal::GetRowUnits() +{ + std::vector aVector; + int aLength, i; + if(_isLocal) { + Handle(TColStd_HSequenceOfExtendedString) aSeq; + aSeq = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->GetRowUnits(); + aLength = aSeq->Length(); + for(i = 1; i<= aLength; i++) aVector.push_back(TCollection_AsciiString(aSeq->Value(i)).ToCString()); + } + else { + SALOMEDS::StringSeq_var aSeq = SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->GetRowUnits(); + aLength = aSeq->length(); + for(i = 0; iGetNbRows(); + else aNb = SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->GetNbRows(); + return aNb; +} + +int SALOMEDS_AttributeTableOfReal::GetNbColumns() +{ + int aNb; + if(_isLocal) aNb = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->GetNbColumns(); + else aNb = SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->GetNbColumns(); + return aNb; + +} + +void SALOMEDS_AttributeTableOfReal::AddRow(const std::vector& theData) +{ + CheckLocked(); + int aLength = theData.size(), i; + if(_isLocal) { + Handle(SALOMEDSImpl_AttributeTableOfReal) aTable; + aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl); + Handle(TColStd_HSequenceOfReal) aRow = new TColStd_HSequenceOfReal; + for (int i = 0; i < aLength; i++) aRow->Append(theData[i]); + try { + aTable->SetRowData(aTable->GetNbRows() + 1, aRow); + } + catch(...) { + throw SALOMEDS::AttributeTableOfReal::IncorrectArgumentLength(); + } + } + else { + SALOMEDS::DoubleSeq_var aSeq = new SALOMEDS::DoubleSeq(); + aSeq->length(aLength); + for(i = 0; i < aLength; i++) aSeq[i] = theData[i]; + SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->AddRow(aSeq); + } +} + +void SALOMEDS_AttributeTableOfReal::SetRow(int theRow, const std::vector& theData) +{ + CheckLocked(); + int aLength = theData.size(), i; + if(_isLocal) { + Handle(SALOMEDSImpl_AttributeTableOfReal) aTable; + aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl); + Handle(TColStd_HSequenceOfReal) aRow = new TColStd_HSequenceOfReal; + for (int i = 0; i < aLength; i++) aRow->Append(theData[i]); + try { + aTable->SetRowData(theRow, aRow); + } + catch(...) { + throw SALOMEDS::AttributeTableOfReal::IncorrectArgumentLength(); + } + } + else { + SALOMEDS::DoubleSeq_var aSeq = new SALOMEDS::DoubleSeq(); + aSeq->length(aLength); + for(i = 0; i < aLength; i++) aSeq[i] = theData[i]; + SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->SetRow(theRow, aSeq); + } +} + +std::vector SALOMEDS_AttributeTableOfReal::GetRow(int theRow) +{ + std::vector aVector; + int aLength, i; + if(_isLocal) { + Handle(TColStd_HSequenceOfReal) aRow; + aRow = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->GetRowData(theRow); + aLength = aRow->Length(); + for(i = 1; i<= aLength; i++) aVector.push_back(aRow->Value(i)); + } + else { + SALOMEDS::DoubleSeq_var aRow = SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->GetRow(theRow); + for(i = 0; i < aLength; i++) aVector.push_back(aRow[i]); + } + + return aVector; +} + +void SALOMEDS_AttributeTableOfReal::AddColumn(const std::vector& theData) +{ + CheckLocked(); + int aLength = theData.size(), i; + if(_isLocal) { + Handle(SALOMEDSImpl_AttributeTableOfReal) aTable; + aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl); + Handle(TColStd_HSequenceOfReal) aColumn = new TColStd_HSequenceOfReal; + for (int i = 0; i < aLength; i++) aColumn->Append(theData[i]); + try { + aTable->SetColumnData(aTable->GetNbColumns() + 1, aColumn); + } + catch(...) { + throw SALOMEDS::AttributeTableOfReal::IncorrectArgumentLength(); + } + } + else { + SALOMEDS::DoubleSeq_var aColumn = new SALOMEDS::DoubleSeq(); + aColumn->length(aLength); + for(i = 0; i < aLength; i++) aColumn[i] = theData[i]; + SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->AddColumn(aColumn); + } +} + +void SALOMEDS_AttributeTableOfReal::SetColumn(int theColumn, const std::vector& theData) +{ + CheckLocked(); + int aLength = theData.size(), i; + if(_isLocal) { + Handle(SALOMEDSImpl_AttributeTableOfReal) aTable; + aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl); + Handle(TColStd_HSequenceOfReal) aColumn = new TColStd_HSequenceOfReal; + for (int i = 0; i < aLength; i++) aColumn->Append(theData[i]); + try { + aTable->SetRowData(theColumn, aColumn); + } + catch(...) { + throw SALOMEDS::AttributeTableOfReal::IncorrectArgumentLength(); + } + } + else { + SALOMEDS::DoubleSeq_var aColumn = new SALOMEDS::DoubleSeq(); + aColumn->length(aLength); + for(i = 0; i < aLength; i++) aColumn[i] = theData[i]; + SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->SetRow(theColumn, aColumn); + } +} + +std::vector SALOMEDS_AttributeTableOfReal::GetColumn(int theColumn) +{ + std::vector aVector; + int aLength, i; + if(_isLocal) { + Handle(TColStd_HSequenceOfReal) aColumn; + aColumn = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->GetColumnData(theColumn); + aLength = aColumn->Length(); + for(i = 1; i<= aLength; i++) aVector.push_back(aColumn->Value(i)); + } + else { + SALOMEDS::DoubleSeq_var aColumn = SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->GetColumn(theColumn); + for(i = 0; i < aLength; i++) aVector.push_back(aColumn[i]); + } + return aVector; +} + +void SALOMEDS_AttributeTableOfReal::PutValue(double theValue, int theRow, int theColumn) +{ + CheckLocked(); + if(_isLocal) { + try { + Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->PutValue(theValue, theRow, theColumn); + } + catch(...) { + throw SALOMEDS::AttributeTableOfReal::IncorrectIndex(); + } + } + else { + SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->PutValue(theValue, theRow, theColumn); + } +} + +bool SALOMEDS_AttributeTableOfReal::HasValue(int theRow, int theColumn) +{ + bool ret; + if(_isLocal) ret = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->HasValue(theRow, theColumn); + else ret = SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->HasValue(theRow, theColumn); + return ret; +} + +double SALOMEDS_AttributeTableOfReal::GetValue(int theRow, int theColumn) +{ + double aValue; + if(_isLocal) { + try { + aValue = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->GetValue(theRow, theColumn); + } + catch(...) { + throw SALOMEDS::AttributeTableOfReal::IncorrectIndex(); + } + } + else { + aValue = SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->GetValue(theRow, theColumn); + } + return aValue; +} + +std::vector SALOMEDS_AttributeTableOfReal::GetRowSetIndices(int theRow) +{ + std::vector aVector; + int aLength, i; + if(_isLocal) { + Handle(TColStd_HSequenceOfInteger) aSet; + aSet = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->GetSetRowIndices(theRow); + aLength = aSet->Length(); + for(i = 1; i<= aLength; i++) aVector.push_back(aSet->Value(i)); + } + else { + SALOMEDS::LongSeq_var aSet = SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->GetRowSetIndices(theRow); + for(i = 0; i < aLength; i++) aVector.push_back(aSet[i]); + } + return aVector; +} + +void SALOMEDS_AttributeTableOfReal::SetNbColumns(int theNbColumns) +{ + if(_isLocal) Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->SetNbColumns(theNbColumns); + else SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->SetNbColumns(theNbColumns); +} diff --git a/src/SALOMEDS/SALOMEDS_AttributeTableOfReal.hxx b/src/SALOMEDS/SALOMEDS_AttributeTableOfReal.hxx new file mode 100644 index 000000000..83864e255 --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_AttributeTableOfReal.hxx @@ -0,0 +1,56 @@ +// File : SALOMEDS_AttributeTableOfReal.hxx +// Author : Sergey RUIN +// Module : SALOME + +#ifndef SALOMEDS_AttributeTableOfReal_HeaderFile +#define SALOMEDS_AttributeTableOfReal_HeaderFile + +#include "SALOMEDSClient_AttributeTableOfReal.hxx" +#include "SALOMEDS_GenericAttribute.hxx" +#include "SALOMEDSImpl_AttributeTableOfReal.hxx" + +// IDL headers +#include +#include CORBA_SERVER_HEADER(SALOMEDS) +#include CORBA_SERVER_HEADER(SALOMEDS_Attributes) + +#include + +class SALOMEDS_AttributeTableOfReal: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeTableOfReal +{ +public: + SALOMEDS_AttributeTableOfReal(const Handle(SALOMEDSImpl_AttributeTableOfReal)& theAttr); + SALOMEDS_AttributeTableOfReal(SALOMEDS::AttributeTableOfReal_ptr theAttr); + ~SALOMEDS_AttributeTableOfReal(); + + virtual void SetTitle(const char* theTitle); + virtual char* GetTitle(); + virtual void SetRowTitle(int theIndex, const char* theTitle); + virtual void SetRowTitles(const std::vector& theTitles); + virtual std::vector GetRowTitles(); + virtual void SetColumnTitle(int theIndex, const char* theTitle); + virtual void SetColumnTitles(const std::vector& theTitles); + virtual std::vector GetColumnTitles(); + + virtual void SetRowUnit(int theIndex, const char* theUnit); + virtual void SetRowUnits(const std::vector& theUnits); + virtual std::vector GetRowUnits(); + + virtual int GetNbRows(); + virtual int GetNbColumns(); + virtual void AddRow(const std::vector& theData); + virtual void SetRow(int theRow, const std::vector& theData); + virtual std::vector GetRow(int theRow); + virtual void AddColumn(const std::vector& theData); + virtual void SetColumn(int theColumn, const std::vector& theData); + virtual std::vector GetColumn(int theColumn); + virtual void PutValue(double theValue, int theRow, int theColumn); + virtual bool HasValue(int theRow, int theColumn); + virtual double GetValue(int theRow, int theColumn); + + virtual std::vector GetRowSetIndices(int theRow); + virtual void SetNbColumns(int theNbColumns); + +}; + +#endif diff --git a/src/SALOMEDS/SALOMEDS_AttributeTableOfString.cxx b/src/SALOMEDS/SALOMEDS_AttributeTableOfString.cxx new file mode 100644 index 000000000..c8ae1ed30 --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_AttributeTableOfString.cxx @@ -0,0 +1,383 @@ +// File : SALOMEDS_AttributeTableOfString.cxx +// Author : Sergey RUIN +// Module : SALOME + +#include "SALOMEDS_AttributeTableOfString.hxx" + +#include +#include +#include +#include +#include + +SALOMEDS_AttributeTableOfString +::SALOMEDS_AttributeTableOfString(const Handle(SALOMEDSImpl_AttributeTableOfString)& theAttr) +:SALOMEDS_GenericAttribute(theAttr) +{} + +SALOMEDS_AttributeTableOfString::SALOMEDS_AttributeTableOfString(SALOMEDS::AttributeTableOfString_ptr theAttr) +:SALOMEDS_GenericAttribute(theAttr) +{} + +SALOMEDS_AttributeTableOfString::~SALOMEDS_AttributeTableOfString() +{} + + +void SALOMEDS_AttributeTableOfString::SetTitle(const char* theTitle) +{ + CheckLocked(); + TCollection_AsciiString aStr((char*)theTitle); + if(_isLocal) Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->SetTitle(aStr); + else SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SetTitle(aStr.ToCString()); +} + +char* SALOMEDS_AttributeTableOfString::GetTitle() +{ + TCollection_AsciiString aStr; + if(_isLocal) aStr = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->GetTitle(); + else aStr = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetTitle(); + return aStr.ToCString(); +} + +void SALOMEDS_AttributeTableOfString::SetRowTitle(int theIndex, const char* theTitle) +{ + CheckLocked(); + TCollection_AsciiString aTitle((char*)theTitle); + if(_isLocal) Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->SetRowTitle(theIndex, aTitle); + else SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SetRowTitle(theIndex, aTitle.ToCString()); +} + +void SALOMEDS_AttributeTableOfString::SetRowTitles(const std::vector& theTitles) +{ + CheckLocked(); + int aLength = theTitles.size(), i; + if(_isLocal) { + Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString; + for(i = 0; i < aLength; i++) aSeq->Append((char*)theTitles[i].c_str()); + Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->SetRowTitles(aSeq); + } + else { + SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq(); + aSeq->length(aLength); + for(i = 0; i < aLength; i++) aSeq[i] = TCollection_AsciiString((char*)theTitles[i].c_str()).ToCString(); + SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SetRowTitles(aSeq); + } + +} + +std::vector SALOMEDS_AttributeTableOfString::GetRowTitles() +{ + std::vector aVector; + int aLength, i; + if(_isLocal) { + Handle(TColStd_HSequenceOfExtendedString) aSeq; + aSeq = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->GetRowTitles(); + aLength = aSeq->Length(); + for(i = 1; i<= aLength; i++) aVector.push_back(TCollection_AsciiString(aSeq->Value(i)).ToCString()); + } + else { + SALOMEDS::StringSeq_var aSeq = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetRowTitles(); + aLength = aSeq->length(); + for(i = 0; iSetColumnTitle(theIndex, aStr); + else SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SetColumnTitle(theIndex, aStr.ToCString()); +} + +void SALOMEDS_AttributeTableOfString::SetColumnTitles(const std::vector& theTitles) +{ + CheckLocked(); + int aLength = theTitles.size(), i; + if(_isLocal) { + Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString; + for(i = 0; i < aLength; i++) aSeq->Append((char*)theTitles[i].c_str()); + Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->SetColumnTitles(aSeq); + } + else { + SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq(); + aSeq->length(aLength); + for(i = 0; i < aLength; i++) aSeq[i] = TCollection_AsciiString((char*)theTitles[i].c_str()).ToCString(); + SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SetColumnTitles(aSeq); + } +} + +std::vector SALOMEDS_AttributeTableOfString::GetColumnTitles() +{ + std::vector aVector; + int aLength, i; + if(_isLocal) { + Handle(TColStd_HSequenceOfExtendedString) aSeq; + aSeq = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->GetColumnTitles(); + aLength = aSeq->Length(); + for(i = 1; i<= aLength; i++) aVector.push_back(TCollection_AsciiString(aSeq->Value(i)).ToCString()); + } + else { + SALOMEDS::StringSeq_var aSeq = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetColumnTitles(); + aLength = aSeq->length(); + for(i = 0; iSetRowUnit(theIndex, aUnit); + else SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SetRowUnit(theIndex, aUnit.ToCString()); +} + +void SALOMEDS_AttributeTableOfString::SetRowUnits(const std::vector& theUnits) +{ + CheckLocked(); + int aLength = theUnits.size(), i; + if(_isLocal) { + Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString; + for(i = 0; i < aLength; i++) aSeq->Append((char*)theUnits[i].c_str()); + Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->SetRowUnits(aSeq); + } + else { + SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq(); + aSeq->length(aLength); + for(i = 0; i < aLength; i++) aSeq[i] = TCollection_AsciiString((char*)theUnits[i].c_str()).ToCString(); + SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SetRowUnits(aSeq); + } +} + +std::vector SALOMEDS_AttributeTableOfString::GetRowUnits() +{ + std::vector aVector; + int aLength, i; + if(_isLocal) { + Handle(TColStd_HSequenceOfExtendedString) aSeq; + aSeq = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->GetRowUnits(); + aLength = aSeq->Length(); + for(i = 1; i<= aLength; i++) aVector.push_back(TCollection_AsciiString(aSeq->Value(i)).ToCString()); + } + else { + SALOMEDS::StringSeq_var aSeq = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetRowUnits(); + aLength = aSeq->length(); + for(i = 0; iGetNbRows(); + else aNb = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetNbRows(); + return aNb; +} + +int SALOMEDS_AttributeTableOfString::GetNbColumns() +{ + int aNb; + if(_isLocal) aNb = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->GetNbColumns(); + else aNb = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetNbColumns(); + return aNb; + +} + +void SALOMEDS_AttributeTableOfString::AddRow(const std::vector& theData) +{ + CheckLocked(); + int aLength = theData.size(), i; + if(_isLocal) { + Handle(SALOMEDSImpl_AttributeTableOfString) aTable; + aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl); + Handle(TColStd_HSequenceOfExtendedString) aRow = new TColStd_HSequenceOfExtendedString; + for (int i = 0; i < aLength; i++) aRow->Append((char*)theData[i].c_str()); + try { + aTable->SetRowData(aTable->GetNbRows() + 1, aRow); + } + catch(...) { + throw SALOMEDS::AttributeTableOfString::IncorrectArgumentLength(); + } + } + else { + SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq(); + aSeq->length(aLength); + for(i = 0; i < aLength; i++) aSeq[i] = TCollection_AsciiString((char*)theData[i].c_str()).ToCString(); + SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->AddRow(aSeq); + } +} + +void SALOMEDS_AttributeTableOfString::SetRow(int theRow, const std::vector& theData) +{ + CheckLocked(); + int aLength = theData.size(), i; + if(_isLocal) { + Handle(SALOMEDSImpl_AttributeTableOfString) aTable; + aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl); + Handle(TColStd_HSequenceOfExtendedString) aRow = new TColStd_HSequenceOfExtendedString; + for (int i = 0; i < aLength; i++) aRow->Append((char*)theData[i].c_str()); + try { + aTable->SetRowData(theRow, aRow); + } + catch(...) { + throw SALOMEDS::AttributeTableOfString::IncorrectArgumentLength(); + } + } + else { + SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq(); + aSeq->length(aLength); + for(i = 0; i < aLength; i++) aSeq[i] = TCollection_AsciiString((char*)theData[i].c_str()).ToCString(); + SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SetRow(theRow, aSeq); + } +} + +std::vector SALOMEDS_AttributeTableOfString::GetRow(int theRow) +{ + std::vector aVector; + int aLength, i; + if(_isLocal) { + Handle(TColStd_HSequenceOfExtendedString) aRow; + aRow = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->GetRowData(theRow); + aLength = aRow->Length(); + for(i = 1; i<= aLength; i++) aVector.push_back(TCollection_AsciiString(aRow->Value(i)).ToCString()); + } + else { + SALOMEDS::StringSeq_var aRow = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetRow(theRow); + for(i = 0; i < aLength; i++) aVector.push_back(TCollection_AsciiString((char*)aRow[i].in()).ToCString()); + } + + return aVector; +} + +void SALOMEDS_AttributeTableOfString::AddColumn(const std::vector& theData) +{ + CheckLocked(); + int aLength = theData.size(), i; + if(_isLocal) { + Handle(SALOMEDSImpl_AttributeTableOfString) aTable; + aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl); + Handle(TColStd_HSequenceOfExtendedString) aColumn = new TColStd_HSequenceOfExtendedString; + for (int i = 0; i < aLength; i++) aColumn->Append((char*)theData[i].c_str()); + try { + aTable->SetColumnData(aTable->GetNbColumns() + 1, aColumn); + } + catch(...) { + throw SALOMEDS::AttributeTableOfString::IncorrectArgumentLength(); + } + } + else { + SALOMEDS::StringSeq_var aColumn = new SALOMEDS::StringSeq(); + aColumn->length(aLength); + for(i = 0; i < aLength; i++) aColumn[i] = TCollection_AsciiString((char*)theData[i].c_str()).ToCString(); + SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->AddColumn(aColumn); + } +} + +void SALOMEDS_AttributeTableOfString::SetColumn(int theColumn, const std::vector& theData) +{ + CheckLocked(); + int aLength = theData.size(), i; + if(_isLocal) { + Handle(SALOMEDSImpl_AttributeTableOfString) aTable; + aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl); + Handle(TColStd_HSequenceOfExtendedString) aColumn = new TColStd_HSequenceOfExtendedString; + for (int i = 0; i < aLength; i++) aColumn->Append((char*)theData[i].c_str()); + try { + aTable->SetRowData(theColumn, aColumn); + } + catch(...) { + throw SALOMEDS::AttributeTableOfString::IncorrectArgumentLength(); + } + } + else { + SALOMEDS::StringSeq_var aColumn = new SALOMEDS::StringSeq(); + aColumn->length(aLength); + for(i = 0; i < aLength; i++) aColumn[i] = TCollection_AsciiString((char*)theData[i].c_str()).ToCString(); + SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SetRow(theColumn, aColumn); + } +} + +std::vector SALOMEDS_AttributeTableOfString::GetColumn(int theColumn) +{ + std::vector aVector; + int aLength, i; + if(_isLocal) { + Handle(TColStd_HSequenceOfExtendedString) aColumn; + aColumn = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->GetColumnData(theColumn); + aLength = aColumn->Length(); + for(i = 1; i<= aLength; i++) aVector.push_back(TCollection_AsciiString(aColumn->Value(i)).ToCString()); + } + else { + SALOMEDS::StringSeq_var aColumn = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetColumn(theColumn); + for(i = 0; i < aLength; i++) aVector.push_back(aColumn[i].in()); + } + return aVector; +} + +void SALOMEDS_AttributeTableOfString::PutValue(const char* theValue, int theRow, int theColumn) +{ + CheckLocked(); + TCollection_AsciiString aValue((char*)theValue); + if(_isLocal) { + try { + Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->PutValue(aValue, theRow, theColumn); + } + catch(...) { + throw SALOMEDS::AttributeTableOfString::IncorrectIndex(); + } + } + else { + SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->PutValue(aValue.ToCString(), theRow, theColumn); + } +} + +bool SALOMEDS_AttributeTableOfString::HasValue(int theRow, int theColumn) +{ + bool ret; + if(_isLocal) ret = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->HasValue(theRow, theColumn); + else ret = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->HasValue(theRow, theColumn); + return ret; +} + +char* SALOMEDS_AttributeTableOfString::GetValue(int theRow, int theColumn) +{ + TCollection_AsciiString aValue; + if(_isLocal) { + try { + aValue = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->GetValue(theRow, theColumn); + } + catch(...) { + throw SALOMEDS::AttributeTableOfString::IncorrectIndex(); + } + } + else { + aValue = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetValue(theRow, theColumn); + } + return aValue.ToCString(); +} + +std::vector SALOMEDS_AttributeTableOfString::GetRowSetIndices(int theRow) +{ + std::vector aVector; + int aLength, i; + if(_isLocal) { + Handle(TColStd_HSequenceOfInteger) aSet; + aSet = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->GetSetRowIndices(theRow); + aLength = aSet->Length(); + for(i = 1; i<= aLength; i++) aVector.push_back(aSet->Value(i)); + } + else { + SALOMEDS::LongSeq_var aSet = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetRowSetIndices(theRow); + for(i = 0; i < aLength; i++) aVector.push_back(aSet[i]); + } + return aVector; +} + +void SALOMEDS_AttributeTableOfString::SetNbColumns(int theNbColumns) +{ + if(_isLocal) Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->SetNbColumns(theNbColumns); + else SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SetNbColumns(theNbColumns); +} diff --git a/src/SALOMEDS/SALOMEDS_AttributeTableOfString.hxx b/src/SALOMEDS/SALOMEDS_AttributeTableOfString.hxx new file mode 100644 index 000000000..269951ff2 --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_AttributeTableOfString.hxx @@ -0,0 +1,56 @@ +// File : SALOMEDS_AttributeTableOfString.hxx +// Author : Sergey RUIN +// Module : SALOME + +#ifndef SALOMEDS_AttributeTableOfString_HeaderFile +#define SALOMEDS_AttributeTableOfString_HeaderFile + +#include "SALOMEDSClient_AttributeTableOfString.hxx" +#include "SALOMEDS_GenericAttribute.hxx" +#include "SALOMEDSImpl_AttributeTableOfString.hxx" + +// IDL headers +#include +#include CORBA_SERVER_HEADER(SALOMEDS) +#include CORBA_SERVER_HEADER(SALOMEDS_Attributes) + +#include + +class SALOMEDS_AttributeTableOfString: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeTableOfString +{ +public: + SALOMEDS_AttributeTableOfString(const Handle(SALOMEDSImpl_AttributeTableOfString)& theAttr); + SALOMEDS_AttributeTableOfString(SALOMEDS::AttributeTableOfString_ptr theAttr); + ~SALOMEDS_AttributeTableOfString(); + + virtual void SetTitle(const char* theTitle); + virtual char* GetTitle(); + virtual void SetRowTitle(int theIndex, const char* theTitle); + virtual void SetRowTitles(const std::vector& theTitles); + virtual std::vector GetRowTitles(); + virtual void SetColumnTitle(int theIndex, const char* theTitle); + virtual void SetColumnTitles(const std::vector& theTitles); + virtual std::vector GetColumnTitles(); + + virtual void SetRowUnit(int theIndex, const char* theUnit); + virtual void SetRowUnits(const std::vector& theUnits); + virtual std::vector GetRowUnits(); + + virtual int GetNbRows(); + virtual int GetNbColumns(); + virtual void AddRow(const std::vector& theData); + virtual void SetRow(int theRow, const std::vector& theData); + virtual std::vector GetRow(int theRow); + virtual void AddColumn(const std::vector& theData); + virtual void SetColumn(int theColumn, const std::vector& theData); + virtual std::vector GetColumn(int theColumn); + virtual void PutValue(const char* theValue, int theRow, int theColumn); + virtual bool HasValue(int theRow, int theColumn); + virtual char* GetValue(int theRow, int theColumn); + + virtual std::vector GetRowSetIndices(int theRow); + virtual void SetNbColumns(int theNbColumns); + +}; + +#endif diff --git a/src/SALOMEDS/SALOMEDS_AttributeTarget.cxx b/src/SALOMEDS/SALOMEDS_AttributeTarget.cxx new file mode 100644 index 000000000..1d5b15205 --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_AttributeTarget.cxx @@ -0,0 +1,63 @@ +// File : SALOMEDS_AttributeTarget.cxx +// Author : Sergey RUIN +// Module : SALOME + +#include "SALOMEDS_AttributeTarget.hxx" + +#include + +#include "SALOMEDSImpl_SObject.hxx" +#include "SALOMEDS_SObject.hxx" + + +SALOMEDS_AttributeTarget::SALOMEDS_AttributeTarget(const Handle(SALOMEDSImpl_AttributeTarget)& theAttr) +:SALOMEDS_GenericAttribute(theAttr) +{} + +SALOMEDS_AttributeTarget::SALOMEDS_AttributeTarget(SALOMEDS::AttributeTarget_ptr theAttr) +:SALOMEDS_GenericAttribute(theAttr) +{} + +SALOMEDS_AttributeTarget::~SALOMEDS_AttributeTarget() +{} + +void SALOMEDS_AttributeTarget::Add(SALOMEDSClient_SObject* theObject) +{ + SALOMEDS_SObject* aSO = dynamic_cast(theObject); + + if(_isLocal) Handle(SALOMEDSImpl_AttributeTarget)::DownCast(_local_impl)->Add(aSO->GetLocalImpl()); + else SALOMEDS::AttributeTarget::_narrow(_corba_impl)->Add(aSO->GetCORBAImpl()); +} + +std::vector SALOMEDS_AttributeTarget::Get() +{ + std::vector aVector; + int aLength, i; + SALOMEDS_SObject* aSO = NULL; + + if(_isLocal) { + Handle(TColStd_HSequenceOfTransient) aSeq = Handle(SALOMEDSImpl_AttributeTarget)::DownCast(_local_impl)->Get(); + aLength = aSeq->Length(); + for(i=1; i<=aLength; i++) { + aSO = new SALOMEDS_SObject(Handle(SALOMEDSImpl_SObject)::DownCast(aSeq->Value(i))); + aVector.push_back(aSO); + } + } + else { + SALOMEDS::Study::ListOfSObject_var aSeq = SALOMEDS::AttributeTarget::_narrow(_corba_impl)->Get(); + aLength = aSeq->length(); + aSO = new SALOMEDS_SObject(aSeq[i].in()); + for(i = 0; i(theObject); + + if(_isLocal) Handle(SALOMEDSImpl_AttributeTarget)::DownCast(_local_impl)->Remove(aSO->GetLocalImpl()); + else SALOMEDS::AttributeTarget::_narrow(_corba_impl)->Remove(aSO->GetCORBAImpl()); +} + diff --git a/src/SALOMEDS/SALOMEDS_AttributeTarget.hxx b/src/SALOMEDS/SALOMEDS_AttributeTarget.hxx new file mode 100644 index 000000000..789977e25 --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_AttributeTarget.hxx @@ -0,0 +1,33 @@ +// File : SALOMEDS_AttributeTarget.hxx +// Author : Sergey RUIN +// Module : SALOME + +#ifndef SALOMEDS_AttributeTarget_HeaderFile +#define SALOMEDS_AttributeTarget_HeaderFile + +#include + +#include "SALOMEDSClient_SObject.hxx" + +#include "SALOMEDSClient_AttributeTarget.hxx" +#include "SALOMEDS_GenericAttribute.hxx" +#include "SALOMEDSImpl_AttributeTarget.hxx" + +// IDL headers +#include +#include CORBA_SERVER_HEADER(SALOMEDS) +#include CORBA_SERVER_HEADER(SALOMEDS_Attributes) + +class SALOMEDS_AttributeTarget: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeTarget +{ +public: + SALOMEDS_AttributeTarget(const Handle(SALOMEDSImpl_AttributeTarget)& theAttr); + SALOMEDS_AttributeTarget(SALOMEDS::AttributeTarget_ptr theAttr); + ~SALOMEDS_AttributeTarget(); + + virtual void Add(SALOMEDSClient_SObject* theObject); + virtual std::vector Get(); + virtual void Remove(SALOMEDSClient_SObject* theObject); +}; + +#endif diff --git a/src/SALOMEDS/SALOMEDS_AttributeTextColor.cxx b/src/SALOMEDS/SALOMEDS_AttributeTextColor.cxx new file mode 100644 index 000000000..4ee4d88b3 --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_AttributeTextColor.cxx @@ -0,0 +1,55 @@ +// File : SALOMEDS_AttributeTextColor.cxx +// Author : Sergey RUIN +// Module : SALOME + +#include "SALOMEDS_AttributeTextColor.hxx" + +#include + +SALOMEDS_AttributeTextColor::SALOMEDS_AttributeTextColor(const Handle(SALOMEDSImpl_AttributeTextColor)& theAttr) +:SALOMEDS_GenericAttribute(theAttr) +{} + +SALOMEDS_AttributeTextColor::SALOMEDS_AttributeTextColor(SALOMEDS::AttributeTextColor_ptr theAttr) +:SALOMEDS_GenericAttribute(theAttr) +{} + +SALOMEDS_AttributeTextColor::~SALOMEDS_AttributeTextColor() +{} + + +std::vector SALOMEDS_AttributeTextColor::TextColor() +{ + std::vector aVector; + int i, aLength; + if(_isLocal) { + Handle(TColStd_HArray1OfReal) aSeq = Handle(SALOMEDSImpl_AttributeTextColor)::DownCast(_local_impl)->TextColor(); + aLength = aSeq->Length(); + for(i=1; i<=aLength; i++) aVector.push_back(aSeq->Value(i)); + } + else { + SALOMEDS::Color aColor = SALOMEDS::AttributeTextColor::_narrow(_corba_impl)->TextColor(); + aVector.push_back(aColor.R); + aVector.push_back(aColor.G); + aVector.push_back(aColor.B); + } + return aVector; +} + +void SALOMEDS_AttributeTextColor::SetTextColor(const std::vector& value) +{ + CheckLocked(); + int i; + if(_isLocal) { + Handle(TColStd_HArray1OfReal) aSeq = new TColStd_HArray1OfReal(1, 3); + for(i=0; i<3; i++) aSeq->SetValue(i+1, value[i]); + Handle(SALOMEDSImpl_AttributeTextColor)::DownCast(_local_impl)->ChangeArray(aSeq); + } + else { + SALOMEDS::Color aColor; + aColor.R = value[0]; + aColor.G = value[1]; + aColor.B = value[2]; + SALOMEDS::AttributeTextColor::_narrow(_corba_impl)->SetTextColor(aColor); + } +} diff --git a/src/SALOMEDS/SALOMEDS_AttributeTextColor.hxx b/src/SALOMEDS/SALOMEDS_AttributeTextColor.hxx new file mode 100644 index 000000000..5933ae4fc --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_AttributeTextColor.hxx @@ -0,0 +1,31 @@ +// File : SALOMEDS_AttributeTextColor.hxx +// Author : Sergey RUIN +// Module : SALOME + +#ifndef SALOMEDS_AttributeTextColor_HeaderFile +#define SALOMEDS_AttributeTextColor_HeaderFile + +#include "SALOMEDSClient_AttributeTextColor.hxx" +#include "SALOMEDS_GenericAttribute.hxx" +#include "SALOMEDSImpl_AttributeTextColor.hxx" + +// IDL headers +#include +#include CORBA_SERVER_HEADER(SALOMEDS) +#include CORBA_SERVER_HEADER(SALOMEDS_Attributes) + +#include + +class SALOMEDS_AttributeTextColor: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeTextColor +{ +public: + SALOMEDS_AttributeTextColor(const Handle(SALOMEDSImpl_AttributeTextColor)& theAttr); + SALOMEDS_AttributeTextColor(SALOMEDS::AttributeTextColor_ptr theAttr); + ~SALOMEDS_AttributeTextColor(); + + virtual std::vector TextColor(); + virtual void SetTextColor(const std::vector& value); + +}; + +#endif diff --git a/src/SALOMEDS/SALOMEDS_AttributeTextHighlightColor.cxx b/src/SALOMEDS/SALOMEDS_AttributeTextHighlightColor.cxx new file mode 100644 index 000000000..644b8835d --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_AttributeTextHighlightColor.cxx @@ -0,0 +1,55 @@ +// File : SALOMEDS_AttributeTextHighlightColor.cxx +// Author : Sergey RUIN +// Module : SALOME + +#include "SALOMEDS_AttributeTextHighlightColor.hxx" + +#include + +SALOMEDS_AttributeTextHighlightColor::SALOMEDS_AttributeTextHighlightColor(const Handle(SALOMEDSImpl_AttributeTextHighlightColor)& theAttr) +:SALOMEDS_GenericAttribute(theAttr) +{} + +SALOMEDS_AttributeTextHighlightColor::SALOMEDS_AttributeTextHighlightColor(SALOMEDS::AttributeTextHighlightColor_ptr theAttr) +:SALOMEDS_GenericAttribute(theAttr) +{} + +SALOMEDS_AttributeTextHighlightColor::~SALOMEDS_AttributeTextHighlightColor() +{} + + +std::vector SALOMEDS_AttributeTextHighlightColor::TextHighlightColor() +{ + std::vector aVector; + int i, aLength; + if(_isLocal) { + Handle(TColStd_HArray1OfReal) aSeq = Handle(SALOMEDSImpl_AttributeTextHighlightColor)::DownCast(_local_impl)->TextHighlightColor(); + aLength = aSeq->Length(); + for(i=1; i<=aLength; i++) aVector.push_back(aSeq->Value(i)); + } + else { + SALOMEDS::Color aColor = SALOMEDS::AttributeTextHighlightColor::_narrow(_corba_impl)->TextHighlightColor(); + aVector.push_back(aColor.R); + aVector.push_back(aColor.G); + aVector.push_back(aColor.B); + } + return aVector; +} + +void SALOMEDS_AttributeTextHighlightColor::SetTextHighlightColor(const std::vector& value) +{ + CheckLocked(); + int i; + if(_isLocal) { + Handle(TColStd_HArray1OfReal) aSeq = new TColStd_HArray1OfReal(1, 3); + for(i=0; i<3; i++) aSeq->SetValue(i+1, value[i]); + Handle(SALOMEDSImpl_AttributeTextHighlightColor)::DownCast(_local_impl)->ChangeArray(aSeq); + } + else { + SALOMEDS::Color aColor; + aColor.R = value[0]; + aColor.G = value[1]; + aColor.B = value[2]; + SALOMEDS::AttributeTextHighlightColor::_narrow(_corba_impl)->SetTextHighlightColor(aColor); + } +} diff --git a/src/SALOMEDS/SALOMEDS_AttributeTextHighlightColor.hxx b/src/SALOMEDS/SALOMEDS_AttributeTextHighlightColor.hxx new file mode 100644 index 000000000..482e3b1e1 --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_AttributeTextHighlightColor.hxx @@ -0,0 +1,31 @@ +// File : SALOMEDS_AttributeTextHighlightColor.hxx +// Author : Sergey RUIN +// Module : SALOME + +#ifndef SALOMEDS_AttributeTextHighlightColor_HeaderFile +#define SALOMEDS_AttributeTextHighlightColor_HeaderFile + +#include "SALOMEDSClient_AttributeTextHighlightColor.hxx" +#include "SALOMEDS_GenericAttribute.hxx" +#include "SALOMEDSImpl_AttributeTextHighlightColor.hxx" + +// IDL headers +#include +#include CORBA_SERVER_HEADER(SALOMEDS) +#include CORBA_SERVER_HEADER(SALOMEDS_Attributes) + +#include + +class SALOMEDS_AttributeTextHighlightColor: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeTextHighlightColor +{ +public: + SALOMEDS_AttributeTextHighlightColor(const Handle(SALOMEDSImpl_AttributeTextHighlightColor)& theAttr); + SALOMEDS_AttributeTextHighlightColor(SALOMEDS::AttributeTextHighlightColor_ptr theAttr); + ~SALOMEDS_AttributeTextHighlightColor(); + + virtual std::vector TextHighlightColor(); + virtual void SetTextHighlightColor(const std::vector& value); + +}; + +#endif diff --git a/src/SALOMEDS/SALOMEDS_AttributeTreeNode.cxx b/src/SALOMEDS/SALOMEDS_AttributeTreeNode.cxx new file mode 100644 index 000000000..80d45b4a8 --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_AttributeTreeNode.cxx @@ -0,0 +1,380 @@ +// File : SALOMEDS_AttributeTreeNode.cxx +// Author : Sergey RUIN +// Module : SALOME + +#include "SALOMEDS_AttributeTreeNode.hxx" + +#include +#include +#include +#include +#include + +#include "SALOMEDSImpl_AttributeTreeNode.hxx" +#include "SALOMEDS_AttributeTreeNode.hxx" + +SALOMEDS_AttributeTreeNode::SALOMEDS_AttributeTreeNode(const Handle(SALOMEDSImpl_AttributeTreeNode)& theAttr) +:SALOMEDS_GenericAttribute(theAttr) +{} + +SALOMEDS_AttributeTreeNode::SALOMEDS_AttributeTreeNode(SALOMEDS::AttributeTreeNode_ptr theAttr) +:SALOMEDS_GenericAttribute(theAttr) +{} + +SALOMEDS_AttributeTreeNode::~SALOMEDS_AttributeTreeNode() +{} + +void SALOMEDS_AttributeTreeNode::SetFather(SALOMEDSClient_AttributeTreeNode* value) +{ + SALOMEDS_AttributeTreeNode* aTN = dynamic_cast(value); + if(_isLocal) { + Handle(SALOMEDSImpl_AttributeTreeNode) aNode, aFather; + aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl); + aFather = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(aTN->_local_impl); + aNode->SetFather(aFather); + } + else { + SALOMEDS::AttributeTreeNode_var aNode = SALOMEDS::AttributeTreeNode::_narrow(_corba_impl); + SALOMEDS::AttributeTreeNode_var aFather = SALOMEDS::AttributeTreeNode::_narrow(aTN->_corba_impl); + aNode->SetFather(aFather); + } +} + +bool SALOMEDS_AttributeTreeNode::HasFather() +{ + bool ret; + if(_isLocal) { + Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl); + ret = aNode->HasFather(); + } + else { + SALOMEDS::AttributeTreeNode_var aNode = SALOMEDS::AttributeTreeNode::_narrow(_corba_impl); + ret = aNode->HasFather(); + } + return ret; +} + +SALOMEDSClient_AttributeTreeNode* SALOMEDS_AttributeTreeNode::GetFather() +{ + SALOMEDS_AttributeTreeNode* aTN; + if(_isLocal) { + Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl); + aTN = new SALOMEDS_AttributeTreeNode(aNode->GetFather()); + } + else { + SALOMEDS::AttributeTreeNode_var aNode = SALOMEDS::AttributeTreeNode::_narrow(_corba_impl); + aTN = new SALOMEDS_AttributeTreeNode(aNode->GetFather()); + } + return aTN; +} + +void SALOMEDS_AttributeTreeNode::SetPrevious(SALOMEDSClient_AttributeTreeNode* value) +{ + SALOMEDS_AttributeTreeNode* aTN = dynamic_cast(value); + if(_isLocal) { + Handle(SALOMEDSImpl_AttributeTreeNode) aNode, aPrev; + aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl); + aPrev = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(aTN->_local_impl); + aNode->SetPrevious(aPrev); + } + else { + SALOMEDS::AttributeTreeNode_var aNode = SALOMEDS::AttributeTreeNode::_narrow(_corba_impl); + SALOMEDS::AttributeTreeNode_var aPrev = SALOMEDS::AttributeTreeNode::_narrow(aTN->_corba_impl); + aNode->SetPrevious(aPrev); + } +} + +bool SALOMEDS_AttributeTreeNode::HasPrevious() +{ + bool ret; + if(_isLocal) { + Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl); + ret = aNode->HasPrevious(); + } + else { + SALOMEDS::AttributeTreeNode_var aNode = SALOMEDS::AttributeTreeNode::_narrow(_corba_impl); + ret = aNode->HasPrevious(); + } + return ret; +} + +SALOMEDSClient_AttributeTreeNode* SALOMEDS_AttributeTreeNode::GetPrevious() +{ + SALOMEDS_AttributeTreeNode* aTN; + if(_isLocal) { + Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl); + aTN = new SALOMEDS_AttributeTreeNode(aNode->GetPrevious()); + } + else { + SALOMEDS::AttributeTreeNode_var aNode = SALOMEDS::AttributeTreeNode::_narrow(_corba_impl); + aTN = new SALOMEDS_AttributeTreeNode(aNode->GetPrevious()); + } + return aTN; +} + +void SALOMEDS_AttributeTreeNode::SetNext(SALOMEDSClient_AttributeTreeNode* value) +{ + SALOMEDS_AttributeTreeNode* aTN = dynamic_cast(value); + if(_isLocal) { + Handle(SALOMEDSImpl_AttributeTreeNode) aNode, aNext; + aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl); + aNext = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(aTN->_local_impl); + aNode->SetNext(aNext); + } + else { + SALOMEDS::AttributeTreeNode_var aNode = SALOMEDS::AttributeTreeNode::_narrow(_corba_impl); + SALOMEDS::AttributeTreeNode_var aNext = SALOMEDS::AttributeTreeNode::_narrow(aTN->_corba_impl); + aNode->SetNext(aNext); + } +} + +bool SALOMEDS_AttributeTreeNode::HasNext() +{ + bool ret; + if(_isLocal) { + Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl); + ret = aNode->HasNext(); + } + else { + SALOMEDS::AttributeTreeNode_var aNode = SALOMEDS::AttributeTreeNode::_narrow(_corba_impl); + ret = aNode->HasNext(); + } + return ret; +} + +SALOMEDSClient_AttributeTreeNode* SALOMEDS_AttributeTreeNode::GetNext() +{ + SALOMEDS_AttributeTreeNode* aTN; + if(_isLocal) { + Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl); + aTN = new SALOMEDS_AttributeTreeNode(aNode->GetNext()); + } + else { + SALOMEDS::AttributeTreeNode_var aNode = SALOMEDS::AttributeTreeNode::_narrow(_corba_impl); + aTN = new SALOMEDS_AttributeTreeNode(aNode->GetNext()); + } + return aTN; +} + +void SALOMEDS_AttributeTreeNode::SetFirst(SALOMEDSClient_AttributeTreeNode* value) +{ + SALOMEDS_AttributeTreeNode* aTN = dynamic_cast(value); + if(_isLocal) { + Handle(SALOMEDSImpl_AttributeTreeNode) aNode, aFirst; + aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl); + aFirst = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(aTN->_local_impl); + aNode->SetFirst(aFirst); + } + else { + SALOMEDS::AttributeTreeNode_var aNode = SALOMEDS::AttributeTreeNode::_narrow(_corba_impl); + SALOMEDS::AttributeTreeNode_var aFirst = SALOMEDS::AttributeTreeNode::_narrow(aTN->_corba_impl); + aNode->SetFirst(aFirst); + } +} + +bool SALOMEDS_AttributeTreeNode::HasFirst() +{ + bool ret; + if(_isLocal) { + Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl); + ret = aNode->HasFirst(); + } + else { + SALOMEDS::AttributeTreeNode_var aNode = SALOMEDS::AttributeTreeNode::_narrow(_corba_impl); + ret = aNode->HasFirst(); + } + return ret; +} + +SALOMEDSClient_AttributeTreeNode* SALOMEDS_AttributeTreeNode::GetFirst() +{ + SALOMEDS_AttributeTreeNode* aTN; + if(_isLocal) { + Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl); + aTN = new SALOMEDS_AttributeTreeNode(aNode->GetFirst()); + } + else { + SALOMEDS::AttributeTreeNode_var aNode = SALOMEDS::AttributeTreeNode::_narrow(_corba_impl); + aTN = new SALOMEDS_AttributeTreeNode(aNode->GetFirst()); + } + return aTN; +} + +void SALOMEDS_AttributeTreeNode::SetTreeID(const char* value) +{ + if(_isLocal) { + Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl); + aNode->SetTreeID(Standard_GUID((char*)value)); + } + else { + SALOMEDS::AttributeTreeNode_var aNode = SALOMEDS::AttributeTreeNode::_narrow(_corba_impl); + aNode->SetTreeID(value); + } +} + +char* SALOMEDS_AttributeTreeNode::GetTreeID() +{ + TCollection_AsciiString aGUID; + if(_isLocal) { + Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl); + char guid[40]; + aNode->GetTreeID().ToCString(guid); + aGUID = TCollection_AsciiString(guid); + } + else { + SALOMEDS::AttributeTreeNode_var aNode = SALOMEDS::AttributeTreeNode::_narrow(_corba_impl); + aGUID = TCollection_AsciiString(aNode->GetTreeID()); + } + + return aGUID.ToCString(); +} + +void SALOMEDS_AttributeTreeNode::Append(SALOMEDSClient_AttributeTreeNode* value) +{ + SALOMEDS_AttributeTreeNode* aTN = dynamic_cast(value); + if(_isLocal) { + Handle(SALOMEDSImpl_AttributeTreeNode) aNode, anOther; + aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl); + anOther = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(aTN->_local_impl); + aNode->Append(anOther); + } + else { + SALOMEDS::AttributeTreeNode_var aNode = SALOMEDS::AttributeTreeNode::_narrow(_corba_impl); + SALOMEDS::AttributeTreeNode_var anOther = SALOMEDS::AttributeTreeNode::_narrow(aTN->_corba_impl); + aNode->Append(anOther); + } +} + +void SALOMEDS_AttributeTreeNode::Prepend(SALOMEDSClient_AttributeTreeNode* value) +{ + SALOMEDS_AttributeTreeNode* aTN = dynamic_cast(value); + if(_isLocal) { + Handle(SALOMEDSImpl_AttributeTreeNode) aNode, anOther; + aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl); + anOther = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(aTN->_local_impl); + aNode->Prepend(anOther); + } + else { + SALOMEDS::AttributeTreeNode_var aNode = SALOMEDS::AttributeTreeNode::_narrow(_corba_impl); + SALOMEDS::AttributeTreeNode_var anOther = SALOMEDS::AttributeTreeNode::_narrow(aTN->_corba_impl); + aNode->Prepend(anOther); + } +} + +void SALOMEDS_AttributeTreeNode::InsertBefore(SALOMEDSClient_AttributeTreeNode* value) +{ + SALOMEDS_AttributeTreeNode* aTN = dynamic_cast(value); + if(_isLocal) { + Handle(SALOMEDSImpl_AttributeTreeNode) aNode, anOther; + aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl); + anOther = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(aTN->_local_impl); + aNode->InsertBefore(anOther); + } + else { + SALOMEDS::AttributeTreeNode_var aNode = SALOMEDS::AttributeTreeNode::_narrow(_corba_impl); + SALOMEDS::AttributeTreeNode_var anOther = SALOMEDS::AttributeTreeNode::_narrow(aTN->_corba_impl); + aNode->InsertBefore(anOther); + } +} + +void SALOMEDS_AttributeTreeNode::InsertAfter(SALOMEDSClient_AttributeTreeNode* value) +{ + SALOMEDS_AttributeTreeNode* aTN = dynamic_cast(value); + if(_isLocal) { + Handle(SALOMEDSImpl_AttributeTreeNode) aNode, anOther; + aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl); + anOther = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(aTN->_local_impl); + aNode->InsertAfter(anOther); + } + else { + SALOMEDS::AttributeTreeNode_var aNode = SALOMEDS::AttributeTreeNode::_narrow(_corba_impl); + SALOMEDS::AttributeTreeNode_var anOther = SALOMEDS::AttributeTreeNode::_narrow(aTN->_corba_impl); + aNode->InsertAfter(anOther); + } +} + +void SALOMEDS_AttributeTreeNode::Remove() +{ + if(_isLocal) Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl)->Remove(); + else SALOMEDS::AttributeTreeNode::_narrow(_corba_impl)->Remove(); +} + +int SALOMEDS_AttributeTreeNode::Depth() +{ + int aDepth; + if(_isLocal) aDepth = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl)->Depth(); + else aDepth = SALOMEDS::AttributeTreeNode::_narrow(_corba_impl)->Depth(); + return aDepth; +} + +bool SALOMEDS_AttributeTreeNode::IsRoot() +{ + bool ret; + if(_isLocal) ret = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl)->IsRoot(); + else ret = SALOMEDS::AttributeTreeNode::_narrow(_corba_impl)->IsRoot(); + return ret; +} + +bool SALOMEDS_AttributeTreeNode::IsDescendant(SALOMEDSClient_AttributeTreeNode* value) +{ + bool ret; + SALOMEDS_AttributeTreeNode* aTN = dynamic_cast(value); + if(_isLocal) { + Handle(SALOMEDSImpl_AttributeTreeNode) aNode, anOther; + aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl); + anOther = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(aTN->_local_impl); + ret = aNode->IsDescendant(anOther); + } + else { + SALOMEDS::AttributeTreeNode_var aNode = SALOMEDS::AttributeTreeNode::_narrow(_corba_impl); + SALOMEDS::AttributeTreeNode_var anOther = SALOMEDS::AttributeTreeNode::_narrow(aTN->_corba_impl); + ret = aNode->IsDescendant(anOther); + } + return ret; +} + +bool SALOMEDS_AttributeTreeNode::IsFather(SALOMEDSClient_AttributeTreeNode* value) +{ + bool ret; + SALOMEDS_AttributeTreeNode* aTN = dynamic_cast(value); + if(_isLocal) { + Handle(SALOMEDSImpl_AttributeTreeNode) aNode, anOther; + aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl); + anOther = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(aTN->_local_impl); + ret = aNode->IsFather(anOther); + } + else { + SALOMEDS::AttributeTreeNode_var aNode = SALOMEDS::AttributeTreeNode::_narrow(_corba_impl); + SALOMEDS::AttributeTreeNode_var anOther = SALOMEDS::AttributeTreeNode::_narrow(aTN->_corba_impl); + ret = aNode->IsFather(anOther); + } + return ret; +} + +bool SALOMEDS_AttributeTreeNode::IsChild(SALOMEDSClient_AttributeTreeNode* value) +{ + bool ret; + SALOMEDS_AttributeTreeNode* aTN = dynamic_cast(value); + if(_isLocal) { + Handle(SALOMEDSImpl_AttributeTreeNode) aNode, anOther; + aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl); + anOther = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(aTN->_local_impl); + ret = aNode->IsChild(anOther); + } + else { + SALOMEDS::AttributeTreeNode_var aNode = SALOMEDS::AttributeTreeNode::_narrow(_corba_impl); + SALOMEDS::AttributeTreeNode_var anOther = SALOMEDS::AttributeTreeNode::_narrow(aTN->_corba_impl); + ret = aNode->IsChild(anOther); + } + return ret; +} + +char* SALOMEDS_AttributeTreeNode::Label() +{ + TCollection_AsciiString aLabel; + if(_isLocal) TDF_Tool::Entry(_local_impl->Label(), aLabel); + else aLabel = SALOMEDS::AttributeTreeNode::_narrow(_corba_impl)->Label(); + return aLabel.ToCString(); +} + + diff --git a/src/SALOMEDS/SALOMEDS_AttributeTreeNode.hxx b/src/SALOMEDS/SALOMEDS_AttributeTreeNode.hxx new file mode 100644 index 000000000..2fec33ddd --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_AttributeTreeNode.hxx @@ -0,0 +1,51 @@ +// File : SALOMEDS_AttributeTreeNode.hxx +// Author : Sergey RUIN +// Module : SALOME + +#ifndef SALOMEDS_AttributeTreeNode_HeaderFile +#define SALOMEDS_AttributeTreeNode_HeaderFile + +#include "SALOMEDSClient_AttributeTreeNode.hxx" +#include "SALOMEDS_GenericAttribute.hxx" +#include "SALOMEDSImpl_AttributeTreeNode.hxx" + +// IDL headers +#include +#include CORBA_SERVER_HEADER(SALOMEDS) +#include CORBA_SERVER_HEADER(SALOMEDS_Attributes) + +class SALOMEDS_AttributeTreeNode: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeTreeNode +{ +public: + SALOMEDS_AttributeTreeNode(const Handle(SALOMEDSImpl_AttributeTreeNode)& theAttr); + SALOMEDS_AttributeTreeNode(SALOMEDS::AttributeTreeNode_ptr theAttr); + ~SALOMEDS_AttributeTreeNode(); + + virtual void SetFather(SALOMEDSClient_AttributeTreeNode* value); + virtual bool HasFather(); + virtual SALOMEDSClient_AttributeTreeNode* GetFather(); + virtual void SetPrevious(SALOMEDSClient_AttributeTreeNode* value); + virtual bool HasPrevious(); + virtual SALOMEDSClient_AttributeTreeNode* GetPrevious(); + virtual void SetNext(SALOMEDSClient_AttributeTreeNode* value); + virtual bool HasNext(); + virtual SALOMEDSClient_AttributeTreeNode* GetNext(); + virtual void SetFirst(SALOMEDSClient_AttributeTreeNode* value); + virtual bool HasFirst(); + virtual SALOMEDSClient_AttributeTreeNode* GetFirst(); + virtual void SetTreeID(const char* value); + virtual char* GetTreeID(); + virtual void Append(SALOMEDSClient_AttributeTreeNode* value); + virtual void Prepend(SALOMEDSClient_AttributeTreeNode* value); + virtual void InsertBefore(SALOMEDSClient_AttributeTreeNode* value); + virtual void InsertAfter(SALOMEDSClient_AttributeTreeNode* value); + virtual void Remove(); + virtual int Depth(); + virtual bool IsRoot(); + virtual bool IsDescendant(SALOMEDSClient_AttributeTreeNode* value); + virtual bool IsFather(SALOMEDSClient_AttributeTreeNode* value); + virtual bool IsChild(SALOMEDSClient_AttributeTreeNode* value); + virtual char* Label(); +}; + +#endif diff --git a/src/SALOMEDS/SALOMEDS_AttributeUserID.cxx b/src/SALOMEDS/SALOMEDS_AttributeUserID.cxx new file mode 100644 index 000000000..bbd11fb82 --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_AttributeUserID.cxx @@ -0,0 +1,40 @@ +// File : SALOMEDS_AttributeUserID.cxx +// Author : Sergey RUIN +// Module : SALOME + +#include "SALOMEDS_AttributeUserID.hxx" + +#include +#include +#include + +SALOMEDS_AttributeUserID::SALOMEDS_AttributeUserID(const Handle(SALOMEDSImpl_AttributeUserID)& theAttr) +:SALOMEDS_GenericAttribute(theAttr) +{} + +SALOMEDS_AttributeUserID::SALOMEDS_AttributeUserID(SALOMEDS::AttributeUserID_ptr theAttr) +:SALOMEDS_GenericAttribute(theAttr) +{} + +SALOMEDS_AttributeUserID::~SALOMEDS_AttributeUserID() +{} + +char* SALOMEDS_AttributeUserID::Value() +{ + TCollection_AsciiString aValue; + if(_isLocal) { + char guid[40]; + Handle(SALOMEDSImpl_AttributeUserID)::DownCast(_local_impl)->Value().ToCString(guid); + aValue = TCollection_AsciiString(guid); + } + else aValue = SALOMEDS::AttributeUserID::_narrow(_corba_impl)->Value(); + return aValue.ToCString(); +} + +void SALOMEDS_AttributeUserID::SetValue(const char* value) +{ + CheckLocked(); + TCollection_AsciiString aValue((char*)value); + if(_isLocal) Handle(SALOMEDSImpl_AttributeUserID)::DownCast(_local_impl)->SetValue(Standard_GUID(aValue.ToCString())); + else SALOMEDS::AttributeUserID::_narrow(_corba_impl)->SetValue(aValue.ToCString()); +} diff --git a/src/SALOMEDS/SALOMEDS_AttributeUserID.hxx b/src/SALOMEDS/SALOMEDS_AttributeUserID.hxx new file mode 100644 index 000000000..f8bff63e4 --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_AttributeUserID.hxx @@ -0,0 +1,28 @@ +// File : SALOMEDS_AttributeUserID.hxx +// Author : Sergey RUIN +// Module : SALOME + +#ifndef SALOMEDS_AttributeUserID_HeaderFile +#define SALOMEDS_AttributeUserID_HeaderFile + +#include "SALOMEDSClient_AttributeUserID.hxx" +#include "SALOMEDS_GenericAttribute.hxx" +#include "SALOMEDSImpl_AttributeUserID.hxx" + +// IDL headers +#include +#include CORBA_SERVER_HEADER(SALOMEDS) +#include CORBA_SERVER_HEADER(SALOMEDS_Attributes) + +class SALOMEDS_AttributeUserID: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeUserID +{ +public: + SALOMEDS_AttributeUserID(const Handle(SALOMEDSImpl_AttributeUserID)& theAttr); + SALOMEDS_AttributeUserID(SALOMEDS::AttributeUserID_ptr theAttr); + ~SALOMEDS_AttributeUserID(); + + virtual char* Value(); + virtual void SetValue(const char* value); +}; + +#endif diff --git a/src/SALOMEDS/SALOMEDS_ChildIterator.cxx b/src/SALOMEDS/SALOMEDS_ChildIterator.cxx new file mode 100644 index 000000000..d16ef6fe7 --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_ChildIterator.cxx @@ -0,0 +1,56 @@ +// File : SALOMEDS_ChildIterator.cxx +// Author : Sergey RUIN +// Module : SALOME + +using namespace std; + +#include "SALOMEDS_ChildIterator.hxx" +#include "SALOMEDS_SObject.hxx" + +SALOMEDS_ChildIterator::SALOMEDS_ChildIterator(const Handle(SALOMEDSImpl_ChildIterator)& theIterator) +{ + _isLocal = true; + _local_impl = theIterator; + _corba_impl = SALOMEDS::ChildIterator::_nil(); +} + +SALOMEDS_ChildIterator::SALOMEDS_ChildIterator(SALOMEDS::ChildIterator_ptr theIterator) +{ + _isLocal = false; + _local_impl = NULL; + _corba_impl = SALOMEDS::ChildIterator::_duplicate(theIterator); +} + +void SALOMEDS_ChildIterator::Init() +{ + if(_isLocal) _local_impl->Init(); + else _corba_impl->Init(); +} + +void SALOMEDS_ChildIterator::InitEx(bool theAllLevels) +{ + if(_isLocal) _local_impl->InitEx(theAllLevels); + else _corba_impl->InitEx(theAllLevels); +} + +bool SALOMEDS_ChildIterator::More() +{ + bool ret; + if(_isLocal) ret = _local_impl->More(); + else ret = _corba_impl->More(); + return ret; +} + +void SALOMEDS_ChildIterator::Next() +{ + if(_isLocal) _local_impl->Next(); + else _corba_impl->Next(); +} + +SALOMEDSClient_SObject* SALOMEDS_ChildIterator::Value() +{ + SALOMEDS_SObject* aSO; + if(_isLocal) aSO = new SALOMEDS_SObject(_local_impl->Value()); + else aSO = new SALOMEDS_SObject(_corba_impl->Value()); + return aSO; +} diff --git a/src/SALOMEDS/SALOMEDS_ChildIterator.hxx b/src/SALOMEDS/SALOMEDS_ChildIterator.hxx new file mode 100644 index 000000000..1507fe847 --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_ChildIterator.hxx @@ -0,0 +1,35 @@ +// File : SALOMEDS_ChildIterator.hxx +// Author : Sergey RUIN +// Module : SALOME + +#ifndef __SALOMEDS_CHILDITERATOR_H__ +#define __SALOMEDS_CHILDITERATOR_H__ + +#include "SALOMEDSClient_ChildIterator.hxx" +#include "SALOMEDSClient_SObject.hxx" +#include "SALOMEDSImpl_ChildIterator.hxx" + +// IDL headers +#include +#include CORBA_SERVER_HEADER(SALOMEDS) + +class SALOMEDS_ChildIterator: public SALOMEDSClient_ChildIterator +{ +private: + bool _isLocal; + Handle(SALOMEDSImpl_ChildIterator) _local_impl; + SALOMEDS::ChildIterator_var _corba_impl; + +public: + + SALOMEDS_ChildIterator(const Handle(SALOMEDSImpl_ChildIterator)& theIterator); + SALOMEDS_ChildIterator(SALOMEDS::ChildIterator_ptr theIterator); + ~SALOMEDS_ChildIterator() {}; + + virtual void Init(); + virtual void InitEx(bool theAllLevels); + virtual bool More(); + virtual void Next(); + virtual SALOMEDSClient_SObject* Value(); +}; +#endif diff --git a/src/SALOMEDS/SALOMEDS_ClientAttributes.hxx b/src/SALOMEDS/SALOMEDS_ClientAttributes.hxx new file mode 100644 index 000000000..a785389b0 --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_ClientAttributes.hxx @@ -0,0 +1,140 @@ +// File : SALOMEDS_Attributes.hxx +// Author : Sergey RUIN +// Module : SALOME + +#ifndef __SALOMEDSCLIENT_ATTRIBUTES__H__ +#define __SALOMEDSCLIENT_ATTRIBUTES__H__ + +#include CORBA_SERVER_HEADER(SALOMEDS_Attributes) + +#include "SALOMEDSImpl_GenericAttribute.hxx" +#include "SALOMEDSImpl_AttributeName.hxx" +#include "SALOMEDSImpl_AttributeComment.hxx" +#include "SALOMEDSImpl_AttributeInteger.hxx" +#include "SALOMEDSImpl_AttributeReal.hxx" +#include "SALOMEDSImpl_AttributeTreeNode.hxx" +#include "SALOMEDSImpl_AttributeUserID.hxx" +#include "SALOMEDSImpl_AttributeSequenceOfReal.hxx" +#include "SALOMEDSImpl_AttributeSequenceOfInteger.hxx" +#include "SALOMEDSImpl_AttributeIOR.hxx" +#include "SALOMEDSImpl_AttributePersistentRef.hxx" +#include "SALOMEDSImpl_AttributeDrawable.hxx" +#include "SALOMEDSImpl_AttributeSelectable.hxx" +#include "SALOMEDSImpl_AttributeExpandable.hxx" +#include "SALOMEDSImpl_AttributeOpened.hxx" +#include "SALOMEDSImpl_AttributeTextColor.hxx" +#include "SALOMEDSImpl_AttributeTextHighlightColor.hxx" +#include "SALOMEDSImpl_AttributePixMap.hxx" +#include "SALOMEDSImpl_AttributeLocalID.hxx" +#include "SALOMEDSImpl_AttributeTarget.hxx" +#include "SALOMEDSImpl_AttributeTableOfInteger.hxx" +#include "SALOMEDSImpl_AttributeTableOfReal.hxx" +#include "SALOMEDSImpl_AttributeTableOfString.hxx" +#include "SALOMEDSImpl_AttributeStudyProperties.hxx" +#include "SALOMEDSImpl_AttributePythonObject.hxx" +#include "SALOMEDSImpl_AttributeExternalFileDef.hxx" +#include "SALOMEDSImpl_AttributeFileType.hxx" +#include "SALOMEDSImpl_AttributeFlags.hxx" +#include "SALOMEDSImpl_AttributeGraphic.hxx" + +#include "SALOMEDS_GenericAttribute.hxx" +#include "SALOMEDS_AttributeName.hxx" +#include "SALOMEDS_AttributeComment.hxx" +#include "SALOMEDS_AttributeInteger.hxx" +#include "SALOMEDS_AttributeReal.hxx" +#include "SALOMEDS_AttributeTreeNode.hxx" +#include "SALOMEDS_AttributeUserID.hxx" +#include "SALOMEDS_AttributeSequenceOfReal.hxx" +#include "SALOMEDS_AttributeSequenceOfInteger.hxx" +#include "SALOMEDS_AttributeIOR.hxx" +#include "SALOMEDS_AttributePersistentRef.hxx" +#include "SALOMEDS_AttributeDrawable.hxx" +#include "SALOMEDS_AttributeSelectable.hxx" +#include "SALOMEDS_AttributeExpandable.hxx" +#include "SALOMEDS_AttributeOpened.hxx" +#include "SALOMEDS_AttributeTextColor.hxx" +#include "SALOMEDS_AttributeTextHighlightColor.hxx" +#include "SALOMEDS_AttributePixMap.hxx" +#include "SALOMEDS_AttributeLocalID.hxx" +#include "SALOMEDS_AttributeTarget.hxx" +#include "SALOMEDS_AttributeTableOfInteger.hxx" +#include "SALOMEDS_AttributeTableOfReal.hxx" +#include "SALOMEDS_AttributeTableOfString.hxx" +#include "SALOMEDS_AttributeStudyProperties.hxx" +#include "SALOMEDS_AttributePythonObject.hxx" +#include "SALOMEDS_AttributeExternalFileDef.hxx" +#include "SALOMEDS_AttributeFileType.hxx" +#include "SALOMEDS_AttributeFlags.hxx" +#include "SALOMEDS_AttributeGraphic.hxx" + +#define __CreateClientAttributeLocal(CORBA_Name) if (strcmp(aTypeOfAttribute, #CORBA_Name) == 0) { \ + Handle(SALOMEDSImpl_##CORBA_Name) A = Handle(SALOMEDSImpl_##CORBA_Name)::DownCast(theGA); \ + aGA = new SALOMEDS_##CORBA_Name(A); \ + } + +#define __CreateClientAttributeCORBA(CORBA_Name) if (strcmp(aTypeOfAttribute, #CORBA_Name) == 0) { \ + SALOMEDS::CORBA_Name##_var A = SALOMEDS::CORBA_Name::_narrow(theGA); \ + aGA = new SALOMEDS_##CORBA_Name(A); \ + } + +#define __CreateGenericClientAttributeLocal \ +__CreateClientAttributeLocal(AttributeReal) \ +__CreateClientAttributeLocal(AttributeInteger) \ +__CreateClientAttributeLocal(AttributeSequenceOfReal) \ +__CreateClientAttributeLocal(AttributeSequenceOfInteger) \ +__CreateClientAttributeLocal(AttributeName) \ +__CreateClientAttributeLocal(AttributeComment) \ +__CreateClientAttributeLocal(AttributeIOR) \ +__CreateClientAttributeLocal(AttributePixMap) \ +__CreateClientAttributeLocal(AttributeLocalID) \ +__CreateClientAttributeLocal(AttributeTableOfInteger) \ +__CreateClientAttributeLocal(AttributeTableOfReal) \ +__CreateClientAttributeLocal(AttributeTableOfString) \ +__CreateClientAttributeLocal(AttributePythonObject) \ +__CreateClientAttributeLocal(AttributePersistentRef) \ +__CreateClientAttributeLocal(AttributeDrawable) \ +__CreateClientAttributeLocal(AttributeSelectable) \ +__CreateClientAttributeLocal(AttributeExpandable) \ +__CreateClientAttributeLocal(AttributeOpened) \ +__CreateClientAttributeLocal(AttributeTextColor) \ +__CreateClientAttributeLocal(AttributeTextHighlightColor) \ +__CreateClientAttributeLocal(AttributeTarget) \ +__CreateClientAttributeLocal(AttributeStudyProperties) \ +__CreateClientAttributeLocal(AttributeExternalFileDef) \ +__CreateClientAttributeLocal(AttributeFileType) \ +__CreateClientAttributeLocal(AttributeFlags) \ +__CreateClientAttributeLocal(AttributeGraphic) \ +__CreateClientAttributeLocal(AttributeTreeNode) \ +__CreateClientAttributeLocal(AttributeUserID) + +#define __CreateGenericClientAttributeCORBA \ +__CreateClientAttributeCORBA(AttributeReal) \ +__CreateClientAttributeCORBA(AttributeInteger) \ +__CreateClientAttributeCORBA(AttributeSequenceOfReal) \ +__CreateClientAttributeCORBA(AttributeSequenceOfInteger) \ +__CreateClientAttributeCORBA(AttributeName) \ +__CreateClientAttributeCORBA(AttributeComment) \ +__CreateClientAttributeCORBA(AttributeIOR) \ +__CreateClientAttributeCORBA(AttributePixMap) \ +__CreateClientAttributeCORBA(AttributeLocalID) \ +__CreateClientAttributeCORBA(AttributeTableOfInteger) \ +__CreateClientAttributeCORBA(AttributeTableOfReal) \ +__CreateClientAttributeCORBA(AttributeTableOfString) \ +__CreateClientAttributeCORBA(AttributePythonObject) \ +__CreateClientAttributeCORBA(AttributePersistentRef) \ +__CreateClientAttributeCORBA(AttributeDrawable) \ +__CreateClientAttributeCORBA(AttributeSelectable) \ +__CreateClientAttributeCORBA(AttributeExpandable) \ +__CreateClientAttributeCORBA(AttributeOpened) \ +__CreateClientAttributeCORBA(AttributeTextColor) \ +__CreateClientAttributeCORBA(AttributeTextHighlightColor) \ +__CreateClientAttributeCORBA(AttributeTarget) \ +__CreateClientAttributeCORBA(AttributeStudyProperties) \ +__CreateClientAttributeCORBA(AttributeExternalFileDef) \ +__CreateClientAttributeCORBA(AttributeFileType) \ +__CreateClientAttributeCORBA(AttributeFlags) \ +__CreateClientAttributeCORBA(AttributeGraphic) \ +__CreateClientAttributeCORBA(AttributeTreeNode) \ +__CreateClientAttributeCORBA(AttributeUserID) + +#endif diff --git a/src/SALOMEDS/SALOMEDS_GenericAttribute.cxx b/src/SALOMEDS/SALOMEDS_GenericAttribute.cxx new file mode 100644 index 000000000..91ea72dc1 --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_GenericAttribute.cxx @@ -0,0 +1,120 @@ +// File : SALOMEDS_GenericAttribute.cxx +// Author : Sergey RUIN +// Module : SALOME + +using namespace std; + +#include + +#include "SALOMEDS_GenericAttribute.hxx" +#include "SALOMEDSImpl_SObject.hxx" +#include "SALOMEDS_SObject.hxx" +#include "SALOMEDS_ClientAttributes.hxx" + +#ifdef WNT +#include +#else +#include +#include +#endif + +#include "OpUtil.hxx" + +SALOMEDS_GenericAttribute::SALOMEDS_GenericAttribute(const Handle(SALOMEDSImpl_GenericAttribute)& theGA) +{ + _isLocal = true; + _local_impl = theGA; + _corba_impl = SALOMEDS::GenericAttribute::_nil(); +} + +SALOMEDS_GenericAttribute::SALOMEDS_GenericAttribute(SALOMEDS::GenericAttribute_ptr theGA) +{ +#ifdef WNT + long pid = (long)_getpid(); +#else + long pid = (long)getpid(); +#endif + + long addr = theGA->GetLocalImpl(GetHostname().c_str(), pid, _isLocal); + if(_isLocal) { + _local_impl = ((SALOMEDSImpl_GenericAttribute*)(addr)); + _corba_impl = SALOMEDS::GenericAttribute::_nil(); + } + else { + _local_impl = NULL; + _corba_impl = SALOMEDS::GenericAttribute::_duplicate(theGA); + } +} + +SALOMEDS_GenericAttribute::~SALOMEDS_GenericAttribute() +{} + +void SALOMEDS_GenericAttribute::CheckLocked() +{ + if(_isLocal) { + try { + _local_impl->CheckLocked(); + } + catch(...) { + throw SALOMEDS::GenericAttribute::LockProtection(); + } + } + else { + _corba_impl->CheckLocked(); + } +} + +char* SALOMEDS_GenericAttribute::Type() +{ + TCollection_AsciiString aType; + if(_isLocal) { + aType = _local_impl->Type(); + } + else { + aType = _corba_impl->Type(); + } + return aType.ToCString(); +} + +char* SALOMEDS_GenericAttribute::GetClassType() +{ + TCollection_AsciiString aType; + if(_isLocal) { + aType = _local_impl->GetClassType(); + } + else { + aType = _corba_impl->GetClassType(); + } + return aType.ToCString(); +} + +SALOMEDSClient_SObject* SALOMEDS_GenericAttribute::GetSObject() +{ + SALOMEDSClient_SObject* aSO = NULL; + if(_isLocal) { + aSO = new SALOMEDS_SObject(_local_impl->GetSObject()); + } + else { + aSO = new SALOMEDS_SObject(_corba_impl->GetSObject()); + } + + return aSO; +} + + +SALOMEDS_GenericAttribute* SALOMEDS_GenericAttribute::CreateAttribute(const Handle(SALOMEDSImpl_GenericAttribute)& theGA) +{ + SALOMEDS_GenericAttribute* aGA = NULL; + char* aTypeOfAttribute = theGA->GetClassType().ToCString(); + __CreateGenericClientAttributeLocal + return aGA; +} + +SALOMEDS_GenericAttribute* SALOMEDS_GenericAttribute::CreateAttribute(SALOMEDS::GenericAttribute_ptr theGA) +{ + SALOMEDS_GenericAttribute* aGA = NULL; + char* aTypeOfAttribute = theGA->GetClassType(); + __CreateGenericClientAttributeCORBA + return aGA; +} + diff --git a/src/SALOMEDS/SALOMEDS_GenericAttribute.hxx b/src/SALOMEDS/SALOMEDS_GenericAttribute.hxx new file mode 100644 index 000000000..fe6f49fb1 --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_GenericAttribute.hxx @@ -0,0 +1,39 @@ +// File : SALOMEDS_GenericAttribute.hxx +// Author : Sergey RUIN +// Module : SALOME + +#ifndef _GENERIC_ATTRIBUTE_HXX_ +#define _GENERIC_ATTRIBUTE_HXX_ + +#include +#include "SALOMEDSClient_GenericAttribute.hxx" +#include "SALOMEDSClient_SObject.hxx" +#include "SALOMEDSImpl_GenericAttribute.hxx" + +// IDL headers +#include +#include CORBA_SERVER_HEADER(SALOMEDS) + + +class SALOMEDS_GenericAttribute: public virtual SALOMEDSClient_GenericAttribute +{ +protected: + bool _isLocal; + Handle(SALOMEDSImpl_GenericAttribute) _local_impl; + SALOMEDS::GenericAttribute_var _corba_impl; + +public: + SALOMEDS_GenericAttribute(const Handle(SALOMEDSImpl_GenericAttribute)& theGA); + SALOMEDS_GenericAttribute(SALOMEDS::GenericAttribute_ptr theGA); + virtual ~SALOMEDS_GenericAttribute(); + + void CheckLocked(); + char* Type(); + char* GetClassType(); + SALOMEDSClient_SObject* GetSObject(); + + static SALOMEDS_GenericAttribute* CreateAttribute(const Handle(SALOMEDSImpl_GenericAttribute)& theGA); + static SALOMEDS_GenericAttribute* CreateAttribute(SALOMEDS::GenericAttribute_ptr theGA); +}; + +#endif diff --git a/src/SALOMEDS/SALOMEDS_SComponent.cxx b/src/SALOMEDS/SALOMEDS_SComponent.cxx new file mode 100644 index 000000000..8aebb91c6 --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_SComponent.cxx @@ -0,0 +1,44 @@ +// File : SALOMEDS_SComponent.cxx +// Author : Sergey RUIN +// Module : SALOME + +using namespace std; + +#include "SALOMEDS_SComponent.hxx" + +SALOMEDS_SComponent::SALOMEDS_SComponent(SALOMEDS::SComponent_ptr theSComponent) +:SALOMEDS_SObject(theSComponent) +{} + +SALOMEDS_SComponent::SALOMEDS_SComponent(const Handle(SALOMEDSImpl_SComponent)& theSComponent) +:SALOMEDS_SObject(theSComponent) +{} + +SALOMEDS_SComponent::~SALOMEDS_SComponent() +{} + +char* SALOMEDS_SComponent::ComponentDataType() +{ + TCollection_AsciiString aType; + if(_isLocal) { + aType = (Handle(SALOMEDSImpl_SComponent)::DownCast(GetLocalImpl()))->ComponentDataType(); + } + else aType = (SALOMEDS::SComponent::_narrow(GetCORBAImpl()))->ComponentDataType(); + + return aType.ToCString(); +} + +bool SALOMEDS_SComponent::ComponentIOR(char* theID) +{ + bool ret; + if(_isLocal) { + TCollection_AsciiString anIOR; + ret = (Handle(SALOMEDSImpl_SComponent)::DownCast(GetLocalImpl()))->ComponentIOR(anIOR); + theID = anIOR.ToCString(); + } + else { + ret = (SALOMEDS::SComponent::_narrow(GetCORBAImpl()))->ComponentIOR(theID); + } + + return ret; +} diff --git a/src/SALOMEDS/SALOMEDS_SComponent.hxx b/src/SALOMEDS/SALOMEDS_SComponent.hxx new file mode 100644 index 000000000..ca1cf8402 --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_SComponent.hxx @@ -0,0 +1,27 @@ +// File : SALOMEDS_SComponent.hxx +// Author : Sergey RUIN +// Module : SALOME + +#ifndef __SALOMEDS_SCOMPONENT_H__ +#define __SALOMEDS_SCOMPONENT_H__ + +#include "SALOMEDSClient_SComponent.hxx" +#include "SALOMEDS_SObject.hxx" +#include "SALOMEDSImpl_SComponent.hxx" + +// IDL headers +#include +#include CORBA_SERVER_HEADER(SALOMEDS) + +class SALOMEDS_SComponent: public SALOMEDS_SObject, public SALOMEDSClient_SComponent +{ +public: + + SALOMEDS_SComponent(const Handle(SALOMEDSImpl_SComponent)& theSComponent); + SALOMEDS_SComponent(SALOMEDS::SComponent_ptr theSComponent); + ~SALOMEDS_SComponent(); + + virtual char* ComponentDataType(); + virtual bool ComponentIOR(char* theID); +}; +#endif diff --git a/src/SALOMEDS/SALOMEDS_SComponentIterator.cxx b/src/SALOMEDS/SALOMEDS_SComponentIterator.cxx new file mode 100644 index 000000000..59f840c10 --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_SComponentIterator.cxx @@ -0,0 +1,52 @@ +// File : SALOMEDS_SComponentIterator.cxx +// Author : Sergey RUIN +// Module : SALOME + +#include "SALOMEDS_SComponentIterator.hxx" +#include "SALOMEDSImpl_SComponent.hxx" +#include "SALOMEDS_SComponent.hxx" + +SALOMEDS_SComponentIterator::SALOMEDS_SComponentIterator(const SALOMEDSImpl_SComponentIterator& theIterator) +:_local_impl(theIterator) +{ + _isLocal = true; + _corba_impl = SALOMEDS::SComponentIterator::_nil(); +} + +SALOMEDS_SComponentIterator::SALOMEDS_SComponentIterator(SALOMEDS::SComponentIterator_ptr theIterator) +{ + _isLocal = false; + _corba_impl = SALOMEDS::SComponentIterator::_duplicate(theIterator); +} + +SALOMEDS_SComponentIterator::~SALOMEDS_SComponentIterator() +{ +} + +void SALOMEDS_SComponentIterator::Init() +{ + if(_isLocal) _local_impl.Init(); + else _corba_impl->Init(); +} + +bool SALOMEDS_SComponentIterator::More() +{ + bool ret; + if(_isLocal) ret = _local_impl.More(); + else ret = _corba_impl->More(); + return ret; +} + +void SALOMEDS_SComponentIterator::Next() +{ + if(_isLocal) _local_impl.Next(); + else _corba_impl->Next(); +} + +SALOMEDSClient_SComponent* SALOMEDS_SComponentIterator::Value() +{ + SALOMEDS_SComponent* aSCO = NULL; + if(_isLocal) aSCO = new SALOMEDS_SComponent(_local_impl.Value()); + else aSCO = new SALOMEDS_SComponent(_corba_impl->Value()); + return aSCO; +} diff --git a/src/SALOMEDS/SALOMEDS_SComponentIterator.hxx b/src/SALOMEDS/SALOMEDS_SComponentIterator.hxx new file mode 100644 index 000000000..0bb2b3077 --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_SComponentIterator.hxx @@ -0,0 +1,34 @@ +// File : SALOMEDS_SComponentIterator.hxx +// Author : Sergey RUIN +// Module : SALOME + +#ifndef __SALOMEDS_SCOMPONENTITERATOR_H__ +#define __SALOMEDS_SCOMPONENTITERATOR_H__ + +#include "SALOMEDSClient_SComponentIterator.hxx" +#include "SALOMEDSClient_SComponent.hxx" +#include "SALOMEDSImpl_SComponentIterator.hxx" + +// IDL headers +#include +#include CORBA_SERVER_HEADER(SALOMEDS) + +class SALOMEDS_SComponentIterator: public SALOMEDSClient_SComponentIterator +{ +public: + SALOMEDS_SComponentIterator(const SALOMEDSImpl_SComponentIterator& theIterator); + SALOMEDS_SComponentIterator(SALOMEDS::SComponentIterator_ptr theIterator); + ~SALOMEDS_SComponentIterator(); + +private: + bool _isLocal; + SALOMEDSImpl_SComponentIterator _local_impl; + SALOMEDS::SComponentIterator_var _corba_impl; + +public: + virtual void Init(); + virtual bool More(); + virtual void Next(); + virtual SALOMEDSClient_SComponent* Value(); +}; +#endif diff --git a/src/SALOMEDS/SALOMEDS_SObject.cxx b/src/SALOMEDS/SALOMEDS_SObject.cxx new file mode 100644 index 000000000..0e85522e5 --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_SObject.cxx @@ -0,0 +1,215 @@ +// File : SALOMEDS_SObject.hxx +// Author : Sergey RUIN +// Module : SALOME + +using namespace std; + +#include +#include + +#include "SALOMEDS_SObject.hxx" +#include "SALOMEDS_SComponent.hxx" +#include "SALOMEDSImpl_SComponent.hxx" +#include "SALOMEDS_GenericAttribute.hxx" +#include "SALOMEDSImpl_GenericAttribute.hxx" +#include "SALOMEDS_Study.hxx" +#include "SALOMEDSImpl_Study.hxx" + +#ifdef WNT +#include +#else +#include +#include +#endif + +#include "OpUtil.hxx" + +SALOMEDS_SObject::SALOMEDS_SObject(SALOMEDS::SObject_ptr theSObject) +{ +#ifdef WNT + long pid = (long)_getpid(); +#else + long pid = (long)getpid(); +#endif + + long addr = theSObject->GetLocalImpl(GetHostname().c_str(), pid, _isLocal); + if(_isLocal) { + _local_impl = ((SALOMEDSImpl_SObject*)(addr)); + _corba_impl = SALOMEDS::SObject::_nil(); + } + else { + _local_impl = NULL; + _corba_impl = SALOMEDS::SObject::_duplicate(theSObject); + } +} + +SALOMEDS_SObject::SALOMEDS_SObject(const Handle(SALOMEDSImpl_SObject)& theSObject) +:_isLocal(true) +{ + _corba_impl = SALOMEDS::SObject::_nil(); + _local_impl = theSObject; +} + +SALOMEDS_SObject::~SALOMEDS_SObject() +{ + cout << "@@@@@@@@@@ Deleting the SOBject" << endl; +} + +char* SALOMEDS_SObject::GetID() +{ + if(_isLocal) return _local_impl->GetID().ToCString(); + return _corba_impl->GetID(); +} + +SALOMEDSClient_SComponent* SALOMEDS_SObject::GetFatherComponent() +{ + if(_isLocal) + return new SALOMEDS_SComponent(Handle(SALOMEDSImpl_SComponent)::DownCast(_local_impl->GetFatherComponent())); + return new SALOMEDS_SComponent(_corba_impl->GetFatherComponent()); +} + +SALOMEDSClient_SObject* SALOMEDS_SObject::GetFather() +{ + if(_isLocal) return new SALOMEDS_SObject(_local_impl->GetFather()); + return new SALOMEDS_SObject(_corba_impl->GetFather()); +} + +bool SALOMEDS_SObject::FindAttribute(SALOMEDSClient_GenericAttribute* anAttribute, const char* aTypeOfAttribute) +{ + bool ret = false; + TCollection_AsciiString aType((char*)aTypeOfAttribute); + if(_isLocal) { + Handle(SALOMEDSImpl_GenericAttribute) anAttr; + ret = _local_impl->FindAttribute(anAttr, aType); + if(ret) anAttribute = SALOMEDS_GenericAttribute::CreateAttribute(anAttr); + } + else { + SALOMEDS::GenericAttribute_var anAttr; + ret = _corba_impl->FindAttribute(anAttr.out(), aType.ToCString()); + if(ret) anAttribute = SALOMEDS_GenericAttribute::CreateAttribute(anAttr); + } + + return ret; +} + +bool SALOMEDS_SObject::ReferencedObject(SALOMEDSClient_SObject* theObject) +{ + bool ret = false; + if(_isLocal) { + Handle(SALOMEDSImpl_SObject) aSO; + ret = _local_impl->ReferencedObject(aSO); + if(ret) theObject = new SALOMEDS_SObject(aSO); + } + else { + SALOMEDS::SObject_var aSO; + ret = _corba_impl->ReferencedObject(aSO.out()); + if(ret) theObject = new SALOMEDS_SObject(aSO); + } + + return ret; +} + + +bool SALOMEDS_SObject::FindSubObject(int theTag, SALOMEDSClient_SObject* theObject) +{ + bool ret = false; + if(_isLocal) { + Handle(SALOMEDSImpl_SObject) aSO; + ret = _local_impl->FindSubObject(theTag, aSO); + if(ret) theObject = new SALOMEDS_SObject(aSO); + } + else { + SALOMEDS::SObject_var aSO; + ret = _corba_impl->FindSubObject(theTag, aSO.out()); + if(ret) theObject = new SALOMEDS_SObject(aSO); + } + + return ret; +} + +SALOMEDSClient_Study* SALOMEDS_SObject::GetStudy() +{ + if(_isLocal) return new SALOMEDS_Study(_local_impl->GetStudy()); + return new SALOMEDS_Study(_corba_impl->GetStudy()); +} + +char* SALOMEDS_SObject::Name() +{ + TCollection_AsciiString aName; + if(_isLocal) aName = _local_impl->Name(); + else aName = _corba_impl->Name(); + + return aName.ToCString(); +} + +void SALOMEDS_SObject::Name(const char* theName) +{ + TCollection_AsciiString aName((char*)theName); + if(_isLocal) _local_impl->Name(aName); + else _corba_impl->Name(aName.ToCString()); +} + +vector SALOMEDS_SObject::GetAllAttributes() +{ + vector aVector; + int aLength = 0; + SALOMEDS_GenericAttribute* anAttr; + + if(_isLocal) { + Handle(TColStd_HSequenceOfTransient) aSeq = _local_impl->GetAllAttributes(); + aLength = aSeq->Length(); + for(int i = 1; i <= aLength; i++) { + anAttr = SALOMEDS_GenericAttribute::CreateAttribute(Handle(SALOMEDSImpl_GenericAttribute)::DownCast(aSeq->Value(i))); + aVector.push_back(anAttr); + } + } + else { + SALOMEDS::ListOfAttributes_var aSeq = _corba_impl->GetAllAttributes(); + aLength = aSeq->length(); + for(int i = 0; i < aLength; i++) { + anAttr = SALOMEDS_GenericAttribute::CreateAttribute(aSeq[i]); + aVector.push_back(anAttr); + } + } + + return aVector; +} + +char* SALOMEDS_SObject::GetName() +{ + TCollection_AsciiString aName; + if(_isLocal) aName = _local_impl->GetName(); + else aName = _corba_impl->GetName(); + + return aName.ToCString(); +} + +char* SALOMEDS_SObject::GetComment() +{ + TCollection_AsciiString aComment; + if(_isLocal) aComment = _local_impl->GetComment(); + else aComment = _corba_impl->GetComment(); + + return aComment.ToCString(); +} + +char* SALOMEDS_SObject::GetIOR() +{ + TCollection_AsciiString anIOR; + if(_isLocal) anIOR = _local_impl->GetIOR(); + else anIOR = _corba_impl->GetIOR(); + + return anIOR.ToCString(); +} + +int SALOMEDS_SObject::Tag() +{ + if(_isLocal) return _local_impl->Tag(); + return _corba_impl->Tag(); +} + +int SALOMEDS_SObject::Depth() +{ + if(_isLocal) return _local_impl->Depth(); + return _corba_impl->Depth(); +} diff --git a/src/SALOMEDS/SALOMEDS_SObject.hxx b/src/SALOMEDS/SALOMEDS_SObject.hxx new file mode 100644 index 000000000..31369ee34 --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_SObject.hxx @@ -0,0 +1,56 @@ +// File : SALOMEDS_SObject.hxx +// Author : Sergey RUIN +// Module : SALOME + +#ifndef __SALOMEDS_SOBJECT_H__ +#define __SALOMEDS_SOBJECT_H__ + +// std C++ headers +#include + +#include +#include +#include + +// IDL headers +#include +#include CORBA_SERVER_HEADER(SALOMEDS) + +#include "SALOMEDS_SObject_i.hxx" +#include "SALOMEDSImpl_SObject.hxx" + +class SALOMEDS_SObject: public virtual SALOMEDSClient_SObject +{ +protected: + +bool _isLocal; +Handle(SALOMEDSImpl_SObject) _local_impl; +SALOMEDS::SObject_var _corba_impl; + +public: + + SALOMEDS_SObject(SALOMEDS::SObject_ptr theSObject); + SALOMEDS_SObject(const Handle(SALOMEDSImpl_SObject)& theSObject); + virtual ~SALOMEDS_SObject(); + + virtual char* GetID(); + virtual SALOMEDSClient_SComponent* GetFatherComponent(); + virtual SALOMEDSClient_SObject* GetFather(); + virtual bool FindAttribute(SALOMEDSClient_GenericAttribute* anAttribute, const char* aTypeOfAttribute); + virtual bool ReferencedObject(SALOMEDSClient_SObject* theObject); + virtual bool FindSubObject(int theTag, SALOMEDSClient_SObject* theObject); + virtual SALOMEDSClient_Study* GetStudy(); + virtual char* Name(); + virtual void Name(const char* theName); + virtual vector GetAllAttributes(); + virtual char* GetName(); + virtual char* GetComment(); + virtual char* GetIOR(); + virtual int Tag(); + virtual int Depth(); + + SALOMEDS::SObject_ptr GetCORBAImpl() { return SALOMEDS::SObject::_duplicate(_corba_impl); } + Handle(SALOMEDSImpl_SObject) GetLocalImpl() { return _local_impl; } +}; + +#endif diff --git a/src/SALOMEDS/SALOMEDS_Study.cxx b/src/SALOMEDS/SALOMEDS_Study.cxx new file mode 100644 index 000000000..739e7d865 --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_Study.cxx @@ -0,0 +1,503 @@ +// File : SALOMEDS_Study.cxx +// Author : Sergey RUIN +// Module : SALOME + +using namespace std; + +#include "utilities.h" + +#include "SALOMEDS_Study.hxx" +#include "SALOMEDS_SComponent.hxx" +#include "SALOMEDSImpl_SComponent.hxx" +#include "SALOMEDS_SObject.hxx" +#include "SALOMEDSImpl_SObject.hxx" +#include "SALOMEDS_StudyBuilder.hxx" +#include "SALOMEDSImpl_StudyBuilder.hxx" +#include "SALOMEDS_ChildIterator.hxx" +#include "SALOMEDSImpl_ChildIterator.hxx" +#include "SALOMEDS_SComponentIterator.hxx" +#include "SALOMEDSImpl_SComponentIterator.hxx" +#include "SALOMEDS_AttributeStudyProperties.hxx" +#include "SALOMEDSImpl_AttributeStudyProperties.hxx" +#include "SALOMEDS_UseCaseBuilder.hxx" +#include "SALOMEDSImpl_UseCaseBuilder.hxx" + +#include "SALOMEDS_Driver_i.hxx" + +#include +#include + +#include "Utils_ORB_INIT.hxx" +#include "Utils_SINGLETON.hxx" + +#ifdef WNT +#include +#else +#include +#include +#endif + +#include "OpUtil.hxx" + +SALOMEDS_Study::SALOMEDS_Study(const Handle(SALOMEDSImpl_Study)& theStudy) +{ + _isLocal = true; + _local_impl = theStudy; + _corba_impl = SALOMEDS::Study::_nil(); + init_orb(); +} + +SALOMEDS_Study::SALOMEDS_Study(SALOMEDS::Study_ptr theStudy) +{ +#ifdef WNT + long pid = (long)_getpid(); +#else + long pid = (long)getpid(); +#endif + + long addr = theStudy->GetLocalImpl(GetHostname().c_str(), pid, _isLocal); + if(_isLocal) { + _local_impl = ((SALOMEDSImpl_Study*)(addr)); + _corba_impl = SALOMEDS::Study::_nil(); + } + else { + _local_impl = NULL; + _corba_impl = SALOMEDS::Study::_duplicate(theStudy); + } + + init_orb(); +} + +SALOMEDS_Study::~SALOMEDS_Study() +{ +} + +char* SALOMEDS_Study::GetPersistentReference() +{ + TCollection_AsciiString aRef; + if(_isLocal) aRef = _local_impl->GetPersistentReference(); + else aRef = _corba_impl->GetPersistentReference(); + return aRef.ToCString(); +} + +char* SALOMEDS_Study::GetTransientReference() +{ + TCollection_AsciiString aRef; + if(_isLocal) aRef = _local_impl->GetTransientReference(); + else aRef = _corba_impl->GetTransientReference(); + return aRef.ToCString(); +} + +bool SALOMEDS_Study::IsEmpty() +{ + bool ret; + if(_isLocal) ret = _local_impl->IsEmpty(); + else ret = _corba_impl->IsEmpty(); + return ret; +} + +SALOMEDSClient_SComponent* SALOMEDS_Study::FindComponent (const char* aComponentName) +{ + SALOMEDS_SComponent* aSCO = NULL; + TCollection_AsciiString aName((char*)aComponentName); + if(_isLocal) aSCO = new SALOMEDS_SComponent(_local_impl->FindComponent(aName)); + else aSCO = new SALOMEDS_SComponent(_corba_impl->FindComponent(aName.ToCString())); + return aSCO; +} + +SALOMEDSClient_SComponent* SALOMEDS_Study::FindComponentID(const char* aComponentID) +{ + SALOMEDS_SComponent* aSCO = NULL; + TCollection_AsciiString anID((char*)aComponentID); + if(_isLocal) aSCO = new SALOMEDS_SComponent(_local_impl->FindComponentID(anID)); + else aSCO = new SALOMEDS_SComponent(_corba_impl->FindComponentID(anID.ToCString())); + return aSCO; + +} + +SALOMEDSClient_SObject* SALOMEDS_Study::FindObject(const char* anObjectName) +{ + SALOMEDS_SObject* aSO = NULL; + TCollection_AsciiString aName((char*)anObjectName); + if(_isLocal) aSO = new SALOMEDS_SObject(_local_impl->FindObject(aName)); + else aSO = new SALOMEDS_SObject(_corba_impl->FindObject(aName.ToCString())); + return aSO; +} + +std::vector SALOMEDS_Study::FindObjectByName(const char* anObjectName, + const char* aComponentName) +{ + std::vector aVector; + int i, aLength = 0; + TCollection_AsciiString anObjName((char*)anObjectName); + TCollection_AsciiString aCompName((char*)aComponentName); + + if(_isLocal) { + Handle(TColStd_HSequenceOfTransient) aSeq = _local_impl->FindObjectByName(anObjName, aCompName); + aLength = aSeq->Length(); + for(i = 1; i<= aLength; i++) + aVector.push_back(new SALOMEDS_SObject(Handle(SALOMEDSImpl_SObject)::DownCast(aSeq->Value(i)))); + } + else { + SALOMEDS::Study::ListOfSObject_var aSeq = _corba_impl->FindObjectByName(anObjName.ToCString(), aCompName.ToCString()); + aLength = aSeq->length(); + for(i = 0; i< aLength; i++) aVector.push_back(new SALOMEDS_SObject(aSeq[i])); + } + + return aVector; +} + +SALOMEDSClient_SObject* SALOMEDS_Study::FindObjectID(const char* anObjectID) +{ + SALOMEDS_SObject* aSO = NULL; + TCollection_AsciiString anID((char*)anObjectID); + if(_isLocal) aSO = new SALOMEDS_SObject(_local_impl->FindObjectID(anID)); + else aSO = new SALOMEDS_SObject(_corba_impl->FindObjectID(anID.ToCString())); + return aSO; +} + +SALOMEDSClient_SObject* SALOMEDS_Study::CreateObjectID(const char* anObjectID) +{ + SALOMEDS_SObject* aSO = NULL; + TCollection_AsciiString anID((char*)anObjectID); + if(_isLocal) aSO = new SALOMEDS_SObject(_local_impl->CreateObjectID(anID)); + else aSO = new SALOMEDS_SObject(_corba_impl->CreateObjectID(anID.ToCString())); + return aSO; +} + +SALOMEDSClient_SObject* SALOMEDS_Study::FindObjectIOR(const char* anObjectIOR) +{ + SALOMEDS_SObject* aSO = NULL; + TCollection_AsciiString anIOR((char*)anObjectIOR); + if(_isLocal) aSO = new SALOMEDS_SObject(_local_impl->FindObjectIOR(anIOR)); + else aSO = new SALOMEDS_SObject(_corba_impl->FindObjectIOR(anIOR.ToCString())); + return aSO; +} + +SALOMEDSClient_SObject* SALOMEDS_Study::FindObjectByPath(const char* thePath) +{ + SALOMEDS_SObject* aSO = NULL; + TCollection_AsciiString aPath((char*)thePath); + if(_isLocal) aSO = new SALOMEDS_SObject(_local_impl->FindObjectByPath(aPath)); + else aSO = new SALOMEDS_SObject(_corba_impl->FindObjectByPath(aPath.ToCString())); + return aSO; +} + +char* SALOMEDS_Study::GetObjectPath(SALOMEDSClient_SObject* theSO) +{ + SALOMEDS_SObject* aSO = dynamic_cast(theSO); + TCollection_AsciiString aPath; + if(_isLocal) aPath = _local_impl->GetObjectPath(aSO->GetLocalImpl()); + else aPath = _corba_impl->GetObjectPath(aSO->GetCORBAImpl()); + return aPath.ToCString(); +} + +void SALOMEDS_Study::SetContext(const char* thePath) +{ + TCollection_AsciiString aPath((char*)thePath); + if(_isLocal) _local_impl->SetContext(aPath); + else _corba_impl->SetContext(aPath.ToCString()); +} + +char* SALOMEDS_Study::GetContext() +{ + TCollection_AsciiString aPath; + if(_isLocal) aPath = _local_impl->GetContext(); + else aPath = _corba_impl->GetContext(); + return aPath.ToCString(); +} + +std::vector SALOMEDS_Study::GetObjectNames(const char* theContext) +{ + std::vector aVector; + TCollection_AsciiString aContext((char*)theContext); + int aLength, i; + if(_isLocal) { + Handle(TColStd_HSequenceOfAsciiString) aSeq = _local_impl->GetObjectNames(aContext); + aLength = aSeq->Length(); + for(i = 1; i<=aLength; i++) aVector.push_back(aSeq->Value(i).ToCString()); + } + else { + SALOMEDS::ListOfStrings_var aSeq = _corba_impl->GetObjectNames(aContext.ToCString()); + aLength = aSeq->length(); + for(i = 0; i SALOMEDS_Study::GetDirectoryNames(const char* theContext) +{ + std::vector aVector; + TCollection_AsciiString aContext((char*)theContext); + int aLength, i; + if(_isLocal) { + Handle(TColStd_HSequenceOfAsciiString) aSeq = _local_impl->GetDirectoryNames(aContext); + aLength = aSeq->Length(); + for(i = 1; i<=aLength; i++) aVector.push_back(aSeq->Value(i).ToCString()); + } + else { + SALOMEDS::ListOfStrings_var aSeq = _corba_impl->GetDirectoryNames(aContext.ToCString()); + aLength = aSeq->length(); + for(i = 0; i SALOMEDS_Study::GetFileNames(const char* theContext) +{ + std::vector aVector; + TCollection_AsciiString aContext((char*)theContext); + int aLength, i; + if(_isLocal) { + Handle(TColStd_HSequenceOfAsciiString) aSeq = _local_impl->GetFileNames(aContext); + aLength = aSeq->Length(); + for(i = 1; i<=aLength; i++) aVector.push_back(aSeq->Value(i).ToCString()); + } + else { + SALOMEDS::ListOfStrings_var aSeq = _corba_impl->GetFileNames(aContext.ToCString()); + aLength = aSeq->length(); + + for(i = 0; i SALOMEDS_Study::GetComponentNames(const char* theContext) +{ + std::vector aVector; + TCollection_AsciiString aContext((char*)theContext); + int aLength, i; + if(_isLocal) { + Handle(TColStd_HSequenceOfAsciiString) aSeq = _local_impl->GetComponentNames(aContext); + aLength = aSeq->Length(); + for(i = 1; i<=aLength; i++) aVector.push_back(aSeq->Value(i).ToCString()); + } + else { + SALOMEDS::ListOfStrings_var aSeq = _corba_impl->GetComponentNames(aContext.ToCString()); + aLength = aSeq->length(); + for(i = 0; i(theSO); + SALOMEDS_ChildIterator* aCI = NULL; + if(_isLocal) { + Handle(SALOMEDSImpl_ChildIterator) aCIimpl = _local_impl->NewChildIterator(aSO->GetLocalImpl()); + aCI = new SALOMEDS_ChildIterator(aCIimpl); + } + else { + SALOMEDS::ChildIterator_var aCIimpl = _corba_impl->NewChildIterator(aSO->GetCORBAImpl()); + aCI = new SALOMEDS_ChildIterator(aCIimpl); + } + + return aCI; +} + +SALOMEDSClient_SComponentIterator* SALOMEDS_Study::NewComponentIterator() +{ + SALOMEDS_SComponentIterator* aCI = NULL; + if(_isLocal) { + SALOMEDSImpl_SComponentIterator aCIimpl = _local_impl->NewComponentIterator(); + aCI = new SALOMEDS_SComponentIterator(aCIimpl); + } + else { + SALOMEDS::SComponentIterator_var aCIimpl = _corba_impl->NewComponentIterator(); + aCI = new SALOMEDS_SComponentIterator(aCIimpl); + } + + return aCI; +} + +SALOMEDSClient_StudyBuilder* SALOMEDS_Study::NewBuilder() +{ + SALOMEDS_StudyBuilder* aSB = NULL; + if(_isLocal) { + Handle(SALOMEDSImpl_StudyBuilder) aSBimpl = _local_impl->NewBuilder(); + aSB = new SALOMEDS_StudyBuilder(aSBimpl); + } + else { + SALOMEDS::StudyBuilder_var aSBimpl = _corba_impl->NewBuilder(); + aSB = new SALOMEDS_StudyBuilder(aSBimpl); + } + + return aSB; +} + +char* SALOMEDS_Study::Name() +{ + TCollection_AsciiString aName; + if(_isLocal) aName = _local_impl->Name(); + else aName = _corba_impl->Name(); + return aName.ToCString(); +} + +void SALOMEDS_Study::Name(const char* name) +{ + TCollection_AsciiString aName((char*)name); + if(_isLocal) _local_impl->Name(aName); + else _corba_impl->Name(aName.ToCString()); +} + +bool SALOMEDS_Study::IsSaved() +{ + bool isSaved; + if(_isLocal) isSaved = _local_impl->IsSaved(); + else isSaved = _corba_impl->IsSaved(); + return isSaved; +} + +void SALOMEDS_Study::IsSaved(bool save) +{ + if(_isLocal) _local_impl->IsSaved(save); + else _corba_impl->IsSaved(save); +} + +bool SALOMEDS_Study::IsModified() +{ + bool isModified; + if(_isLocal) isModified = _local_impl->IsModified(); + else isModified = _corba_impl->IsModified(); + return isModified; +} + +char* SALOMEDS_Study::URL() +{ + TCollection_AsciiString aURL; + if(_isLocal) aURL = _local_impl->URL(); + else aURL = _corba_impl->URL(); + return aURL.ToCString(); +} + +void SALOMEDS_Study::URL(const char* url) +{ + TCollection_AsciiString aURL((char*)url); + if(_isLocal) _local_impl->URL(aURL); + else _corba_impl->URL(aURL.ToCString()); +} + +int SALOMEDS_Study::StudyId() +{ + int anID; + if(_isLocal) anID = _local_impl->StudyId(); + else anID = _corba_impl->StudyId(); + return anID; +} + +void SALOMEDS_Study::StudyId(int id) +{ + if(_isLocal) _local_impl->StudyId(id); + else _corba_impl->StudyId(id); +} + +std::vector SALOMEDS_Study::FindDependances(SALOMEDSClient_SObject* theSO) +{ + std::vector aVector; + SALOMEDS_SObject* aSO = dynamic_cast(theSO); + int aLength, i; + if(_isLocal) { + Handle(TColStd_HSequenceOfTransient) aSeq = _local_impl->FindDependances(aSO->GetLocalImpl()); + aLength = aSeq->Length(); + for(i=1; i<=aLength; i++) + aVector.push_back(new SALOMEDS_SObject(Handle(SALOMEDSImpl_SObject)::DownCast(aSeq->Value(i)))); + } + else { + SALOMEDS::Study::ListOfSObject_var aSeq = _corba_impl->FindDependances(aSO->GetCORBAImpl()); + aLength = aSeq->length(); + for(i=0; iGetProperties()); + else aProp = new SALOMEDS_AttributeStudyProperties(_corba_impl->GetProperties()); + return aProp; +} + +char* SALOMEDS_Study::GetLastModificationDate() +{ + TCollection_AsciiString aDate; + if(_isLocal) aDate = _local_impl->GetLastModificationDate(); + else aDate = _corba_impl->GetLastModificationDate(); + return aDate.ToCString(); +} + +std::vector SALOMEDS_Study::GetModificationsDate() +{ + std::vector aVector; + int aLength, i; + if(_isLocal) { + Handle(TColStd_HSequenceOfAsciiString) aSeq = _local_impl->GetModificationsDate(); + aLength = aSeq->Length(); + for(i=1; i<=aLength; i++) aVector.push_back(aSeq->Value(i).ToCString()); + } + else { + SALOMEDS::ListOfDates_var aSeq = _corba_impl->GetModificationsDate(); + aLength = aSeq->length(); + for(i=0; iGetUseCaseBuilder(); + aUB = new SALOMEDS_UseCaseBuilder(aUBimpl); + } + else { + SALOMEDS::UseCaseBuilder_var aUBimpl = _corba_impl->GetUseCaseBuilder(); + aUB = new SALOMEDS_UseCaseBuilder(aUBimpl); + } + + return aUB; +} + +void SALOMEDS_Study::Close() +{ + if(_isLocal) _local_impl->Close(); + else _corba_impl->Close(); +} + +void SALOMEDS_Study::EnableUseCaseAutoFilling(bool isEnabled) +{ + if(_isLocal) _local_impl->EnableUseCaseAutoFilling(isEnabled); + else _corba_impl->EnableUseCaseAutoFilling(isEnabled); +} + +bool SALOMEDS_Study::DumpStudy(const char* thePath, const char* theBaseName, bool isPublished) +{ + TCollection_AsciiString aPath((char*)thePath); + TCollection_AsciiString aBaseName((char*)theBaseName); + bool ret; + if(_isLocal) { + SALOMEDS_DriverFactory_i* aFactory = new SALOMEDS_DriverFactory_i(_orb); + ret = _local_impl->DumpStudy(aPath, aBaseName, isPublished, aFactory); + delete aFactory; + } + else ret = _corba_impl->DumpStudy(aPath.ToCString(), aBaseName.ToCString(), isPublished); + return ret; +} + +char* SALOMEDS_Study::ConvertObjectToIOR(CORBA::Object_ptr theObject) +{ + return _orb->object_to_string(theObject); +} + +CORBA::Object_ptr SALOMEDS_Study::ConvertIORToObject(const char* theIOR) +{ + return _orb->string_to_object(theIOR); +} + +void SALOMEDS_Study::init_orb() +{ + ORB_INIT &init = *SINGLETON_::Instance() ; + ASSERT(SINGLETON_::IsAlreadyExisting()) ; + _orb = init(0 , 0 ) ; +} diff --git a/src/SALOMEDS/SALOMEDS_Study.hxx b/src/SALOMEDS/SALOMEDS_Study.hxx new file mode 100644 index 000000000..1d0933f88 --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_Study.hxx @@ -0,0 +1,87 @@ +// File : SALOMEDS_Study.hxx +// Author : Sergey RUIN +// Module : SALOME + +#ifndef __SALOMEDS_STUDY_H__ +#define __SALOMEDS_STUDY_H__ + +#include +#include + +#include "SALOMEDSClient_Study.hxx" +#include "SALOMEDSClient_SComponentIterator.hxx" +#include "SALOMEDSClient_StudyBuilder.hxx" +#include "SALOMEDSClient_SObject.hxx" +#include "SALOMEDSClient_SComponent.hxx" +#include "SALOMEDSClient_UseCaseBuilder.hxx" +#include "SALOMEDSClient_AttributeStudyProperties.hxx" +#include "SALOMEDSClient_ChildIterator.hxx" + +#include "SALOMEDSImpl_Study.hxx" + +// IDL headers +#include +#include CORBA_SERVER_HEADER(SALOMEDS) + +class SALOMEDS_Study: public SALOMEDSClient_Study +{ + +private: + bool _isLocal; + Handle(SALOMEDSImpl_Study) _local_impl; + SALOMEDS::Study_var _corba_impl; + CORBA::ORB_var _orb; + +public: + + SALOMEDS_Study(const Handle(SALOMEDSImpl_Study)& theStudy); + SALOMEDS_Study(SALOMEDS::Study_ptr theStudy); + ~SALOMEDS_Study(); + + virtual char* GetPersistentReference(); + virtual char* GetTransientReference(); + virtual bool IsEmpty(); + virtual SALOMEDSClient_SComponent* FindComponent (const char* aComponentName); + virtual SALOMEDSClient_SComponent* FindComponentID(const char* aComponentID); + virtual SALOMEDSClient_SObject* FindObject(const char* anObjectName); + virtual std::vector FindObjectByName( const char* anObjectName, const char* aComponentName ) ; + virtual SALOMEDSClient_SObject* FindObjectID(const char* anObjectID); + virtual SALOMEDSClient_SObject* CreateObjectID(const char* anObjectID); + virtual SALOMEDSClient_SObject* FindObjectIOR(const char* anObjectIOR); + virtual SALOMEDSClient_SObject* FindObjectByPath(const char* thePath); + virtual char* GetObjectPath(SALOMEDSClient_SObject* theSO); + virtual void SetContext(const char* thePath); + virtual char* GetContext(); + virtual std::vector GetObjectNames(const char* theContext); + virtual std::vector GetDirectoryNames(const char* theContext); + virtual std::vector GetFileNames(const char* theContext); + virtual std::vector GetComponentNames(const char* theContext); + virtual SALOMEDSClient_ChildIterator* NewChildIterator(SALOMEDSClient_SObject* theSO); + virtual SALOMEDSClient_SComponentIterator* NewComponentIterator(); + virtual SALOMEDSClient_StudyBuilder* NewBuilder(); + virtual char* Name(); + virtual void Name(const char* name); + virtual bool IsSaved(); + virtual void IsSaved(bool save); + virtual bool IsModified(); + virtual char* URL(); + virtual void URL(const char* url); + virtual int StudyId(); + virtual void StudyId(int id); + virtual std::vector FindDependances(SALOMEDSClient_SObject* theSO); + virtual SALOMEDSClient_AttributeStudyProperties* GetProperties(); + virtual char* GetLastModificationDate(); + virtual std::vector GetModificationsDate(); + virtual SALOMEDSClient_UseCaseBuilder* GetUseCaseBuilder(); + virtual void Close(); + virtual void EnableUseCaseAutoFilling(bool isEnabled); + virtual bool DumpStudy(const char* thePath, const char* theBaseName, bool isPublished); + + char* ConvertObjectToIOR(CORBA::Object_ptr theObject); + CORBA::Object_ptr ConvertIORToObject(const char* theIOR); + +private: + void init_orb(); + +}; +#endif diff --git a/src/SALOMEDS/SALOMEDS_StudyBuilder.cxx b/src/SALOMEDS/SALOMEDS_StudyBuilder.cxx new file mode 100644 index 000000000..c552a2ce9 --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_StudyBuilder.cxx @@ -0,0 +1,406 @@ +// File : SALOMEDS_StudyBuilder.cxx +// Author : Sergey RUIN +// Module : SALOME + +using namespace std; + +#include "utilities.h" + +#include "SALOMEDS_StudyBuilder.hxx" +#include "SALOMEDS_SObject.hxx" +#include "SALOMEDSImpl_SObject.hxx" +#include "SALOMEDS_SComponent.hxx" +#include "SALOMEDSImpl_SComponent.hxx" +#include "SALOMEDS_Driver_i.hxx" +#include "SALOMEDS_GenericAttribute.hxx" +#include "SALOMEDSImpl_GenericAttribute.hxx" +#include +#include +#include "SALOMEDS_StudyManager.hxx" + +#include "Utils_CorbaException.hxx" +#include "Utils_ORB_INIT.hxx" +#include "Utils_SINGLETON.hxx" + +SALOMEDS_StudyBuilder::SALOMEDS_StudyBuilder(const Handle(SALOMEDSImpl_StudyBuilder)& theBuilder) +{ + _isLocal = true; + _local_impl = theBuilder; + _corba_impl = SALOMEDS::StudyBuilder::_nil(); + init_orb(); +} + +SALOMEDS_StudyBuilder::SALOMEDS_StudyBuilder(SALOMEDS::StudyBuilder_ptr theBuilder) +{ + _isLocal = false; + _local_impl = NULL; + _corba_impl = SALOMEDS::StudyBuilder::_duplicate(theBuilder); + init_orb(); +} + +SALOMEDS_StudyBuilder::~SALOMEDS_StudyBuilder() +{ +} + +SALOMEDSClient_SComponent* SALOMEDS_StudyBuilder::NewComponent(const char* ComponentDataType) +{ + CheckLocked(); + + SALOMEDS_SComponent* aSCO = NULL; + TCollection_AsciiString aType((char*)ComponentDataType); + + if(_isLocal) + aSCO = new SALOMEDS_SComponent(_local_impl->NewComponent(aType)); + else + aSCO = new SALOMEDS_SComponent(_corba_impl->NewComponent(aType.ToCString())); + + return aSCO; +} + +void SALOMEDS_StudyBuilder::DefineComponentInstance (SALOMEDSClient_SComponent* theSCO, + const char* ComponentIOR) +{ + CheckLocked(); + + SALOMEDS_SComponent* aSCO = dynamic_cast(theSCO); + TCollection_AsciiString anIOR((char*)ComponentIOR); + if(_isLocal) _local_impl->DefineComponentInstance(Handle(SALOMEDSImpl_SComponent)::DownCast(aSCO->GetLocalImpl()),anIOR); + else { + CORBA::Object_var obj = _orb->string_to_object(ComponentIOR); + _corba_impl->DefineComponentInstance(SALOMEDS::SComponent::_narrow(aSCO->GetCORBAImpl()), obj); + } +} + +void SALOMEDS_StudyBuilder::RemoveComponent(SALOMEDSClient_SComponent* theSCO) +{ + CheckLocked(); + + SALOMEDS_SComponent* aSCO = dynamic_cast(theSCO); + if(_isLocal) _local_impl->RemoveComponent(Handle(SALOMEDSImpl_SComponent)::DownCast(aSCO->GetLocalImpl())); + else _corba_impl->RemoveComponent(SALOMEDS::SComponent::_narrow(aSCO->GetCORBAImpl())); +} + +SALOMEDSClient_SObject* SALOMEDS_StudyBuilder::NewObject(SALOMEDSClient_SObject* theFatherObject) +{ + CheckLocked(); + + SALOMEDS_SObject* aSO = NULL; + SALOMEDS_SObject* father = dynamic_cast< SALOMEDS_SObject*>(theFatherObject); + if(father == NULL) return aSO; + if(_isLocal) aSO = new SALOMEDS_SObject(_local_impl->NewObject(father->GetLocalImpl())); + else aSO = new SALOMEDS_SObject(_corba_impl->NewObject(father->GetCORBAImpl())); + + return aSO; +} + +SALOMEDSClient_SObject* SALOMEDS_StudyBuilder::NewObjectToTag(SALOMEDSClient_SObject* theFatherObject, int theTag) +{ + CheckLocked(); + + SALOMEDS_SObject* aSO = NULL; + SALOMEDS_SObject* father = dynamic_cast< SALOMEDS_SObject*>(theFatherObject); + if(father == NULL) return aSO; + if(_isLocal) aSO = new SALOMEDS_SObject(_local_impl->NewObjectToTag(father->GetLocalImpl(), theTag)); + else aSO = new SALOMEDS_SObject(_corba_impl->NewObjectToTag(father->GetCORBAImpl(), theTag)); + + return aSO; + +} + +void SALOMEDS_StudyBuilder::AddDirectory(const char* thePath) +{ + CheckLocked(); + + TCollection_AsciiString aPath((char*)thePath); + if(_isLocal) { + _local_impl->AddDirectory(aPath); + if(!_local_impl->AddDirectory(TCollection_AsciiString((char*)thePath))) { + TCollection_AsciiString anErrorCode = _local_impl->GetErrorCode(); + if(anErrorCode == "StudyNameAlreadyUsed") throw SALOMEDS::Study::StudyNameAlreadyUsed(); + if(anErrorCode == "StudyInvalidDirectory") throw SALOMEDS::Study::StudyInvalidDirectory(); + if(anErrorCode == "StudyInvalidComponent") throw SALOMEDS::Study::StudyInvalidComponent(); + } + } + else _corba_impl->AddDirectory(aPath.ToCString()); +} + +void SALOMEDS_StudyBuilder::LoadWith(SALOMEDSClient_SComponent* theSCO, const char* theIOR) +{ + SALOMEDS_SComponent* aSCO = dynamic_cast(theSCO); + TCollection_AsciiString anIOR((char*)theIOR); + CORBA::Object_var obj = _orb->string_to_object(theIOR); + SALOMEDS::Driver_var aDriver = SALOMEDS::Driver::_narrow(obj); + + if(_isLocal) { + SALOMEDS_Driver_i* drv = new SALOMEDS_Driver_i(aDriver, _orb); + bool isDone = _local_impl->LoadWith(Handle(SALOMEDSImpl_SComponent)::DownCast(aSCO->GetLocalImpl()), drv); + delete drv; + if(!isDone && _local_impl->IsError()) + THROW_SALOME_CORBA_EXCEPTION(_local_impl->GetErrorCode().ToCString(),SALOME::BAD_PARAM); + } + else { + _corba_impl->LoadWith(SALOMEDS::SComponent::_narrow(aSCO->GetCORBAImpl()), aDriver); + } +} + +void SALOMEDS_StudyBuilder::Load(SALOMEDSClient_SObject* theSCO) +{ + SALOMEDS_SComponent* aSCO = dynamic_cast(theSCO); + if(_isLocal) _local_impl->Load(Handle(SALOMEDSImpl_SComponent)::DownCast(aSCO->GetLocalImpl())); + else _corba_impl->Load(SALOMEDS::SComponent::_narrow(aSCO->GetCORBAImpl())); +} + +void SALOMEDS_StudyBuilder::RemoveObject(SALOMEDSClient_SObject* theSO) +{ + CheckLocked(); + + SALOMEDS_SObject* aSO = dynamic_cast(theSO); + if(_isLocal) _local_impl->RemoveObject(aSO->GetLocalImpl()); + else _corba_impl->RemoveObject(aSO->GetCORBAImpl()); +} + +void SALOMEDS_StudyBuilder::RemoveObjectWithChildren(SALOMEDSClient_SObject* theSO) +{ + CheckLocked(); + + SALOMEDS_SObject* aSO = dynamic_cast(theSO); + if(_isLocal) _local_impl->RemoveObjectWithChildren(aSO->GetLocalImpl()); + else _corba_impl->RemoveObjectWithChildren(aSO->GetCORBAImpl()); +} + +SALOMEDSClient_GenericAttribute* SALOMEDS_StudyBuilder::FindOrCreateAttribute(SALOMEDSClient_SObject* theSO, + const char* aTypeOfAttribute) +{ + SALOMEDS_SObject* aSO = dynamic_cast(theSO); + SALOMEDS_GenericAttribute* anAttr = NULL; + TCollection_AsciiString aType((char*)aTypeOfAttribute); + if(_isLocal) { + Handle(SALOMEDSImpl_GenericAttribute) aGA; + try { + aGA=Handle(SALOMEDSImpl_GenericAttribute)::DownCast(_local_impl->FindOrCreateAttribute(aSO->GetLocalImpl(),aType)); + } + catch (...) { + throw SALOMEDS::StudyBuilder::LockProtection(); + } + anAttr = SALOMEDS_GenericAttribute::CreateAttribute(aGA); + } + else { + SALOMEDS::GenericAttribute_var aGA = _corba_impl->FindOrCreateAttribute(aSO->GetCORBAImpl(), aType.ToCString()); + anAttr = SALOMEDS_GenericAttribute::CreateAttribute(aGA); + } + + return anAttr; +} + +bool SALOMEDS_StudyBuilder::FindAttribute(SALOMEDSClient_SObject* theSO, + SALOMEDSClient_GenericAttribute* anAttribute, + const char* aTypeOfAttribute) +{ + bool ret; + SALOMEDS_SObject* aSO = dynamic_cast(theSO); + TCollection_AsciiString aType((char*)aTypeOfAttribute); + anAttribute = NULL; + if(_isLocal) { + Handle(SALOMEDSImpl_GenericAttribute) aGA; + ret = _local_impl->FindAttribute(aSO->GetLocalImpl(), aGA, aType); + if(ret) anAttribute = SALOMEDS_GenericAttribute::CreateAttribute(aGA); + } + else { + SALOMEDS::GenericAttribute_var aGA; + ret = _corba_impl->FindAttribute(aSO->GetCORBAImpl(), aGA.out(), aType.ToCString()); + if(ret) anAttribute = SALOMEDS_GenericAttribute::CreateAttribute(aGA); + } + + return ret; +} + +void SALOMEDS_StudyBuilder::RemoveAttribute(SALOMEDSClient_SObject* theSO, const char* aTypeOfAttribute) +{ + CheckLocked(); + + SALOMEDS_SObject* aSO = dynamic_cast(theSO); + TCollection_AsciiString aType((char*)aTypeOfAttribute); + if(_isLocal) _local_impl->RemoveAttribute(aSO->GetLocalImpl(), aType); + else _corba_impl->RemoveAttribute(aSO->GetCORBAImpl(), aType.ToCString()); +} + +void SALOMEDS_StudyBuilder::Addreference(SALOMEDSClient_SObject* me, SALOMEDSClient_SObject* thereferencedObject) +{ + CheckLocked(); + + SALOMEDS_SObject* aSO = dynamic_cast(me); + SALOMEDS_SObject* aRefSO = dynamic_cast(thereferencedObject); + if(_isLocal) _local_impl->Addreference(aSO->GetLocalImpl(), aRefSO->GetLocalImpl()); + else _corba_impl->Addreference(aSO->GetCORBAImpl(), aRefSO->GetCORBAImpl()); +} + +void SALOMEDS_StudyBuilder::RemoveReference(SALOMEDSClient_SObject* me) +{ + CheckLocked(); + + SALOMEDS_SObject* aSO = dynamic_cast(me); + if(_isLocal) _local_impl->RemoveReference(aSO->GetLocalImpl()); + else _corba_impl->RemoveReference(aSO->GetCORBAImpl()); +} + +void SALOMEDS_StudyBuilder::SetGUID(SALOMEDSClient_SObject* theSO, const char* theGUID) +{ + CheckLocked(); + + SALOMEDS_SObject* aSO = dynamic_cast(theSO); + TCollection_AsciiString aGUID((char*)theGUID); + if(_isLocal) _local_impl->SetGUID(aSO->GetLocalImpl(), aGUID); + else _corba_impl->SetGUID(aSO->GetCORBAImpl(), aGUID.ToCString()); +} + +bool SALOMEDS_StudyBuilder::IsGUID(SALOMEDSClient_SObject* theSO, const char* theGUID) +{ + SALOMEDS_SObject* aSO = dynamic_cast(theSO); + TCollection_AsciiString aGUID((char*)theGUID); + bool ret; + if(_isLocal) ret = _local_impl->IsGUID(aSO->GetLocalImpl(), aGUID); + else ret = _corba_impl->IsGUID(aSO->GetCORBAImpl(), aGUID.ToCString()); + + return ret; +} + +void SALOMEDS_StudyBuilder::NewCommand() +{ + if(_isLocal) _local_impl->NewCommand(); + else _corba_impl->NewCommand(); +} + +void SALOMEDS_StudyBuilder::CommitCommand() +{ + if(_isLocal) { + try { + _local_impl->CommitCommand(); + } + catch(...) { + throw SALOMEDS::StudyBuilder::LockProtection(); + } + } + else _corba_impl->CommitCommand(); +} + +bool SALOMEDS_StudyBuilder::HasOpenCommand() +{ + bool ret; + if(_isLocal) ret = _local_impl->HasOpenCommand(); + else ret = _corba_impl->HasOpenCommand(); + return ret; +} + +void SALOMEDS_StudyBuilder::AbortCommand() +{ + if(_isLocal) _local_impl->AbortCommand(); + else _corba_impl->AbortCommand(); +} + +void SALOMEDS_StudyBuilder::Undo() +{ + if(_isLocal) { + try { + _local_impl->Undo(); + } + catch(...) { + throw SALOMEDS::StudyBuilder::LockProtection(); + } + } + else _corba_impl->Undo(); +} + +void SALOMEDS_StudyBuilder::Redo() +{ + if(_isLocal) { + try { + _local_impl->Redo(); + } + catch(...) { + throw SALOMEDS::StudyBuilder::LockProtection(); + } + } + else _corba_impl->Redo(); +} + +bool SALOMEDS_StudyBuilder::GetAvailableUndos() +{ + bool ret; + if(_isLocal) ret = _local_impl->GetAvailableUndos(); + else ret = _corba_impl->GetAvailableUndos(); + return ret; +} + +bool SALOMEDS_StudyBuilder::GetAvailableRedos() +{ + bool ret; + if(_isLocal) ret = _local_impl->GetAvailableRedos(); + else ret = _corba_impl->GetAvailableRedos(); + return ret; +} + +int SALOMEDS_StudyBuilder::UndoLimit() +{ + int aLimit; + if(_isLocal) aLimit = _local_impl->UndoLimit(); + else aLimit = _corba_impl->UndoLimit(); + return aLimit; +} + +void SALOMEDS_StudyBuilder::UndoLimit(int theLimit) +{ + CheckLocked(); + + if(_isLocal) _local_impl->UndoLimit(theLimit); + else _corba_impl->UndoLimit(theLimit); +} + +void SALOMEDS_StudyBuilder::CheckLocked() +{ + //There is only local part as CORBA part throws the correct exeception + if(_isLocal) { + try { + _local_impl->CheckLocked(); + } + catch(...) { + throw SALOMEDS::StudyBuilder::LockProtection(); + } + } +} + +void SALOMEDS_StudyBuilder::SetName(SALOMEDSClient_SObject* theSO, const char* theValue) +{ + CheckLocked(); + + SALOMEDS_SObject* aSO = dynamic_cast(theSO); + TCollection_AsciiString aValue((char*)theValue); + if(_isLocal) _local_impl->SetName(aSO->GetLocalImpl(), aValue); + else _corba_impl->SetName(aSO->GetCORBAImpl(), aValue.ToCString()); +} + +void SALOMEDS_StudyBuilder::SetComment(SALOMEDSClient_SObject* theSO, const char* theValue) +{ + CheckLocked(); + + SALOMEDS_SObject* aSO = dynamic_cast(theSO); + TCollection_AsciiString aValue((char*)theValue); + if(_isLocal) _local_impl->SetComment(aSO->GetLocalImpl(), aValue); + else _corba_impl->SetComment(aSO->GetCORBAImpl(), aValue.ToCString()); +} + +void SALOMEDS_StudyBuilder::SetIOR(SALOMEDSClient_SObject* theSO, const char* theValue) +{ + CheckLocked(); + + SALOMEDS_SObject* aSO = dynamic_cast(theSO); + TCollection_AsciiString aValue((char*)theValue); + if(_isLocal) _local_impl->SetIOR(aSO->GetLocalImpl(), aValue); + else _corba_impl->SetIOR(aSO->GetCORBAImpl(), aValue.ToCString()); +} + +void SALOMEDS_StudyBuilder::init_orb() +{ + ORB_INIT &init = *SINGLETON_::Instance() ; + ASSERT(SINGLETON_::IsAlreadyExisting()) ; + _orb = init(0 , 0 ) ; +} diff --git a/src/SALOMEDS/SALOMEDS_StudyBuilder.hxx b/src/SALOMEDS/SALOMEDS_StudyBuilder.hxx new file mode 100644 index 000000000..b97e085b6 --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_StudyBuilder.hxx @@ -0,0 +1,71 @@ +// File : SALOMEDS_StudyBuilder.hxx +// Author : Sergey RUIN +// Module : SALOME + +#ifndef __SALOMEDS_STUDYBUILDER_H__ +#define __SALOMEDS_STUDYBUILDER_H__ + +#include "SALOMEDSClient_StudyBuilder.hxx" +#include "SALOMEDSClient_SObject.hxx" +#include "SALOMEDSClient_SComponent.hxx" +#include "SALOMEDSClient_GenericAttribute.hxx" +#include "SALOMEDSImpl_StudyBuilder.hxx" + +// IDL headers +#include +#include CORBA_SERVER_HEADER(SALOMEDS) + + +class SALOMEDS_StudyBuilder: public SALOMEDSClient_StudyBuilder +{ +private: + bool _isLocal; + Handle(SALOMEDSImpl_StudyBuilder) _local_impl; + SALOMEDS::StudyBuilder_var _corba_impl; + CORBA::ORB_var _orb; + +public: + + SALOMEDS_StudyBuilder(const Handle(SALOMEDSImpl_StudyBuilder)& theBuilder); + SALOMEDS_StudyBuilder(SALOMEDS::StudyBuilder_ptr theBuilder); + ~SALOMEDS_StudyBuilder(); + + virtual SALOMEDSClient_SComponent* NewComponent(const char* ComponentDataType); + virtual void DefineComponentInstance (SALOMEDSClient_SComponent*, const char* ComponentIOR); + virtual void RemoveComponent(SALOMEDSClient_SComponent* theSCO); + virtual SALOMEDSClient_SObject* NewObject(SALOMEDSClient_SObject* theFatherObject); + virtual SALOMEDSClient_SObject* NewObjectToTag(SALOMEDSClient_SObject* theFatherObject, int theTag); + virtual void AddDirectory(const char* thePath); + virtual void LoadWith(SALOMEDSClient_SComponent* theSCO, const char* theIOR); + virtual void Load(SALOMEDSClient_SObject* theSCO); + virtual void RemoveObject(SALOMEDSClient_SObject* theSO); + virtual void RemoveObjectWithChildren(SALOMEDSClient_SObject* theSO); + virtual SALOMEDSClient_GenericAttribute* FindOrCreateAttribute(SALOMEDSClient_SObject* theSO, + const char* aTypeOfAttribute); + virtual bool FindAttribute(SALOMEDSClient_SObject* theSO, + SALOMEDSClient_GenericAttribute* theAttribute, + const char* aTypeOfAttribute); + virtual void RemoveAttribute(SALOMEDSClient_SObject* theSO, const char* aTypeOfAttribute); + virtual void Addreference(SALOMEDSClient_SObject* me, SALOMEDSClient_SObject* thereferencedObject); + virtual void RemoveReference(SALOMEDSClient_SObject* me); + virtual void SetGUID(SALOMEDSClient_SObject* theSO, const char* theGUID); + virtual bool IsGUID(SALOMEDSClient_SObject* theSO, const char* theGUID); + virtual void NewCommand(); + virtual void CommitCommand(); + virtual bool HasOpenCommand(); + virtual void AbortCommand(); + virtual void Undo(); + virtual void Redo(); + virtual bool GetAvailableUndos(); + virtual bool GetAvailableRedos(); + virtual int UndoLimit(); + virtual void UndoLimit(int theLimit); + virtual void SetName(SALOMEDSClient_SObject* theSO, const char* theValue); + virtual void SetComment(SALOMEDSClient_SObject* theSO, const char* theValue); + virtual void SetIOR(SALOMEDSClient_SObject* theSO, const char* theValue); + +private: + void CheckLocked(); + void init_orb(); +}; +#endif diff --git a/src/SALOMEDS/SALOMEDS_StudyManager.cxx b/src/SALOMEDS/SALOMEDS_StudyManager.cxx new file mode 100644 index 000000000..55d3de1da --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_StudyManager.cxx @@ -0,0 +1,172 @@ +// File : SALOMEDSClient_StudyManager.cxx +// Author : Sergey RUIN +// Module : SALOME + +using namespace std; +#include "SALOMEDS_StudyManager.hxx" + +#include "SALOMEDSImpl_Study.hxx" +#include "SALOMEDS_Study.hxx" +#include "SALOMEDS_SObject.hxx" + +#ifdef WNT +#include +#else +#include +#include +#endif + +#include +#include + +#include "OpUtil.hxx" + +SALOMEDS_StudyManager::SALOMEDS_StudyManager(SALOMEDS::StudyManager_ptr theManager) +{ + +#ifdef WNT + long pid = (long)_getpid(); +#else + long pid = (long)getpid(); +#endif + + long addr = theManager->GetLocalImpl(GetHostname().c_str(), pid, _isLocal); + if(_isLocal) { + _local_impl = ((SALOMEDSImpl_StudyManager*)(addr)); + _corba_impl = SALOMEDS::StudyManager::_duplicate(theManager); + } + else { + _local_impl = NULL; + _corba_impl = SALOMEDS::StudyManager::_duplicate(theManager); + } +} + +SALOMEDS_StudyManager::~SALOMEDS_StudyManager() +{ +} + +SALOMEDSClient_Study* SALOMEDS_StudyManager::NewStudy(const char* study_name) +{ + SALOMEDS_Study* aStudy; + TCollection_AsciiString aName((char*)study_name); + + if(_isLocal) aStudy = new SALOMEDS_Study(_local_impl->NewStudy(aName)); + else aStudy = new SALOMEDS_Study(_corba_impl->NewStudy(aName.ToCString())); + + return aStudy; +} + +SALOMEDSClient_Study* SALOMEDS_StudyManager::Open(const char* theStudyUrl) +{ + SALOMEDS_Study* aStudy; + TCollection_AsciiString aName((char*)theStudyUrl); + + if(_isLocal) aStudy = new SALOMEDS_Study(_local_impl->Open(aName)); + else aStudy = new SALOMEDS_Study(_corba_impl->Open(aName.ToCString())); + + return aStudy; +} + +void SALOMEDS_StudyManager::Close( SALOMEDSClient_Study* theStudy) +{ + //SRN: Pure CORBA close as it does more cleaning then the local one + SALOMEDS::Study_var aStudy = _corba_impl->GetStudyByID(theStudy->StudyId()); + _corba_impl->Close(aStudy); +} + +void SALOMEDS_StudyManager::Save( SALOMEDSClient_Study* theStudy, bool theMultiFile) +{ + //SRN: Pure CORBA save as the save operation require CORBA in any case + SALOMEDS::Study_var aStudy = _corba_impl->GetStudyByID(theStudy->StudyId()); + _corba_impl->Save(aStudy, theMultiFile); +} + +void SALOMEDS_StudyManager::SaveASCII( SALOMEDSClient_Study* theStudy, bool theMultiFile) +{ + //SRN: Pure CORBA save as the save operation require CORBA in any case + SALOMEDS::Study_var aStudy = _corba_impl->GetStudyByID(theStudy->StudyId()); + _corba_impl->SaveASCII(aStudy, theMultiFile); +} + +void SALOMEDS_StudyManager::SaveAs(const char* theUrl, SALOMEDSClient_Study* theStudy, bool theMultiFile) +{ + //SRN: Pure CORBA save as the save operation require CORBA in any case + TCollection_AsciiString anURL((char*)theUrl); + SALOMEDS::Study_var aStudy = _corba_impl->GetStudyByID(theStudy->StudyId()); + _corba_impl->SaveAs(anURL.ToCString(), aStudy, theMultiFile); +} + +void SALOMEDS_StudyManager::SaveAsASCII(const char* theUrl, SALOMEDSClient_Study* theStudy, bool theMultiFile) +{ + //SRN: Pure CORBA save as the save operation require CORBA in any case + TCollection_AsciiString anURL((char*)theUrl); + SALOMEDS::Study_var aStudy = _corba_impl->GetStudyByID(theStudy->StudyId()); + _corba_impl->SaveAsASCII(anURL.ToCString(), aStudy, theMultiFile); +} + +std::vector SALOMEDS_StudyManager::GetOpenStudies() +{ + std::vector aVector; + int aLength, i; + + if(_isLocal) { + Handle(TColStd_HSequenceOfTransient) aSeq = _local_impl->GetOpenStudies(); + aLength = aSeq->Length(); + for(i = 1; i <= aLength; i++) + aVector.push_back(Handle(SALOMEDSImpl_Study)::DownCast(aSeq->Value(i))->Name().ToCString()); + } + else { + SALOMEDS::ListOfOpenStudies_var aSeq = _corba_impl->GetOpenStudies(); + aLength = aSeq->length(); + for(i = 0; i < aLength; i++) + aVector.push_back(aSeq[i].in()); + } + return aVector; +} + +SALOMEDSClient_Study* SALOMEDS_StudyManager::GetStudyByName(const char* theStudyName) +{ + SALOMEDS_Study* aStudy = NULL; + TCollection_AsciiString aName((char*)theStudyName); + if(_isLocal) aStudy = new SALOMEDS_Study(_local_impl->GetStudyByName(aName)); + else aStudy = new SALOMEDS_Study(_corba_impl->GetStudyByName(aName.ToCString())); + return aStudy; +} + +SALOMEDSClient_Study* SALOMEDS_StudyManager::GetStudyByID(int theStudyID) +{ + SALOMEDS_Study* aStudy = NULL; + if(_isLocal) aStudy = new SALOMEDS_Study(_local_impl->GetStudyByID(theStudyID)); + else aStudy = new SALOMEDS_Study(_corba_impl->GetStudyByID(theStudyID)); + return aStudy; +} + +bool SALOMEDS_StudyManager::CanCopy(SALOMEDSClient_SObject* theSO) +{ + SALOMEDS_SObject* aSO = dynamic_cast(theSO); + //SRN: Pure CORBA call as SALOMEDS::Driver required for this method + return _corba_impl->CanCopy(aSO->GetCORBAImpl()); +} + +bool SALOMEDS_StudyManager::Copy(SALOMEDSClient_SObject* theSO) +{ + SALOMEDS_SObject* aSO = dynamic_cast(theSO); + //SRN: Pure CORBA call as SALOMEDS::Driver required for this method + return _corba_impl->Copy(aSO->GetCORBAImpl()); +} + +bool SALOMEDS_StudyManager::CanPaste(SALOMEDSClient_SObject* theSO) +{ + SALOMEDS_SObject* aSO = dynamic_cast(theSO); + //SRN: Pure CORBA call as SALOMEDS::Driver required for this method + return _corba_impl->CanPaste(aSO->GetCORBAImpl()); +} + +SALOMEDSClient_SObject* SALOMEDS_StudyManager::Paste(SALOMEDSClient_SObject* theSO) +{ + SALOMEDS_SObject* aSO = dynamic_cast(theSO); + //SRN: Pure CORBA call as SALOMEDS::Driver required for this method + SALOMEDS_SObject* aResultSO = new SALOMEDS_SObject(_corba_impl->Paste(aSO->GetCORBAImpl())); + return aResultSO; +} + diff --git a/src/SALOMEDS/SALOMEDS_StudyManager.hxx b/src/SALOMEDS/SALOMEDS_StudyManager.hxx new file mode 100644 index 000000000..6d8680227 --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_StudyManager.hxx @@ -0,0 +1,47 @@ +// File : SALOMEDS_StudyManager.hxx +// Author : Sergey RUIN +// Module : SALOME + +#ifndef __SALOMEDS_STUDYMANAGER_H__ +#define __SALOMEDS_STUDYMANAGER_H__ + +#include +#include + +#include "SALOMEDSClient_StudyManager.hxx" +#include "SALOMEDSClient_Study.hxx" +#include "SALOMEDSImpl_StudyManager.hxx" + +// IDL headers + +#include +#include CORBA_SERVER_HEADER(SALOMEDS) + +class SALOMEDS_StudyManager: public SALOMEDSClient_StudyManager +{ +private: + bool _isLocal; + Handle(SALOMEDSImpl_StudyManager) _local_impl; + SALOMEDS::StudyManager_var _corba_impl; +public: + + SALOMEDS_StudyManager(SALOMEDS::StudyManager_ptr theManager); + ~SALOMEDS_StudyManager(); + + virtual SALOMEDSClient_Study* NewStudy(const char* study_name); + virtual SALOMEDSClient_Study* Open(const char* theStudyUrl); + virtual void Close( SALOMEDSClient_Study* theStudy); + virtual void Save( SALOMEDSClient_Study* theStudy, bool theMultiFile); + virtual void SaveASCII( SALOMEDSClient_Study* theStudy, bool theMultiFile); + virtual void SaveAs(const char* theUrl, SALOMEDSClient_Study* theStudy, bool theMultiFile); + virtual void SaveAsASCII(const char* theUrl, SALOMEDSClient_Study* theStudy, bool theMultiFile); + virtual std::vector GetOpenStudies(); + virtual SALOMEDSClient_Study* GetStudyByName(const char* theStudyName) ; + virtual SALOMEDSClient_Study* GetStudyByID(int theStudyID) ; + virtual bool CanCopy(SALOMEDSClient_SObject* theSO); + virtual bool Copy(SALOMEDSClient_SObject* theSO); + virtual bool CanPaste(SALOMEDSClient_SObject* theSO); + virtual SALOMEDSClient_SObject* Paste(SALOMEDSClient_SObject* theSO); +}; + +#endif diff --git a/src/SALOMEDS/SALOMEDS_UseCaseBuilder.cxx b/src/SALOMEDS/SALOMEDS_UseCaseBuilder.cxx new file mode 100644 index 000000000..45ce230c7 --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_UseCaseBuilder.cxx @@ -0,0 +1,147 @@ +// File : SALOMEDS_UseCaseBuilder.cxx +// Author : Sergey RUIN +// Module : SALOME + +using namespace std; + +#include "SALOMEDS_UseCaseBuilder.hxx" + +#include "SALOMEDSImpl_SObject.hxx" +#include "SALOMEDS_SObject.hxx" +#include "SALOMEDSImpl_UseCaseIterator.hxx" +#include "SALOMEDS_UseCaseIterator.hxx" +#include + +SALOMEDS_UseCaseBuilder::SALOMEDS_UseCaseBuilder(const Handle(SALOMEDSImpl_UseCaseBuilder)& theBuilder) +{ + _isLocal = true; + _local_impl = theBuilder; + _corba_impl = SALOMEDS::UseCaseBuilder::_nil(); +} + +SALOMEDS_UseCaseBuilder::SALOMEDS_UseCaseBuilder(SALOMEDS::UseCaseBuilder_ptr theBuilder) +{ + _isLocal = false; + _local_impl = NULL; + _corba_impl = SALOMEDS::UseCaseBuilder::_duplicate(theBuilder); +} + +SALOMEDS_UseCaseBuilder::~SALOMEDS_UseCaseBuilder() +{ +} + +bool SALOMEDS_UseCaseBuilder::Append(SALOMEDSClient_SObject* theObject) +{ + bool ret; + SALOMEDS_SObject* obj = dynamic_cast(theObject); + if(_isLocal) ret = _local_impl->Append(obj->GetLocalImpl()); + else ret = _corba_impl->Append(obj->GetCORBAImpl()); + return ret; +} + +bool SALOMEDS_UseCaseBuilder::Remove(SALOMEDSClient_SObject* theObject) +{ + bool ret; + SALOMEDS_SObject* obj = dynamic_cast(theObject); + if(_isLocal) ret = _local_impl->Remove(obj->GetLocalImpl()); + else ret = _corba_impl->Remove(obj->GetCORBAImpl()); + return ret; +} + +bool SALOMEDS_UseCaseBuilder::AppendTo(SALOMEDSClient_SObject* theFather, SALOMEDSClient_SObject* theObject) +{ + bool ret; + SALOMEDS_SObject* father = dynamic_cast(theFather); + SALOMEDS_SObject* obj = dynamic_cast(theObject); + if(_isLocal) ret = _local_impl->AppendTo(father->GetLocalImpl(), obj->GetLocalImpl()); + else ret = _corba_impl->AppendTo(father->GetCORBAImpl(), obj->GetCORBAImpl()); + return ret; +} + +bool SALOMEDS_UseCaseBuilder::InsertBefore(SALOMEDSClient_SObject* theFirst, SALOMEDSClient_SObject* theNext) +{ + bool ret; + SALOMEDS_SObject* first = dynamic_cast(theFirst); + SALOMEDS_SObject* next = dynamic_cast(theNext); + if(_isLocal) ret = _local_impl->InsertBefore(first->GetLocalImpl(), next->GetLocalImpl()); + else ret = _corba_impl->InsertBefore(first->GetCORBAImpl(), next->GetCORBAImpl()); + return ret; +} + +bool SALOMEDS_UseCaseBuilder::SetCurrentObject(SALOMEDSClient_SObject* theObject) +{ + bool ret; + SALOMEDS_SObject* obj = dynamic_cast(theObject); + if(_isLocal) ret = _local_impl->SetCurrentObject(obj->GetLocalImpl()); + else ret = _corba_impl->SetCurrentObject(obj->GetCORBAImpl()); + return ret; +} + +bool SALOMEDS_UseCaseBuilder::SetRootCurrent() +{ + bool ret; + if(_isLocal) ret = _local_impl->SetRootCurrent(); + else ret = _corba_impl->SetRootCurrent(); + return ret; +} + +bool SALOMEDS_UseCaseBuilder::HasChildren(SALOMEDSClient_SObject* theObject) +{ + bool ret; + SALOMEDS_SObject* obj = dynamic_cast(theObject); + if(_isLocal) ret = _local_impl->HasChildren(obj->GetLocalImpl()); + else ret = _corba_impl->HasChildren(obj->GetCORBAImpl()); + return ret; +} + +bool SALOMEDS_UseCaseBuilder::IsUseCase(SALOMEDSClient_SObject* theObject) +{ + bool ret; + SALOMEDS_SObject* obj = dynamic_cast(theObject); + if(_isLocal) ret = _local_impl->IsUseCase(obj->GetLocalImpl()); + else ret = _corba_impl->IsUseCase(obj->GetCORBAImpl()); + return ret; +} + +bool SALOMEDS_UseCaseBuilder::SetName(const char* theName) +{ + bool ret; + TCollection_AsciiString aName((char*)theName); + if(_isLocal) ret = _local_impl->SetName(aName); + else ret = _corba_impl->SetName(aName.ToCString()); + return ret; +} + +SALOMEDSClient_SObject* SALOMEDS_UseCaseBuilder::GetCurrentObject() +{ + SALOMEDS_SObject* obj = NULL; + if(_isLocal) obj = new SALOMEDS_SObject(_local_impl->GetCurrentObject()); + else obj = new SALOMEDS_SObject(_corba_impl->GetCurrentObject()); + return obj; +} + +char* SALOMEDS_UseCaseBuilder::GetName() +{ + TCollection_AsciiString aName; + if(_isLocal) aName = _local_impl->GetName(); + else aName = _corba_impl->GetName(); + return aName.ToCString(); +} + +SALOMEDSClient_SObject* SALOMEDS_UseCaseBuilder::AddUseCase(const char* theName) +{ + SALOMEDS_SObject* obj = NULL; + TCollection_AsciiString aName((char*)theName); + if(_isLocal) obj = new SALOMEDS_SObject(_local_impl->AddUseCase(aName)); + else obj = new SALOMEDS_SObject(_corba_impl->AddUseCase(aName.ToCString())); + return obj; +} + +SALOMEDSClient_UseCaseIterator* SALOMEDS_UseCaseBuilder::GetUseCaseIterator(SALOMEDSClient_SObject* theObject) +{ + SALOMEDS_UseCaseIterator* it = NULL; + SALOMEDS_SObject* obj = dynamic_cast(theObject); + if(_isLocal) it = new SALOMEDS_UseCaseIterator(_local_impl->GetUseCaseIterator(obj->GetLocalImpl())); + else it = new SALOMEDS_UseCaseIterator(_corba_impl->GetUseCaseIterator(obj->GetCORBAImpl())); + return it; +} diff --git a/src/SALOMEDS/SALOMEDS_UseCaseBuilder.hxx b/src/SALOMEDS/SALOMEDS_UseCaseBuilder.hxx new file mode 100644 index 000000000..125869013 --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_UseCaseBuilder.hxx @@ -0,0 +1,46 @@ +// File : SALOMEDS_UseCaseBuilder.hxx +// Author : Sergey RUIN +// Module : SALOME + +#ifndef __SALOMEDS_USECaseBuilder_H__ +#define __SALOMEDS_USECaseBuilder_H__ + +#include "SALOMEDSClient_UseCaseIterator.hxx" +#include "SALOMEDSClient_UseCaseBuilder.hxx" +#include "SALOMEDSClient_SObject.hxx" +#include "SALOMEDSImpl_UseCaseBuilder.hxx" + +// IDL headers +#include +#include CORBA_SERVER_HEADER(SALOMEDS) + +class SALOMEDS_UseCaseBuilder: public SALOMEDSClient_UseCaseBuilder +{ + +private: + bool _isLocal; + Handle(SALOMEDSImpl_UseCaseBuilder) _local_impl; + SALOMEDS::UseCaseBuilder_var _corba_impl; + +public: + + SALOMEDS_UseCaseBuilder(const Handle(SALOMEDSImpl_UseCaseBuilder)& theBuilder); + SALOMEDS_UseCaseBuilder(SALOMEDS::UseCaseBuilder_ptr theBuilder); + ~SALOMEDS_UseCaseBuilder(); + + virtual bool Append(SALOMEDSClient_SObject* theObject); + virtual bool Remove(SALOMEDSClient_SObject* theObject); + virtual bool AppendTo(SALOMEDSClient_SObject* theFather, SALOMEDSClient_SObject* theObject); + virtual bool InsertBefore(SALOMEDSClient_SObject* theFirst, SALOMEDSClient_SObject* theNext); + virtual bool SetCurrentObject(SALOMEDSClient_SObject* theObject); + virtual bool SetRootCurrent(); + virtual bool HasChildren(SALOMEDSClient_SObject* theObject); + virtual bool IsUseCase(SALOMEDSClient_SObject* theObject); + virtual bool SetName(const char* theName); + virtual SALOMEDSClient_SObject* GetCurrentObject(); + virtual char* GetName(); + virtual SALOMEDSClient_SObject* AddUseCase(const char* theName); + virtual SALOMEDSClient_UseCaseIterator* GetUseCaseIterator(SALOMEDSClient_SObject* anObject); + +}; +#endif diff --git a/src/SALOMEDS/SALOMEDS_UseCaseIterator.cxx b/src/SALOMEDS/SALOMEDS_UseCaseIterator.cxx new file mode 100644 index 000000000..bc8092491 --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_UseCaseIterator.cxx @@ -0,0 +1,54 @@ +// File : SALOMEDS_UseCaseIterator.cxx +// Author : Sergey RUIN +// Module : SALOME + +using namespace std; + +#include "SALOMEDS_UseCaseIterator.hxx" +#include "SALOMEDS_SObject.hxx" + +SALOMEDS_UseCaseIterator::SALOMEDS_UseCaseIterator(const Handle(SALOMEDSImpl_UseCaseIterator)& theIterator) +{ + _isLocal = true; + _local_impl = theIterator; + _corba_impl = SALOMEDS::UseCaseIterator::_nil(); +} + +SALOMEDS_UseCaseIterator::SALOMEDS_UseCaseIterator(SALOMEDS::UseCaseIterator_ptr theIterator) +{ + _isLocal = false; + _local_impl = NULL; + _corba_impl = SALOMEDS::UseCaseIterator::_duplicate(theIterator); +} + +SALOMEDS_UseCaseIterator::~SALOMEDS_UseCaseIterator() +{ +} + +void SALOMEDS_UseCaseIterator::Init(bool theAllLevels) +{ + if(_isLocal) _local_impl->Init(theAllLevels); + else _corba_impl->Init(theAllLevels); +} + +bool SALOMEDS_UseCaseIterator::More() +{ + bool ret; + if(_isLocal) ret = _local_impl->More(); + else ret = _corba_impl->More(); + return ret; +} + +void SALOMEDS_UseCaseIterator::Next() +{ + if(_isLocal) _local_impl->Next(); + else _corba_impl->Next(); +} + +SALOMEDSClient_SObject* SALOMEDS_UseCaseIterator::Value() +{ + SALOMEDS_SObject* aSO; + if(_isLocal) aSO = new SALOMEDS_SObject(_local_impl->Value()); + else aSO = new SALOMEDS_SObject(_corba_impl->Value()); + return aSO; +} diff --git a/src/SALOMEDS/SALOMEDS_UseCaseIterator.hxx b/src/SALOMEDS/SALOMEDS_UseCaseIterator.hxx new file mode 100644 index 000000000..35533515a --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_UseCaseIterator.hxx @@ -0,0 +1,35 @@ +// File : SALOMEDS_UseCaseIterator.hxx +// Author : Sergey RUIN +// Module : SALOME + +#ifndef __SALOMEDS_USECASEITERATOR_H__ +#define __SALOMEDS_USECASEITERATOR_H__ + +#include "SALOMEDSClient_UseCaseIterator.hxx" +#include "SALOMEDSClient_SObject.hxx" +#include "SALOMEDSImpl_UseCaseIterator.hxx" + +// IDL headers +#include +#include CORBA_SERVER_HEADER(SALOMEDS) + +class SALOMEDS_UseCaseIterator: public SALOMEDSClient_UseCaseIterator +{ +private: + bool _isLocal; + Handle(SALOMEDSImpl_UseCaseIterator) _local_impl; + SALOMEDS::UseCaseIterator_var _corba_impl; + +public: + + SALOMEDS_UseCaseIterator(const Handle(SALOMEDSImpl_UseCaseIterator)& theIterator); + SALOMEDS_UseCaseIterator(SALOMEDS::UseCaseIterator_ptr theIterator); + ~SALOMEDS_UseCaseIterator(); + + virtual void Init(bool theAllLevels); + virtual bool More(); + virtual void Next(); + virtual SALOMEDSClient_SObject* Value(); +}; + +#endif