From 6da1ea661b7a0fc0ac6b15ff8e021683a32ffca3 Mon Sep 17 00:00:00 2001 From: srn Date: Mon, 4 Apr 2005 07:03:27 +0000 Subject: [PATCH] Modified attributes to comply with modifications in the method's names in SALOMEDSImpl --- src/SALOMEDS/Makefile.in | 48 ++++++++++++++++- src/SALOMEDS/SALOMEDS_AttributeComment_i.cxx | 4 +- src/SALOMEDS/SALOMEDS_AttributeDrawable_i.cxx | 4 +- .../SALOMEDS_AttributeExpandable_i.cxx | 4 +- .../SALOMEDS_AttributeExternalFileDef_i.cxx | 4 +- src/SALOMEDS/SALOMEDS_AttributeFileType_i.cxx | 4 +- src/SALOMEDS/SALOMEDS_AttributeInteger_i.cxx | 4 +- src/SALOMEDS/SALOMEDS_AttributeName_i.cxx | 4 +- src/SALOMEDS/SALOMEDS_AttributeOpened_i.cxx | 4 +- .../SALOMEDS_AttributePersistentRef_i.cxx | 4 +- src/SALOMEDS/SALOMEDS_AttributePixMap_i.cxx | 8 ++- src/SALOMEDS/SALOMEDS_AttributeReal_i.cxx | 4 +- .../SALOMEDS_AttributeSelectable_i.cxx | 4 +- .../SALOMEDS_AttributeTableOfInteger_i.cxx | 47 +++-------------- .../SALOMEDS_AttributeTableOfReal_i.cxx | 49 +++--------------- .../SALOMEDS_AttributeTableOfString_i.cxx | 51 +++---------------- src/SALOMEDS/SALOMEDS_AttributeTarget_i.cxx | 24 ++++----- .../SALOMEDS_AttributeTextColor_i.cxx | 2 +- ...SALOMEDS_AttributeTextHighlightColor_i.cxx | 2 +- src/SALOMEDS/SALOMEDS_GenericAttribute_i.cxx | 36 ++++++++++++- src/SALOMEDS/SALOMEDS_GenericAttribute_i.hxx | 6 ++- src/SALOMEDS/SALOMEDS_SObject_i.cxx | 24 +++++++++ src/SALOMEDS/SALOMEDS_SObject_i.hxx | 2 + src/SALOMEDS/SALOMEDS_StudyManager_i.cxx | 23 +++++++++ src/SALOMEDS/SALOMEDS_StudyManager_i.hxx | 2 + src/SALOMEDS/SALOMEDS_Study_i.cxx | 23 +++++++++ src/SALOMEDS/SALOMEDS_Study_i.hxx | 2 + 27 files changed, 220 insertions(+), 173 deletions(-) diff --git a/src/SALOMEDS/Makefile.in b/src/SALOMEDS/Makefile.in index e066eec2a..9381217ce 100644 --- a/src/SALOMEDS/Makefile.in +++ b/src/SALOMEDS/Makefile.in @@ -13,7 +13,12 @@ VPATH=.:@srcdir@:@top_srcdir@/idl:$(top_srcdir)/idl EXPORT_HEADERS= \ SALOMEDS_StudyManager_i.hxx \ - SALOMEDS_Driver_i.hxx + SALOMEDS_Driver_i.hxx \ + SALOMEDS_StudyManager.hxx \ + SALOMEDS_Study.hxx \ + SALOMEDS_SObject.hxx \ + SALOMEDS_SComponent.hxx \ + SALOMEDS_GenericAttribute.hxx # Libraries targets @@ -58,7 +63,46 @@ LIB_SRC = \ SALOMEDS_AttributeTableOfReal_i.cxx \ SALOMEDS_AttributeTableOfString_i.cxx \ SALOMEDS_AttributeStudyProperties_i.cxx \ - SALOMEDS_AttributePythonObject_i.cxx + SALOMEDS_AttributePythonObject_i.cxx \ + SALOMEDS_SObject.cxx \ + SALOMEDS_SComponent.cxx \ + SALOMEDS_GenericAttribute.cxx \ + SALOMEDS_ChildIterator.cxx \ + SALOMEDS_SComponentIterator.cxx \ + SALOMEDS_UseCaseIterator.cxx \ + SALOMEDS_UseCaseBuilder.cxx \ + SALOMEDS_StudyBuilder.cxx \ + SALOMEDS_Study.cxx \ + SALOMEDS_StudyManager.cxx \ + SALOMEDS_AttributeStudyProperties.cxx \ + SALOMEDS_AttributeComment.cxx \ + SALOMEDS_AttributeDrawable.cxx \ + SALOMEDS_AttributeExpandable.cxx \ + SALOMEDS_AttributeExternalFileDef.cxx \ + SALOMEDS_AttributeFileType.cxx \ + SALOMEDS_AttributeFlags.cxx \ + SALOMEDS_AttributeGraphic.cxx \ + SALOMEDS_AttributeIOR.cxx \ + SALOMEDS_AttributeInteger.cxx \ + SALOMEDS_AttributeLocalID.cxx \ + SALOMEDS_AttributeName.cxx \ + SALOMEDS_AttributeOpened.cxx \ + SALOMEDS_AttributePythonObject.cxx \ + SALOMEDS_AttributeReal.cxx \ + SALOMEDS_AttributeSelectable.cxx \ + SALOMEDS_AttributeSequenceOfInteger.cxx \ + SALOMEDS_AttributePersistentRef.cxx \ + SALOMEDS_AttributePixMap.cxx \ + SALOMEDS_AttributeSequenceOfReal.cxx \ + SALOMEDS_AttributeTableOfInteger.cxx \ + SALOMEDS_AttributeTableOfReal.cxx \ + SALOMEDS_AttributeTableOfString.cxx \ + SALOMEDS_AttributeTarget.cxx \ + SALOMEDS_AttributeTextColor.cxx \ + SALOMEDS_AttributeTextHighlightColor.cxx \ + SALOMEDS_AttributeTreeNode.cxx \ + SALOMEDS_AttributeUserID.cxx + # Executables targets BIN = SALOMEDS_Server SALOMEDS_Client diff --git a/src/SALOMEDS/SALOMEDS_AttributeComment_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeComment_i.cxx index e1565166a..737ee2bf2 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeComment_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeComment_i.cxx @@ -14,7 +14,7 @@ char* SALOMEDS_AttributeComment_i::Value() SALOMEDS::Locker lock; CORBA::String_var c_s = - CORBA::string_dup(TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeComment)::DownCast(_impl)->Get()).ToCString()); + CORBA::string_dup(TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeComment)::DownCast(_impl)->Value()).ToCString()); return c_s._retn(); } @@ -24,5 +24,5 @@ void SALOMEDS_AttributeComment_i::SetValue(const char* value) CheckLocked(); TCollection_AsciiString aStr((char*)value); - Handle(SALOMEDSImpl_AttributeComment)::DownCast(_impl)->Set(TCollection_ExtendedString(aStr)); + Handle(SALOMEDSImpl_AttributeComment)::DownCast(_impl)->SetValue(TCollection_ExtendedString(aStr)); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeDrawable_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeDrawable_i.cxx index f39a1d193..675361f98 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeDrawable_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeDrawable_i.cxx @@ -10,13 +10,13 @@ using namespace std; CORBA::Boolean SALOMEDS_AttributeDrawable_i::IsDrawable() { SALOMEDS::Locker lock; - return (Handle(SALOMEDSImpl_AttributeDrawable)::DownCast(_impl)->Get() == 1); + return (Handle(SALOMEDSImpl_AttributeDrawable)::DownCast(_impl)->IsDrawable() == 1); } void SALOMEDS_AttributeDrawable_i::SetDrawable(CORBA::Boolean value) { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeDrawable)::DownCast(_impl)->Set(value); + Handle(SALOMEDSImpl_AttributeDrawable)::DownCast(_impl)->SetDrawable(value); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeExpandable_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeExpandable_i.cxx index 11fe92a7e..192a9ba8d 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeExpandable_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeExpandable_i.cxx @@ -9,13 +9,13 @@ using namespace std; CORBA::Boolean SALOMEDS_AttributeExpandable_i::IsExpandable() { SALOMEDS::Locker lock; - return (Handle(SALOMEDSImpl_AttributeExpandable)::DownCast(_impl)->Get() == 1); + return (Handle(SALOMEDSImpl_AttributeExpandable)::DownCast(_impl)->IsExpandable() == 1); } void SALOMEDS_AttributeExpandable_i::SetExpandable(CORBA::Boolean value) { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeExpandable)::DownCast(_impl)->Set(value); + Handle(SALOMEDSImpl_AttributeExpandable)::DownCast(_impl)->SetExpandable(value); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeExternalFileDef_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeExternalFileDef_i.cxx index cb9fd5938..9795c3342 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeExternalFileDef_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeExternalFileDef_i.cxx @@ -11,7 +11,7 @@ char* SALOMEDS_AttributeExternalFileDef_i::Value() { SALOMEDS::Locker lock; CORBA::String_var c_s = - CORBA::string_dup(TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeExternalFileDef)::DownCast(_impl)->Get()).ToCString()); + CORBA::string_dup(TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeExternalFileDef)::DownCast(_impl)->Value()).ToCString()); return c_s._retn(); } @@ -20,5 +20,5 @@ void SALOMEDS_AttributeExternalFileDef_i::SetValue(const char* value) SALOMEDS::Locker lock; CheckLocked(); CORBA::String_var Str = CORBA::string_dup(value); - Handle(SALOMEDSImpl_AttributeExternalFileDef)::DownCast(_impl)->Set(TCollection_ExtendedString(Str)); + Handle(SALOMEDSImpl_AttributeExternalFileDef)::DownCast(_impl)->SetValue(TCollection_ExtendedString(Str)); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeFileType_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeFileType_i.cxx index 525e51f04..84bdab1e9 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeFileType_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeFileType_i.cxx @@ -11,7 +11,7 @@ char* SALOMEDS_AttributeFileType_i::Value() { SALOMEDS::Locker lock; CORBA::String_var c_s = - CORBA::string_dup(TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeFileType)::DownCast(_impl)->Get()).ToCString()); + CORBA::string_dup(TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeFileType)::DownCast(_impl)->Value()).ToCString()); return c_s._retn(); } @@ -20,5 +20,5 @@ void SALOMEDS_AttributeFileType_i::SetValue(const char* value) SALOMEDS::Locker lock; CheckLocked(); CORBA::String_var Str = CORBA::string_dup(value); - Handle(SALOMEDSImpl_AttributeFileType)::DownCast(_impl)->Set(TCollection_ExtendedString(Str)); + Handle(SALOMEDSImpl_AttributeFileType)::DownCast(_impl)->SetValue(TCollection_ExtendedString(Str)); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeInteger_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeInteger_i.cxx index 2a08dddfd..601956099 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeInteger_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeInteger_i.cxx @@ -9,14 +9,14 @@ using namespace std; CORBA::Long SALOMEDS_AttributeInteger_i::Value() { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeInteger)::DownCast(_impl)->Get(); + return Handle(SALOMEDSImpl_AttributeInteger)::DownCast(_impl)->Value(); } void SALOMEDS_AttributeInteger_i::SetValue(CORBA::Long value) { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeInteger)::DownCast(_impl)->Set(value); + Handle(SALOMEDSImpl_AttributeInteger)::DownCast(_impl)->SetValue(value); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeName_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeName_i.cxx index 14a4d423e..5bb4cf13f 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeName_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeName_i.cxx @@ -11,7 +11,7 @@ char* SALOMEDS_AttributeName_i::Value() { SALOMEDS::Locker lock; CORBA::String_var c_s = - CORBA::string_dup(TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeName)::DownCast(_impl)->Get()).ToCString()); + CORBA::string_dup(TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeName)::DownCast(_impl)->Value()).ToCString()); return c_s._retn(); } @@ -19,5 +19,5 @@ void SALOMEDS_AttributeName_i::SetValue(const char* value) { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeName)::DownCast(_impl)->Set(TCollection_ExtendedString((char*)value)); + Handle(SALOMEDSImpl_AttributeName)::DownCast(_impl)->SetValue(TCollection_ExtendedString((char*)value)); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeOpened_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeOpened_i.cxx index 5c1fb6522..a1e77dc16 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeOpened_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeOpened_i.cxx @@ -9,7 +9,7 @@ using namespace std; CORBA::Boolean SALOMEDS_AttributeOpened_i::IsOpened() { SALOMEDS::Locker lock; - return (Handle(SALOMEDSImpl_AttributeOpened)::DownCast(_impl)->Get() == 1); + return (Handle(SALOMEDSImpl_AttributeOpened)::DownCast(_impl)->IsOpened() == 1); } void SALOMEDS_AttributeOpened_i::SetOpened(CORBA::Boolean value) @@ -18,5 +18,5 @@ void SALOMEDS_AttributeOpened_i::SetOpened(CORBA::Boolean value) Standard_Integer val = 0; if (value != 0) val = 1; - Handle(SALOMEDSImpl_AttributeOpened)::DownCast(_impl)->Set(val); + Handle(SALOMEDSImpl_AttributeOpened)::DownCast(_impl)->SetOpened(val); } diff --git a/src/SALOMEDS/SALOMEDS_AttributePersistentRef_i.cxx b/src/SALOMEDS/SALOMEDS_AttributePersistentRef_i.cxx index 02fca5517..cabd447ac 100644 --- a/src/SALOMEDS/SALOMEDS_AttributePersistentRef_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributePersistentRef_i.cxx @@ -11,7 +11,7 @@ char* SALOMEDS_AttributePersistentRef_i::Value() { SALOMEDS::Locker lock; CORBA::String_var c_s = - CORBA::string_dup(TCollection_AsciiString(Handle(SALOMEDSImpl_AttributePersistentRef)::DownCast(_impl)->Get()).ToCString()); + CORBA::string_dup(TCollection_AsciiString(Handle(SALOMEDSImpl_AttributePersistentRef)::DownCast(_impl)->Value()).ToCString()); return c_s._retn(); } @@ -20,5 +20,5 @@ void SALOMEDS_AttributePersistentRef_i::SetValue(const char* value) SALOMEDS::Locker lock; CheckLocked(); CORBA::String_var Str = CORBA::string_dup(value); - Handle(SALOMEDSImpl_AttributePersistentRef)::DownCast(_impl)->Set(TCollection_ExtendedString(Str)); + Handle(SALOMEDSImpl_AttributePersistentRef)::DownCast(_impl)->SetValue(TCollection_ExtendedString(Str)); } diff --git a/src/SALOMEDS/SALOMEDS_AttributePixMap_i.cxx b/src/SALOMEDS/SALOMEDS_AttributePixMap_i.cxx index 56532dba3..df6f837fd 100644 --- a/src/SALOMEDS/SALOMEDS_AttributePixMap_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributePixMap_i.cxx @@ -9,16 +9,14 @@ using namespace std; CORBA::Boolean SALOMEDS_AttributePixMap_i::HasPixMap() { - TCollection_ExtendedString S = Handle(SALOMEDSImpl_AttributePixMap)::DownCast(_impl)->Get(); - if (strcmp(TCollection_AsciiString(S).ToCString(), "None") == 0) return Standard_False; - return Standard_True; + return Handle(SALOMEDSImpl_AttributePixMap)::DownCast(_impl)->HasPixMap(); } char* SALOMEDS_AttributePixMap_i::GetPixMap() { SALOMEDS::Locker lock; CORBA::String_var S = - CORBA::string_dup(TCollection_AsciiString(Handle(SALOMEDSImpl_AttributePixMap)::DownCast(_impl)->Get()).ToCString()); + CORBA::string_dup(TCollection_AsciiString(Handle(SALOMEDSImpl_AttributePixMap)::DownCast(_impl)->GetPixMap()).ToCString()); return S._retn(); } @@ -27,6 +25,6 @@ void SALOMEDS_AttributePixMap_i::SetPixMap(const char* value) SALOMEDS::Locker lock; CheckLocked(); CORBA::String_var Str = CORBA::string_dup(value); - Handle(SALOMEDSImpl_AttributePixMap)::DownCast(_impl)->Set(TCollection_ExtendedString(Str)); + Handle(SALOMEDSImpl_AttributePixMap)::DownCast(_impl)->SetPixMap(TCollection_ExtendedString(Str)); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeReal_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeReal_i.cxx index 7278f0af3..aaeae7ee1 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeReal_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeReal_i.cxx @@ -12,13 +12,13 @@ using namespace std; CORBA::Double SALOMEDS_AttributeReal_i::Value() { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeReal)::DownCast(_impl)->Get(); + return Handle(SALOMEDSImpl_AttributeReal)::DownCast(_impl)->Value(); } void SALOMEDS_AttributeReal_i::SetValue(CORBA::Double value) { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeReal)::DownCast(_impl)->Set(value); + Handle(SALOMEDSImpl_AttributeReal)::DownCast(_impl)->SetValue(value); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeSelectable_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeSelectable_i.cxx index 53b53becc..eb89f24dc 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeSelectable_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeSelectable_i.cxx @@ -9,7 +9,7 @@ using namespace std; CORBA::Boolean SALOMEDS_AttributeSelectable_i::IsSelectable() { SALOMEDS::Locker lock; - return (Handle(SALOMEDSImpl_AttributeSelectable)::DownCast(_impl)->Get() == 1); + return (Handle(SALOMEDSImpl_AttributeSelectable)::DownCast(_impl)->IsSelectable() == 1); } void SALOMEDS_AttributeSelectable_i::SetSelectable(CORBA::Boolean value) @@ -17,6 +17,6 @@ void SALOMEDS_AttributeSelectable_i::SetSelectable(CORBA::Boolean value) SALOMEDS::Locker lock; Standard_Integer val = 0; if (value != 0) val = 1; - Handle(SALOMEDSImpl_AttributeSelectable)::DownCast(_impl)->Set(val); + Handle(SALOMEDSImpl_AttributeSelectable)::DownCast(_impl)->SetSelectable(val); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeTableOfInteger_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeTableOfInteger_i.cxx index a740a184b..d8adf45ba 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTableOfInteger_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTableOfInteger_i.cxx @@ -15,31 +15,9 @@ using namespace std; #include #include -#define SEPARATOR '\1' - UNEXPECT_CATCH(ATI_IncorrectIndex, SALOMEDS::AttributeTableOfInteger::IncorrectIndex); UNEXPECT_CATCH(ATI_IncorrectArgumentLength, SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength); -static TCollection_ExtendedString getUnit(TCollection_ExtendedString theString) -{ - TCollection_ExtendedString aString(theString); - int aPos = aString.Search(SEPARATOR); - if(aPos <= 0 || aPos == aString.Length() ) return TCollection_ExtendedString(); - return aString.Split(aPos); -} - -static TCollection_ExtendedString getTitle(TCollection_ExtendedString theString) -{ - TCollection_ExtendedString aString(theString); - int aPos = aString.Search(SEPARATOR); - if(aPos < 1) return aString; - if(aPos == 1) return TCollection_ExtendedString(); - aString.Split(aPos-1); - return aString; -} - - - void SALOMEDS_AttributeTableOfInteger_i::SetTitle(const char* theTitle) { SALOMEDS::Locker lock; @@ -64,15 +42,7 @@ void SALOMEDS_AttributeTableOfInteger_i::SetRowTitle(CORBA::Long theIndex, const CheckLocked(); Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl); if (theIndex <= 0 || theIndex > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfInteger::IncorrectIndex(); - CORBA::String_var aStr = CORBA::string_dup(theTitle); - TCollection_ExtendedString aTitle(aStr); - TCollection_ExtendedString aUnit = getUnit(aTable->GetRowTitle(theIndex)); - if(aUnit.Length() > 0) { - aTitle += SEPARATOR; - aTitle += aUnit; - } - - aTable->SetRowTitle(theIndex, aTitle); + aTable->SetRowTitle(theIndex, TCollection_ExtendedString((char*)theTitle)); } void SALOMEDS_AttributeTableOfInteger_i::SetRowTitles(const SALOMEDS::StringSeq& theTitles) @@ -95,7 +65,7 @@ SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfInteger_i::GetRowTitles() SALOMEDS::StringSeq_var aTitles = new SALOMEDS::StringSeq; aTitles->length(aTable->GetNbRows()); for(int i = 0; i < aTitles->length(); i++) - aTitles[i] = CORBA::string_dup(TCollection_AsciiString(getTitle(aTable->GetRowTitle(i + 1))).ToCString()); + aTitles[i] = CORBA::string_dup(TCollection_AsciiString(aTable->GetRowTitle(i + 1)).ToCString()); return aTitles._retn(); } @@ -120,7 +90,7 @@ void SALOMEDS_AttributeTableOfInteger_i::SetColumnTitles(const SALOMEDS::StringS Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl); if (theTitles.length() != aTable->GetNbColumns()) throw SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength(); for (int i = 0; i < theTitles.length(); i++) { - SetColumnTitle(i + 1, theTitles[i]); + aTable->SetColumnTitle(i + 1, (char*)theTitles[i].in()); } } @@ -144,12 +114,7 @@ void SALOMEDS_AttributeTableOfInteger_i::SetRowUnit(CORBA::Long theIndex, const CheckLocked(); Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl); if (theIndex <= 0 || theIndex > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfInteger::IncorrectIndex(); - CORBA::String_var aStr = CORBA::string_dup(theUnit); - TCollection_ExtendedString aTitle = getTitle(aTable->GetRowTitle(theIndex)); - TCollection_ExtendedString aUnit(aStr); - aTitle += SEPARATOR; - aTitle += aUnit; - aTable->SetRowTitle(theIndex, aTitle); + aTable->SetRowUnit(theIndex, TCollection_ExtendedString((char*)theUnit)); } void SALOMEDS_AttributeTableOfInteger_i::SetRowUnits(const SALOMEDS::StringSeq& theUnits) @@ -161,7 +126,7 @@ void SALOMEDS_AttributeTableOfInteger_i::SetRowUnits(const SALOMEDS::StringSeq& Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl); if (theUnits.length() != aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength(); for (int i = 0; i < theUnits.length(); i++) { - SetRowUnit(i + 1, theUnits[i]); + aTable->SetRowUnit(i + 1, (char*)theUnits[i].in()); } } @@ -172,7 +137,7 @@ SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfInteger_i::GetRowUnits() SALOMEDS::StringSeq_var aUnits = new SALOMEDS::StringSeq; aUnits->length(aTable->GetNbRows()); for(int i = 0; i < aUnits->length(); i++) - aUnits[i] = CORBA::string_dup(TCollection_AsciiString(getUnit(aTable->GetRowTitle(i + 1))).ToCString()); + aUnits[i] = CORBA::string_dup(TCollection_AsciiString(aTable->GetRowUnit(i + 1)).ToCString()); return aUnits._retn(); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeTableOfReal_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeTableOfReal_i.cxx index a6c0d7504..d32a1399a 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTableOfReal_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTableOfReal_i.cxx @@ -17,28 +17,6 @@ using namespace std; UNEXPECT_CATCH(ATR_IncorrectIndex, SALOMEDS::AttributeTableOfReal::IncorrectIndex); UNEXPECT_CATCH(ATR_IncorrectArgumentLength, SALOMEDS::AttributeTableOfReal::IncorrectArgumentLength); -#define SEPARATOR '\1' - -static TCollection_ExtendedString getUnit(TCollection_ExtendedString theString) -{ - TCollection_ExtendedString aString(theString); - int aPos = aString.Search(SEPARATOR); - if(aPos <= 0 || aPos == aString.Length() ) return TCollection_ExtendedString(); - return aString.Split(aPos); -} - -static TCollection_ExtendedString getTitle(TCollection_ExtendedString theString) -{ - TCollection_ExtendedString aString(theString); - int aPos = aString.Search(SEPARATOR); - if(aPos < 1) return aString; - if(aPos == 1) return TCollection_ExtendedString(); - aString.Split(aPos-1); - return aString; -} - - - void SALOMEDS_AttributeTableOfReal_i::SetTitle(const char* theTitle) { SALOMEDS::Locker lock; @@ -64,15 +42,7 @@ void SALOMEDS_AttributeTableOfReal_i::SetRowTitle(CORBA::Long theIndex, const ch CheckLocked(); Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl); if (theIndex <= 0 || theIndex > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfReal::IncorrectIndex(); - CORBA::String_var aStr = CORBA::string_dup(theTitle); - TCollection_ExtendedString aTitle(aStr); - TCollection_ExtendedString aUnit = getUnit(aTable->GetRowTitle(theIndex)); - if(aUnit.Length() > 0) { - aTitle += SEPARATOR; - aTitle += aUnit; - } - - aTable->SetRowTitle(theIndex, aTitle); + aTable->SetRowTitle(theIndex, TCollection_ExtendedString((char*)theTitle)); } void SALOMEDS_AttributeTableOfReal_i::SetRowTitles(const SALOMEDS::StringSeq& theTitles) @@ -84,7 +54,7 @@ void SALOMEDS_AttributeTableOfReal_i::SetRowTitles(const SALOMEDS::StringSeq& th Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl); if (theTitles.length() != aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfReal::IncorrectArgumentLength(); for (int i = 0; i < theTitles.length(); i++) { - SetRowTitle(i + 1, theTitles[i]); + aTable->SetRowTitle(i + 1, (char*)theTitles[i].in()); } } @@ -95,7 +65,7 @@ SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfReal_i::GetRowTitles() SALOMEDS::StringSeq_var aTitles = new SALOMEDS::StringSeq; aTitles->length(aTable->GetNbRows()); for(int i = 0; i < aTitles->length(); i++) - aTitles[i] = CORBA::string_dup(TCollection_AsciiString(getTitle(aTable->GetRowTitle(i + 1))).ToCString()); + aTitles[i] = CORBA::string_dup(TCollection_AsciiString(aTable->GetRowTitle(i + 1)).ToCString()); return aTitles._retn(); } @@ -120,7 +90,7 @@ void SALOMEDS_AttributeTableOfReal_i::SetColumnTitles(const SALOMEDS::StringSeq& Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl); if (theTitles.length() != aTable->GetNbColumns()) throw SALOMEDS::AttributeTableOfReal::IncorrectArgumentLength(); for (int i = 0; i < theTitles.length(); i++) { - SetColumnTitle(i + 1, theTitles[i]); + aTable->SetColumnTitle(i + 1, (char*)theTitles[i].in()); } } @@ -144,12 +114,7 @@ void SALOMEDS_AttributeTableOfReal_i::SetRowUnit(CORBA::Long theIndex, const cha CheckLocked(); Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl); if (theIndex <= 0 || theIndex > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfReal::IncorrectIndex(); - CORBA::String_var aStr = CORBA::string_dup(theUnit); - TCollection_ExtendedString aTitle = getTitle(aTable->GetRowTitle(theIndex)); - TCollection_ExtendedString aUnit(aStr); - aTitle += SEPARATOR; - aTitle += aUnit; - aTable->SetRowTitle(theIndex, aTitle); + aTable->SetRowUnit(theIndex, TCollection_ExtendedString((char*)theUnit)); } void SALOMEDS_AttributeTableOfReal_i::SetRowUnits(const SALOMEDS::StringSeq& theUnits) @@ -161,7 +126,7 @@ void SALOMEDS_AttributeTableOfReal_i::SetRowUnits(const SALOMEDS::StringSeq& the Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl); if (theUnits.length() != aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfReal::IncorrectArgumentLength(); for (int i = 0; i < theUnits.length(); i++) { - SetRowUnit(i + 1, theUnits[i]); + aTable->SetRowUnit(i + 1, (char*)theUnits[i].in()); } } @@ -172,7 +137,7 @@ SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfReal_i::GetRowUnits() SALOMEDS::StringSeq_var aUnits = new SALOMEDS::StringSeq; aUnits->length(aTable->GetNbRows()); for(int i = 0; i < aUnits->length(); i++) - aUnits[i] = CORBA::string_dup(TCollection_AsciiString(getUnit(aTable->GetRowTitle(i + 1))).ToCString()); + aUnits[i] = CORBA::string_dup(TCollection_AsciiString(aTable->GetRowTitle(i + 1)).ToCString()); return aUnits._retn(); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeTableOfString_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeTableOfString_i.cxx index 844322372..414424781 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTableOfString_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTableOfString_i.cxx @@ -20,28 +20,6 @@ using namespace std; UNEXPECT_CATCH(ATS_IncorrectIndex, SALOMEDS::AttributeTableOfString::IncorrectIndex); UNEXPECT_CATCH(ATS_IncorrectArgumentLength, SALOMEDS::AttributeTableOfString::IncorrectArgumentLength); -#define SEPARATOR '\1' - -static TCollection_ExtendedString getUnit(TCollection_ExtendedString theString) -{ - TCollection_ExtendedString aString(theString); - int aPos = aString.Search(SEPARATOR); - if(aPos <= 0 || aPos == aString.Length() ) return TCollection_ExtendedString(); - return aString.Split(aPos); -} - -static TCollection_ExtendedString getTitle(TCollection_ExtendedString theString) -{ - TCollection_ExtendedString aString(theString); - int aPos = aString.Search(SEPARATOR); - if(aPos < 1) return aString; - if(aPos == 1) return TCollection_ExtendedString(); - aString.Split(aPos-1); - return aString; -} - - - void SALOMEDS_AttributeTableOfString_i::SetTitle(const char* theTitle) { SALOMEDS::Locker lock; @@ -67,15 +45,8 @@ void SALOMEDS_AttributeTableOfString_i::SetRowTitle(CORBA::Long theIndex, const CheckLocked(); Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl); if (theIndex <= 0 || theIndex > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfString::IncorrectIndex(); - CORBA::String_var aStr = CORBA::string_dup(theTitle); - TCollection_ExtendedString aTitle(aStr); - TCollection_ExtendedString aUnit = getUnit(aTable->GetRowTitle(theIndex)); - if(aUnit.Length() > 0) { - aTitle += SEPARATOR; - aTitle += aUnit; - } - aTable->SetRowTitle(theIndex, aTitle); + aTable->SetRowTitle(theIndex, TCollection_ExtendedString((char*)theTitle)); } void SALOMEDS_AttributeTableOfString_i::SetRowTitles(const SALOMEDS::StringSeq& theTitles) @@ -87,7 +58,7 @@ void SALOMEDS_AttributeTableOfString_i::SetRowTitles(const SALOMEDS::StringSeq& Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl); if (theTitles.length() != aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfString::IncorrectArgumentLength(); for (int i = 0; i < theTitles.length(); i++) { - SetRowTitle(i + 1, CORBA::string_dup(theTitles[i])); + aTable->SetRowTitle(i + 1, TCollection_ExtendedString((char*)theTitles[i].in())); } } @@ -98,7 +69,7 @@ SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfString_i::GetRowTitles() SALOMEDS::StringSeq_var aTitles = new SALOMEDS::StringSeq; aTitles->length(aTable->GetNbRows()); for(int i = 0; i < aTitles->length(); i++) - aTitles[i] = CORBA::string_dup(TCollection_AsciiString(getTitle(aTable->GetRowTitle(i + 1))).ToCString()); + aTitles[i] =CORBA::string_dup(TCollection_AsciiString(aTable->GetRowTitle(i + 1)).ToCString()); return aTitles._retn(); } @@ -110,8 +81,7 @@ void SALOMEDS_AttributeTableOfString_i::SetColumnTitle(CORBA::Long theIndex, con CheckLocked(); Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl); if (theIndex <= 0 || theIndex > aTable->GetNbColumns()) throw SALOMEDS::AttributeTableOfString::IncorrectIndex(); - CORBA::String_var aStr = CORBA::string_dup(theTitle); - aTable->SetColumnTitle(theIndex, TCollection_ExtendedString(aStr)); + aTable->SetColumnTitle(theIndex, TCollection_ExtendedString((char*)theTitle)); } void SALOMEDS_AttributeTableOfString_i::SetColumnTitles(const SALOMEDS::StringSeq& theTitles) @@ -123,7 +93,7 @@ void SALOMEDS_AttributeTableOfString_i::SetColumnTitles(const SALOMEDS::StringSe Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl); if (theTitles.length() != aTable->GetNbColumns()) throw SALOMEDS::AttributeTableOfString::IncorrectArgumentLength(); for (int i = 0; i < theTitles.length(); i++) { - SetColumnTitle(i + 1, CORBA::string_dup(theTitles[i])); + aTable->SetColumnTitle(i + 1, TCollection_ExtendedString((char*)theTitles[i].in())); } } @@ -147,12 +117,7 @@ void SALOMEDS_AttributeTableOfString_i::SetRowUnit(CORBA::Long theIndex, const c CheckLocked(); Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl); if (theIndex <= 0 || theIndex > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfString::IncorrectIndex(); - CORBA::String_var aStr = CORBA::string_dup(theUnit); - TCollection_ExtendedString aTitle = getTitle(aTable->GetRowTitle(theIndex)); - TCollection_ExtendedString aUnit(aStr); - aTitle += SEPARATOR; - aTitle += aUnit; - aTable->SetRowTitle(theIndex, aTitle); + aTable->SetRowUnit(theIndex, TCollection_ExtendedString((char*)theUnit)); } void SALOMEDS_AttributeTableOfString_i::SetRowUnits(const SALOMEDS::StringSeq& theUnits) @@ -164,7 +129,7 @@ void SALOMEDS_AttributeTableOfString_i::SetRowUnits(const SALOMEDS::StringSeq& t Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl); if (theUnits.length() != aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfString::IncorrectArgumentLength(); for (int i = 0; i < theUnits.length(); i++) { - SetRowUnit(i + 1, CORBA::string_dup(theUnits[i])); + aTable->SetRowUnit(i + 1, TCollection_ExtendedString((char*)theUnits[i].in())); } } @@ -175,7 +140,7 @@ SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfString_i::GetRowUnits() SALOMEDS::StringSeq_var aUnits = new SALOMEDS::StringSeq; aUnits->length(aTable->GetNbRows()); for(int i = 0; i < aUnits->length(); i++) - aUnits[i] = CORBA::string_dup(TCollection_AsciiString(getUnit(aTable->GetRowTitle(i + 1))).ToCString()); + aUnits[i] = CORBA::string_dup(TCollection_AsciiString(aTable->GetRowTitle(i + 1)).ToCString()); return aUnits._retn(); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeTarget_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeTarget_i.cxx index 13ac6002e..07929e3fe 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTarget_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTarget_i.cxx @@ -9,31 +9,27 @@ using namespace std; #include "SALOMEDSImpl_Study.hxx" #include "SALOMEDS.hxx" -#include -#include +#include void SALOMEDS_AttributeTarget_i::Add(SALOMEDS::SObject_ptr anObject) { SALOMEDS::Locker lock; TDF_Label aLabel; TDF_Tool::Label(_impl->Label().Data(),anObject->GetID(),aLabel,1); - (Handle(SALOMEDSImpl_AttributeTarget)::DownCast(_impl))->Append(aLabel); + (Handle(SALOMEDSImpl_AttributeTarget)::DownCast(_impl))->Add(SALOMEDSImpl_Study::SObject(aLabel)); } SALOMEDS::Study::ListOfSObject* SALOMEDS_AttributeTarget_i::Get() { SALOMEDS::Locker lock; - TDF_LabelList aLList; + Handle(TColStd_HSequenceOfTransient) aSeq = (Handle(SALOMEDSImpl_AttributeTarget)::DownCast(_impl))->Get(); SALOMEDS::Study::ListOfSObject_var aSList = new SALOMEDS::Study::ListOfSObject; - (Handle(SALOMEDSImpl_AttributeTarget)::DownCast(_impl))->Get(aLList); - if (aLList.Extent() == 0) - return aSList._retn(); - aSList->length(aLList.Extent()); - TDF_ListIteratorOfLabelList anIter(aLList); - int index; - for(index=0;anIter.More();anIter.Next(),index++) { - SALOMEDS::SObject_var anSO = SALOMEDS_SObject_i::New(SALOMEDSImpl_Study::GetStudy(anIter.Value())->GetSObject(anIter.Value()), _orb); - aSList[index] = anSO; + int aLength = aSeq->Length(), i; + if (aLength == 0) return aSList._retn(); + aSList->length(aLength); + for(i=1; i <=aLength; i++) { + SALOMEDS::SObject_var anSO = SALOMEDS_SObject_i::New(Handle(SALOMEDSImpl_SObject)::DownCast(aSeq->Value(i)), _orb); + aSList[i-1] = anSO; } return aSList._retn(); } @@ -43,5 +39,5 @@ void SALOMEDS_AttributeTarget_i::Remove(SALOMEDS::SObject_ptr anObject) SALOMEDS::Locker lock; TDF_Label aLabel; TDF_Tool::Label(_impl->Label().Data(),anObject->GetID(),aLabel,1); - (Handle(SALOMEDSImpl_AttributeTarget)::DownCast(_impl))->Remove(aLabel); + (Handle(SALOMEDSImpl_AttributeTarget)::DownCast(_impl))->Remove(SALOMEDSImpl_Study::SObject(aLabel)); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeTextColor_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeTextColor_i.cxx index 7ce8f7666..eafff6072 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTextColor_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTextColor_i.cxx @@ -11,7 +11,7 @@ SALOMEDS::Color SALOMEDS_AttributeTextColor_i::TextColor() { SALOMEDS::Locker lock; SALOMEDS::Color TextColor; - Handle(TColStd_HArray1OfReal) anArray = Handle(SALOMEDSImpl_AttributeTextColor)::DownCast(_impl)->GetTextColor(); + Handle(TColStd_HArray1OfReal) anArray = Handle(SALOMEDSImpl_AttributeTextColor)::DownCast(_impl)->TextColor(); if (anArray.IsNull() || anArray->Length()!=3) { TextColor.R = 0; TextColor.G = 0; diff --git a/src/SALOMEDS/SALOMEDS_AttributeTextHighlightColor_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeTextHighlightColor_i.cxx index 152438f32..edc95c070 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTextHighlightColor_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTextHighlightColor_i.cxx @@ -11,7 +11,7 @@ SALOMEDS::Color SALOMEDS_AttributeTextHighlightColor_i::TextHighlightColor() { SALOMEDS::Locker lock; SALOMEDS::Color TextHighlightColor; - Handle(TColStd_HArray1OfReal) anArray=Handle(SALOMEDSImpl_AttributeTextHighlightColor)::DownCast(_impl)->GetTextColor(); + Handle(TColStd_HArray1OfReal) anArray=Handle(SALOMEDSImpl_AttributeTextHighlightColor)::DownCast(_impl)->TextHighlightColor(); if (anArray.IsNull() || anArray->Length()!=3) { TextHighlightColor.R = 0; TextHighlightColor.G = 0; diff --git a/src/SALOMEDS/SALOMEDS_GenericAttribute_i.cxx b/src/SALOMEDS/SALOMEDS_GenericAttribute_i.cxx index 99d6bfc8c..899f81cea 100644 --- a/src/SALOMEDS/SALOMEDS_GenericAttribute_i.cxx +++ b/src/SALOMEDS/SALOMEDS_GenericAttribute_i.cxx @@ -13,6 +13,15 @@ using namespace std; #include #include +#ifdef WNT +#include +#else +#include +#include +#endif + +#include "OpUtil.hxx" + UNEXPECT_CATCH(GALockProtection, SALOMEDS::GenericAttribute::LockProtection); SALOMEDS_GenericAttribute_i::SALOMEDS_GenericAttribute_i(const Handle(TDF_Attribute)& theImpl, CORBA::ORB_ptr theOrb) @@ -40,7 +49,7 @@ SALOMEDS::SObject_ptr SALOMEDS_GenericAttribute_i::GetSObject() { SALOMEDS::Locker lock; if (_impl.IsNull() || _impl->Label().IsNull()) return SALOMEDS::SObject::_nil(); - Handle(SALOMEDSImpl_SObject) so_impl = SALOMEDSImpl_Study::GetStudy(_impl->Label())->GetSObject(_impl->Label()); + Handle(SALOMEDSImpl_SObject) so_impl = SALOMEDSImpl_Study::SObject(_impl->Label()); SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (so_impl, _orb); return so._retn(); } @@ -56,6 +65,16 @@ char* SALOMEDS_GenericAttribute_i::Type() return ""; } +char* SALOMEDS_GenericAttribute_i::GetClassType() +{ + SALOMEDS::Locker lock; + if (!_impl.IsNull()) { + return CORBA::string_dup(SALOMEDSImpl_GenericAttribute::Impl_GetClassType(_impl)); + } + + return ""; +} + SALOMEDS::GenericAttribute_ptr SALOMEDS_GenericAttribute_i::CreateAttribute(const Handle(TDF_Attribute)& theAttr, CORBA::ORB_ptr theOrb) @@ -78,3 +97,18 @@ SALOMEDS::GenericAttribute_ptr SALOMEDS_GenericAttribute_i::CreateAttribute(cons return anAttribute._retn(); } + +//=========================================================================== +// PRIVATE FUNCTIONS +//=========================================================================== +long SALOMEDS_GenericAttribute_i::GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal) +{ +#ifdef WNT + long pid = (long)_getpid(); +#else + long pid = (long)getpid(); +#endif + isLocal = (strcmp(theHostname, GetHostname().c_str()) == 0 && pid == thePID)?1:0; + TDF_Attribute* local_impl = _impl.operator->(); + return ((long)local_impl); +} diff --git a/src/SALOMEDS/SALOMEDS_GenericAttribute_i.hxx b/src/SALOMEDS/SALOMEDS_GenericAttribute_i.hxx index 4bd8461b1..1710831ae 100644 --- a/src/SALOMEDS/SALOMEDS_GenericAttribute_i.hxx +++ b/src/SALOMEDS/SALOMEDS_GenericAttribute_i.hxx @@ -26,13 +26,17 @@ public: void CheckLocked() throw (SALOMEDS::GenericAttribute::LockProtection); - char* Type(); + virtual char* Type(); + + char* GetClassType(); SALOMEDS::SObject_ptr GetSObject(); virtual Handle(TDF_Attribute) GetImpl() { return _impl; } static SALOMEDS::GenericAttribute_ptr CreateAttribute(const Handle(TDF_Attribute)& theAttr, CORBA::ORB_ptr theOrb); + + virtual long GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal); }; #endif diff --git a/src/SALOMEDS/SALOMEDS_SObject_i.cxx b/src/SALOMEDS/SALOMEDS_SObject_i.cxx index ce60bace5..e70da136b 100644 --- a/src/SALOMEDS/SALOMEDS_SObject_i.cxx +++ b/src/SALOMEDS/SALOMEDS_SObject_i.cxx @@ -20,6 +20,15 @@ using namespace std; #include #include +#ifdef WNT +#include +#else +#include +#include +#endif + +#include "OpUtil.hxx" + SALOMEDS::SObject_ptr SALOMEDS_SObject_i::New(const Handle(SALOMEDSImpl_SObject)& theImpl, CORBA::ORB_ptr theORB) { static std::map _mapOfSO; @@ -293,3 +302,18 @@ char* SALOMEDS_SObject_i::GetIOR() CORBA::String_var aStr = CORBA::string_dup(_impl->GetIOR().ToCString()); return aStr._retn(); } + +//=========================================================================== +// PRIVATE FUNCTIONS +//=========================================================================== +long SALOMEDS_SObject_i::GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal) +{ +#ifdef WNT + long pid = (long)_getpid(); +#else + long pid = (long)getpid(); +#endif + isLocal = (strcmp(theHostname, GetHostname().c_str()) == 0 && pid == thePID)?1:0; + SALOMEDSImpl_SObject* local_impl = _impl.operator->(); + return ((long)local_impl); +} diff --git a/src/SALOMEDS/SALOMEDS_SObject_i.hxx b/src/SALOMEDS/SALOMEDS_SObject_i.hxx index a5573d924..2027c236f 100644 --- a/src/SALOMEDS/SALOMEDS_SObject_i.hxx +++ b/src/SALOMEDS/SALOMEDS_SObject_i.hxx @@ -49,6 +49,8 @@ public: virtual CORBA::Short Tag(); virtual CORBA::Short Depth(); + + virtual long GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal); }; #endif diff --git a/src/SALOMEDS/SALOMEDS_StudyManager_i.cxx b/src/SALOMEDS/SALOMEDS_StudyManager_i.cxx index 9c4a9d748..1b3965924 100644 --- a/src/SALOMEDS/SALOMEDS_StudyManager_i.cxx +++ b/src/SALOMEDS/SALOMEDS_StudyManager_i.cxx @@ -24,6 +24,15 @@ #include using namespace std; +#ifdef WNT +#include +#else +#include +#include +#endif + +#include "OpUtil.hxx" + #include "SALOME_GenericObj_i.hh" #include "Utils_ExceptHandlers.hxx" @@ -402,6 +411,20 @@ SALOMEDS_Driver_i* GetDriver(const Handle(SALOMEDSImpl_SObject)& theObject, CORB return driver; } +//=========================================================================== +// PRIVATE FUNCTIONS +//=========================================================================== +long SALOMEDS_StudyManager_i::GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal) +{ +#ifdef WNT + long pid = (long)_getpid(); +#else + long pid = (long)getpid(); +#endif + isLocal = (strcmp(theHostname, GetHostname().c_str()) == 0 && pid == thePID)?1:0; + SALOMEDSImpl_StudyManager* aManager = _impl.operator->(); + return ((long)aManager); +} //=========================================================================== namespace SALOMEDS diff --git a/src/SALOMEDS/SALOMEDS_StudyManager_i.hxx b/src/SALOMEDS/SALOMEDS_StudyManager_i.hxx index a3ded98f8..e057cb7ca 100644 --- a/src/SALOMEDS/SALOMEDS_StudyManager_i.hxx +++ b/src/SALOMEDS/SALOMEDS_StudyManager_i.hxx @@ -123,6 +123,8 @@ public: virtual CORBA::Object_ptr ConvertIORToObject(const char* theIOR) { return _orb->string_to_object(theIOR); }; void ping(){}; + + virtual long GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal); }; #endif diff --git a/src/SALOMEDS/SALOMEDS_Study_i.cxx b/src/SALOMEDS/SALOMEDS_Study_i.cxx index 77e8bbe62..3298a7466 100644 --- a/src/SALOMEDS/SALOMEDS_Study_i.cxx +++ b/src/SALOMEDS/SALOMEDS_Study_i.cxx @@ -27,6 +27,14 @@ using namespace std; #include #include +#ifdef WNT +#include +#else +#include +#include +#endif + +#include "OpUtil.hxx" //============================================================================ /*! Function : SALOMEDS_Study_i @@ -700,3 +708,18 @@ CORBA::Boolean SALOMEDS_Study_i::DumpStudy(const char* thePath, const char* theB delete factory; return ret; } + +//=========================================================================== +// PRIVATE FUNCTIONS +//=========================================================================== +long SALOMEDS_Study_i::GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal) +{ +#ifdef WNT + long pid = (long)_getpid(); +#else + long pid = (long)getpid(); +#endif + isLocal = (strcmp(theHostname, GetHostname().c_str()) == 0 && pid == thePID)?1:0; + SALOMEDSImpl_Study* local_impl = _impl.operator->(); + return ((long)local_impl); +} diff --git a/src/SALOMEDS/SALOMEDS_Study_i.hxx b/src/SALOMEDS/SALOMEDS_Study_i.hxx index e8f4518f2..7800eae18 100644 --- a/src/SALOMEDS/SALOMEDS_Study_i.hxx +++ b/src/SALOMEDS/SALOMEDS_Study_i.hxx @@ -258,5 +258,7 @@ public: virtual CORBA::Boolean DumpStudy(const char* thePath, const char* theBaseName, CORBA::Boolean isPublished); virtual Handle(SALOMEDSImpl_Study) GetImpl() { return _impl; } + + virtual long GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal); }; #endif -- 2.39.2