From 8d1163f1a54683bfb81c49a035a26c8857d27d96 Mon Sep 17 00:00:00 2001 From: srn Date: Thu, 17 Mar 2005 07:52:14 +0000 Subject: [PATCH] Local Study --- src/SALOMEDS/Makefile.in | 73 +- ...MEDS_BasicAttribute_i.cxx => SALOMEDS.cxx} | 34 +- ...SALOMEDS_SAttribute_i.hxx => SALOMEDS.hxx} | 62 +- src/SALOMEDS/SALOMEDS_AttributeComment_i.cxx | 54 +- src/SALOMEDS/SALOMEDS_AttributeComment_i.hxx | 52 +- src/SALOMEDS/SALOMEDS_AttributeDrawable_i.cxx | 50 +- src/SALOMEDS/SALOMEDS_AttributeDrawable_i.hxx | 49 +- .../SALOMEDS_AttributeExpandable_i.cxx | 52 +- .../SALOMEDS_AttributeExpandable_i.hxx | 45 +- .../SALOMEDS_AttributeExternalFileDef_i.cxx | 43 +- .../SALOMEDS_AttributeExternalFileDef_i.hxx | 41 +- src/SALOMEDS/SALOMEDS_AttributeFileType_i.cxx | 40 +- src/SALOMEDS/SALOMEDS_AttributeFileType_i.hxx | 44 +- src/SALOMEDS/SALOMEDS_AttributeFlags_i.cxx | 53 +- src/SALOMEDS/SALOMEDS_AttributeFlags_i.hxx | 41 +- src/SALOMEDS/SALOMEDS_AttributeGraphic_i.cxx | 47 +- src/SALOMEDS/SALOMEDS_AttributeGraphic_i.hxx | 43 +- src/SALOMEDS/SALOMEDS_AttributeIOR_i.cxx | 47 +- src/SALOMEDS/SALOMEDS_AttributeIOR_i.hxx | 45 +- src/SALOMEDS/SALOMEDS_AttributeInteger_i.cxx | 52 +- src/SALOMEDS/SALOMEDS_AttributeInteger_i.hxx | 51 +- src/SALOMEDS/SALOMEDS_AttributeLocalID_i.cxx | 53 +- src/SALOMEDS/SALOMEDS_AttributeLocalID_i.hxx | 44 +- src/SALOMEDS/SALOMEDS_AttributeName_i.cxx | 53 +- src/SALOMEDS/SALOMEDS_AttributeName_i.hxx | 46 +- src/SALOMEDS/SALOMEDS_AttributeOpened_i.cxx | 51 +- src/SALOMEDS/SALOMEDS_AttributeOpened_i.hxx | 44 +- .../SALOMEDS_AttributePersistentRef_i.cxx | 47 +- .../SALOMEDS_AttributePersistentRef_i.hxx | 49 +- src/SALOMEDS/SALOMEDS_AttributePixMap_i.cxx | 57 +- src/SALOMEDS/SALOMEDS_AttributePixMap_i.hxx | 45 +- .../SALOMEDS_AttributePythonObject_i.cxx | 42 +- .../SALOMEDS_AttributePythonObject_i.hxx | 32 +- src/SALOMEDS/SALOMEDS_AttributeReal_i.cxx | 74 +- src/SALOMEDS/SALOMEDS_AttributeReal_i.hxx | 50 +- .../SALOMEDS_AttributeSelectable_i.cxx | 49 +- .../SALOMEDS_AttributeSelectable_i.hxx | 49 +- .../SALOMEDS_AttributeSequenceOfInteger_i.cxx | 79 +- .../SALOMEDS_AttributeSequenceOfInteger_i.hxx | 49 +- .../SALOMEDS_AttributeSequenceOfReal_i.cxx | 79 +- .../SALOMEDS_AttributeSequenceOfReal_i.hxx | 48 +- .../SALOMEDS_AttributeStudyProperties_i.cxx | 195 +-- .../SALOMEDS_AttributeStudyProperties_i.hxx | 29 +- .../SALOMEDS_AttributeTableOfInteger_i.cxx | 142 +- .../SALOMEDS_AttributeTableOfInteger_i.hxx | 32 +- .../SALOMEDS_AttributeTableOfReal_i.cxx | 137 +- .../SALOMEDS_AttributeTableOfReal_i.hxx | 32 +- .../SALOMEDS_AttributeTableOfString_i.cxx | 140 +- .../SALOMEDS_AttributeTableOfString_i.hxx | 31 +- src/SALOMEDS/SALOMEDS_AttributeTarget_i.cxx | 70 +- src/SALOMEDS/SALOMEDS_AttributeTarget_i.hxx | 46 +- .../SALOMEDS_AttributeTextColor_i.cxx | 58 +- .../SALOMEDS_AttributeTextColor_i.hxx | 44 +- ...SALOMEDS_AttributeTextHighlightColor_i.cxx | 59 +- ...SALOMEDS_AttributeTextHighlightColor_i.hxx | 46 +- src/SALOMEDS/SALOMEDS_AttributeTreeNode_i.cxx | 286 ++-- src/SALOMEDS/SALOMEDS_AttributeTreeNode_i.hxx | 48 +- src/SALOMEDS/SALOMEDS_AttributeUserID_i.cxx | 48 +- src/SALOMEDS/SALOMEDS_AttributeUserID_i.hxx | 49 +- src/SALOMEDS/SALOMEDS_Attributes.hxx | 106 ++ .../SALOMEDS_BasicAttributeFactory.cxx | 54 - .../SALOMEDS_BasicAttributeFactory.hxx | 48 - src/SALOMEDS/SALOMEDS_BasicAttribute_i.hxx | 55 - src/SALOMEDS/SALOMEDS_Callback_i.hxx | 12 +- src/SALOMEDS/SALOMEDS_ChildIterator_i.cxx | 65 +- src/SALOMEDS/SALOMEDS_ChildIterator_i.hxx | 55 +- ...ataMapIteratorOfDataMapOfIntegerString.hxx | 95 -- ...aMapIteratorOfDataMapOfIntegerString_0.cxx | 46 - ...DS_DataMapIteratorOfDataMapStringLabel.hxx | 114 -- ..._DataMapIteratorOfDataMapStringLabel_0.cxx | 64 - ...DS_DataMapNodeOfDataMapOfIntegerString.hxx | 132 -- ..._DataMapNodeOfDataMapOfIntegerString_0.cxx | 95 -- ...LOMEDS_DataMapNodeOfDataMapStringLabel.hxx | 154 -- ...MEDS_DataMapNodeOfDataMapStringLabel_0.cxx | 113 -- .../SALOMEDS_DataMapOfIntegerString.hxx | 127 -- .../SALOMEDS_DataMapOfIntegerString_0.cxx | 49 - src/SALOMEDS/SALOMEDS_DataMapStringLabel.hxx | 146 -- .../SALOMEDS_DataMapStringLabel_0.cxx | 67 - src/SALOMEDS/SALOMEDS_DrawableAttribute.cdl | 77 - src/SALOMEDS/SALOMEDS_DrawableAttribute.cxx | 114 -- src/SALOMEDS/SALOMEDS_DrawableAttribute.hxx | 127 -- src/SALOMEDS/SALOMEDS_DrawableAttribute.ixx | 87 -- src/SALOMEDS/SALOMEDS_DrawableAttribute.jxx | 43 - src/SALOMEDS/SALOMEDS_Driver_i.cxx | 269 ++++ src/SALOMEDS/SALOMEDS_Driver_i.hxx | 122 ++ src/SALOMEDS/SALOMEDS_ExpandableAttribute.cdl | 77 - src/SALOMEDS/SALOMEDS_ExpandableAttribute.cxx | 114 -- src/SALOMEDS/SALOMEDS_ExpandableAttribute.hxx | 127 -- src/SALOMEDS/SALOMEDS_ExpandableAttribute.ixx | 87 -- src/SALOMEDS/SALOMEDS_ExpandableAttribute.jxx | 43 - src/SALOMEDS/SALOMEDS_ExternalFileDef.cdl | 76 - src/SALOMEDS/SALOMEDS_ExternalFileDef.cxx | 114 -- src/SALOMEDS/SALOMEDS_ExternalFileDef.hxx | 108 -- src/SALOMEDS/SALOMEDS_ExternalFileDef.ixx | 73 - src/SALOMEDS/SALOMEDS_ExternalFileDef.jxx | 18 - src/SALOMEDS/SALOMEDS_FileType.cdl | 76 - src/SALOMEDS/SALOMEDS_FileType.cxx | 114 -- src/SALOMEDS/SALOMEDS_FileType.hxx | 108 -- src/SALOMEDS/SALOMEDS_FileType.ixx | 73 - src/SALOMEDS/SALOMEDS_FileType.jxx | 18 - src/SALOMEDS/SALOMEDS_FlagsAttribute.cxx | 162 -- src/SALOMEDS/SALOMEDS_FlagsAttribute.hxx | 72 - src/SALOMEDS/SALOMEDS_GenericAttribute_i.cxx | 80 +- src/SALOMEDS/SALOMEDS_GenericAttribute_i.hxx | 156 +- src/SALOMEDS/SALOMEDS_GraphicAttribute.cxx | 185 --- src/SALOMEDS/SALOMEDS_GraphicAttribute.hxx | 80 - src/SALOMEDS/SALOMEDS_IORAttribute.cdl | 77 - src/SALOMEDS/SALOMEDS_IORAttribute.cxx | 117 -- src/SALOMEDS/SALOMEDS_IORAttribute.hxx | 131 -- src/SALOMEDS/SALOMEDS_IORAttribute.ixx | 87 -- src/SALOMEDS/SALOMEDS_IORAttribute.jxx | 44 - src/SALOMEDS/SALOMEDS_LocalIDAttribute.cdl | 75 - src/SALOMEDS/SALOMEDS_LocalIDAttribute.cxx | 114 -- src/SALOMEDS/SALOMEDS_LocalIDAttribute.hxx | 127 -- src/SALOMEDS/SALOMEDS_LocalIDAttribute.ixx | 87 -- src/SALOMEDS/SALOMEDS_LocalIDAttribute.jxx | 43 - src/SALOMEDS/SALOMEDS_OCAFApplication.cdl | 49 - src/SALOMEDS/SALOMEDS_OCAFApplication.cxx | 66 - src/SALOMEDS/SALOMEDS_OCAFApplication.hxx | 114 -- src/SALOMEDS/SALOMEDS_OCAFApplication.ixx | 87 -- src/SALOMEDS/SALOMEDS_OCAFApplication.jxx | 32 - src/SALOMEDS/SALOMEDS_OpenedAttribute.cdl | 77 - src/SALOMEDS/SALOMEDS_OpenedAttribute.cxx | 114 -- src/SALOMEDS/SALOMEDS_OpenedAttribute.hxx | 127 -- src/SALOMEDS/SALOMEDS_OpenedAttribute.ixx | 87 -- src/SALOMEDS/SALOMEDS_OpenedAttribute.jxx | 43 - src/SALOMEDS/SALOMEDS_PersRefAttribute.cdl | 77 - src/SALOMEDS/SALOMEDS_PersRefAttribute.cxx | 113 -- src/SALOMEDS/SALOMEDS_PersRefAttribute.hxx | 125 -- src/SALOMEDS/SALOMEDS_PersRefAttribute.ixx | 87 -- src/SALOMEDS/SALOMEDS_PersRefAttribute.jxx | 44 - src/SALOMEDS/SALOMEDS_PixMapAttribute.cdl | 77 - src/SALOMEDS/SALOMEDS_PixMapAttribute.cxx | 113 -- src/SALOMEDS/SALOMEDS_PixMapAttribute.hxx | 125 -- src/SALOMEDS/SALOMEDS_PixMapAttribute.ixx | 87 -- src/SALOMEDS/SALOMEDS_PixMapAttribute.jxx | 46 - .../SALOMEDS_PythonObjectAttribute.cdl | 68 - .../SALOMEDS_PythonObjectAttribute.cxx | 89 -- .../SALOMEDS_PythonObjectAttribute.hxx | 126 -- .../SALOMEDS_PythonObjectAttribute.ixx | 68 - .../SALOMEDS_PythonObjectAttribute.jxx | 29 - .../SALOMEDS_SComponentIterator_i.cxx | 63 +- .../SALOMEDS_SComponentIterator_i.hxx | 58 +- src/SALOMEDS/SALOMEDS_SComponent_i.cxx | 127 +- src/SALOMEDS/SALOMEDS_SComponent_i.hxx | 72 +- src/SALOMEDS/SALOMEDS_SObject_i.cxx | 782 ++-------- src/SALOMEDS/SALOMEDS_SObject_i.hxx | 156 +- src/SALOMEDS/SALOMEDS_SelectableAttribute.cdl | 77 - src/SALOMEDS/SALOMEDS_SelectableAttribute.cxx | 114 -- src/SALOMEDS/SALOMEDS_SelectableAttribute.hxx | 127 -- src/SALOMEDS/SALOMEDS_SelectableAttribute.ixx | 87 -- src/SALOMEDS/SALOMEDS_SelectableAttribute.jxx | 43 - .../SALOMEDS_SequenceOfIntegerAttribute.cdl | 104 -- .../SALOMEDS_SequenceOfIntegerAttribute.cxx | 151 -- .../SALOMEDS_SequenceOfIntegerAttribute.hxx | 134 -- .../SALOMEDS_SequenceOfIntegerAttribute.ixx | 85 - .../SALOMEDS_SequenceOfIntegerAttribute.jxx | 46 - .../SALOMEDS_SequenceOfRealAttribute.cdl | 104 -- .../SALOMEDS_SequenceOfRealAttribute.cxx | 153 -- .../SALOMEDS_SequenceOfRealAttribute.hxx | 137 -- .../SALOMEDS_SequenceOfRealAttribute.ixx | 85 - .../SALOMEDS_SequenceOfRealAttribute.jxx | 46 - src/SALOMEDS/SALOMEDS_StudyBuilder_i.cxx | 803 +++------- src/SALOMEDS/SALOMEDS_StudyBuilder_i.hxx | 62 +- src/SALOMEDS/SALOMEDS_StudyManager_i.cxx | 1386 +++-------------- src/SALOMEDS/SALOMEDS_StudyManager_i.hxx | 108 +- .../SALOMEDS_StudyPropertiesAttribute.cdl | 93 -- .../SALOMEDS_StudyPropertiesAttribute.cxx | 217 --- .../SALOMEDS_StudyPropertiesAttribute.hxx | 148 -- .../SALOMEDS_StudyPropertiesAttribute.ixx | 68 - .../SALOMEDS_StudyPropertiesAttribute.jxx | 35 - src/SALOMEDS/SALOMEDS_Study_i.cxx | 1171 ++++---------- src/SALOMEDS/SALOMEDS_Study_i.hxx | 155 +- src/SALOMEDS/SALOMEDS_UseCaseBuilder_i.cxx | 334 +--- src/SALOMEDS/SALOMEDS_UseCaseBuilder_i.hxx | 37 +- src/SALOMEDS/SALOMEDS_UseCaseIterator_i.cxx | 46 +- src/SALOMEDS/SALOMEDS_UseCaseIterator_i.hxx | 37 +- 177 files changed, 2897 insertions(+), 15473 deletions(-) rename src/SALOMEDS/{SALOMEDS_BasicAttribute_i.cxx => SALOMEDS.cxx} (71%) rename src/SALOMEDS/{SALOMEDS_SAttribute_i.hxx => SALOMEDS.hxx} (50%) create mode 100644 src/SALOMEDS/SALOMEDS_Attributes.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_BasicAttributeFactory.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_BasicAttributeFactory.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_BasicAttribute_i.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_DataMapIteratorOfDataMapOfIntegerString.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_DataMapIteratorOfDataMapOfIntegerString_0.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_DataMapIteratorOfDataMapStringLabel.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_DataMapIteratorOfDataMapStringLabel_0.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_DataMapNodeOfDataMapOfIntegerString.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_DataMapNodeOfDataMapOfIntegerString_0.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_DataMapNodeOfDataMapStringLabel.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_DataMapNodeOfDataMapStringLabel_0.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_DataMapOfIntegerString.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_DataMapOfIntegerString_0.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_DataMapStringLabel.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_DataMapStringLabel_0.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_DrawableAttribute.cdl delete mode 100644 src/SALOMEDS/SALOMEDS_DrawableAttribute.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_DrawableAttribute.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_DrawableAttribute.ixx delete mode 100644 src/SALOMEDS/SALOMEDS_DrawableAttribute.jxx create mode 100644 src/SALOMEDS/SALOMEDS_Driver_i.cxx create mode 100644 src/SALOMEDS/SALOMEDS_Driver_i.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_ExpandableAttribute.cdl delete mode 100644 src/SALOMEDS/SALOMEDS_ExpandableAttribute.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_ExpandableAttribute.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_ExpandableAttribute.ixx delete mode 100644 src/SALOMEDS/SALOMEDS_ExpandableAttribute.jxx delete mode 100644 src/SALOMEDS/SALOMEDS_ExternalFileDef.cdl delete mode 100644 src/SALOMEDS/SALOMEDS_ExternalFileDef.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_ExternalFileDef.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_ExternalFileDef.ixx delete mode 100644 src/SALOMEDS/SALOMEDS_ExternalFileDef.jxx delete mode 100644 src/SALOMEDS/SALOMEDS_FileType.cdl delete mode 100644 src/SALOMEDS/SALOMEDS_FileType.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_FileType.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_FileType.ixx delete mode 100644 src/SALOMEDS/SALOMEDS_FileType.jxx delete mode 100644 src/SALOMEDS/SALOMEDS_FlagsAttribute.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_FlagsAttribute.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_GraphicAttribute.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_GraphicAttribute.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_IORAttribute.cdl delete mode 100644 src/SALOMEDS/SALOMEDS_IORAttribute.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_IORAttribute.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_IORAttribute.ixx delete mode 100644 src/SALOMEDS/SALOMEDS_IORAttribute.jxx delete mode 100644 src/SALOMEDS/SALOMEDS_LocalIDAttribute.cdl delete mode 100644 src/SALOMEDS/SALOMEDS_LocalIDAttribute.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_LocalIDAttribute.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_LocalIDAttribute.ixx delete mode 100644 src/SALOMEDS/SALOMEDS_LocalIDAttribute.jxx delete mode 100644 src/SALOMEDS/SALOMEDS_OCAFApplication.cdl delete mode 100644 src/SALOMEDS/SALOMEDS_OCAFApplication.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_OCAFApplication.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_OCAFApplication.ixx delete mode 100644 src/SALOMEDS/SALOMEDS_OCAFApplication.jxx delete mode 100644 src/SALOMEDS/SALOMEDS_OpenedAttribute.cdl delete mode 100644 src/SALOMEDS/SALOMEDS_OpenedAttribute.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_OpenedAttribute.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_OpenedAttribute.ixx delete mode 100644 src/SALOMEDS/SALOMEDS_OpenedAttribute.jxx delete mode 100644 src/SALOMEDS/SALOMEDS_PersRefAttribute.cdl delete mode 100644 src/SALOMEDS/SALOMEDS_PersRefAttribute.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_PersRefAttribute.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_PersRefAttribute.ixx delete mode 100644 src/SALOMEDS/SALOMEDS_PersRefAttribute.jxx delete mode 100644 src/SALOMEDS/SALOMEDS_PixMapAttribute.cdl delete mode 100644 src/SALOMEDS/SALOMEDS_PixMapAttribute.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_PixMapAttribute.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_PixMapAttribute.ixx delete mode 100644 src/SALOMEDS/SALOMEDS_PixMapAttribute.jxx delete mode 100644 src/SALOMEDS/SALOMEDS_PythonObjectAttribute.cdl delete mode 100644 src/SALOMEDS/SALOMEDS_PythonObjectAttribute.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_PythonObjectAttribute.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_PythonObjectAttribute.ixx delete mode 100644 src/SALOMEDS/SALOMEDS_PythonObjectAttribute.jxx delete mode 100644 src/SALOMEDS/SALOMEDS_SelectableAttribute.cdl delete mode 100644 src/SALOMEDS/SALOMEDS_SelectableAttribute.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_SelectableAttribute.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_SelectableAttribute.ixx delete mode 100644 src/SALOMEDS/SALOMEDS_SelectableAttribute.jxx delete mode 100644 src/SALOMEDS/SALOMEDS_SequenceOfIntegerAttribute.cdl delete mode 100644 src/SALOMEDS/SALOMEDS_SequenceOfIntegerAttribute.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_SequenceOfIntegerAttribute.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_SequenceOfIntegerAttribute.ixx delete mode 100644 src/SALOMEDS/SALOMEDS_SequenceOfIntegerAttribute.jxx delete mode 100644 src/SALOMEDS/SALOMEDS_SequenceOfRealAttribute.cdl delete mode 100644 src/SALOMEDS/SALOMEDS_SequenceOfRealAttribute.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_SequenceOfRealAttribute.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_SequenceOfRealAttribute.ixx delete mode 100644 src/SALOMEDS/SALOMEDS_SequenceOfRealAttribute.jxx delete mode 100644 src/SALOMEDS/SALOMEDS_StudyPropertiesAttribute.cdl delete mode 100644 src/SALOMEDS/SALOMEDS_StudyPropertiesAttribute.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_StudyPropertiesAttribute.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_StudyPropertiesAttribute.ixx delete mode 100644 src/SALOMEDS/SALOMEDS_StudyPropertiesAttribute.jxx diff --git a/src/SALOMEDS/Makefile.in b/src/SALOMEDS/Makefile.in index 5a4adbf4e..e066eec2a 100644 --- a/src/SALOMEDS/Makefile.in +++ b/src/SALOMEDS/Makefile.in @@ -1,28 +1,6 @@ -# SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -# -# Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -# -# # # File : Makefile.in -# Author : Marc Tajchman +# Author : Sergey RUIN # Module : SALOME top_srcdir=@top_srcdir@ @@ -35,13 +13,14 @@ VPATH=.:@srcdir@:@top_srcdir@/idl:$(top_srcdir)/idl EXPORT_HEADERS= \ SALOMEDS_StudyManager_i.hxx \ - SALOMEDS_OCAFApplication.hxx \ - Handle_SALOMEDS_OCAFApplication.hxx + SALOMEDS_Driver_i.hxx # Libraries targets LIB = libSalomeDS.la LIB_SRC = \ + SALOMEDS.cxx \ + SALOMEDS_Driver_i.cxx \ SALOMEDS_StudyManager_i.cxx \ SALOMEDS_UseCaseBuilder_i.cxx \ SALOMEDS_UseCaseIterator_i.cxx \ @@ -51,12 +30,7 @@ LIB_SRC = \ SALOMEDS_StudyBuilder_i.cxx \ SALOMEDS_SObject_i.cxx \ SALOMEDS_SComponent_i.cxx \ - SALOMEDS_OCAFApplication.cxx \ SALOMEDS_GenericAttribute_i.cxx \ - SALOMEDS_IORAttribute.cxx \ - SALOMEDS_ExternalFileDef.cxx \ - SALOMEDS_FileType.cxx \ - SALOMEDS_PersRefAttribute.cxx \ SALOMEDS_AttributeComment_i.cxx \ SALOMEDS_AttributeExternalFileDef_i.cxx \ SALOMEDS_AttributeFileType_i.cxx \ @@ -84,52 +58,33 @@ LIB_SRC = \ SALOMEDS_AttributeTableOfReal_i.cxx \ SALOMEDS_AttributeTableOfString_i.cxx \ SALOMEDS_AttributeStudyProperties_i.cxx \ - SALOMEDS_AttributePythonObject_i.cxx \ - SALOMEDS_SequenceOfRealAttribute.cxx \ - SALOMEDS_SequenceOfIntegerAttribute.cxx \ - SALOMEDS_DrawableAttribute.cxx \ - SALOMEDS_SelectableAttribute.cxx \ - SALOMEDS_ExpandableAttribute.cxx \ - SALOMEDS_OpenedAttribute.cxx \ - SALOMEDS_FlagsAttribute.cxx \ - SALOMEDS_GraphicAttribute.cxx \ - SALOMEDS_TextColorAttribute.cxx \ - SALOMEDS_TextHighlightColorAttribute.cxx \ - SALOMEDS_PixMapAttribute.cxx \ - SALOMEDS_LocalIDAttribute.cxx \ - SALOMEDS_TargetAttribute.cxx \ - SALOMEDS_TableOfIntegerAttribute.cxx \ - SALOMEDS_TableOfRealAttribute.cxx \ - SALOMEDS_TableOfStringAttribute.cxx \ - SALOMEDS_StudyPropertiesAttribute.cxx \ - SALOMEDS_PythonObjectAttribute.cxx \ - SALOMEDS_DataMapOfIntegerString_0.cxx \ - SALOMEDS_DataMapIteratorOfDataMapOfIntegerString_0.cxx \ - SALOMEDS_DataMapNodeOfDataMapOfIntegerString_0.cxx \ - SALOMEDS_DataMapIteratorOfDataMapStringLabel_0.cxx \ - SALOMEDS_DataMapNodeOfDataMapStringLabel_0.cxx \ - SALOMEDS_DataMapStringLabel_0.cxx + SALOMEDS_AttributePythonObject_i.cxx # Executables targets BIN = SALOMEDS_Server SALOMEDS_Client BIN_SRC = -LIB_SERVER_IDL = SALOMEDS.idl SALOMEDS_Attributes.idl SALOME_Exception.idl SALOME_ContainerManager.idl +LIB_SERVER_IDL = SALOMEDS.idl SALOMEDS_Attributes.idl SALOME_Exception.idl BIN_SERVER_IDL = SALOMEDS.idl SALOMEDS_Attributes.idl BIN_CLIENT_IDL = -LIB_CLIENT_IDL = SALOME_Component.idl SALOME_GenericObj.idl CPPFLAGS+=$(OCC_INCLUDES) $(HDF5_INCLUDES) CXXFLAGS+=$(OCC_CXXFLAGS) -LDFLAGS+= $(HDF5_LIBS) -lTOOLSDS -lSalomeNS -lSalomeHDFPersist -lOpUtil -lSALOMELocalTrace $(CAS_LDPATH) -lTKCAF -lTKBO -lTKStdSchema -lSalomeGenericObj -lSalomeLifeCycleCORBA -lSalomeContainer -lSalomeResourcesManager +LDFLAGS+= $(HDF5_LIBS) -lTOOLSDS -lSalomeNS -lSalomeHDFPersist -lOpUtil -lSALOMELocalTrace -lSalomeDSImpl $(CAS_LDPATH) -lTKCAF -lTKBO -lTKStdSchema -lSalomeGenericObj -lSalomeLifeCycleCORBA # _CS_gbo_090604 Ajout Spécifique Calibre 3, pour l'utilisation de la version 5.12 de la bibliothèque OCC. # La bibliothèque OCC5.12 a été compilée sur Calibre 3 avec l'extention Xmu (impossible de compiler sans). # On est donc obligé ici, pour permettre l'édition de lien avec les bibliothèques OCC, de spécifier le # chemin d'accès aux bibliothèques Xmu # + +# _CS_gbo_090604 Ajout Sp.cifique Calibre 3, pour l'utilisation de la version 5.12 de la biblioth.que OCC. +# La biblioth.que OCC5.12 a .t. compil.e sur Calibre 3 avec l'extention Xmu (impossible de compiler sans). +# On est donc oblig. ici, pour permettre l'.dition de lien avec les biblioth.ques OCC, de sp.cifier le +# chemin d'acc.s aux biblioth.ques Xmu +# LDXMUFLAGS= -L/usr/X11R6/lib -lXmu LDFLAGS+=$(LDXMUFLAGS) -LDFLAGSFORBIN= $(LDFLAGS) -lRegistry -lSalomeNotification -lSALOMETraceCollector +LDFLAGSFORBIN= $(LDFLAGS) -lRegistry -lSalomeNotification -lSALOMETraceCollector @CONCLUDE@ diff --git a/src/SALOMEDS/SALOMEDS_BasicAttribute_i.cxx b/src/SALOMEDS/SALOMEDS.cxx similarity index 71% rename from src/SALOMEDS/SALOMEDS_BasicAttribute_i.cxx rename to src/SALOMEDS/SALOMEDS.cxx index 5022f049c..1cebce2ed 100644 --- a/src/SALOMEDS/SALOMEDS_BasicAttribute_i.cxx +++ b/src/SALOMEDS/SALOMEDS.cxx @@ -21,21 +21,33 @@ // // // -// File : SALOMEDS_BasicAttribute_i.cxx -// Author : Estelle Deville, CEA +// File : SALOMEDS.cxx +// Author : Sergey ANIKIN // Module : SALOME // $Header$ -#include "SALOMEDS_BasicAttribute_i.hxx" -using namespace std; -//============================================================================ -/*! Function : SetLabel - * Purpose : - */ -//============================================================================ -void SALOMEDS_BasicAttribute_i::SetLabel(const TDF_Label Lab) +#include + +using namespace SALOMEDS; + +// PAL8065: san -- Global recursive mutex for SALOMEDS methods +Utils_Mutex Locker::MutexDS; + +// PAL8065: san -- Global SALOMEDS locker +Locker::Locker() +: Utils_Locker( &MutexDS ) +{} + +Locker::~Locker() +{} + +void SALOMEDS::lock() { - _Lab = Lab; + Locker::MutexDS.lock(); } +void SALOMEDS::unlock() +{ + Locker::MutexDS.unlock(); +} diff --git a/src/SALOMEDS/SALOMEDS_SAttribute_i.hxx b/src/SALOMEDS/SALOMEDS.hxx similarity index 50% rename from src/SALOMEDS/SALOMEDS_SAttribute_i.hxx rename to src/SALOMEDS/SALOMEDS.hxx index d7c739be5..06ee1825e 100644 --- a/src/SALOMEDS/SALOMEDS_SAttribute_i.hxx +++ b/src/SALOMEDS/SALOMEDS.hxx @@ -21,43 +21,47 @@ // // // -// File : SALOMEDS_SAttribute_i.hxx -// Author : Yves FRICAUD +// File : SALOMEDS.hxx +// Author : Sergey ANIKIN // Module : SALOME // $Header$ -#ifndef __SALOMEDS_SATTRIBUTE_I_H__ -#define __SALOMEDS_SATTRIBUTE_I_H__ -// std C++ headers -#include +#ifndef SALOMEDS_HeaderFile +#define SALOMEDS_HeaderFile -// IDL headers -#include -#include CORBA_SERVER_HEADER(SALOMEDS) +#include +namespace SALOMEDS +{ + // PAL8065: san -- Implementation of convenient locker based on simple recursive + // mutex for POSIX platforms. + // This class is to protect SALOMEDS CORBA methods which deal with OCC calls from + // parallel access by several threads + // To protect some method, an instance of Locker class should be created + // on the stack at the beginning of guarded code: + // + // Locker lock; + // + class Locker : public Utils_Locker + { + public: + Locker(); + virtual ~Locker(); + private: + static Utils_Mutex MutexDS; -// Cascade headers -#include -#include + friend void lock(); + friend void unlock(); + }; -class SALOMEDS_SAttribute_i: public POA_IStudy::SAttribute, - public PortableServer::RefCountServantBase { -private: - CORBA::ORB_ptr _orb; - char* _Type; - char -public: - - SALOMEDS_SAttribute_i(const Handle(TDocStd_Document), CORBA::ORB_ptr); - - ~SALOMEDS_SAttribute_i(); - - virtual char* GetID() ; - virtual SObject_ptr GetOwner(); - virtual char* GetType(); - virtual char* GetValue(); - + // Convenient functions to lock/unlock the global SALOMEDS mutex temporarily. + // In particular, "unlock-dosomething-lock" scheme should be used, when some non-SALOMEDS + // CORBA interface is called (component's engine), to avoid deadlocks in case of + // indirect recursion. + void lock(); + void unlock(); }; + #endif diff --git a/src/SALOMEDS/SALOMEDS_AttributeComment_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeComment_i.cxx index d84186658..e1565166a 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeComment_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeComment_i.cxx @@ -1,56 +1,28 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// // File : SALOMEDS_AttributeComment_i.cxx -// Author : Yves FRICAUD +// Author : Sergey RUIN // Module : SALOME -// $Header$ - -#include -#include +using namespace std; #include "SALOMEDS_AttributeComment_i.hxx" -using namespace std; +#include +#include "SALOMEDS_SObject_i.hxx" +#include "SALOMEDS.hxx" char* SALOMEDS_AttributeComment_i::Value() { - TCollection_ExtendedString S = Handle(TDataStd_Comment)::DownCast(_myAttr)->Get(); - CORBA::String_var c_s = CORBA::string_dup(TCollection_AsciiString(S).ToCString()); + SALOMEDS::Locker lock; + + CORBA::String_var c_s = + CORBA::string_dup(TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeComment)::DownCast(_impl)->Get()).ToCString()); return c_s._retn(); } void SALOMEDS_AttributeComment_i::SetValue(const char* value) { - CheckLocked(); - CORBA::String_var Str = CORBA::string_dup(value); - Handle(TDataStd_Comment)::DownCast(_myAttr)->Set(TCollection_ExtendedString(Str)); -} + SALOMEDS::Locker lock; -char* SALOMEDS_AttributeComment_i::Store() { - return Value(); -} - -void SALOMEDS_AttributeComment_i::Restore(const char* value) { - SetValue(value); + CheckLocked(); + TCollection_AsciiString aStr((char*)value); + Handle(SALOMEDSImpl_AttributeComment)::DownCast(_impl)->Set(TCollection_ExtendedString(aStr)); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeComment_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeComment_i.hxx index 762a96fe9..dcc5a4892 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeComment_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeComment_i.hxx @@ -1,56 +1,28 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// // File : SALOMEDS_AttributeComment_i.hxx -// Author : Yves FRICAUD +// Author : Sergey RUIN // Module : SALOME -// $Header$ #ifndef SALOMEDS_AttributeComment_i_HeaderFile #define SALOMEDS_AttributeComment_i_HeaderFile -#include - -#include "SALOMEDS_GenericAttribute_i.hxx" - // IDL headers #include #include CORBA_SERVER_HEADER(SALOMEDS_Attributes) -DEFINE_DERIVED_ATTR(AttributeComment,TDataStd_Comment,true); +#include "SALOMEDS_GenericAttribute_i.hxx" +#include "SALOMEDSImpl_AttributeComment.hxx" -class SALOMEDS_AttributeComment_i: - public virtual POA_SALOMEDS::AttributeComment, - public virtual SALOMEDS_TAttributeComment_i +class SALOMEDS_AttributeComment_i: public virtual POA_SALOMEDS::AttributeComment, + public virtual SALOMEDS_GenericAttribute_i { - DEFINE_DERIVED_ATTR_METH_DEFAULT(AttributeComment,TDataStd_Comment); -public: +public: + SALOMEDS_AttributeComment_i(const Handle(SALOMEDSImpl_AttributeComment)& theAttr, CORBA::ORB_ptr orb) + :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; + + virtual ~SALOMEDS_AttributeComment_i() {}; + char* Value(); - void SetValue(const char* theValue); - - char* Store(); - void Restore(const char*); + void SetValue(const char* value); }; - #endif diff --git a/src/SALOMEDS/SALOMEDS_AttributeDrawable_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeDrawable_i.cxx index 26f657821..f39a1d193 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeDrawable_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeDrawable_i.cxx @@ -1,50 +1,22 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// // File : SALOMEDS_AttributeDrawable_i.cxx -// Author : Yves FRICAUD +// Author : Sergey RUIN // Module : SALOME -// $Header$ -#include "SALOMEDS_AttributeDrawable_i.hxx" using namespace std; +#include "SALOMEDS_AttributeDrawable_i.hxx" +#include "SALOMEDS.hxx" -CORBA::Boolean SALOMEDS_AttributeDrawable_i::IsDrawable() { - return (Handle(SALOMEDS_DrawableAttribute)::DownCast(_myAttr)->Get() == 1); +CORBA::Boolean SALOMEDS_AttributeDrawable_i::IsDrawable() +{ + SALOMEDS::Locker lock; + return (Handle(SALOMEDSImpl_AttributeDrawable)::DownCast(_impl)->Get() == 1); } -void SALOMEDS_AttributeDrawable_i::SetDrawable(CORBA::Boolean value) { +void SALOMEDS_AttributeDrawable_i::SetDrawable(CORBA::Boolean value) +{ + SALOMEDS::Locker lock; CheckLocked(); - Standard_Integer val = 0; - if (value != 0) val = 1; - Handle(TDataStd_Integer)::DownCast(_myAttr)->Set(val); + Handle(SALOMEDSImpl_AttributeDrawable)::DownCast(_impl)->Set(value); } -char* SALOMEDS_AttributeDrawable_i::Store() { - return CORBA::string_dup(IsDrawable()?"1":"0"); -} - -void SALOMEDS_AttributeDrawable_i::Restore(const char* value) { - SetDrawable(value[0] == '1'); -} diff --git a/src/SALOMEDS/SALOMEDS_AttributeDrawable_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeDrawable_i.hxx index 7fb12ac34..97fbda50e 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeDrawable_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeDrawable_i.hxx @@ -1,56 +1,31 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// // File : SALOMEDS_AttributeDrawable_i.hxx -// Author : Yves FRICAUD +// Author : Sergey RUIN // Module : SALOME -// $Header: #ifndef SALOMEDS_AttributeDrawable_i_HeaderFile #define SALOMEDS_AttributeDrawable_i_HeaderFile -#include "SALOMEDS_DrawableAttribute.hxx" -#include "SALOMEDS_GenericAttribute_i.hxx" - // IDL headers + #include #include CORBA_SERVER_HEADER(SALOMEDS_Attributes) -DEFINE_DERIVED_ATTR(AttributeDrawable,SALOMEDS_DrawableAttribute,false); +#include "SALOMEDS_GenericAttribute_i.hxx" +#include "SALOMEDSImpl_AttributeDrawable.hxx" -class SALOMEDS_AttributeDrawable_i: - public virtual POA_SALOMEDS::AttributeDrawable, - public virtual SALOMEDS_TAttributeDrawable_i +class SALOMEDS_AttributeDrawable_i: public virtual POA_SALOMEDS::AttributeDrawable, + public virtual SALOMEDS_GenericAttribute_i { - DEFINE_DERIVED_ATTR_METH_DEFAULT(AttributeDrawable,SALOMEDS_DrawableAttribute); public: + + SALOMEDS_AttributeDrawable_i(const Handle(SALOMEDSImpl_AttributeDrawable)& theAttr, CORBA::ORB_ptr orb) + :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; + + virtual ~SALOMEDS_AttributeDrawable_i() {}; CORBA::Boolean IsDrawable(); void SetDrawable(CORBA::Boolean value); - - char* Store(); - void Restore(const char*); - }; + #endif diff --git a/src/SALOMEDS/SALOMEDS_AttributeExpandable_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeExpandable_i.cxx index 70601d33f..11fe92a7e 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeExpandable_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeExpandable_i.cxx @@ -1,49 +1,21 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// // File : SALOMEDS_AttributeExpandable_i.cxx -// Author : Yves FRICAUD +// Author : Sergey RUIN // Module : SALOME -// $Header$ - -#include "SALOMEDS_AttributeExpandable_i.hxx" using namespace std; +#include "SALOMEDS_AttributeExpandable_i.hxx" +#include "SALOMEDS.hxx" -CORBA::Boolean SALOMEDS_AttributeExpandable_i::IsExpandable() { - return (Handle(SALOMEDS_ExpandableAttribute)::DownCast(_myAttr)->Get() == 1); +CORBA::Boolean SALOMEDS_AttributeExpandable_i::IsExpandable() +{ + SALOMEDS::Locker lock; + return (Handle(SALOMEDSImpl_AttributeExpandable)::DownCast(_impl)->Get() == 1); } -void SALOMEDS_AttributeExpandable_i::SetExpandable(CORBA::Boolean value) { - Standard_Integer val = 0; - if (value != 0) val = 1; - Handle(TDataStd_Integer)::DownCast(_myAttr)->Set(val); +void SALOMEDS_AttributeExpandable_i::SetExpandable(CORBA::Boolean value) +{ + SALOMEDS::Locker lock; + CheckLocked(); + Handle(SALOMEDSImpl_AttributeExpandable)::DownCast(_impl)->Set(value); } -char* SALOMEDS_AttributeExpandable_i::Store() { - return CORBA::string_dup(IsExpandable()?"1":"0"); -} - -void SALOMEDS_AttributeExpandable_i::Restore(const char* value) { - SetExpandable(value[0] == '1'); -} diff --git a/src/SALOMEDS/SALOMEDS_AttributeExpandable_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeExpandable_i.hxx index a8c57c00e..7463c8f51 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeExpandable_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeExpandable_i.hxx @@ -1,28 +1,5 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// // File : SALOMEDS_AttributeExpandable_i.hxx -// Author : Yves FRICAUD +// Author : Sergey RUIN // Module : SALOME // $Header: @@ -30,26 +7,24 @@ #define SALOMEDS_AttributeExpandable_i_HeaderFile // IDL headers + #include #include CORBA_SERVER_HEADER(SALOMEDS_Attributes) -#include "SALOMEDS_ExpandableAttribute.hxx" #include "SALOMEDS_GenericAttribute_i.hxx" +#include "SALOMEDSImpl_AttributeExpandable.hxx" -DEFINE_DERIVED_ATTR(AttributeExpandable,SALOMEDS_ExpandableAttribute,false); - -class SALOMEDS_AttributeExpandable_i: - public virtual POA_SALOMEDS::AttributeExpandable, - public virtual SALOMEDS_TAttributeExpandable_i +class SALOMEDS_AttributeExpandable_i: public virtual POA_SALOMEDS::AttributeExpandable, + public virtual SALOMEDS_GenericAttribute_i { - DEFINE_DERIVED_ATTR_METH_DEFAULT(AttributeExpandable,SALOMEDS_ExpandableAttribute); public: + + SALOMEDS_AttributeExpandable_i(const Handle(SALOMEDSImpl_AttributeExpandable)& theAttr, CORBA::ORB_ptr orb) + :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; + + ~SALOMEDS_AttributeExpandable_i() {}; CORBA::Boolean IsExpandable(); void SetExpandable(CORBA::Boolean value); - - char* Store(); - void Restore(const char*); - }; diff --git a/src/SALOMEDS/SALOMEDS_AttributeExternalFileDef_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeExternalFileDef_i.cxx index 9c60c8886..cb9fd5938 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeExternalFileDef_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeExternalFileDef_i.cxx @@ -1,49 +1,24 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// // File : SALOMEDS_AttributeExternalFileDef_i.cxx -// Author : Yves FRICAUD +// Author : Sergey RUIN // Module : SALOME -// $Header$ +using namespace std; #include "SALOMEDS_AttributeExternalFileDef_i.hxx" - +#include "SALOMEDS.hxx" #include -#include - -using namespace std; char* SALOMEDS_AttributeExternalFileDef_i::Value() -{ - TCollection_ExtendedString S = Handle(SALOMEDS_ExternalFileDef)::DownCast(_myAttr)->Get(); - CORBA::String_var c_s = CORBA::string_dup(TCollection_AsciiString(S).ToCString()); +{ + SALOMEDS::Locker lock; + CORBA::String_var c_s = + CORBA::string_dup(TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeExternalFileDef)::DownCast(_impl)->Get()).ToCString()); return c_s._retn(); } void SALOMEDS_AttributeExternalFileDef_i::SetValue(const char* value) { + SALOMEDS::Locker lock; CheckLocked(); CORBA::String_var Str = CORBA::string_dup(value); - // Handle(SALOMEDS_ExternalFileDef)::DownCast(_myAttr)->Set(TCollection_ExtendedString(Str)); - Handle(TDataStd_Comment)::DownCast(_myAttr)->Set(TCollection_ExtendedString(Str)); + Handle(SALOMEDSImpl_AttributeExternalFileDef)::DownCast(_impl)->Set(TCollection_ExtendedString(Str)); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeExternalFileDef_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeExternalFileDef_i.hxx index 12b203356..a6032c359 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeExternalFileDef_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeExternalFileDef_i.hxx @@ -1,30 +1,6 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// // File : SALOMEDS_AttributeExternalFileDef_i.hxx -// Author : Yves FRICAUD +// Author : Sergey RUIN // Module : SALOME -// $Header$ #ifndef SALOMEDS_AttributeExternalFileDef_i_HeaderFile #define SALOMEDS_AttributeExternalFileDef_i_HeaderFile @@ -34,16 +10,17 @@ #include CORBA_SERVER_HEADER(SALOMEDS_Attributes) #include "SALOMEDS_GenericAttribute_i.hxx" -#include "SALOMEDS_ExternalFileDef.hxx" +#include "SALOMEDSImpl_AttributeExternalFileDef.hxx" -DEFINE_DERIVED_ATTR(AttributeExternalFileDef,SALOMEDS_ExternalFileDef,false); - -class SALOMEDS_AttributeExternalFileDef_i: - public virtual POA_SALOMEDS::AttributeExternalFileDef, - public virtual SALOMEDS_TAttributeExternalFileDef_i +class SALOMEDS_AttributeExternalFileDef_i: public virtual POA_SALOMEDS::AttributeExternalFileDef, + public virtual SALOMEDS_GenericAttribute_i { - DEFINE_DERIVED_ATTR_METH_DEFAULT(AttributeExternalFileDef,SALOMEDS_ExternalFileDef); public: + + SALOMEDS_AttributeExternalFileDef_i(const Handle(SALOMEDSImpl_AttributeExternalFileDef)& theAttr, CORBA::ORB_ptr orb) + :SALOMEDS_GenericAttribute_i(theAttr, orb) {} + ~SALOMEDS_AttributeExternalFileDef_i() {}; + char* Value(); void SetValue(const char* value); diff --git a/src/SALOMEDS/SALOMEDS_AttributeFileType_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeFileType_i.cxx index b6237f309..525e51f04 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeFileType_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeFileType_i.cxx @@ -1,48 +1,24 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// // File : SALOMEDS_AttributeFileType_i.cxx -// Author : Yves FRICAUD +// Author : Sergey RUIN // Module : SALOME -// $Header$ +using namespace std; #include "SALOMEDS_AttributeFileType_i.hxx" +#include "SALOMEDS.hxx" #include -#include - -using namespace std; char* SALOMEDS_AttributeFileType_i::Value() { - TCollection_ExtendedString S = Handle(SALOMEDS_FileType)::DownCast(_myAttr)->Get(); - CORBA::String_var c_s = CORBA::string_dup(TCollection_AsciiString(S).ToCString()); + SALOMEDS::Locker lock; + CORBA::String_var c_s = + CORBA::string_dup(TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeFileType)::DownCast(_impl)->Get()).ToCString()); return c_s._retn(); } void SALOMEDS_AttributeFileType_i::SetValue(const char* value) { + SALOMEDS::Locker lock; CheckLocked(); CORBA::String_var Str = CORBA::string_dup(value); - // Handle(SALOMEDS_FileType)::DownCast(_myAttr)->Set(TCollection_ExtendedString(Str)); - Handle(TDataStd_Comment)::DownCast(_myAttr)->Set(TCollection_ExtendedString(Str)); + Handle(SALOMEDSImpl_AttributeFileType)::DownCast(_impl)->Set(TCollection_ExtendedString(Str)); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeFileType_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeFileType_i.hxx index e31e23b2e..321d1a024 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeFileType_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeFileType_i.hxx @@ -1,49 +1,25 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// // File : SALOMEDS_AttributeFileType_i.hxx -// Author : Yves FRICAUD +// Author : Sergey RUIN // Module : SALOME -// $Header$ #ifndef SALOMEDS_AttributeFileType_i_HeaderFile #define SALOMEDS_AttributeFileType_i_HeaderFile -#include "SALOMEDS_GenericAttribute_i.hxx" -#include "SALOMEDS_FileType.hxx" - // IDL headers #include #include CORBA_SERVER_HEADER(SALOMEDS_Attributes) -DEFINE_DERIVED_ATTR(AttributeFileType,SALOMEDS_FileType,true); +#include "SALOMEDS_GenericAttribute_i.hxx" +#include "SALOMEDSImpl_AttributeFileType.hxx" -class SALOMEDS_AttributeFileType_i: - public virtual POA_SALOMEDS::AttributeFileType, - public virtual SALOMEDS_TAttributeFileType_i -{ - DEFINE_DERIVED_ATTR_METH_DEFAULT(AttributeFileType,SALOMEDS_FileType); +class SALOMEDS_AttributeFileType_i: public virtual POA_SALOMEDS::AttributeFileType, + public virtual SALOMEDS_GenericAttribute_i { public: + + SALOMEDS_AttributeFileType_i(const Handle(SALOMEDSImpl_AttributeFileType)& theAttr, CORBA::ORB_ptr orb) + :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; + ~SALOMEDS_AttributeFileType_i() {}; + char* Value(); void SetValue(const char* value); diff --git a/src/SALOMEDS/SALOMEDS_AttributeFlags_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeFlags_i.cxx index 43f2fd947..f26712d2a 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeFlags_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeFlags_i.cxx @@ -1,34 +1,22 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// // File : SALOMEDS_AttributeFlags_i.cxx -// Author : Sergey LITONIN +// Author : Sergey RUIN // Module : SALOME -// $Header$ +using namespace std; #include "SALOMEDS_AttributeFlags_i.hxx" +#include "SALOMEDS.hxx" + +/* + Class : SALOMEDS_AttributeFlags_i + Description : This class is intended for storing different object attributes that + have only two states (0 and 1). + + Avalable attributes: + + IS_VISIBLE - is equal to 1 if object is visible in 3D view (0 - overwise). + This attribute is valid for active view only. +*/ -using namespace std; //======================================================================= // function : SALOMEDS_AttributeFlags_i::GetFlags @@ -36,7 +24,8 @@ using namespace std; //======================================================================= CORBA::Long SALOMEDS_AttributeFlags_i::GetFlags() { - return Handle(SALOMEDS_FlagsAttribute)::DownCast( _myAttr )->Get(); + SALOMEDS::Locker lock; + return Handle(SALOMEDSImpl_AttributeFlags)::DownCast(_impl)->Get(); } //======================================================================= @@ -45,7 +34,8 @@ CORBA::Long SALOMEDS_AttributeFlags_i::GetFlags() //======================================================================= void SALOMEDS_AttributeFlags_i::SetFlags( CORBA::Long theFlags ) { - Handle(SALOMEDS_FlagsAttribute)::DownCast( _myAttr )->Set( theFlags ); + SALOMEDS::Locker lock; + Handle(SALOMEDSImpl_AttributeFlags)::DownCast(_impl)->Set( theFlags ); } //======================================================================= @@ -54,7 +44,8 @@ void SALOMEDS_AttributeFlags_i::SetFlags( CORBA::Long theFlags ) //======================================================================= CORBA::Boolean SALOMEDS_AttributeFlags_i::Get( CORBA::Long theFlag ) { - return Handle(SALOMEDS_FlagsAttribute)::DownCast( _myAttr )->Get() & theFlag ? true : false; + SALOMEDS::Locker lock; + return Handle(SALOMEDSImpl_AttributeFlags)::DownCast(_impl)->Get() & theFlag ? true : false; } //======================================================================= @@ -63,8 +54,8 @@ CORBA::Boolean SALOMEDS_AttributeFlags_i::Get( CORBA::Long theFlag ) //======================================================================= void SALOMEDS_AttributeFlags_i::Set( CORBA::Long theFlag, CORBA::Boolean theValue ) { - Handle(SALOMEDS_FlagsAttribute) anAttr = - Handle(SALOMEDS_FlagsAttribute)::DownCast( _myAttr ); + SALOMEDS::Locker lock; + Handle(SALOMEDSImpl_AttributeFlags) anAttr = Handle(SALOMEDSImpl_AttributeFlags)::DownCast(_impl); if ( theValue ) anAttr->Set( anAttr->Get() | theFlag ); else diff --git a/src/SALOMEDS/SALOMEDS_AttributeFlags_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeFlags_i.hxx index 228654562..1481d0720 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeFlags_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeFlags_i.hxx @@ -1,28 +1,5 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// // File : SALOMEDS_AttributeFlags_i.hxx -// Author : Sergey LITONIN +// Author : Sergey RUIN // Module : SALOME // $Header: @@ -30,11 +7,12 @@ #define SALOMEDS_AttributeFlags_i_HeaderFile // IDL headers + #include #include CORBA_SERVER_HEADER(SALOMEDS_Attributes) -#include "SALOMEDS_FlagsAttribute.hxx" #include "SALOMEDS_GenericAttribute_i.hxx" +#include "SALOMEDSImpl_AttributeFlags.hxx" /* Class : SALOMEDS_AttributeFlags_i @@ -47,14 +25,15 @@ This attribute is valid for active view only. */ -DEFINE_DERIVED_ATTR(AttributeFlags,SALOMEDS_FlagsAttribute,true); - -class SALOMEDS_AttributeFlags_i: - public virtual POA_SALOMEDS::AttributeFlags, - public virtual SALOMEDS_TAttributeFlags_i +class SALOMEDS_AttributeFlags_i: public virtual POA_SALOMEDS::AttributeFlags, + public virtual SALOMEDS_GenericAttribute_i { - DEFINE_DERIVED_ATTR_METH_DEFAULT(AttributeFlags,SALOMEDS_FlagsAttribute); public: + + SALOMEDS_AttributeFlags_i( const Handle(SALOMEDSImpl_AttributeFlags)& theAttr, CORBA::ORB_ptr orb ) + :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; + + virtual ~SALOMEDS_AttributeFlags_i() {}; CORBA::Long GetFlags(); void SetFlags( CORBA::Long theFlags ); diff --git a/src/SALOMEDS/SALOMEDS_AttributeGraphic_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeGraphic_i.cxx index 7865b2501..cc94d8d81 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeGraphic_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeGraphic_i.cxx @@ -1,34 +1,17 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// // File : SALOMEDS_AttributeGraphic_i.cxx -// Author : Sergey LITONIN +// Author : Sergey RUIN // Module : SALOME -// $Header$ +using namespace std; #include "SALOMEDS_AttributeGraphic_i.hxx" +#include "SALOMEDS.hxx" + +/* + Class : SALOMEDS_AttributeGraphic_i + Description : This class is intended for storing information about + graphic representation of objects in dirrent views +*/ -using namespace std; //======================================================================= // function : SALOMEDS_AttributeGraphic_i::~SetVisibility @@ -37,10 +20,9 @@ using namespace std; void SALOMEDS_AttributeGraphic_i::SetVisibility( CORBA::Long theViewId, CORBA::Boolean theValue ) { - Handle(SALOMEDS_GraphicAttribute) anAttr = - Handle(SALOMEDS_GraphicAttribute)::DownCast( _myAttr ); - if ( !anAttr.IsNull() ) - anAttr->SetVisibility( theViewId, theValue ); + SALOMEDS::Locker lock; + if ( !_impl.IsNull() ) + Handle(SALOMEDSImpl_AttributeGraphic)::DownCast(_impl)->SetVisibility( theViewId, theValue ); } //======================================================================= @@ -49,9 +31,8 @@ void SALOMEDS_AttributeGraphic_i::SetVisibility( CORBA::Long theViewId, //======================================================================= CORBA::Boolean SALOMEDS_AttributeGraphic_i::GetVisibility( CORBA::Long theViewId ) { - Handle(SALOMEDS_GraphicAttribute) anAttr = - Handle(SALOMEDS_GraphicAttribute)::DownCast( _myAttr ); - return !anAttr.IsNull() ? anAttr->GetVisibility( theViewId ) : false; + SALOMEDS::Locker lock; + return !_impl.IsNull() ? Handle(SALOMEDSImpl_AttributeGraphic)::DownCast(_impl)->GetVisibility( theViewId ) : false; } diff --git a/src/SALOMEDS/SALOMEDS_AttributeGraphic_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeGraphic_i.hxx index 718b28619..a391fc333 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeGraphic_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeGraphic_i.hxx @@ -1,28 +1,5 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// // File : SALOMEDS_AttributeFlags_i.hxx -// Author : Sergey LITONIN +// Author : Sergey RUIN // Module : SALOME // $Header: @@ -30,11 +7,13 @@ #define SALOMEDS_AttributeGraphic_i_HeaderFile // IDL headers + + #include #include CORBA_SERVER_HEADER(SALOMEDS_Attributes) -#include "SALOMEDS_GraphicAttribute.hxx" #include "SALOMEDS_GenericAttribute_i.hxx" +#include "SALOMEDSImpl_AttributeGraphic.hxx" /* Class : SALOMEDS_AttributeGraphic_i @@ -42,18 +21,20 @@ graphic representation of objects in dirrent views */ -DEFINE_DERIVED_ATTR(AttributeGraphic,SALOMEDS_GraphicAttribute,true); - -class SALOMEDS_AttributeGraphic_i: - public virtual POA_SALOMEDS::AttributeGraphic, - public virtual SALOMEDS_TAttributeGraphic_i +class SALOMEDS_AttributeGraphic_i: public virtual POA_SALOMEDS::AttributeGraphic, + public virtual SALOMEDS_GenericAttribute_i { - DEFINE_DERIVED_ATTR_METH_DEFAULT(AttributeGraphic,SALOMEDS_GraphicAttribute); public: + + SALOMEDS_AttributeGraphic_i( const Handle(SALOMEDSImpl_AttributeGraphic)& theAttr, CORBA::ORB_ptr orb ) + :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; + + virtual ~SALOMEDS_AttributeGraphic_i() {}; void SetVisibility( CORBA::Long theViewId, CORBA::Boolean theValue ); CORBA::Boolean GetVisibility( CORBA::Long theViewId ); + }; #endif diff --git a/src/SALOMEDS/SALOMEDS_AttributeIOR_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeIOR_i.cxx index dec61d358..292a5a901 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeIOR_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeIOR_i.cxx @@ -1,55 +1,24 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// // File : SALOMEDS_AttributeIOR_i.cxx -// Author : Yves FRICAUD +// Author : Sergey RUIN // Module : SALOME -// $Header$ +using namespace std; #include "SALOMEDS_AttributeIOR_i.hxx" - +#include "SALOMEDS.hxx" #include -#include "SALOMEDS_SObject_i.hxx" -#include "SALOMEDS_Study_i.hxx" - -using namespace std; char* SALOMEDS_AttributeIOR_i::Value() { - TCollection_ExtendedString S = Handle(SALOMEDS_IORAttribute)::DownCast(_myAttr)->Get(); - CORBA::String_var c_s = CORBA::string_dup(TCollection_AsciiString(S).ToCString()); + SALOMEDS::Locker lock; + CORBA::String_var c_s = + CORBA::string_dup(TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeIOR)::DownCast(_impl)->Value()).ToCString()); return c_s._retn(); } void SALOMEDS_AttributeIOR_i::SetValue(const char* value) { + SALOMEDS::Locker lock; CheckLocked(); - - SALOMEDS_Study_i* aStudy = _mySObject->GetStudyServant(); - aStudy->AddCreatedPostponed(value); - aStudy->AddPostponed(Value()); - CORBA::String_var Str = CORBA::string_dup(value); - Handle(TDataStd_Comment)::DownCast(_myAttr)->Set(TCollection_ExtendedString(Str)); - aStudy->IORUpdated(Handle(SALOMEDS_IORAttribute)::DownCast(_myAttr)); + Handle(SALOMEDSImpl_AttributeIOR)::DownCast(_impl)->SetValue(TCollection_ExtendedString(Str)); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeIOR_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeIOR_i.hxx index 5e60bd6cb..1aa1b7e4f 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeIOR_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeIOR_i.hxx @@ -1,48 +1,25 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// // File : SALOMEDS_AttributeIOR_i.hxx -// Author : Yves FRICAUD +// Author : Sergey RUIN // Module : SALOME -// $Header$ #ifndef SALOMEDS_AttributeIOR_i_HeaderFile #define SALOMEDS_AttributeIOR_i_HeaderFile -#include "SALOMEDS_GenericAttribute_i.hxx" -#include "SALOMEDS_IORAttribute.hxx" - #include #include CORBA_SERVER_HEADER(SALOMEDS_Attributes) -DEFINE_DERIVED_ATTR(AttributeIOR,SALOMEDS_IORAttribute,true); +#include "SALOMEDS_GenericAttribute_i.hxx" +#include "SALOMEDSImpl_AttributeIOR.hxx" -class SALOMEDS_AttributeIOR_i: - public virtual POA_SALOMEDS::AttributeIOR, - public virtual SALOMEDS_TAttributeIOR_i -{ - DEFINE_DERIVED_ATTR_METH_DEFAULT(AttributeIOR,SALOMEDS_IORAttribute); +class SALOMEDS_AttributeIOR_i: public virtual POA_SALOMEDS::AttributeIOR, + public virtual SALOMEDS_GenericAttribute_i { public: + + SALOMEDS_AttributeIOR_i(const Handle(SALOMEDSImpl_AttributeIOR)& theAttr, CORBA::ORB_ptr orb) + :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; + + ~SALOMEDS_AttributeIOR_i() {}; + char* Value(); void SetValue(const char* value); diff --git a/src/SALOMEDS/SALOMEDS_AttributeInteger_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeInteger_i.cxx index 8e40d8590..2a08dddfd 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeInteger_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeInteger_i.cxx @@ -1,52 +1,22 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// // File : SALOMEDS_AttributeInteger_i.cxx -// Author : Yves FRICAUD +// Author : Sergey RUIN // Module : SALOME -// $Header$ - -#include "SALOMEDS_AttributeInteger_i.hxx" using namespace std; +#include "SALOMEDS_AttributeInteger_i.hxx" +#include "SALOMEDS.hxx" -CORBA::Long SALOMEDS_AttributeInteger_i::Value() { - return Handle(TDataStd_Integer)::DownCast(_myAttr)->Get(); +CORBA::Long SALOMEDS_AttributeInteger_i::Value() +{ + SALOMEDS::Locker lock; + return Handle(SALOMEDSImpl_AttributeInteger)::DownCast(_impl)->Get(); } -void SALOMEDS_AttributeInteger_i::SetValue(CORBA::Long value) { +void SALOMEDS_AttributeInteger_i::SetValue(CORBA::Long value) +{ + SALOMEDS::Locker lock; CheckLocked(); - Handle(TDataStd_Integer)::DownCast(_myAttr)->Set(value); + Handle(SALOMEDSImpl_AttributeInteger)::DownCast(_impl)->Set(value); } -char* SALOMEDS_AttributeInteger_i::Store() { - char* IntVal = new char[25]; - sprintf(IntVal, "%d", Value()); - return IntVal; -} -void SALOMEDS_AttributeInteger_i::Restore(const char* value) { - char *err = NULL; - CORBA::Long l = atol(value); - SetValue(l); -} diff --git a/src/SALOMEDS/SALOMEDS_AttributeInteger_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeInteger_i.hxx index 0339a2cce..dc0bea26e 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeInteger_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeInteger_i.hxx @@ -1,57 +1,32 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// // File : SALOMEDS_AttributeInteger_i.hxx -// Author : Yves FRICAUD +// Author : Sergey RUIN // Module : SALOME -// $Header: #ifndef SALOMEDS_AttributeInteger_i_HeaderFile #define SALOMEDS_AttributeInteger_i_HeaderFile -#include +// IDL headers -#include "SALOMEDS_GenericAttribute_i.hxx" -// IDL headers #include #include CORBA_SERVER_HEADER(SALOMEDS_Attributes) -DEFINE_DERIVED_ATTR(AttributeInteger,TDataStd_Integer,true); +#include "SALOMEDS_GenericAttribute_i.hxx" +#include "SALOMEDSImpl_AttributeInteger.hxx" -class SALOMEDS_AttributeInteger_i: - public virtual POA_SALOMEDS::AttributeInteger, - public virtual SALOMEDS_TAttributeInteger_i -{ - DEFINE_DERIVED_ATTR_METH_DEFAULT(AttributeInteger,TDataStd_Integer); +class SALOMEDS_AttributeInteger_i: public virtual POA_SALOMEDS::AttributeInteger, + public virtual SALOMEDS_GenericAttribute_i { public: - CORBA::Long Value(); - void SetValue(CORBA::Long theValue); + + SALOMEDS_AttributeInteger_i(const Handle(SALOMEDSImpl_AttributeInteger)& theAttr, CORBA::ORB_ptr orb) + :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; - char* Store(); - void Restore(const char*); + ~SALOMEDS_AttributeInteger_i() {}; + CORBA::Long Value(); + void SetValue(CORBA::Long value); }; + #endif diff --git a/src/SALOMEDS/SALOMEDS_AttributeLocalID_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeLocalID_i.cxx index 77cef4678..23e4cf152 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeLocalID_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeLocalID_i.cxx @@ -1,52 +1,21 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// // File : SALOMEDS_AttributeLocalID_i.cxx -// Author : Yves FRICAUD +// Author : Sergey RUIN // Module : SALOME -// $Header$ - -#include "SALOMEDS_AttributeLocalID_i.hxx" using namespace std; +#include "SALOMEDS_AttributeLocalID_i.hxx" +#include "SALOMEDS.hxx" -CORBA::Long SALOMEDS_AttributeLocalID_i::Value() { - return Handle(SALOMEDS_LocalIDAttribute)::DownCast(_myAttr)->Get(); +CORBA::Long SALOMEDS_AttributeLocalID_i::Value() +{ + SALOMEDS::Locker lock; + return Handle(SALOMEDSImpl_AttributeLocalID)::DownCast(_impl)->Value(); } -void SALOMEDS_AttributeLocalID_i::SetValue(CORBA::Long value) { +void SALOMEDS_AttributeLocalID_i::SetValue(CORBA::Long value) +{ + SALOMEDS::Locker lock; CheckLocked(); - Handle(TDataStd_Integer)::DownCast(_myAttr)->Set(value); + Handle(SALOMEDSImpl_AttributeLocalID)::DownCast(_impl)->SetValue(value); } -char* SALOMEDS_AttributeLocalID_i::Store() { - char* IntVal = new char[25]; - sprintf(IntVal, "%d", Value()); - return IntVal; -} - -void SALOMEDS_AttributeLocalID_i::Restore(const char* value) { - char *err = NULL; - CORBA::Long l = atol(value); - SetValue(l); -} diff --git a/src/SALOMEDS/SALOMEDS_AttributeLocalID_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeLocalID_i.hxx index a2d41abf9..add11aab7 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeLocalID_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeLocalID_i.hxx @@ -1,28 +1,5 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// // File : SALOMEDS_AttributeLocalID_i.hxx -// Author : Yves FRICAUD +// Author : Sergey RUIN // Module : SALOME // $Header: @@ -33,25 +10,24 @@ #include #include CORBA_SERVER_HEADER(SALOMEDS_Attributes) -#include "SALOMEDS_LocalIDAttribute.hxx" #include "SALOMEDS_GenericAttribute_i.hxx" +#include "SALOMEDSImpl_AttributeLocalID.hxx" -DEFINE_DERIVED_ATTR(AttributeLocalID,SALOMEDS_LocalIDAttribute,true); - -class SALOMEDS_AttributeLocalID_i: - public virtual POA_SALOMEDS::AttributeLocalID, - public virtual SALOMEDS_TAttributeLocalID_i +class SALOMEDS_AttributeLocalID_i: public virtual POA_SALOMEDS::AttributeLocalID, + public virtual SALOMEDS_GenericAttribute_i { - DEFINE_DERIVED_ATTR_METH_DEFAULT(AttributeLocalID,SALOMEDS_LocalIDAttribute); public: + + SALOMEDS_AttributeLocalID_i(const Handle(SALOMEDSImpl_AttributeLocalID)& theAttr, CORBA::ORB_ptr orb) + :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; + + ~SALOMEDS_AttributeLocalID_i() {}; CORBA::Long Value(); void SetValue(CORBA::Long value); - char* Store(); - void Restore(const char*); - }; + #endif diff --git a/src/SALOMEDS/SALOMEDS_AttributeName_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeName_i.cxx index b495f26bf..14a4d423e 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeName_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeName_i.cxx @@ -1,52 +1,23 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// // File : SALOMEDS_AttributeName_i.cxx -// Author : Yves FRICAUD +// Author : Sergey RUIN // Module : SALOME -// $Header$ +using namespace std; #include "SALOMEDS_AttributeName_i.hxx" +#include "SALOMEDS.hxx" #include -#include - -using namespace std; -char* SALOMEDS_AttributeName_i::Value() { - TCollection_ExtendedString S = Handle(TDataStd_Name)::DownCast(_myAttr)->Get(); - CORBA::String_var c_s = CORBA::string_dup(TCollection_AsciiString(S).ToCString()); +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()); return c_s._retn(); } -void SALOMEDS_AttributeName_i::SetValue(const char* theValue) { +void SALOMEDS_AttributeName_i::SetValue(const char* value) +{ + SALOMEDS::Locker lock; CheckLocked(); - Handle(TDataStd_Name)::DownCast(_myAttr)->Set(TCollection_ExtendedString((char*)theValue)); -} - -char* SALOMEDS_AttributeName_i::Store() { - return Value(); -} - -void SALOMEDS_AttributeName_i::Restore(const char* value) { - SetValue(value); + Handle(SALOMEDSImpl_AttributeName)::DownCast(_impl)->Set(TCollection_ExtendedString((char*)value)); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeName_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeName_i.hxx index ffcebc20f..cdb147181 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeName_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeName_i.hxx @@ -1,55 +1,31 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// // File : SALOMEDS_AttributeName_i.hxx -// Author : Yves FRICAUD +// Author : Sergey RUIN // Module : SALOME // $Header: #ifndef SALOMEDS_AttributeName_i_HeaderFile #define SALOMEDS_AttributeName_i_HeaderFile -#include - -#include "SALOMEDS_GenericAttribute_i.hxx" - // IDL headers #include #include CORBA_SERVER_HEADER(SALOMEDS_Attributes) -DEFINE_DERIVED_ATTR(AttributeName,TDataStd_Name,true); +#include "SALOMEDS_GenericAttribute_i.hxx" +#include "SALOMEDSImpl_AttributeName.hxx" -class SALOMEDS_AttributeName_i: - public virtual POA_SALOMEDS::AttributeName, - public virtual SALOMEDS_TAttributeName_i +class SALOMEDS_AttributeName_i: public virtual POA_SALOMEDS::AttributeName, + public virtual SALOMEDS_GenericAttribute_i { - DEFINE_DERIVED_ATTR_METH_DEFAULT(AttributeName,TDataStd_Name); public: + + SALOMEDS_AttributeName_i(const Handle(SALOMEDSImpl_AttributeName)& theAttr, CORBA::ORB_ptr orb) + :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; + + ~SALOMEDS_AttributeName_i() {}; + char* Value(); void SetValue(const char* value); - char* Store(); - void Restore(const char*); }; diff --git a/src/SALOMEDS/SALOMEDS_AttributeOpened_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeOpened_i.cxx index 5471006e5..5c1fb6522 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeOpened_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeOpened_i.cxx @@ -1,49 +1,22 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// // File : SALOMEDS_AttributeOpened_i.cxx -// Author : Yves FRICAUD +// Author : Sergey RUIN // Module : SALOME -// $Header$ - -#include "SALOMEDS_AttributeOpened_i.hxx" using namespace std; +#include "SALOMEDS_AttributeOpened_i.hxx" +#include "SALOMEDS.hxx" -CORBA::Boolean SALOMEDS_AttributeOpened_i::IsOpened() { - return (Handle(SALOMEDS_OpenedAttribute)::DownCast(_myAttr)->Get() == 1); +CORBA::Boolean SALOMEDS_AttributeOpened_i::IsOpened() +{ + SALOMEDS::Locker lock; + return (Handle(SALOMEDSImpl_AttributeOpened)::DownCast(_impl)->Get() == 1); } -void SALOMEDS_AttributeOpened_i::SetOpened(CORBA::Boolean value) { +void SALOMEDS_AttributeOpened_i::SetOpened(CORBA::Boolean value) +{ + SALOMEDS::Locker lock; + Standard_Integer val = 0; if (value != 0) val = 1; - Handle(TDataStd_Integer)::DownCast(_myAttr)->Set(val); -} - -char* SALOMEDS_AttributeOpened_i::Store() { - return CORBA::string_dup(IsOpened()?"1":"0"); -} - -void SALOMEDS_AttributeOpened_i::Restore(const char* value) { - SetOpened(value[0] == '1'); + Handle(SALOMEDSImpl_AttributeOpened)::DownCast(_impl)->Set(val); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeOpened_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeOpened_i.hxx index 0ad905ca6..3d5ea9ca6 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeOpened_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeOpened_i.hxx @@ -1,28 +1,5 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// // File : SALOMEDS_AttributeOpened_i.hxx -// Author : Yves FRICAUD +// Author : Sergey RUIN // Module : SALOME // $Header: @@ -33,23 +10,20 @@ #include #include CORBA_SERVER_HEADER(SALOMEDS_Attributes) -#include "SALOMEDS_OpenedAttribute.hxx" #include "SALOMEDS_GenericAttribute_i.hxx" +#include "SALOMEDSImpl_AttributeOpened.hxx" -DEFINE_DERIVED_ATTR(AttributeOpened,SALOMEDS_OpenedAttribute,false); - -class SALOMEDS_AttributeOpened_i: - public virtual POA_SALOMEDS::AttributeOpened, - public virtual SALOMEDS_TAttributeOpened_i +class SALOMEDS_AttributeOpened_i: public virtual POA_SALOMEDS::AttributeOpened, + public virtual SALOMEDS_GenericAttribute_i { - DEFINE_DERIVED_ATTR_METH_DEFAULT(AttributeOpened,SALOMEDS_OpenedAttribute); public: + + SALOMEDS_AttributeOpened_i(const Handle(SALOMEDSImpl_AttributeOpened)& theAttr, CORBA::ORB_ptr orb) + :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; + ~SALOMEDS_AttributeOpened_i() {}; + CORBA::Boolean IsOpened(); void SetOpened(CORBA::Boolean value); - - char* Store(); - void Restore(const char*); - }; diff --git a/src/SALOMEDS/SALOMEDS_AttributePersistentRef_i.cxx b/src/SALOMEDS/SALOMEDS_AttributePersistentRef_i.cxx index 67281220b..02fca5517 100644 --- a/src/SALOMEDS/SALOMEDS_AttributePersistentRef_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributePersistentRef_i.cxx @@ -1,55 +1,24 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// // File : SALOMEDS_AttributePersistentRef_i.cxx -// Author : Yves FRICAUD +// Author : Sergey RUIN // Module : SALOME -// $Header$ +using namespace std; #include "SALOMEDS_AttributePersistentRef_i.hxx" +#include "SALOMEDS.hxx" #include -#include - -using namespace std; char* SALOMEDS_AttributePersistentRef_i::Value() { - TCollection_ExtendedString S = Handle(SALOMEDS_PersRefAttribute)::DownCast(_myAttr)->Get(); - CORBA::String_var c_s = CORBA::string_dup(TCollection_AsciiString(S).ToCString()); + SALOMEDS::Locker lock; + CORBA::String_var c_s = + CORBA::string_dup(TCollection_AsciiString(Handle(SALOMEDSImpl_AttributePersistentRef)::DownCast(_impl)->Get()).ToCString()); return c_s._retn(); } void SALOMEDS_AttributePersistentRef_i::SetValue(const char* value) { + SALOMEDS::Locker lock; CheckLocked(); CORBA::String_var Str = CORBA::string_dup(value); - Handle(TDataStd_Comment)::DownCast(_myAttr)->Set(TCollection_ExtendedString(Str)); -} - -char* SALOMEDS_AttributePersistentRef_i::Store() { - return Value(); -} - -void SALOMEDS_AttributePersistentRef_i::Restore(const char* value) { - SetValue(value); + Handle(SALOMEDSImpl_AttributePersistentRef)::DownCast(_impl)->Set(TCollection_ExtendedString(Str)); } diff --git a/src/SALOMEDS/SALOMEDS_AttributePersistentRef_i.hxx b/src/SALOMEDS/SALOMEDS_AttributePersistentRef_i.hxx index 40cb20149..ccf47be6c 100644 --- a/src/SALOMEDS/SALOMEDS_AttributePersistentRef_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributePersistentRef_i.hxx @@ -1,55 +1,30 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// // File : SALOMEDS_AttributePersistentRef_i.hxx -// Author : Yves FRICAUD +// Author : Sergey RUIN // Module : SALOME -// $Header$ #ifndef SALOMEDS_AttributePersistentRef_i_HeaderFile #define SALOMEDS_AttributePersistentRef_i_HeaderFile -#include "SALOMEDS_GenericAttribute_i.hxx" -#include "SALOMEDS_PersRefAttribute.hxx" - #include #include CORBA_SERVER_HEADER(SALOMEDS_Attributes) -DEFINE_DERIVED_ATTR(AttributePersistentRef,SALOMEDS_PersRefAttribute,false); +#include "SALOMEDS_GenericAttribute_i.hxx" +#include "SALOMEDSImpl_AttributePersistentRef.hxx" -class SALOMEDS_AttributePersistentRef_i: - public virtual POA_SALOMEDS::AttributePersistentRef, - public virtual SALOMEDS_TAttributePersistentRef_i -{ - DEFINE_DERIVED_ATTR_METH_DEFAULT(AttributePersistentRef,SALOMEDS_PersRefAttribute); +class SALOMEDS_AttributePersistentRef_i: public virtual POA_SALOMEDS::AttributePersistentRef, + public virtual SALOMEDS_GenericAttribute_i { public: + + SALOMEDS_AttributePersistentRef_i(const Handle(SALOMEDSImpl_AttributePersistentRef)& theAttr, CORBA::ORB_ptr orb) + :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; + + ~SALOMEDS_AttributePersistentRef_i() {}; + char* Value(); void SetValue(const char* value); - char* Store(); - void Restore(const char*); - }; + #endif diff --git a/src/SALOMEDS/SALOMEDS_AttributePixMap_i.cxx b/src/SALOMEDS/SALOMEDS_AttributePixMap_i.cxx index 8fc0f2be1..56532dba3 100644 --- a/src/SALOMEDS/SALOMEDS_AttributePixMap_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributePixMap_i.cxx @@ -1,57 +1,32 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// // File : SALOMEDS_AttributePixMap_i.cxx -// Author : Yves FRICAUD +// Author : Sergey RUIN // Module : SALOME -// $Header$ +using namespace std; #include "SALOMEDS_AttributePixMap_i.hxx" +#include "SALOMEDS.hxx" #include -using namespace std; - -CORBA::Boolean SALOMEDS_AttributePixMap_i::HasPixMap() { - TCollection_ExtendedString S = Handle(SALOMEDS_PixMapAttribute)::DownCast(_myAttr)->Get(); +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; } -char* SALOMEDS_AttributePixMap_i::GetPixMap() { - CORBA::String_var S = CORBA::string_dup(TCollection_AsciiString(Handle(SALOMEDS_PixMapAttribute)::DownCast(_myAttr)->Get()).ToCString()); - return S._retn(); +char* SALOMEDS_AttributePixMap_i::GetPixMap() +{ + SALOMEDS::Locker lock; + CORBA::String_var S = + CORBA::string_dup(TCollection_AsciiString(Handle(SALOMEDSImpl_AttributePixMap)::DownCast(_impl)->Get()).ToCString()); + return S._retn(); } -void SALOMEDS_AttributePixMap_i::SetPixMap(const char* value) { +void SALOMEDS_AttributePixMap_i::SetPixMap(const char* value) +{ + SALOMEDS::Locker lock; CheckLocked(); CORBA::String_var Str = CORBA::string_dup(value); - Handle(TDataStd_Comment)::DownCast(_myAttr)->Set(TCollection_ExtendedString(Str)); + Handle(SALOMEDSImpl_AttributePixMap)::DownCast(_impl)->Set(TCollection_ExtendedString(Str)); } -char* SALOMEDS_AttributePixMap_i::Store() { - return GetPixMap(); -} - -void SALOMEDS_AttributePixMap_i::Restore(const char* value) { - SetPixMap(value); -} diff --git a/src/SALOMEDS/SALOMEDS_AttributePixMap_i.hxx b/src/SALOMEDS/SALOMEDS_AttributePixMap_i.hxx index c17fa5c2f..46f3797ff 100644 --- a/src/SALOMEDS/SALOMEDS_AttributePixMap_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributePixMap_i.hxx @@ -1,30 +1,6 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// // File : SALOMEDS_AttributePixMap_i.hxx -// Author : Yves FRICAUD +// Author : Sergey RUIN // Module : SALOME -// $Header$ #ifndef SALOMEDS_AttributePixMap_i_HeaderFile #define SALOMEDS_AttributePixMap_i_HeaderFile @@ -33,24 +9,23 @@ #include #include CORBA_SERVER_HEADER(SALOMEDS_Attributes) -#include "SALOMEDS_PixMapAttribute.hxx" #include "SALOMEDS_GenericAttribute_i.hxx" +#include "SALOMEDSImpl_AttributePixMap.hxx" -DEFINE_DERIVED_ATTR(AttributePixMap,SALOMEDS_PixMapAttribute,false); - -class SALOMEDS_AttributePixMap_i: - public virtual POA_SALOMEDS::AttributePixMap, - public virtual SALOMEDS_TAttributePixMap_i +class SALOMEDS_AttributePixMap_i: public virtual POA_SALOMEDS::AttributePixMap, + public virtual SALOMEDS_GenericAttribute_i { - DEFINE_DERIVED_ATTR_METH_DEFAULT(AttributePixMap,SALOMEDS_PixMapAttribute); public: + + SALOMEDS_AttributePixMap_i(const Handle(SALOMEDSImpl_AttributePixMap)& theAttr, CORBA::ORB_ptr orb) + :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; + + ~SALOMEDS_AttributePixMap_i() {}; + CORBA::Boolean HasPixMap(); char* GetPixMap(); void SetPixMap(const char* value); - char* Store(); - void Restore(const char*); - }; diff --git a/src/SALOMEDS/SALOMEDS_AttributePythonObject_i.cxx b/src/SALOMEDS/SALOMEDS_AttributePythonObject_i.cxx index 2faab629d..c8f4b886b 100644 --- a/src/SALOMEDS/SALOMEDS_AttributePythonObject_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributePythonObject_i.cxx @@ -1,43 +1,33 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// -// // File : SALOMEDS_AttributePythonObject_i.cxx -// Author : Michael Ponikarov +// Author : Sergey RUIN // Module : SALOME -// $Header$ +using namespace std; #include "SALOMEDS_AttributePythonObject_i.hxx" +#include "SALOMEDS.hxx" #include #include -using namespace std; - -void SALOMEDS_AttributePythonObject_i::SetObject(const char* theSequence, CORBA::Boolean IsScript) { +void SALOMEDS_AttributePythonObject_i::SetObject(const char* theSequence, CORBA::Boolean IsScript) +{ + SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDS_PythonObjectAttribute)::DownCast(_myAttr)->SetObject(const_cast(theSequence), IsScript); + char *aSeq = CORBA::string_dup(theSequence); + Handle(SALOMEDSImpl_AttributePythonObject)::DownCast(_impl)->SetObject(aSeq, IsScript); } -char* SALOMEDS_AttributePythonObject_i::GetObject() { - char* aSeq = Handle(SALOMEDS_PythonObjectAttribute)::DownCast(_myAttr)->GetObject(); +char* SALOMEDS_AttributePythonObject_i::GetObject() +{ + SALOMEDS::Locker lock; + char* aSeq = Handle(SALOMEDSImpl_AttributePythonObject)::DownCast(_impl)->GetObject().ToCString(); CORBA::String_var aStr = CORBA::string_dup(aSeq); return aStr._retn(); } -CORBA::Boolean SALOMEDS_AttributePythonObject_i::IsScript() { - return Handle(SALOMEDS_PythonObjectAttribute)::DownCast(_myAttr)->IsScript(); +CORBA::Boolean SALOMEDS_AttributePythonObject_i::IsScript() +{ + SALOMEDS::Locker lock; + return Handle(SALOMEDSImpl_AttributePythonObject)::DownCast(_impl)->IsScript(); } -char* SALOMEDS_AttributePythonObject_i::Store() { - CORBA::String_var aString = GetObject(); - char* aResult = new char[strlen(aString) + 2]; - aResult[0] = IsScript()?'s':'n'; - strcpy(aResult+1, aString); - return aResult; -} -void SALOMEDS_AttributePythonObject_i::Restore(const char* theValue) { - SetObject(&theValue[1], theValue[0]=='s'); -} diff --git a/src/SALOMEDS/SALOMEDS_AttributePythonObject_i.hxx b/src/SALOMEDS/SALOMEDS_AttributePythonObject_i.hxx index 615690b97..fb82ce740 100644 --- a/src/SALOMEDS/SALOMEDS_AttributePythonObject_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributePythonObject_i.hxx @@ -1,13 +1,6 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// -// // File : SALOMEDS_AttributePythonObject_i.hxx -// Author : Michael Ponikarov +// Author : Sergey RUIN // Module : SALOME -// $Header$ #ifndef SALOMEDS_AttributePythonObject_i_HeaderFile #define SALOMEDS_AttributePythonObject_i_HeaderFile @@ -17,23 +10,24 @@ #include CORBA_SERVER_HEADER(SALOMEDS_Attributes) #include "SALOMEDS_GenericAttribute_i.hxx" -#include "SALOMEDS_PythonObjectAttribute.hxx" +#include "SALOMEDSImpl_AttributePythonObject.hxx" -DEFINE_DERIVED_ATTR(AttributePythonObject,SALOMEDS_PythonObjectAttribute,true); - -class SALOMEDS_AttributePythonObject_i: - public virtual POA_SALOMEDS::AttributePythonObject, - public virtual SALOMEDS_TAttributePythonObject_i -{ - DEFINE_DERIVED_ATTR_METH_DEFAULT(AttributePythonObject,SALOMEDS_PythonObjectAttribute); +class SALOMEDS_AttributePythonObject_i: public virtual POA_SALOMEDS::AttributePythonObject, + public virtual SALOMEDS_GenericAttribute_i { public: + + SALOMEDS_AttributePythonObject_i(const Handle(SALOMEDSImpl_AttributePythonObject)& theAttr, CORBA::ORB_ptr orb) + :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; + + ~SALOMEDS_AttributePythonObject_i() {}; + virtual void SetObject(const char* theSequence, CORBA::Boolean IsScript); virtual char* GetObject(); virtual CORBA::Boolean IsScript(); - virtual char* Store(); - virtual void Restore(const char*); - }; + + + #endif diff --git a/src/SALOMEDS/SALOMEDS_AttributeReal_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeReal_i.cxx index ca74454ee..7278f0af3 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeReal_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeReal_i.cxx @@ -1,80 +1,24 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// // File : SALOMEDS_AttributeReal_i.cxx -// Author : Yves FRICAUD +// Author : Sergey RUIN // Module : SALOME -// $Header$ #include "SALOMEDS_AttributeReal_i.hxx" +#include "SALOMEDS_SObject_i.hxx" +#include "SALOMEDS.hxx" #include using namespace std; -static const char* write_double(double value) +CORBA::Double SALOMEDS_AttributeReal_i::Value() { - std::ostringstream os; - unsigned char* array = (unsigned char*)&value; - for(int i = 0; i < sizeof(double); i++) { - unsigned tmp = (unsigned short)array[i]; - os << " " << tmp; - } - return os.str().c_str(); + SALOMEDS::Locker lock; + return Handle(SALOMEDSImpl_AttributeReal)::DownCast(_impl)->Get(); } -static double read_double(const char* str) +void SALOMEDS_AttributeReal_i::SetValue(CORBA::Double value) { - std::istringstream is(str); - double value; - unsigned char* array = (unsigned char*)(&value); - for(int i = 0; i < sizeof(double); i++) { - unsigned tmp; - is >> tmp; - array[i] = (unsigned char)tmp; - } - return value; -} - -CORBA::Double SALOMEDS_AttributeReal_i::Value() { - return Handle(TDataStd_Real)::DownCast(_myAttr)->Get(); -} - -void SALOMEDS_AttributeReal_i::SetValue(CORBA::Double value) { + SALOMEDS::Locker lock; CheckLocked(); - Handle(TDataStd_Real)::DownCast(_myAttr)->Set(value); -} - -char* SALOMEDS_AttributeReal_i::Store() { - // char* RealVal = new char[35]; - // sprintf(RealVal, "%.20f", Value()); - //return RealVal; - return (char*)write_double( (double)Value() ); -} - -void SALOMEDS_AttributeReal_i::Restore(const char* value) { - //char *err = NULL; - //CORBA::Double r = strtod(value, &err); - //if (err != value) SetValue(r); - SetValue( read_double(value) ); + Handle(SALOMEDSImpl_AttributeReal)::DownCast(_impl)->Set(value); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeReal_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeReal_i.hxx index a7fa861e6..305cfb6b1 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeReal_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeReal_i.hxx @@ -1,56 +1,28 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// // File : SALOMEDS_AttributeReal_i.hxx -// Author : Yves FRICAUD +// Author : Sergey RUIN // Module : SALOME -// $Header$ #ifndef SALOMEDS_AttributeReal_i_HeaderFile #define SALOMEDS_AttributeReal_i_HeaderFile -#include - -#include "SALOMEDS_GenericAttribute_i.hxx" - // IDL headers #include #include CORBA_SERVER_HEADER(SALOMEDS_Attributes) -DEFINE_DERIVED_ATTR(AttributeReal,TDataStd_Real,true); +#include "SALOMEDS_GenericAttribute_i.hxx" +#include "SALOMEDSImpl_AttributeReal.hxx" -class SALOMEDS_AttributeReal_i: - public virtual POA_SALOMEDS::AttributeReal, - public virtual SALOMEDS_TAttributeReal_i -{ - DEFINE_DERIVED_ATTR_METH_DEFAULT(AttributeReal,TDataStd_Real); +class SALOMEDS_AttributeReal_i: public virtual POA_SALOMEDS::AttributeReal, + public virtual SALOMEDS_GenericAttribute_i { public: - CORBA::Double Value(); - void SetValue(CORBA::Double theValue); + + SALOMEDS_AttributeReal_i(const Handle(SALOMEDSImpl_AttributeReal)& theAttr, CORBA::ORB_ptr orb) + :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; - char* Store(); - void Restore(const char*); + ~SALOMEDS_AttributeReal_i() {}; + CORBA::Double Value(); + void SetValue(CORBA::Double value); }; diff --git a/src/SALOMEDS/SALOMEDS_AttributeSelectable_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeSelectable_i.cxx index 1ae041186..53b53becc 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeSelectable_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeSelectable_i.cxx @@ -1,49 +1,22 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// // File : SALOMEDS_AttributeSelectable_i.cxx -// Author : Yves FRICAUD +// Author : Sergey RUIN // Module : SALOME -// $Header$ - -#include "SALOMEDS_AttributeSelectable_i.hxx" using namespace std; +#include "SALOMEDS_AttributeSelectable_i.hxx" +#include "SALOMEDS.hxx" -CORBA::Boolean SALOMEDS_AttributeSelectable_i::IsSelectable() { - return (Handle(SALOMEDS_SelectableAttribute)::DownCast(_myAttr)->Get() == 1); +CORBA::Boolean SALOMEDS_AttributeSelectable_i::IsSelectable() +{ + SALOMEDS::Locker lock; + return (Handle(SALOMEDSImpl_AttributeSelectable)::DownCast(_impl)->Get() == 1); } -void SALOMEDS_AttributeSelectable_i::SetSelectable(CORBA::Boolean value) { +void SALOMEDS_AttributeSelectable_i::SetSelectable(CORBA::Boolean value) +{ + SALOMEDS::Locker lock; Standard_Integer val = 0; if (value != 0) val = 1; - Handle(TDataStd_Integer)::DownCast(_myAttr)->Set(val); + Handle(SALOMEDSImpl_AttributeSelectable)::DownCast(_impl)->Set(val); } -char* SALOMEDS_AttributeSelectable_i::Store() { - return CORBA::string_dup(IsSelectable()?"1":"0"); -} - -void SALOMEDS_AttributeSelectable_i::Restore(const char* value) { - SetSelectable(value[0] == '1'); -} diff --git a/src/SALOMEDS/SALOMEDS_AttributeSelectable_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeSelectable_i.hxx index f7158eeda..d91f510be 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeSelectable_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeSelectable_i.hxx @@ -1,56 +1,31 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// // File : SALOMEDS_AttributeSelectable_i.hxx -// Author : Yves FRICAUD +// Author : Sergey RUIN // Module : SALOME -// $Header: #ifndef SALOMEDS_AttributeSelectable_i_HeaderFile #define SALOMEDS_AttributeSelectable_i_HeaderFile -#include "SALOMEDS_SelectableAttribute.hxx" -#include "SALOMEDS_GenericAttribute_i.hxx" - // IDL headers #include #include CORBA_SERVER_HEADER(SALOMEDS_Attributes) -DEFINE_DERIVED_ATTR(AttributeSelectable,SALOMEDS_SelectableAttribute,false); +#include "SALOMEDS_GenericAttribute_i.hxx" +#include "SALOMEDSImpl_AttributeSelectable.hxx" -class SALOMEDS_AttributeSelectable_i: - public virtual POA_SALOMEDS::AttributeSelectable, - public virtual SALOMEDS_TAttributeSelectable_i -{ - DEFINE_DERIVED_ATTR_METH_DEFAULT(AttributeSelectable,SALOMEDS_SelectableAttribute); +class SALOMEDS_AttributeSelectable_i: public virtual POA_SALOMEDS::AttributeSelectable, + public virtual SALOMEDS_GenericAttribute_i { public: + + SALOMEDS_AttributeSelectable_i(const Handle(SALOMEDSImpl_AttributeSelectable)& theAttr, CORBA::ORB_ptr orb) + :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; + + ~SALOMEDS_AttributeSelectable_i() {}; + CORBA::Boolean IsSelectable(); void SetSelectable(CORBA::Boolean value); - char* Store(); - void Restore(const char*); - }; + #endif diff --git a/src/SALOMEDS/SALOMEDS_AttributeSequenceOfInteger_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeSequenceOfInteger_i.cxx index 33b8fbd1e..7e9b96798 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeSequenceOfInteger_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeSequenceOfInteger_i.cxx @@ -1,50 +1,30 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// // File : SALOMEDS_AttributeSequenceOfInteger_i.cxx -// Author : Yves FRICAUD +// Author : Sergey RUIN // Module : SALOME -// $Header$ +using namespace std; #include "SALOMEDS_AttributeSequenceOfInteger_i.hxx" +#include "SALOMEDS.hxx" #include -using namespace std; void SALOMEDS_AttributeSequenceOfInteger_i::Assign(const SALOMEDS::LongSeq& other) { + SALOMEDS::Locker lock; CheckLocked(); Handle(TColStd_HSequenceOfInteger) CasCadeSeq = new TColStd_HSequenceOfInteger; for (int i = 0; i < other.length(); i++) { CasCadeSeq->Append(other[i]); } - Handle(SALOMEDS_SequenceOfIntegerAttribute)::DownCast(_myAttr)->Assign(CasCadeSeq); + Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_impl)->Assign(CasCadeSeq); } SALOMEDS::LongSeq* SALOMEDS_AttributeSequenceOfInteger_i::CorbaSequence() { + SALOMEDS::Locker lock; SALOMEDS::LongSeq_var CorbaSeq = new SALOMEDS::LongSeq; - Handle(SALOMEDS_SequenceOfIntegerAttribute) CasCadeSeq = Handle(SALOMEDS_SequenceOfIntegerAttribute)::DownCast(_myAttr); + Handle(SALOMEDSImpl_AttributeSequenceOfInteger) CasCadeSeq; + CasCadeSeq = Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_impl); CorbaSeq->length(CasCadeSeq->Length()); for (int i = 0; i < CasCadeSeq->Length(); i++) { CorbaSeq[i] = CasCadeSeq->Value(i+1);; @@ -54,55 +34,34 @@ SALOMEDS::LongSeq* SALOMEDS_AttributeSequenceOfInteger_i::CorbaSequence() void SALOMEDS_AttributeSequenceOfInteger_i::Add(CORBA::Long value) { + SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDS_SequenceOfIntegerAttribute)::DownCast(_myAttr)->Add(value); + Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_impl)->Add(value); } void SALOMEDS_AttributeSequenceOfInteger_i::Remove(CORBA::Long index) { + SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDS_SequenceOfIntegerAttribute)::DownCast(_myAttr)->Remove(index); + Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_impl)->Remove(index); } void SALOMEDS_AttributeSequenceOfInteger_i::ChangeValue(CORBA::Long index, CORBA::Long value) { + SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDS_SequenceOfIntegerAttribute)::DownCast(_myAttr)->ChangeValue(index, value); + Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_impl)->ChangeValue(index, value); } CORBA::Long SALOMEDS_AttributeSequenceOfInteger_i::Value(CORBA::Short index) { - return Handle(SALOMEDS_SequenceOfIntegerAttribute)::DownCast(_myAttr)->Value(index); + SALOMEDS::Locker lock; + return Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_impl)->Value(index); } CORBA::Long SALOMEDS_AttributeSequenceOfInteger_i::Length() -{ - return Handle(SALOMEDS_SequenceOfIntegerAttribute)::DownCast(_myAttr)->Length(); +{ + SALOMEDS::Locker lock; + return Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_impl)->Length(); } -char* SALOMEDS_AttributeSequenceOfInteger_i::Store() { - Handle(SALOMEDS_SequenceOfIntegerAttribute) CasCadeSeq = Handle(SALOMEDS_SequenceOfIntegerAttribute)::DownCast(_myAttr); - Standard_Integer aLength = CasCadeSeq->Length(); - char* aResult = new char[aLength * 25]; - aResult[0] = 0; - Standard_Integer aPosition = 0; - for (int i = 1; i <= aLength; i++) { - sprintf(aResult + aPosition , "%d ", CasCadeSeq->Value(i)); - aPosition += strlen(aResult + aPosition); - } - return aResult; -} - -void SALOMEDS_AttributeSequenceOfInteger_i::Restore(const char* value) { - Handle(TColStd_HSequenceOfInteger) CasCadeSeq = new TColStd_HSequenceOfInteger; - - char* aCopy = strdup(value); - char* adr = strtok(aCopy, " "); - while (adr) { - CORBA::Long l = atol(adr); - CasCadeSeq->Append(l); - adr = strtok(NULL, " "); - } - free(aCopy); - Handle(SALOMEDS_SequenceOfIntegerAttribute)::DownCast(_myAttr)->Assign(CasCadeSeq); -} diff --git a/src/SALOMEDS/SALOMEDS_AttributeSequenceOfInteger_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeSequenceOfInteger_i.hxx index d561d229d..320bbd21e 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeSequenceOfInteger_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeSequenceOfInteger_i.hxx @@ -1,49 +1,27 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// // File : SALOMEDS_AttributeSequenceOfInteger_i.hxx -// Author : Yves FRICAUD +// Author : Sergey RUIN // Module : SALOME -// $Header$ #ifndef SALOMEDS_AttributeSequenceOfInteger_i_HeaderFile #define SALOMEDS_AttributeSequenceOfInteger_i_HeaderFile -#include "SALOMEDS_SequenceOfIntegerAttribute.hxx" -#include "SALOMEDS_GenericAttribute_i.hxx" - // IDL headers #include #include CORBA_SERVER_HEADER(SALOMEDS_Attributes) -DEFINE_DERIVED_ATTR(AttributeSequenceOfInteger,SALOMEDS_SequenceOfIntegerAttribute,true); +#include "SALOMEDS_GenericAttribute_i.hxx" +#include "SALOMEDSImpl_AttributeSequenceOfInteger.hxx" -class SALOMEDS_AttributeSequenceOfInteger_i: - public virtual POA_SALOMEDS::AttributeSequenceOfInteger, - public virtual SALOMEDS_TAttributeSequenceOfInteger_i -{ - DEFINE_DERIVED_ATTR_METH_DEFAULT(AttributeSequenceOfInteger,SALOMEDS_SequenceOfIntegerAttribute); +class SALOMEDS_AttributeSequenceOfInteger_i: public virtual POA_SALOMEDS::AttributeSequenceOfInteger, + public virtual SALOMEDS_GenericAttribute_i +{ public: + + SALOMEDS_AttributeSequenceOfInteger_i(const Handle(SALOMEDSImpl_AttributeSequenceOfInteger)& theAttr,CORBA::ORB_ptr orb) + :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; + + ~SALOMEDS_AttributeSequenceOfInteger_i() {}; + void Assign(const SALOMEDS::LongSeq& other); SALOMEDS::LongSeq* CorbaSequence(); void Add(CORBA::Long value); @@ -52,9 +30,6 @@ public: CORBA::Long Value(CORBA::Short index); CORBA::Long Length(); - char* Store(); - void Restore(const char*); - }; #endif diff --git a/src/SALOMEDS/SALOMEDS_AttributeSequenceOfReal_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeSequenceOfReal_i.cxx index 308ec01c0..583721d41 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeSequenceOfReal_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeSequenceOfReal_i.cxx @@ -1,50 +1,28 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// // File : SALOMEDS_AttributeSequenceOfReal_i.cxx -// Author : Yves FRICAUD +// Author : Sergey RUIN // Module : SALOME -// $Header$ +using namespace std; #include "SALOMEDS_AttributeSequenceOfReal_i.hxx" +#include "SALOMEDS.hxx" #include -using namespace std; - void SALOMEDS_AttributeSequenceOfReal_i::Assign(const SALOMEDS::DoubleSeq& other) { + SALOMEDS::Locker lock; CheckLocked(); Handle(TColStd_HSequenceOfReal) CasCadeSeq = new TColStd_HSequenceOfReal; for (int i = 0; i < other.length(); i++) { CasCadeSeq->Append(other[i]); } - Handle(SALOMEDS_SequenceOfRealAttribute)::DownCast(_myAttr)->Assign(CasCadeSeq); + Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_impl)->Assign(CasCadeSeq); } SALOMEDS::DoubleSeq* SALOMEDS_AttributeSequenceOfReal_i::CorbaSequence() { + SALOMEDS::Locker lock; SALOMEDS::DoubleSeq_var CorbaSeq = new SALOMEDS::DoubleSeq; - Handle(SALOMEDS_SequenceOfRealAttribute) CasCadeSeq = Handle(SALOMEDS_SequenceOfRealAttribute)::DownCast(_myAttr); + Handle(SALOMEDSImpl_AttributeSequenceOfReal) CasCadeSeq = Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_impl); CorbaSeq->length(CasCadeSeq->Length()); for (int i = 0; i < CasCadeSeq->Length(); i++) { CorbaSeq[i] = CasCadeSeq->Value(i+1);; @@ -54,57 +32,34 @@ SALOMEDS::DoubleSeq* SALOMEDS_AttributeSequenceOfReal_i::CorbaSequence() void SALOMEDS_AttributeSequenceOfReal_i::Add(CORBA::Double value) { + SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDS_SequenceOfRealAttribute)::DownCast(_myAttr)->Add(value); + Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_impl)->Add(value); } void SALOMEDS_AttributeSequenceOfReal_i::Remove(CORBA::Long index) { + SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDS_SequenceOfRealAttribute)::DownCast(_myAttr)->Remove(index); + Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_impl)->Remove(index); } void SALOMEDS_AttributeSequenceOfReal_i::ChangeValue(CORBA::Long index, CORBA::Double value) { + SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDS_SequenceOfRealAttribute)::DownCast(_myAttr)->ChangeValue(index, value); + Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_impl)->ChangeValue(index, value); } CORBA::Double SALOMEDS_AttributeSequenceOfReal_i::Value(CORBA::Short index) { - return Handle(SALOMEDS_SequenceOfRealAttribute)::DownCast(_myAttr)->Value(index); + SALOMEDS::Locker lock; + return Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_impl)->Value(index); } CORBA::Long SALOMEDS_AttributeSequenceOfReal_i::Length() { - return Handle(SALOMEDS_SequenceOfRealAttribute)::DownCast(_myAttr)->Length(); + SALOMEDS::Locker lock; + return Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_impl)->Length(); } -char* SALOMEDS_AttributeSequenceOfReal_i::Store() { - Handle(SALOMEDS_SequenceOfRealAttribute) CasCadeSeq = Handle(SALOMEDS_SequenceOfRealAttribute)::DownCast(_myAttr); - Standard_Integer aLength = CasCadeSeq->Length(); - char* aResult = new char[aLength * 25]; - aResult[0] = 0; - Standard_Integer aPosition = 0; - for (int i = 1; i <= aLength; i++) { - sprintf(aResult + aPosition , "%f ", CasCadeSeq->Value(i)); - aPosition += strlen(aResult + aPosition); - } - return aResult; -} - -void SALOMEDS_AttributeSequenceOfReal_i::Restore(const char* value) { - Handle(TColStd_HSequenceOfReal) CasCadeSeq = new TColStd_HSequenceOfReal; - - char* aCopy = strdup(value); - char* adr = strtok(aCopy, " "); - char *err = NULL; - while (adr) { - CORBA::Double r = strtod(adr, &err); - if (err == adr) break; - else CasCadeSeq->Append(r); - adr = strtok(NULL, " "); - } - free(aCopy); - Handle(SALOMEDS_SequenceOfRealAttribute)::DownCast(_myAttr)->Assign(CasCadeSeq); -} diff --git a/src/SALOMEDS/SALOMEDS_AttributeSequenceOfReal_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeSequenceOfReal_i.hxx index 4c7fa6a17..a4aa834cc 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeSequenceOfReal_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeSequenceOfReal_i.hxx @@ -1,49 +1,26 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// // File : SALOMEDS_AttributeSequenceOfSequenceOfReal_i.hxx -// Author : Yves FRICAUD +// Author : Sergey RUIN // Module : SALOME -// $Header$ #ifndef SALOMEDS_AttributeSequenceOfSequenceOfReal_i_HeaderFile #define SALOMEDS_AttributeSequenceOfSequenceOfReal_i_HeaderFile -#include "SALOMEDS_SequenceOfRealAttribute.hxx" -#include "SALOMEDS_GenericAttribute_i.hxx" - // IDL headers #include #include CORBA_SERVER_HEADER(SALOMEDS_Attributes) -DEFINE_DERIVED_ATTR(AttributeSequenceOfReal,SALOMEDS_SequenceOfRealAttribute,true); +#include "SALOMEDS_GenericAttribute_i.hxx" +#include "SALOMEDSImpl_AttributeSequenceOfReal.hxx" -class SALOMEDS_AttributeSequenceOfReal_i: - public virtual POA_SALOMEDS::AttributeSequenceOfReal, - public virtual SALOMEDS_TAttributeSequenceOfReal_i -{ - DEFINE_DERIVED_ATTR_METH_DEFAULT(AttributeSequenceOfReal,SALOMEDS_SequenceOfRealAttribute); +class SALOMEDS_AttributeSequenceOfReal_i: public virtual POA_SALOMEDS::AttributeSequenceOfReal, + public virtual SALOMEDS_GenericAttribute_i { public: + + SALOMEDS_AttributeSequenceOfReal_i(const Handle(SALOMEDSImpl_AttributeSequenceOfReal)& theAttr, CORBA::ORB_ptr orb) + :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; + + ~SALOMEDS_AttributeSequenceOfReal_i() {}; + void Assign(const SALOMEDS::DoubleSeq& other); SALOMEDS::DoubleSeq* CorbaSequence(); void Add(CORBA::Double value); @@ -52,9 +29,6 @@ public: CORBA::Double Value(CORBA::Short index); CORBA::Long Length(); - char* Store(); - void Restore(const char*); - }; diff --git a/src/SALOMEDS/SALOMEDS_AttributeStudyProperties_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeStudyProperties_i.cxx index b08b9d5c4..baa75a717 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeStudyProperties_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeStudyProperties_i.cxx @@ -1,35 +1,29 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// -// // File : SALOMEDS_AttributeStudyProperties_i.cxx -// Author : Yves FRICAUD +// Author : Sergey RUIN // Module : SALOME -// $Header$ +using namespace std; +#include "SALOMEDS_AttributeStudyProperties_i.hxx" +#include "SALOMEDS.hxx" #include #include #include -#include - -#include "SALOMEDS_AttributeStudyProperties_i.hxx" #define CREATION_MODE_NOTDEFINED 0 #define CREATION_MODE_SCRATCH 1 #define CREATION_MODE_COPY 2 -using namespace std; - -void SALOMEDS_AttributeStudyProperties_i::SetUserName(const char* theName) { +void SALOMEDS_AttributeStudyProperties_i::SetUserName(const char* theName) +{ + SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDS_StudyPropertiesAttribute) aProp = Handle(SALOMEDS_StudyPropertiesAttribute)::DownCast(_myAttr); - aProp->SetFirstName(const_cast(theName)); + Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl)->SetFirstName((char*)theName); } -char* SALOMEDS_AttributeStudyProperties_i::GetUserName() { - TCollection_ExtendedString S = Handle(SALOMEDS_StudyPropertiesAttribute)::DownCast(_myAttr)->GetCreatorName(); +char* SALOMEDS_AttributeStudyProperties_i::GetUserName() +{ + SALOMEDS::Locker lock; + TCollection_ExtendedString S = Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl)->GetCreatorName(); CORBA::String_var c_s = CORBA::string_dup(TCollection_AsciiString(S).ToCString()); return c_s._retn(); } @@ -38,9 +32,11 @@ void SALOMEDS_AttributeStudyProperties_i::SetCreationDate(CORBA::Long theMinute, CORBA::Long theHour, CORBA::Long theDay, CORBA::Long theMonth, - CORBA::Long theYear) { + CORBA::Long theYear) +{ + SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDS_StudyPropertiesAttribute) aProp = Handle(SALOMEDS_StudyPropertiesAttribute)::DownCast(_myAttr); + Handle(SALOMEDSImpl_AttributeStudyProperties) aProp = Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl); int aTmp; if (aProp->GetCreationDate(aTmp, aTmp, aTmp, aTmp, aTmp)) return; aProp->SetModificationDate(theMinute, theHour, theDay, theMonth, theYear); @@ -50,35 +46,42 @@ CORBA::Boolean SALOMEDS_AttributeStudyProperties_i::GetCreationDate(CORBA::Long& CORBA::Long& theHour, CORBA::Long& theDay, CORBA::Long& theMonth, - CORBA::Long& theYear) { + CORBA::Long& theYear) +{ + SALOMEDS::Locker lock; Standard_Integer aMinute; Standard_Integer aHour; Standard_Integer aDay; Standard_Integer aMonth; Standard_Integer aYear; - if (Handle(SALOMEDS_StudyPropertiesAttribute)::DownCast(_myAttr)->GetCreationDate(aMinute, aHour, aDay, - aMonth, aYear)) { - theMinute = aMinute; - theHour = aHour; - theDay = aDay; - theMonth = aMonth; - theYear = aYear; - return Standard_True; - } + if (Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl)->GetCreationDate(aMinute, aHour, aDay, + aMonth, aYear)) + { + theMinute = aMinute; + theHour = aHour; + theDay = aDay; + theMonth = aMonth; + theYear = aYear; + return Standard_True; + } return Standard_False; } -void SALOMEDS_AttributeStudyProperties_i::SetCreationMode(const char* theMode) { +void SALOMEDS_AttributeStudyProperties_i::SetCreationMode(const char* theMode) +{ + SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDS_StudyPropertiesAttribute) aProp = Handle(SALOMEDS_StudyPropertiesAttribute)::DownCast(_myAttr); + Handle(SALOMEDSImpl_AttributeStudyProperties) aProp = Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl); if (strcmp(theMode,"from scratch")==0) aProp->SetCreationMode(CREATION_MODE_SCRATCH); else if (strcmp(theMode,"copy from")==0) aProp->SetCreationMode(CREATION_MODE_COPY); else aProp->SetCreationMode(CREATION_MODE_NOTDEFINED); } -char* SALOMEDS_AttributeStudyProperties_i::GetCreationMode() { +char* SALOMEDS_AttributeStudyProperties_i::GetCreationMode() +{ + SALOMEDS::Locker lock; CORBA::String_var c_s; - switch (Handle(SALOMEDS_StudyPropertiesAttribute)::DownCast(_myAttr)->GetCreationMode()) { + switch (Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl)->GetCreationMode()) { case CREATION_MODE_SCRATCH: c_s = "from scratch"; break; case CREATION_MODE_COPY: c_s = "copy from"; break; default: c_s = ""; @@ -86,24 +89,34 @@ char* SALOMEDS_AttributeStudyProperties_i::GetCreationMode() { return c_s._retn(); } -void SALOMEDS_AttributeStudyProperties_i::SetModified(CORBA::Long theModified) { - Handle(SALOMEDS_StudyPropertiesAttribute)::DownCast(_myAttr)->SetModified(theModified); +void SALOMEDS_AttributeStudyProperties_i::SetModified(CORBA::Long theModified) +{ + SALOMEDS::Locker lock; + Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl)->SetModified(theModified); } -CORBA::Boolean SALOMEDS_AttributeStudyProperties_i::IsModified() { - return Handle(SALOMEDS_StudyPropertiesAttribute)::DownCast(_myAttr)->IsModified(); +CORBA::Boolean SALOMEDS_AttributeStudyProperties_i::IsModified() +{ + SALOMEDS::Locker lock; + return Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl)->IsModified(); } -CORBA::Long SALOMEDS_AttributeStudyProperties_i::GetModified() { - return Handle(SALOMEDS_StudyPropertiesAttribute)::DownCast(_myAttr)->GetModified(); +CORBA::Long SALOMEDS_AttributeStudyProperties_i::GetModified() +{ + SALOMEDS::Locker lock; + return Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl)->GetModified(); } -void SALOMEDS_AttributeStudyProperties_i::SetLocked(CORBA::Boolean theLocked) { - Handle(SALOMEDS_StudyPropertiesAttribute)::DownCast(_myAttr)->SetLocked(theLocked); +void SALOMEDS_AttributeStudyProperties_i::SetLocked(CORBA::Boolean theLocked) +{ + SALOMEDS::Locker lock; + Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl)->SetLocked(theLocked); } -CORBA::Boolean SALOMEDS_AttributeStudyProperties_i::IsLocked() { - return Handle(SALOMEDS_StudyPropertiesAttribute)::DownCast(_myAttr)->IsLocked(); +CORBA::Boolean SALOMEDS_AttributeStudyProperties_i::IsLocked() +{ + SALOMEDS::Locker lock; + return Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl)->IsLocked(); } void SALOMEDS_AttributeStudyProperties_i::SetModification(const char* theName, @@ -111,10 +124,12 @@ void SALOMEDS_AttributeStudyProperties_i::SetModification(const char* theName, CORBA::Long theHour, CORBA::Long theDay, CORBA::Long theMonth, - CORBA::Long theYear) { + CORBA::Long theYear) +{ + SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDS_StudyPropertiesAttribute) aProp = Handle(SALOMEDS_StudyPropertiesAttribute)::DownCast(_myAttr); - aProp->SetUserName(const_cast(theName)); + Handle(SALOMEDSImpl_AttributeStudyProperties) aProp = Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl); + aProp->SetUserName((char*)theName); aProp->SetModificationDate((int)theMinute, (int)theHour, (int)theDay, (int)theMonth, (int)theYear); } void SALOMEDS_AttributeStudyProperties_i::GetModificationsList(SALOMEDS::StringSeq_out theNames, @@ -123,16 +138,16 @@ void SALOMEDS_AttributeStudyProperties_i::GetModificationsList(SALOMEDS::StringS SALOMEDS::LongSeq_out theDays, SALOMEDS::LongSeq_out theMonths, SALOMEDS::LongSeq_out theYears, - CORBA::Boolean theWithCreator) { + CORBA::Boolean theWithCreator) +{ + SALOMEDS::Locker lock; Handle(TColStd_HSequenceOfExtendedString) aNames; Handle(TColStd_HSequenceOfInteger) aMinutes, aHours, aDays, aMonths, aYears; - Handle(SALOMEDS_StudyPropertiesAttribute) aProp = Handle(SALOMEDS_StudyPropertiesAttribute)::DownCast(_myAttr); + Handle(SALOMEDSImpl_AttributeStudyProperties) aProp = Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl); aNames = aProp->GetUserNames(); aProp->GetModificationDates(aMinutes, aHours, aDays, aMonths, aYears); int aLength = aNames->Length()-((theWithCreator)?0:1); theNames = new SALOMEDS::StringSeq; -// SALOMEDS::LongSeq *maminute = new SALOMEDS::LongSeq; -// maminute->length(5); theMinutes = new SALOMEDS::LongSeq; theHours = new SALOMEDS::LongSeq; theDays = new SALOMEDS::LongSeq; @@ -147,7 +162,7 @@ void SALOMEDS_AttributeStudyProperties_i::GetModificationsList(SALOMEDS::StringS int a; for(a = 0; a < aLength; a++) { - (*theNames)[a] = CORBA::string_dup(TCollection_AsciiString(aNames->Value(a + 1 + ((theWithCreator)?0:1))).ToCString()); + (*theNames)[a]=CORBA::string_dup(TCollection_AsciiString(aNames->Value(a + 1 + ((theWithCreator)?0:1))).ToCString()); (*theMinutes)[a] = aMinutes->Value(a + 1 + ((theWithCreator)?0:1)); (*theHours)[a] = aHours->Value(a + 1 + ((theWithCreator)?0:1)); (*theDays)[a] = aDays->Value(a + 1 + ((theWithCreator)?0:1)); @@ -156,79 +171,3 @@ void SALOMEDS_AttributeStudyProperties_i::GetModificationsList(SALOMEDS::StringS } } -char* SALOMEDS_AttributeStudyProperties_i::Store() { - Handle(TColStd_HSequenceOfExtendedString) aNames; - Handle(TColStd_HSequenceOfInteger) aMinutes, aHours, aDays, aMonths, aYears; - Handle(SALOMEDS_StudyPropertiesAttribute) aProp = Handle(SALOMEDS_StudyPropertiesAttribute)::DownCast(_myAttr); - aNames = aProp->GetUserNames(); - aProp->GetModificationDates(aMinutes, aHours, aDays, aMonths, aYears); - - int aLength, anIndex; - for(aLength = 0, anIndex = aNames->Length(); anIndex > 0; anIndex--) aLength += aNames->Value(anIndex).Length() + 1; - - char* aProperty = new char[3 + aLength + 12 * aNames->Length()]; - - sprintf(aProperty,"%c%c", strlen(GetCreationMode())?GetCreationMode()[0]:'0', IsLocked()?'l':'u'); - - aLength = aNames->Length(); - int a = 2; - for(anIndex = 1; anIndex <= aLength; anIndex++) { - sprintf(&(aProperty[a]),"%2d%2d%2d%2d%4d%s", - (int)(aMinutes->Value(anIndex)), - (int)(aHours->Value(anIndex)), - (int)(aDays->Value(anIndex)), - (int)(aMonths->Value(anIndex)), - (int)(aYears->Value(anIndex)), - (char*)(TCollection_AsciiString(aNames->Value(anIndex)).ToCString())); - a = strlen(aProperty); - aProperty[a++] = 1; - } - aProperty[a] = 0; - return aProperty; -} - -void SALOMEDS_AttributeStudyProperties_i::Restore(const char* value) { - char* aCopy = strdup(value); - if (aCopy[0] == 'f') SetCreationMode("from scratch"); - else if (aCopy[0] == 'c') SetCreationMode("copy from"); - else SetCreationMode("none"); - - int anIndex; - for(anIndex = 2; anIndex + 2 < strlen(value) ;) { - char str[10]; - Standard_Integer aMinute, aHour, aDay, aMonth, aYear; - str[0] = aCopy[anIndex++]; - str[1] = aCopy[anIndex++]; - str[2] = 0; - aMinute = atoi(str); - str[0] = aCopy[anIndex++]; - str[1] = aCopy[anIndex++]; - aHour = atoi(str); - str[0] = aCopy[anIndex++]; - str[1] = aCopy[anIndex++]; - aDay = atoi(str); - str[0] = aCopy[anIndex++]; - str[1] = aCopy[anIndex++]; - aMonth = atoi(str); - str[0] = aCopy[anIndex++]; - str[1] = aCopy[anIndex++]; - str[2] = aCopy[anIndex++]; - str[3] = aCopy[anIndex++]; - str[4] = 0; - aYear = atoi(str); - - int aNameSize; - for(aNameSize = 0; aCopy[anIndex+aNameSize]!=1; aNameSize++); - char *aName = new char[aNameSize+1]; - strncpy(aName, &(aCopy[anIndex]), aNameSize); - aName[aNameSize] = 0; - SetModification(aName, aMinute,aHour,aDay,aMonth,aYear); - delete(aName); - anIndex += aNameSize + 1; - } - if (aCopy[1] == 'l') { - SetLocked(Standard_True); - } - SetModified(0); - free(aCopy); -} diff --git a/src/SALOMEDS/SALOMEDS_AttributeStudyProperties_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeStudyProperties_i.hxx index b7e1d0020..7a93e197d 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeStudyProperties_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeStudyProperties_i.hxx @@ -1,13 +1,6 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// -// // File : SALOMEDS_AttributeStudyProperties_i.hxx -// Author : Yves FRICAUD +// Author : Sergey RUIN // Module : SALOME -// $Header$ #ifndef SALOMEDS_AttributeStudyProperties_i_HeaderFile #define SALOMEDS_AttributeStudyProperties_i_HeaderFile @@ -16,17 +9,18 @@ #include #include CORBA_SERVER_HEADER(SALOMEDS_Attributes) -#include "SALOMEDS_StudyPropertiesAttribute.hxx" #include "SALOMEDS_GenericAttribute_i.hxx" +#include "SALOMEDSImpl_AttributeStudyProperties.hxx" -DEFINE_DERIVED_ATTR(AttributeStudyProperties,SALOMEDS_StudyPropertiesAttribute,false); - -class SALOMEDS_AttributeStudyProperties_i: - public virtual POA_SALOMEDS::AttributeStudyProperties, - public virtual SALOMEDS_TAttributeStudyProperties_i -{ - DEFINE_DERIVED_ATTR_METH_DEFAULT(AttributeStudyProperties,SALOMEDS_StudyPropertiesAttribute); +class SALOMEDS_AttributeStudyProperties_i: public virtual POA_SALOMEDS::AttributeStudyProperties, + public virtual SALOMEDS_GenericAttribute_i { public: + + SALOMEDS_AttributeStudyProperties_i(const Handle(SALOMEDSImpl_AttributeStudyProperties)& theAttr, CORBA::ORB_ptr orb) + :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; + + ~SALOMEDS_AttributeStudyProperties_i() {}; + virtual void SetUserName(const char* theName); virtual char* GetUserName() ; virtual void SetCreationDate(CORBA::Long theMinute, CORBA::Long theHour, CORBA::Long theDay, CORBA::Long theMonth, CORBA::Long theYear); @@ -52,9 +46,6 @@ public: SALOMEDS::LongSeq_out theYears, CORBA::Boolean theWithCreator); - char* Store(); - void Restore(const char*); - }; diff --git a/src/SALOMEDS/SALOMEDS_AttributeTableOfInteger_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeTableOfInteger_i.cxx index 380741f49..a740a184b 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTableOfInteger_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTableOfInteger_i.cxx @@ -1,28 +1,20 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// -// // File : SALOMEDS_AttributeTableOfInteger_i.cxx -// Author : Michael Ponikarov +// Author : Sergey RUIN // Module : SALOME -// $Header$ + +using namespace std; +#include "SALOMEDS_AttributeTableOfInteger_i.hxx" +#include "SALOMEDS.hxx" #include -#include #include #include - -#include "SALOMEDS_AttributeTableOfInteger_i.hxx" #include "Utils_ExceptHandlers.hxx" #include #include #include -using namespace std; - #define SEPARATOR '\1' UNEXPECT_CATCH(ATI_IncorrectIndex, SALOMEDS::AttributeTableOfInteger::IncorrectIndex); @@ -46,15 +38,20 @@ static TCollection_ExtendedString getTitle(TCollection_ExtendedString theString) return aString; } -void SALOMEDS_AttributeTableOfInteger_i::SetTitle(const char* theTitle) { + + +void SALOMEDS_AttributeTableOfInteger_i::SetTitle(const char* theTitle) +{ + SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDS_TableOfIntegerAttribute) aTable = Handle(SALOMEDS_TableOfIntegerAttribute)::DownCast(_myAttr); CORBA::String_var aStr = CORBA::string_dup(theTitle); - aTable->SetTitle(TCollection_ExtendedString(aStr)); + Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl)->SetTitle(TCollection_ExtendedString(aStr)); } -char* SALOMEDS_AttributeTableOfInteger_i::GetTitle() { - Handle(SALOMEDS_TableOfIntegerAttribute) aTable = Handle(SALOMEDS_TableOfIntegerAttribute)::DownCast(_myAttr); +char* SALOMEDS_AttributeTableOfInteger_i::GetTitle() +{ + SALOMEDS::Locker lock; + Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl); CORBA::String_var c_s = CORBA::string_dup(TCollection_AsciiString(aTable->GetTitle()).ToCString()); return c_s._retn(); } @@ -62,9 +59,10 @@ char* SALOMEDS_AttributeTableOfInteger_i::GetTitle() { void SALOMEDS_AttributeTableOfInteger_i::SetRowTitle(CORBA::Long theIndex, const char* theTitle) throw (SALOMEDS::AttributeTableOfInteger::IncorrectIndex) { + SALOMEDS::Locker lock; Unexpect aCatch (ATI_IncorrectIndex); CheckLocked(); - Handle(SALOMEDS_TableOfIntegerAttribute) aTable = Handle(SALOMEDS_TableOfIntegerAttribute)::DownCast(_myAttr); + 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); @@ -80,17 +78,20 @@ void SALOMEDS_AttributeTableOfInteger_i::SetRowTitle(CORBA::Long theIndex, const void SALOMEDS_AttributeTableOfInteger_i::SetRowTitles(const SALOMEDS::StringSeq& theTitles) throw (SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength) { + SALOMEDS::Locker lock; Unexpect aCatch (ATI_IncorrectArgumentLength); CheckLocked(); - Handle(SALOMEDS_TableOfIntegerAttribute) aTable = Handle(SALOMEDS_TableOfIntegerAttribute)::DownCast(_myAttr); + Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl); if (theTitles.length() != aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength(); for (int i = 0; i < theTitles.length(); i++) { SetRowTitle(i + 1, theTitles[i]); } } -SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfInteger_i::GetRowTitles() { - Handle(SALOMEDS_TableOfIntegerAttribute) aTable = Handle(SALOMEDS_TableOfIntegerAttribute)::DownCast(_myAttr); +SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfInteger_i::GetRowTitles() +{ + SALOMEDS::Locker lock; + Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl); SALOMEDS::StringSeq_var aTitles = new SALOMEDS::StringSeq; aTitles->length(aTable->GetNbRows()); for(int i = 0; i < aTitles->length(); i++) @@ -101,9 +102,10 @@ SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfInteger_i::GetRowTitles() { void SALOMEDS_AttributeTableOfInteger_i::SetColumnTitle(CORBA::Long theIndex, const char* theTitle) throw (SALOMEDS::AttributeTableOfInteger::IncorrectIndex) { + SALOMEDS::Locker lock; Unexpect aCatch (ATI_IncorrectIndex); CheckLocked(); - Handle(SALOMEDS_TableOfIntegerAttribute) aTable = Handle(SALOMEDS_TableOfIntegerAttribute)::DownCast(_myAttr); + Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl); if (theIndex <= 0 || theIndex > aTable->GetNbColumns()) throw SALOMEDS::AttributeTableOfInteger::IncorrectIndex(); CORBA::String_var aStr = CORBA::string_dup(theTitle); aTable->SetColumnTitle(theIndex, TCollection_ExtendedString(aStr)); @@ -112,17 +114,20 @@ void SALOMEDS_AttributeTableOfInteger_i::SetColumnTitle(CORBA::Long theIndex, co void SALOMEDS_AttributeTableOfInteger_i::SetColumnTitles(const SALOMEDS::StringSeq& theTitles) throw (SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength) { + SALOMEDS::Locker lock; Unexpect aCatch(ATI_IncorrectArgumentLength); CheckLocked(); - Handle(SALOMEDS_TableOfIntegerAttribute) aTable = Handle(SALOMEDS_TableOfIntegerAttribute)::DownCast(_myAttr); + 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]); } } -SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfInteger_i::GetColumnTitles() { - Handle(SALOMEDS_TableOfIntegerAttribute) aTable = Handle(SALOMEDS_TableOfIntegerAttribute)::DownCast(_myAttr); +SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfInteger_i::GetColumnTitles() +{ + SALOMEDS::Locker lock; + Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl); SALOMEDS::StringSeq_var aTitles = new SALOMEDS::StringSeq; aTitles->length(aTable->GetNbColumns()); for(int i = 0; i < aTitles->length(); i++) @@ -134,9 +139,10 @@ SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfInteger_i::GetColumnTitles() { void SALOMEDS_AttributeTableOfInteger_i::SetRowUnit(CORBA::Long theIndex, const char* theUnit) throw (SALOMEDS::AttributeTableOfInteger::IncorrectIndex) { - Unexpect aCatch (ATI_IncorrectIndex); + SALOMEDS::Locker lock; + Unexpect aCatch (ATI_IncorrectIndex); CheckLocked(); - Handle(SALOMEDS_TableOfIntegerAttribute) aTable = Handle(SALOMEDS_TableOfIntegerAttribute)::DownCast(_myAttr); + 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)); @@ -149,17 +155,20 @@ void SALOMEDS_AttributeTableOfInteger_i::SetRowUnit(CORBA::Long theIndex, const void SALOMEDS_AttributeTableOfInteger_i::SetRowUnits(const SALOMEDS::StringSeq& theUnits) throw (SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength) { + SALOMEDS::Locker lock; Unexpect aCatch (ATI_IncorrectArgumentLength); CheckLocked(); - Handle(SALOMEDS_TableOfIntegerAttribute) aTable = Handle(SALOMEDS_TableOfIntegerAttribute)::DownCast(_myAttr); + 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]); } } -SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfInteger_i::GetRowUnits() { - Handle(SALOMEDS_TableOfIntegerAttribute) aTable = Handle(SALOMEDS_TableOfIntegerAttribute)::DownCast(_myAttr); +SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfInteger_i::GetRowUnits() +{ + SALOMEDS::Locker lock; + Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl); SALOMEDS::StringSeq_var aUnits = new SALOMEDS::StringSeq; aUnits->length(aTable->GetNbRows()); for(int i = 0; i < aUnits->length(); i++) @@ -167,19 +176,25 @@ SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfInteger_i::GetRowUnits() { return aUnits._retn(); } -CORBA::Long SALOMEDS_AttributeTableOfInteger_i::GetNbRows() { - return Handle(SALOMEDS_TableOfIntegerAttribute)::DownCast(_myAttr)->GetNbRows(); +CORBA::Long SALOMEDS_AttributeTableOfInteger_i::GetNbRows() +{ + SALOMEDS::Locker lock; + return Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl)->GetNbRows(); } -CORBA::Long SALOMEDS_AttributeTableOfInteger_i::GetNbColumns() { - return Handle(SALOMEDS_TableOfIntegerAttribute)::DownCast(_myAttr)->GetNbColumns(); + +CORBA::Long SALOMEDS_AttributeTableOfInteger_i::GetNbColumns() +{ + SALOMEDS::Locker lock; + return Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl)->GetNbColumns(); } void SALOMEDS_AttributeTableOfInteger_i::AddRow(const SALOMEDS::LongSeq& theData) throw (SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength) { + SALOMEDS::Locker lock; Unexpect aCatch(ATI_IncorrectArgumentLength); CheckLocked(); - Handle(SALOMEDS_TableOfIntegerAttribute) aTable = Handle(SALOMEDS_TableOfIntegerAttribute)::DownCast(_myAttr); + Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl); Handle(TColStd_HSequenceOfInteger) aRow = new TColStd_HSequenceOfInteger; for (int i = 0; i < theData.length(); i++) aRow->Append(theData[i]); @@ -194,9 +209,10 @@ void SALOMEDS_AttributeTableOfInteger_i::AddRow(const SALOMEDS::LongSeq& theData void SALOMEDS_AttributeTableOfInteger_i::SetRow(CORBA::Long theRow, const SALOMEDS::LongSeq& theData) throw (SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength, SALOMEDS::AttributeTableOfInteger::IncorrectIndex) { + SALOMEDS::Locker lock; Unexpect aCatch(ATI_IncorrectArgumentLength); CheckLocked(); - Handle(SALOMEDS_TableOfIntegerAttribute) aTable = Handle(SALOMEDS_TableOfIntegerAttribute)::DownCast(_myAttr); + Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl); Handle(TColStd_HSequenceOfInteger) aRow = new TColStd_HSequenceOfInteger; for (int i = 0; i < theData.length(); i++) aRow->Append(theData[i]); @@ -211,8 +227,9 @@ void SALOMEDS_AttributeTableOfInteger_i::SetRow(CORBA::Long theRow, const SALOME SALOMEDS::LongSeq* SALOMEDS_AttributeTableOfInteger_i::GetRow(CORBA::Long theRow) throw (SALOMEDS::AttributeTableOfInteger::IncorrectIndex) { + SALOMEDS::Locker lock; Unexpect aCatch(ATI_IncorrectIndex); - Handle(SALOMEDS_TableOfIntegerAttribute) aTable = Handle(SALOMEDS_TableOfIntegerAttribute)::DownCast(_myAttr); + Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl); if (theRow <= 0 || theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfInteger::IncorrectIndex(); SALOMEDS::LongSeq_var CorbaSeq = new SALOMEDS::LongSeq; @@ -227,9 +244,10 @@ SALOMEDS::LongSeq* SALOMEDS_AttributeTableOfInteger_i::GetRow(CORBA::Long theRow void SALOMEDS_AttributeTableOfInteger_i::AddColumn(const SALOMEDS::LongSeq& theData) throw (SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength) { + SALOMEDS::Locker lock; Unexpect aCatch(ATI_IncorrectArgumentLength); CheckLocked(); - Handle(SALOMEDS_TableOfIntegerAttribute) aTable = Handle(SALOMEDS_TableOfIntegerAttribute)::DownCast(_myAttr); + Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl); Handle(TColStd_HSequenceOfInteger) aColumn = new TColStd_HSequenceOfInteger; for (int i = 0; i < theData.length(); i++) aColumn->Append(theData[i]); @@ -244,9 +262,10 @@ void SALOMEDS_AttributeTableOfInteger_i::AddColumn(const SALOMEDS::LongSeq& theD void SALOMEDS_AttributeTableOfInteger_i::SetColumn(CORBA::Long theColumn, const SALOMEDS::LongSeq& theData) throw (SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength, SALOMEDS::AttributeTableOfInteger::IncorrectIndex) { + SALOMEDS::Locker lock; Unexpect aCatch(ATI_IncorrectArgumentLength); CheckLocked(); - Handle(SALOMEDS_TableOfIntegerAttribute) aTable = Handle(SALOMEDS_TableOfIntegerAttribute)::DownCast(_myAttr); + Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl); Handle(TColStd_HSequenceOfInteger) aColumn = new TColStd_HSequenceOfInteger; for (int i = 0; i < theData.length(); i++) aColumn->Append(theData[i]); @@ -261,8 +280,9 @@ void SALOMEDS_AttributeTableOfInteger_i::SetColumn(CORBA::Long theColumn, const SALOMEDS::LongSeq* SALOMEDS_AttributeTableOfInteger_i::GetColumn(CORBA::Long theColumn) throw (SALOMEDS::AttributeTableOfInteger::IncorrectIndex) { + SALOMEDS::Locker lock; Unexpect aCatch(ATI_IncorrectIndex); - Handle(SALOMEDS_TableOfIntegerAttribute) aTable = Handle(SALOMEDS_TableOfIntegerAttribute)::DownCast(_myAttr); + Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl); if (theColumn <= 0 || theColumn > aTable->GetNbColumns()) throw SALOMEDS::AttributeTableOfInteger::IncorrectIndex(); SALOMEDS::LongSeq_var CorbaSeq = new SALOMEDS::LongSeq; @@ -277,9 +297,10 @@ SALOMEDS::LongSeq* SALOMEDS_AttributeTableOfInteger_i::GetColumn(CORBA::Long the void SALOMEDS_AttributeTableOfInteger_i::PutValue(CORBA::Long theValue, CORBA::Long theRow, CORBA::Long theColumn) throw (SALOMEDS::AttributeTableOfInteger::IncorrectIndex) { + SALOMEDS::Locker lock; Unexpect aCatch(ATI_IncorrectIndex); CheckLocked(); - Handle(SALOMEDS_TableOfIntegerAttribute) aTable = Handle(SALOMEDS_TableOfIntegerAttribute)::DownCast(_myAttr); + Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl); try { aTable->PutValue(theValue, theRow, theColumn); @@ -289,15 +310,18 @@ void SALOMEDS_AttributeTableOfInteger_i::PutValue(CORBA::Long theValue, CORBA::L } } -CORBA::Boolean SALOMEDS_AttributeTableOfInteger_i::HasValue(CORBA::Long theRow, CORBA::Long theColumn) { - return Handle(SALOMEDS_TableOfIntegerAttribute)::DownCast(_myAttr)->HasValue(theRow, theColumn); +CORBA::Boolean SALOMEDS_AttributeTableOfInteger_i::HasValue(CORBA::Long theRow, CORBA::Long theColumn) +{ + SALOMEDS::Locker lock; + return Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl)->HasValue(theRow, theColumn); } CORBA::Long SALOMEDS_AttributeTableOfInteger_i::GetValue(CORBA::Long theRow, CORBA::Long theColumn) throw (SALOMEDS::AttributeTableOfInteger::IncorrectIndex) { + SALOMEDS::Locker lock; Unexpect aCatch(ATI_IncorrectIndex); - Handle(SALOMEDS_TableOfIntegerAttribute) aTable = Handle(SALOMEDS_TableOfIntegerAttribute)::DownCast(_myAttr); + Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl); if (theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfInteger::IncorrectIndex(); CORBA::Long aValue; @@ -312,7 +336,8 @@ CORBA::Long SALOMEDS_AttributeTableOfInteger_i::GetValue(CORBA::Long theRow, COR SALOMEDS::LongSeq* SALOMEDS_AttributeTableOfInteger_i::GetRowSetIndices(CORBA::Long theRow) { - Handle(SALOMEDS_TableOfIntegerAttribute) aTable = Handle(SALOMEDS_TableOfIntegerAttribute)::DownCast(_myAttr); + SALOMEDS::Locker lock; + Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl); if(theRow <= 0 || theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfInteger::IncorrectIndex(); @@ -328,13 +353,15 @@ SALOMEDS::LongSeq* SALOMEDS_AttributeTableOfInteger_i::GetRowSetIndices(CORBA::L void SALOMEDS_AttributeTableOfInteger_i::SetNbColumns(CORBA::Long theNbColumns) { - Handle(SALOMEDS_TableOfIntegerAttribute) aTable = Handle(SALOMEDS_TableOfIntegerAttribute)::DownCast(_myAttr); + SALOMEDS::Locker lock; + Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl); aTable->SetNbColumns(theNbColumns); } bool SALOMEDS_AttributeTableOfInteger_i::ReadFromFile(const SALOMEDS::TMPFile& theStream) { - Handle(SALOMEDS_TableOfIntegerAttribute) aTable = Handle(SALOMEDS_TableOfIntegerAttribute)::DownCast(_myAttr); + SALOMEDS::Locker lock; + Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl); istrstream aStream((char*)&theStream[0], theStream.length()); return aTable->RestoreFromString(aStream); @@ -342,7 +369,8 @@ bool SALOMEDS_AttributeTableOfInteger_i::ReadFromFile(const SALOMEDS::TMPFile& t SALOMEDS::TMPFile* SALOMEDS_AttributeTableOfInteger_i::SaveToFile() { - Handle(SALOMEDS_TableOfIntegerAttribute) aTable = Handle(SALOMEDS_TableOfIntegerAttribute)::DownCast(_myAttr); + SALOMEDS::Locker lock; + Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl); ostrstream ostr; string aString; @@ -360,20 +388,4 @@ SALOMEDS::TMPFile* SALOMEDS_AttributeTableOfInteger_i::SaveToFile() return aStreamFile._retn(); } -char* SALOMEDS_AttributeTableOfInteger_i::Store() { - Handle(SALOMEDS_TableOfIntegerAttribute) aTable = Handle(SALOMEDS_TableOfIntegerAttribute)::DownCast(_myAttr); - ostrstream ostr; - aTable->ConvertToString(ostr); - string aString = ostr.rdbuf()->str(); - - CORBA::String_var aBuffer = CORBA::string_dup(aString.c_str()); - return aBuffer._retn(); -} - -void SALOMEDS_AttributeTableOfInteger_i::Restore(const char* value) { - Handle(SALOMEDS_TableOfIntegerAttribute) aTable = Handle(SALOMEDS_TableOfIntegerAttribute)::DownCast(_myAttr); - - istrstream aStream(value, strlen(value)); - aTable->RestoreFromString(aStream); -} diff --git a/src/SALOMEDS/SALOMEDS_AttributeTableOfInteger_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeTableOfInteger_i.hxx index 03f996572..a2999eb26 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTableOfInteger_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTableOfInteger_i.hxx @@ -1,32 +1,28 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// -// // File : SALOMEDS_AttributeTableOfInteger_i.hxx -// Author : Michael Ponikarov +// Author : Sergey RUIN // Module : SALOME -// $Header$ #ifndef SALOMEDS_AttributeTableOfInteger_i_HeaderFile #define SALOMEDS_AttributeTableOfInteger_i_HeaderFile -#include "SALOMEDS_TableOfIntegerAttribute.hxx" -#include "SALOMEDS_GenericAttribute_i.hxx" - // IDL headers #include #include CORBA_SERVER_HEADER(SALOMEDS_Attributes) -DEFINE_DERIVED_ATTR(AttributeTableOfInteger,SALOMEDS_TableOfIntegerAttribute,true); +#include "SALOMEDS_GenericAttribute_i.hxx" +#include "SALOMEDSImpl_AttributeTableOfInteger.hxx" -class SALOMEDS_AttributeTableOfInteger_i: - public virtual POA_SALOMEDS::AttributeTableOfInteger, - public virtual SALOMEDS_TAttributeTableOfInteger_i +class SALOMEDS_AttributeTableOfInteger_i: public virtual POA_SALOMEDS::AttributeTableOfInteger, + public virtual SALOMEDS_GenericAttribute_i { - DEFINE_DERIVED_ATTR_METH_DEFAULT(AttributeTableOfInteger,SALOMEDS_TableOfIntegerAttribute); + public: + + SALOMEDS_AttributeTableOfInteger_i(const Handle(SALOMEDSImpl_AttributeTableOfInteger)& theAttr, CORBA::ORB_ptr orb) + :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; + + ~SALOMEDS_AttributeTableOfInteger_i() {}; + virtual void SetTitle(const char* theTitle); virtual char* GetTitle(); virtual void SetRowTitle(CORBA::Long theIndex, const char* theTitle) @@ -71,10 +67,6 @@ public: virtual bool ReadFromFile(const SALOMEDS::TMPFile& theStream); virtual SALOMEDS::TMPFile* SaveToFile(); - - virtual char* Store(); - virtual void Restore(const char*); - }; #endif diff --git a/src/SALOMEDS/SALOMEDS_AttributeTableOfReal_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeTableOfReal_i.cxx index c550cf38b..a6c0d7504 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTableOfReal_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTableOfReal_i.cxx @@ -1,18 +1,12 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// -// // File : SALOMEDS_AttributeTableOfReal_i.cxx -// Author : Michael Ponikarov +// Author : Sergey RUIN // Module : SALOME -// $Header$ +using namespace std; #include "SALOMEDS_AttributeTableOfReal_i.hxx" +#include "SALOMEDS.hxx" #include -#include #include #include @@ -25,8 +19,6 @@ UNEXPECT_CATCH(ATR_IncorrectArgumentLength, SALOMEDS::AttributeTableOfReal::Inco #define SEPARATOR '\1' -using namespace std; - static TCollection_ExtendedString getUnit(TCollection_ExtendedString theString) { TCollection_ExtendedString aString(theString); @@ -45,15 +37,21 @@ static TCollection_ExtendedString getTitle(TCollection_ExtendedString theString) return aString; } -void SALOMEDS_AttributeTableOfReal_i::SetTitle(const char* theTitle) { + + +void SALOMEDS_AttributeTableOfReal_i::SetTitle(const char* theTitle) +{ + SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDS_TableOfRealAttribute) aTable = Handle(SALOMEDS_TableOfRealAttribute)::DownCast(_myAttr); + Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl); CORBA::String_var aStr = CORBA::string_dup(theTitle); aTable->SetTitle(TCollection_ExtendedString(aStr)); } -char* SALOMEDS_AttributeTableOfReal_i::GetTitle() { - Handle(SALOMEDS_TableOfRealAttribute) aTable = Handle(SALOMEDS_TableOfRealAttribute)::DownCast(_myAttr); +char* SALOMEDS_AttributeTableOfReal_i::GetTitle() +{ + SALOMEDS::Locker lock; + Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl); CORBA::String_var c_s = CORBA::string_dup(TCollection_AsciiString(aTable->GetTitle()).ToCString()); return c_s._retn(); } @@ -61,9 +59,10 @@ char* SALOMEDS_AttributeTableOfReal_i::GetTitle() { void SALOMEDS_AttributeTableOfReal_i::SetRowTitle(CORBA::Long theIndex, const char* theTitle) throw (SALOMEDS::AttributeTableOfReal::IncorrectIndex) { + SALOMEDS::Locker lock; Unexpect aCatch (ATR_IncorrectIndex); CheckLocked(); - Handle(SALOMEDS_TableOfRealAttribute) aTable = Handle(SALOMEDS_TableOfRealAttribute)::DownCast(_myAttr); + 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); @@ -79,17 +78,20 @@ void SALOMEDS_AttributeTableOfReal_i::SetRowTitle(CORBA::Long theIndex, const ch void SALOMEDS_AttributeTableOfReal_i::SetRowTitles(const SALOMEDS::StringSeq& theTitles) throw (SALOMEDS::AttributeTableOfReal::IncorrectArgumentLength) { + SALOMEDS::Locker lock; Unexpect aCatch (ATR_IncorrectArgumentLength); CheckLocked(); - Handle(SALOMEDS_TableOfRealAttribute) aTable = Handle(SALOMEDS_TableOfRealAttribute)::DownCast(_myAttr); + 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]); } } -SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfReal_i::GetRowTitles() { - Handle(SALOMEDS_TableOfRealAttribute) aTable = Handle(SALOMEDS_TableOfRealAttribute)::DownCast(_myAttr); +SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfReal_i::GetRowTitles() +{ + SALOMEDS::Locker lock; + Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl); SALOMEDS::StringSeq_var aTitles = new SALOMEDS::StringSeq; aTitles->length(aTable->GetNbRows()); for(int i = 0; i < aTitles->length(); i++) @@ -100,9 +102,10 @@ SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfReal_i::GetRowTitles() { void SALOMEDS_AttributeTableOfReal_i::SetColumnTitle(CORBA::Long theIndex, const char* theTitle) throw (SALOMEDS::AttributeTableOfReal::IncorrectIndex) { + SALOMEDS::Locker lock; Unexpect aCatch (ATR_IncorrectIndex); CheckLocked(); - Handle(SALOMEDS_TableOfRealAttribute) aTable = Handle(SALOMEDS_TableOfRealAttribute)::DownCast(_myAttr); + Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl); if (theIndex <= 0 || theIndex > aTable->GetNbColumns()) throw SALOMEDS::AttributeTableOfReal::IncorrectIndex(); CORBA::String_var aStr = CORBA::string_dup(theTitle); aTable->SetColumnTitle(theIndex, TCollection_ExtendedString(aStr)); @@ -111,17 +114,20 @@ void SALOMEDS_AttributeTableOfReal_i::SetColumnTitle(CORBA::Long theIndex, const void SALOMEDS_AttributeTableOfReal_i::SetColumnTitles(const SALOMEDS::StringSeq& theTitles) throw (SALOMEDS::AttributeTableOfReal::IncorrectArgumentLength) { + SALOMEDS::Locker lock; Unexpect aCatch(ATR_IncorrectArgumentLength); CheckLocked(); - Handle(SALOMEDS_TableOfRealAttribute) aTable = Handle(SALOMEDS_TableOfRealAttribute)::DownCast(_myAttr); + 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]); } } -SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfReal_i::GetColumnTitles() { - Handle(SALOMEDS_TableOfRealAttribute) aTable = Handle(SALOMEDS_TableOfRealAttribute)::DownCast(_myAttr); +SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfReal_i::GetColumnTitles() +{ + SALOMEDS::Locker lock; + Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl); SALOMEDS::StringSeq_var aTitles = new SALOMEDS::StringSeq; aTitles->length(aTable->GetNbColumns()); for(int i = 0; i < aTitles->length(); i++) @@ -133,9 +139,10 @@ SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfReal_i::GetColumnTitles() { void SALOMEDS_AttributeTableOfReal_i::SetRowUnit(CORBA::Long theIndex, const char* theUnit) throw (SALOMEDS::AttributeTableOfReal::IncorrectIndex) { + SALOMEDS::Locker lock; Unexpect aCatch (ATR_IncorrectIndex); CheckLocked(); - Handle(SALOMEDS_TableOfRealAttribute) aTable = Handle(SALOMEDS_TableOfRealAttribute)::DownCast(_myAttr); + 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)); @@ -148,17 +155,20 @@ void SALOMEDS_AttributeTableOfReal_i::SetRowUnit(CORBA::Long theIndex, const cha void SALOMEDS_AttributeTableOfReal_i::SetRowUnits(const SALOMEDS::StringSeq& theUnits) throw (SALOMEDS::AttributeTableOfReal::IncorrectArgumentLength) { + SALOMEDS::Locker lock; Unexpect aCatch (ATR_IncorrectArgumentLength); CheckLocked(); - Handle(SALOMEDS_TableOfRealAttribute) aTable = Handle(SALOMEDS_TableOfRealAttribute)::DownCast(_myAttr); + 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]); } } -SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfReal_i::GetRowUnits() { - Handle(SALOMEDS_TableOfRealAttribute) aTable = Handle(SALOMEDS_TableOfRealAttribute)::DownCast(_myAttr); +SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfReal_i::GetRowUnits() +{ + SALOMEDS::Locker lock; + Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl); SALOMEDS::StringSeq_var aUnits = new SALOMEDS::StringSeq; aUnits->length(aTable->GetNbRows()); for(int i = 0; i < aUnits->length(); i++) @@ -167,19 +177,25 @@ SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfReal_i::GetRowUnits() { } -CORBA::Long SALOMEDS_AttributeTableOfReal_i::GetNbRows() { - return Handle(SALOMEDS_TableOfRealAttribute)::DownCast(_myAttr)->GetNbRows(); +CORBA::Long SALOMEDS_AttributeTableOfReal_i::GetNbRows() +{ + SALOMEDS::Locker lock; + return Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl)->GetNbRows(); } -CORBA::Long SALOMEDS_AttributeTableOfReal_i::GetNbColumns() { - return Handle(SALOMEDS_TableOfRealAttribute)::DownCast(_myAttr)->GetNbColumns(); + +CORBA::Long SALOMEDS_AttributeTableOfReal_i::GetNbColumns() +{ + SALOMEDS::Locker lock; + return Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl)->GetNbColumns(); } void SALOMEDS_AttributeTableOfReal_i::AddRow(const SALOMEDS::DoubleSeq& theData) throw (SALOMEDS::AttributeTableOfReal::IncorrectArgumentLength) { + SALOMEDS::Locker lock; Unexpect aCatch(ATR_IncorrectArgumentLength); CheckLocked(); - Handle(SALOMEDS_TableOfRealAttribute) aTable = Handle(SALOMEDS_TableOfRealAttribute)::DownCast(_myAttr); + Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl); Handle(TColStd_HSequenceOfReal) aRow = new TColStd_HSequenceOfReal; for (int i = 0; i < theData.length(); i++) aRow->Append(theData[i]); @@ -189,9 +205,10 @@ void SALOMEDS_AttributeTableOfReal_i::AddRow(const SALOMEDS::DoubleSeq& theData) void SALOMEDS_AttributeTableOfReal_i::SetRow(CORBA::Long theRow, const SALOMEDS::DoubleSeq& theData) throw (SALOMEDS::AttributeTableOfReal::IncorrectArgumentLength, SALOMEDS::AttributeTableOfReal::IncorrectIndex) { + SALOMEDS::Locker lock; Unexpect aCatch(ATR_IncorrectArgumentLength); CheckLocked(); - Handle(SALOMEDS_TableOfRealAttribute) aTable = Handle(SALOMEDS_TableOfRealAttribute)::DownCast(_myAttr); + Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl); Handle(TColStd_HSequenceOfReal) aRow = new TColStd_HSequenceOfReal; for (int i = 0; i < theData.length(); i++) aRow->Append(theData[i]); @@ -201,8 +218,9 @@ void SALOMEDS_AttributeTableOfReal_i::SetRow(CORBA::Long theRow, const SALOMEDS: SALOMEDS::DoubleSeq* SALOMEDS_AttributeTableOfReal_i::GetRow(CORBA::Long theRow) throw (SALOMEDS::AttributeTableOfReal::IncorrectIndex) { + SALOMEDS::Locker lock; Unexpect aCatch(ATR_IncorrectIndex); - Handle(SALOMEDS_TableOfRealAttribute) aTable = Handle(SALOMEDS_TableOfRealAttribute)::DownCast(_myAttr); + Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl); if (theRow <= 0 || theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfReal::IncorrectIndex(); SALOMEDS::DoubleSeq_var CorbaSeq = new SALOMEDS::DoubleSeq; @@ -217,9 +235,10 @@ SALOMEDS::DoubleSeq* SALOMEDS_AttributeTableOfReal_i::GetRow(CORBA::Long theRow) void SALOMEDS_AttributeTableOfReal_i::AddColumn(const SALOMEDS::DoubleSeq& theData) throw (SALOMEDS::AttributeTableOfReal::IncorrectArgumentLength) { + SALOMEDS::Locker lock; Unexpect aCatch(ATR_IncorrectArgumentLength); CheckLocked(); - Handle(SALOMEDS_TableOfRealAttribute) aTable = Handle(SALOMEDS_TableOfRealAttribute)::DownCast(_myAttr); + Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl); Handle(TColStd_HSequenceOfReal) aColumn = new TColStd_HSequenceOfReal; for (int i = 0; i < theData.length(); i++) aColumn->Append(theData[i]); @@ -229,9 +248,10 @@ void SALOMEDS_AttributeTableOfReal_i::AddColumn(const SALOMEDS::DoubleSeq& theDa void SALOMEDS_AttributeTableOfReal_i::SetColumn(CORBA::Long theColumn, const SALOMEDS::DoubleSeq& theData) throw (SALOMEDS::AttributeTableOfReal::IncorrectArgumentLength, SALOMEDS::AttributeTableOfReal::IncorrectIndex) { + SALOMEDS::Locker lock; Unexpect aCatch(ATR_IncorrectArgumentLength); CheckLocked(); - Handle(SALOMEDS_TableOfRealAttribute) aTable = Handle(SALOMEDS_TableOfRealAttribute)::DownCast(_myAttr); + Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl); Handle(TColStd_HSequenceOfReal) aColumn = new TColStd_HSequenceOfReal; for (int i = 0; i < theData.length(); i++) aColumn->Append(theData[i]); @@ -241,8 +261,9 @@ void SALOMEDS_AttributeTableOfReal_i::SetColumn(CORBA::Long theColumn, const SAL SALOMEDS::DoubleSeq* SALOMEDS_AttributeTableOfReal_i::GetColumn(CORBA::Long theColumn) throw (SALOMEDS::AttributeTableOfReal::IncorrectIndex) { + SALOMEDS::Locker lock; Unexpect aCatch(ATR_IncorrectIndex); - Handle(SALOMEDS_TableOfRealAttribute) aTable = Handle(SALOMEDS_TableOfRealAttribute)::DownCast(_myAttr); + Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl); if (theColumn <= 0 || theColumn > aTable->GetNbColumns()) throw SALOMEDS::AttributeTableOfReal::IncorrectIndex(); SALOMEDS::DoubleSeq_var CorbaSeq = new SALOMEDS::DoubleSeq; @@ -257,22 +278,26 @@ SALOMEDS::DoubleSeq* SALOMEDS_AttributeTableOfReal_i::GetColumn(CORBA::Long theC void SALOMEDS_AttributeTableOfReal_i::PutValue(CORBA::Double theValue, CORBA::Long theRow, CORBA::Long theColumn) throw (SALOMEDS::AttributeTableOfReal::IncorrectIndex) { + SALOMEDS::Locker lock; Unexpect aCatch(ATR_IncorrectIndex); CheckLocked(); - Handle(SALOMEDS_TableOfRealAttribute) aTable = Handle(SALOMEDS_TableOfRealAttribute)::DownCast(_myAttr); + Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl); aTable->PutValue(theValue, theRow, theColumn); } -CORBA::Boolean SALOMEDS_AttributeTableOfReal_i::HasValue(CORBA::Long theRow, CORBA::Long theColumn) { - return Handle(SALOMEDS_TableOfRealAttribute)::DownCast(_myAttr)->HasValue(theRow, theColumn); +CORBA::Boolean SALOMEDS_AttributeTableOfReal_i::HasValue(CORBA::Long theRow, CORBA::Long theColumn) +{ + SALOMEDS::Locker lock; + return Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl)->HasValue(theRow, theColumn); } CORBA::Double SALOMEDS_AttributeTableOfReal_i::GetValue(CORBA::Long theRow, CORBA::Long theColumn) throw (SALOMEDS::AttributeTableOfReal::IncorrectIndex) { + SALOMEDS::Locker lock; Unexpect aCatch(ATR_IncorrectIndex); - Handle(SALOMEDS_TableOfRealAttribute) aTable = Handle(SALOMEDS_TableOfRealAttribute)::DownCast(_myAttr); + Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl); if (theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfReal::IncorrectIndex(); CORBA::Double aValue; @@ -290,7 +315,8 @@ CORBA::Double SALOMEDS_AttributeTableOfReal_i::GetValue(CORBA::Long theRow, CORB SALOMEDS::LongSeq* SALOMEDS_AttributeTableOfReal_i::GetRowSetIndices(CORBA::Long theRow) { - Handle(SALOMEDS_TableOfRealAttribute) aTable = Handle(SALOMEDS_TableOfRealAttribute)::DownCast(_myAttr); + SALOMEDS::Locker lock; + Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl); if(theRow <= 0 || theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfReal::IncorrectIndex(); @@ -306,13 +332,15 @@ SALOMEDS::LongSeq* SALOMEDS_AttributeTableOfReal_i::GetRowSetIndices(CORBA::Long void SALOMEDS_AttributeTableOfReal_i::SetNbColumns(CORBA::Long theNbColumns) { - Handle(SALOMEDS_TableOfRealAttribute) aTable = Handle(SALOMEDS_TableOfRealAttribute)::DownCast(_myAttr); + SALOMEDS::Locker lock; + Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl); aTable->SetNbColumns(theNbColumns); } bool SALOMEDS_AttributeTableOfReal_i::ReadFromFile(const SALOMEDS::TMPFile& theStream) { - Handle(SALOMEDS_TableOfRealAttribute) aTable = Handle(SALOMEDS_TableOfRealAttribute)::DownCast(_myAttr); + SALOMEDS::Locker lock; + Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl); istrstream aStream((char*)&theStream[0], theStream.length()); return aTable->RestoreFromString(aStream); @@ -320,7 +348,8 @@ bool SALOMEDS_AttributeTableOfReal_i::ReadFromFile(const SALOMEDS::TMPFile& theS SALOMEDS::TMPFile* SALOMEDS_AttributeTableOfReal_i::SaveToFile() { - Handle(SALOMEDS_TableOfRealAttribute) aTable = Handle(SALOMEDS_TableOfRealAttribute)::DownCast(_myAttr); + SALOMEDS::Locker lock; + Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl); ostrstream ostr; string aString; @@ -337,21 +366,3 @@ SALOMEDS::TMPFile* SALOMEDS_AttributeTableOfReal_i::SaveToFile() return aStreamFile._retn(); } - -char* SALOMEDS_AttributeTableOfReal_i::Store() { - Handle(SALOMEDS_TableOfRealAttribute) aTable = Handle(SALOMEDS_TableOfRealAttribute)::DownCast(_myAttr); - - ostrstream ostr; - aTable->ConvertToString(ostr); - string aString = ostr.rdbuf()->str(); - - CORBA::String_var aBuffer = CORBA::string_dup(aString.c_str()); - return aBuffer._retn(); -} - -void SALOMEDS_AttributeTableOfReal_i::Restore(const char* value) { - Handle(SALOMEDS_TableOfRealAttribute) aTable = Handle(SALOMEDS_TableOfRealAttribute)::DownCast(_myAttr); - - istrstream aStream(value, strlen(value)); - aTable->RestoreFromString(aStream); -} diff --git a/src/SALOMEDS/SALOMEDS_AttributeTableOfReal_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeTableOfReal_i.hxx index 9726ec82a..0165154b7 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTableOfReal_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTableOfReal_i.hxx @@ -1,33 +1,28 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// -// // File : SALOMEDS_AttributeTableOfReal_i.hxx // Author : Michael Ponikarov // Module : SALOME -// $Header$ #ifndef SALOMEDS_AttributeTableOfReal_i_HeaderFile #define SALOMEDS_AttributeTableOfReal_i_HeaderFile -#include "SALOMEDS_TableOfRealAttribute.hxx" -#include "SALOMEDS_GenericAttribute_i.hxx" - // IDL headers #include #include CORBA_SERVER_HEADER(SALOMEDS_Attributes) -DEFINE_DERIVED_ATTR(AttributeTableOfReal,SALOMEDS_TableOfRealAttribute,true); +#include "SALOMEDS_GenericAttribute_i.hxx" +#include "SALOMEDSImpl_AttributeTableOfReal.hxx" -class SALOMEDS_AttributeTableOfReal_i: - public virtual POA_SALOMEDS::AttributeTableOfReal, - public virtual SALOMEDS_TAttributeTableOfReal_i -{ - DEFINE_DERIVED_ATTR_METH_DEFAULT(AttributeTableOfReal,SALOMEDS_TableOfRealAttribute); +class SALOMEDS_AttributeTableOfReal_i: public virtual POA_SALOMEDS::AttributeTableOfReal, + public virtual SALOMEDS_GenericAttribute_i { + public: - virtual void SetTitle(const char* theTitle); + + SALOMEDS_AttributeTableOfReal_i(const Handle(SALOMEDSImpl_AttributeTableOfReal)& theAttr, CORBA::ORB_ptr orb) + :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; + + ~SALOMEDS_AttributeTableOfReal_i() {}; + + virtual void SetTitle(const char* theTitle); virtual char* GetTitle(); virtual void SetRowTitle(CORBA::Long theIndex, const char* theTitle) throw (SALOMEDS::AttributeTableOfReal::IncorrectIndex); @@ -72,9 +67,6 @@ public: virtual bool ReadFromFile(const SALOMEDS::TMPFile& theStream); virtual SALOMEDS::TMPFile* SaveToFile(); - virtual char* Store(); - virtual void Restore(const char*); - }; #endif diff --git a/src/SALOMEDS/SALOMEDS_AttributeTableOfString_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeTableOfString_i.cxx index 8527cf8db..844322372 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTableOfString_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTableOfString_i.cxx @@ -1,31 +1,25 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// -// // File : SALOMEDS_AttributeTableOfString_i.cxx -// Author : Sergey Ruin +// Author : Sergey RUIN // Module : SALOME +using namespace std; #include #include -#include +#include "SALOMEDS_AttributeTableOfString_i.hxx" +#include "SALOMEDS.hxx" + +#include #include #include #include #include -#include "SALOMEDS_AttributeTableOfString_i.hxx" - #include "Utils_ExceptHandlers.hxx" - UNEXPECT_CATCH(ATS_IncorrectIndex, SALOMEDS::AttributeTableOfString::IncorrectIndex); UNEXPECT_CATCH(ATS_IncorrectArgumentLength, SALOMEDS::AttributeTableOfString::IncorrectArgumentLength); -using namespace std; #define SEPARATOR '\1' static TCollection_ExtendedString getUnit(TCollection_ExtendedString theString) @@ -46,15 +40,21 @@ static TCollection_ExtendedString getTitle(TCollection_ExtendedString theString) return aString; } -void SALOMEDS_AttributeTableOfString_i::SetTitle(const char* theTitle) { + + +void SALOMEDS_AttributeTableOfString_i::SetTitle(const char* theTitle) +{ + SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDS_TableOfStringAttribute) aTable = Handle(SALOMEDS_TableOfStringAttribute)::DownCast(_myAttr); + Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl); CORBA::String_var aStr = CORBA::string_dup(theTitle); aTable->SetTitle(TCollection_ExtendedString(aStr)); } -char* SALOMEDS_AttributeTableOfString_i::GetTitle() { - Handle(SALOMEDS_TableOfStringAttribute) aTable = Handle(SALOMEDS_TableOfStringAttribute)::DownCast(_myAttr); +char* SALOMEDS_AttributeTableOfString_i::GetTitle() +{ + SALOMEDS::Locker lock; + Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl); CORBA::String_var c_s = CORBA::string_dup(TCollection_AsciiString(aTable->GetTitle()).ToCString()); return c_s._retn(); } @@ -62,9 +62,10 @@ char* SALOMEDS_AttributeTableOfString_i::GetTitle() { void SALOMEDS_AttributeTableOfString_i::SetRowTitle(CORBA::Long theIndex, const char* theTitle) throw (SALOMEDS::AttributeTableOfString::IncorrectIndex) { + SALOMEDS::Locker lock; Unexpect aCatch(ATS_IncorrectIndex); CheckLocked(); - Handle(SALOMEDS_TableOfStringAttribute) aTable = Handle(SALOMEDS_TableOfStringAttribute)::DownCast(_myAttr); + 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); @@ -80,17 +81,20 @@ void SALOMEDS_AttributeTableOfString_i::SetRowTitle(CORBA::Long theIndex, const void SALOMEDS_AttributeTableOfString_i::SetRowTitles(const SALOMEDS::StringSeq& theTitles) throw (SALOMEDS::AttributeTableOfString::IncorrectArgumentLength) { + SALOMEDS::Locker lock; Unexpect aCatch(ATS_IncorrectArgumentLength); CheckLocked(); - Handle(SALOMEDS_TableOfStringAttribute) aTable = Handle(SALOMEDS_TableOfStringAttribute)::DownCast(_myAttr); + 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])); } } -SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfString_i::GetRowTitles() { - Handle(SALOMEDS_TableOfStringAttribute) aTable = Handle(SALOMEDS_TableOfStringAttribute)::DownCast(_myAttr); +SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfString_i::GetRowTitles() +{ + SALOMEDS::Locker lock; + Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl); SALOMEDS::StringSeq_var aTitles = new SALOMEDS::StringSeq; aTitles->length(aTable->GetNbRows()); for(int i = 0; i < aTitles->length(); i++) @@ -101,9 +105,10 @@ SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfString_i::GetRowTitles() { void SALOMEDS_AttributeTableOfString_i::SetColumnTitle(CORBA::Long theIndex, const char* theTitle) throw (SALOMEDS::AttributeTableOfString::IncorrectIndex) { + SALOMEDS::Locker lock; Unexpect aCatch(ATS_IncorrectIndex); CheckLocked(); - Handle(SALOMEDS_TableOfStringAttribute) aTable = Handle(SALOMEDS_TableOfStringAttribute)::DownCast(_myAttr); + 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)); @@ -112,17 +117,20 @@ void SALOMEDS_AttributeTableOfString_i::SetColumnTitle(CORBA::Long theIndex, con void SALOMEDS_AttributeTableOfString_i::SetColumnTitles(const SALOMEDS::StringSeq& theTitles) throw (SALOMEDS::AttributeTableOfString::IncorrectArgumentLength) { + SALOMEDS::Locker lock; Unexpect aCatch(ATS_IncorrectArgumentLength); CheckLocked(); - Handle(SALOMEDS_TableOfStringAttribute) aTable = Handle(SALOMEDS_TableOfStringAttribute)::DownCast(_myAttr); + 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])); } } -SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfString_i::GetColumnTitles() { - Handle(SALOMEDS_TableOfStringAttribute) aTable = Handle(SALOMEDS_TableOfStringAttribute)::DownCast(_myAttr); +SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfString_i::GetColumnTitles() +{ + SALOMEDS::Locker lock; + Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl); SALOMEDS::StringSeq_var aTitles = new SALOMEDS::StringSeq; aTitles->length(aTable->GetNbColumns()); for(int i = 0; i < aTitles->length(); i++) @@ -134,9 +142,10 @@ SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfString_i::GetColumnTitles() { void SALOMEDS_AttributeTableOfString_i::SetRowUnit(CORBA::Long theIndex, const char* theUnit) throw (SALOMEDS::AttributeTableOfString::IncorrectIndex) { + SALOMEDS::Locker lock; Unexpect aCatch(ATS_IncorrectIndex); CheckLocked(); - Handle(SALOMEDS_TableOfStringAttribute) aTable = Handle(SALOMEDS_TableOfStringAttribute)::DownCast(_myAttr); + 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)); @@ -149,17 +158,20 @@ void SALOMEDS_AttributeTableOfString_i::SetRowUnit(CORBA::Long theIndex, const c void SALOMEDS_AttributeTableOfString_i::SetRowUnits(const SALOMEDS::StringSeq& theUnits) throw (SALOMEDS::AttributeTableOfString::IncorrectArgumentLength) { + SALOMEDS::Locker lock; Unexpect aCatch(ATS_IncorrectArgumentLength); CheckLocked(); - Handle(SALOMEDS_TableOfStringAttribute) aTable = Handle(SALOMEDS_TableOfStringAttribute)::DownCast(_myAttr); + 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])); } } -SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfString_i::GetRowUnits() { - Handle(SALOMEDS_TableOfStringAttribute) aTable = Handle(SALOMEDS_TableOfStringAttribute)::DownCast(_myAttr); +SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfString_i::GetRowUnits() +{ + SALOMEDS::Locker lock; + Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl); SALOMEDS::StringSeq_var aUnits = new SALOMEDS::StringSeq; aUnits->length(aTable->GetNbRows()); for(int i = 0; i < aUnits->length(); i++) @@ -168,19 +180,25 @@ SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfString_i::GetRowUnits() { } -CORBA::Long SALOMEDS_AttributeTableOfString_i::GetNbRows() { - return Handle(SALOMEDS_TableOfStringAttribute)::DownCast(_myAttr)->GetNbRows(); +CORBA::Long SALOMEDS_AttributeTableOfString_i::GetNbRows() +{ + SALOMEDS::Locker lock; + return Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl)->GetNbRows(); } -CORBA::Long SALOMEDS_AttributeTableOfString_i::GetNbColumns() { - return Handle(SALOMEDS_TableOfStringAttribute)::DownCast(_myAttr)->GetNbColumns(); + +CORBA::Long SALOMEDS_AttributeTableOfString_i::GetNbColumns() +{ + SALOMEDS::Locker lock; + return Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl)->GetNbColumns(); } void SALOMEDS_AttributeTableOfString_i::AddRow(const SALOMEDS::StringSeq& theData) throw (SALOMEDS::AttributeTableOfString::IncorrectArgumentLength) { + SALOMEDS::Locker lock; Unexpect aCatch(ATS_IncorrectArgumentLength); CheckLocked(); - Handle(SALOMEDS_TableOfStringAttribute) aTable = Handle(SALOMEDS_TableOfStringAttribute)::DownCast(_myAttr); + Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl); Handle(TColStd_HSequenceOfExtendedString) aRow = new TColStd_HSequenceOfExtendedString; for (int i = 0; i < theData.length(); i++) aRow->Append(TCollection_AsciiString(CORBA::string_dup(theData[i]))); @@ -190,9 +208,10 @@ void SALOMEDS_AttributeTableOfString_i::AddRow(const SALOMEDS::StringSeq& theDat void SALOMEDS_AttributeTableOfString_i::SetRow(CORBA::Long theRow, const SALOMEDS::StringSeq& theData) throw (SALOMEDS::AttributeTableOfString::IncorrectArgumentLength, SALOMEDS::AttributeTableOfString::IncorrectIndex) { + SALOMEDS::Locker lock; Unexpect aCatch(ATS_IncorrectArgumentLength); CheckLocked(); - Handle(SALOMEDS_TableOfStringAttribute) aTable = Handle(SALOMEDS_TableOfStringAttribute)::DownCast(_myAttr); + Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl); Handle(TColStd_HSequenceOfExtendedString) aRow = new TColStd_HSequenceOfExtendedString; for (int i = 0; i < theData.length(); i++) aRow->Append(TCollection_AsciiString(CORBA::string_dup(theData[i]))); @@ -202,8 +221,9 @@ void SALOMEDS_AttributeTableOfString_i::SetRow(CORBA::Long theRow, const SALOMED SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfString_i::GetRow(CORBA::Long theRow) throw (SALOMEDS::AttributeTableOfString::IncorrectIndex) { + SALOMEDS::Locker lock; Unexpect aCatch(ATS_IncorrectIndex); - Handle(SALOMEDS_TableOfStringAttribute) aTable = Handle(SALOMEDS_TableOfStringAttribute)::DownCast(_myAttr); + Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl); if (theRow <= 0 || theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfString::IncorrectIndex(); SALOMEDS::StringSeq_var CorbaSeq = new SALOMEDS::StringSeq; @@ -218,9 +238,10 @@ SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfString_i::GetRow(CORBA::Long theRo void SALOMEDS_AttributeTableOfString_i::AddColumn(const SALOMEDS::StringSeq& theData) throw (SALOMEDS::AttributeTableOfString::IncorrectArgumentLength) { + SALOMEDS::Locker lock; Unexpect aCatch(ATS_IncorrectArgumentLength); CheckLocked(); - Handle(SALOMEDS_TableOfStringAttribute) aTable = Handle(SALOMEDS_TableOfStringAttribute)::DownCast(_myAttr); + Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl); Handle(TColStd_HSequenceOfExtendedString) aColumn = new TColStd_HSequenceOfExtendedString; for (int i = 0; i < theData.length(); i++) aColumn->Append(TCollection_AsciiString(CORBA::string_dup(theData[i]))); @@ -230,9 +251,10 @@ void SALOMEDS_AttributeTableOfString_i::AddColumn(const SALOMEDS::StringSeq& the void SALOMEDS_AttributeTableOfString_i::SetColumn(CORBA::Long theColumn, const SALOMEDS::StringSeq& theData) throw (SALOMEDS::AttributeTableOfString::IncorrectArgumentLength, SALOMEDS::AttributeTableOfString::IncorrectIndex) { + SALOMEDS::Locker lock; Unexpect aCatch(ATS_IncorrectArgumentLength); CheckLocked(); - Handle(SALOMEDS_TableOfStringAttribute) aTable = Handle(SALOMEDS_TableOfStringAttribute)::DownCast(_myAttr); + Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl); Handle(TColStd_HSequenceOfExtendedString) aColumn = new TColStd_HSequenceOfExtendedString; for (int i = 0; i < theData.length(); i++) aColumn->Append(TCollection_AsciiString(CORBA::string_dup(theData[i]))); @@ -242,8 +264,9 @@ void SALOMEDS_AttributeTableOfString_i::SetColumn(CORBA::Long theColumn, const S SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfString_i::GetColumn(CORBA::Long theColumn) throw (SALOMEDS::AttributeTableOfString::IncorrectIndex) { + SALOMEDS::Locker lock; Unexpect aCatch(ATS_IncorrectIndex); - Handle(SALOMEDS_TableOfStringAttribute) aTable = Handle(SALOMEDS_TableOfStringAttribute)::DownCast(_myAttr); + Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl); if (theColumn <= 0 || theColumn > aTable->GetNbColumns()) throw SALOMEDS::AttributeTableOfString::IncorrectIndex(); SALOMEDS::StringSeq_var CorbaSeq = new SALOMEDS::StringSeq; @@ -258,23 +281,27 @@ SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfString_i::GetColumn(CORBA::Long th void SALOMEDS_AttributeTableOfString_i::PutValue(const char* theValue, CORBA::Long theRow, CORBA::Long theColumn) throw (SALOMEDS::AttributeTableOfString::IncorrectIndex) { + SALOMEDS::Locker lock; Unexpect aCatch(ATS_IncorrectIndex); CheckLocked(); - Handle(SALOMEDS_TableOfStringAttribute) aTable = Handle(SALOMEDS_TableOfStringAttribute)::DownCast(_myAttr); + Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl); char* aValue = CORBA::string_dup(theValue); aTable->PutValue(aValue, theRow, theColumn); } -CORBA::Boolean SALOMEDS_AttributeTableOfString_i::HasValue(CORBA::Long theRow, CORBA::Long theColumn) { - return Handle(SALOMEDS_TableOfStringAttribute)::DownCast(_myAttr)->HasValue(theRow, theColumn); +CORBA::Boolean SALOMEDS_AttributeTableOfString_i::HasValue(CORBA::Long theRow, CORBA::Long theColumn) +{ + SALOMEDS::Locker lock; + return Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl)->HasValue(theRow, theColumn); } char* SALOMEDS_AttributeTableOfString_i::GetValue(CORBA::Long theRow, CORBA::Long theColumn) throw (SALOMEDS::AttributeTableOfString::IncorrectIndex) { + SALOMEDS::Locker lock; Unexpect aCatch(ATS_IncorrectIndex); - Handle(SALOMEDS_TableOfStringAttribute) aTable = Handle(SALOMEDS_TableOfStringAttribute)::DownCast(_myAttr); + Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl); if (theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfString::IncorrectIndex(); TCollection_AsciiString aValue; @@ -292,7 +319,8 @@ char* SALOMEDS_AttributeTableOfString_i::GetValue(CORBA::Long theRow, CORBA::Lon SALOMEDS::LongSeq* SALOMEDS_AttributeTableOfString_i::GetRowSetIndices(CORBA::Long theRow) { - Handle(SALOMEDS_TableOfStringAttribute) aTable = Handle(SALOMEDS_TableOfStringAttribute)::DownCast(_myAttr); + SALOMEDS::Locker lock; + Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl); if(theRow <= 0 || theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfString::IncorrectIndex(); @@ -308,13 +336,15 @@ SALOMEDS::LongSeq* SALOMEDS_AttributeTableOfString_i::GetRowSetIndices(CORBA::Lo void SALOMEDS_AttributeTableOfString_i::SetNbColumns(CORBA::Long theNbColumns) { - Handle(SALOMEDS_TableOfStringAttribute) aTable = Handle(SALOMEDS_TableOfStringAttribute)::DownCast(_myAttr); + SALOMEDS::Locker lock; + Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl); aTable->SetNbColumns(theNbColumns); } bool SALOMEDS_AttributeTableOfString_i::ReadFromFile(const SALOMEDS::TMPFile& theStream) { - Handle(SALOMEDS_TableOfStringAttribute) aTable = Handle(SALOMEDS_TableOfStringAttribute)::DownCast(_myAttr); + SALOMEDS::Locker lock; + Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl); istrstream aStream((char*)&theStream[0], theStream.length()); return aTable->RestoreFromString(aStream); @@ -322,7 +352,8 @@ bool SALOMEDS_AttributeTableOfString_i::ReadFromFile(const SALOMEDS::TMPFile& th SALOMEDS::TMPFile* SALOMEDS_AttributeTableOfString_i::SaveToFile() { - Handle(SALOMEDS_TableOfStringAttribute) aTable = Handle(SALOMEDS_TableOfStringAttribute)::DownCast(_myAttr); + SALOMEDS::Locker lock; + Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl); ostrstream ostr; aTable->ConvertToString(ostr); @@ -332,20 +363,3 @@ SALOMEDS::TMPFile* SALOMEDS_AttributeTableOfString_i::SaveToFile() return aStreamFile._retn(); } -char* SALOMEDS_AttributeTableOfString_i::Store() { - Handle(SALOMEDS_TableOfStringAttribute) aTable = Handle(SALOMEDS_TableOfStringAttribute)::DownCast(_myAttr); - - ostrstream ostr; - aTable->ConvertToString(ostr); - string aString = ostr.rdbuf()->str(); - - CORBA::String_var aBuffer = CORBA::string_dup(aString.c_str()); - return aBuffer._retn(); -} - -void SALOMEDS_AttributeTableOfString_i::Restore(const char* value) { - Handle(SALOMEDS_TableOfStringAttribute) aTable = Handle(SALOMEDS_TableOfStringAttribute)::DownCast(_myAttr); - - istrstream aStream(value, strlen(value)); - aTable->RestoreFromString(aStream); -} diff --git a/src/SALOMEDS/SALOMEDS_AttributeTableOfString_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeTableOfString_i.hxx index cc2e84125..c6290525c 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTableOfString_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTableOfString_i.hxx @@ -1,31 +1,27 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// -// // File : SALOMEDS_AttributeTableOfString_i.hxx -// Author : Sergey Ruin +// Author : Sergey RUIN // Module : SALOME #ifndef SALOMEDS_AttributeTableOfString_i_HeaderFile #define SALOMEDS_AttributeTableOfString_i_HeaderFile -#include "SALOMEDS_TableOfStringAttribute.hxx" -#include "SALOMEDS_GenericAttribute_i.hxx" - // IDL headers #include #include CORBA_SERVER_HEADER(SALOMEDS_Attributes) -DEFINE_DERIVED_ATTR(AttributeTableOfString,SALOMEDS_TableOfStringAttribute,true); +#include "SALOMEDS_GenericAttribute_i.hxx" +#include "SALOMEDSImpl_AttributeTableOfString.hxx" -class SALOMEDS_AttributeTableOfString_i: - public virtual POA_SALOMEDS::AttributeTableOfString, - public virtual SALOMEDS_TAttributeTableOfString_i -{ - DEFINE_DERIVED_ATTR_METH_DEFAULT(AttributeTableOfString,SALOMEDS_TableOfStringAttribute); +class SALOMEDS_AttributeTableOfString_i: public virtual POA_SALOMEDS::AttributeTableOfString, + public virtual SALOMEDS_GenericAttribute_i { + public: + + SALOMEDS_AttributeTableOfString_i(const Handle(SALOMEDSImpl_AttributeTableOfString)& theAttr, CORBA::ORB_ptr orb) + :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; + + ~SALOMEDS_AttributeTableOfString_i() {}; + virtual void SetTitle(const char* theTitle); virtual char* GetTitle(); virtual void SetRowTitle(CORBA::Long theIndex, const char* theTitle) @@ -71,9 +67,6 @@ public: virtual bool ReadFromFile(const SALOMEDS::TMPFile& theStream); virtual SALOMEDS::TMPFile* SaveToFile(); - char* Store(); - void Restore(const char*); - }; #endif diff --git a/src/SALOMEDS/SALOMEDS_AttributeTarget_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeTarget_i.cxx index 70f7b81b9..af9d090e0 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTarget_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTarget_i.cxx @@ -1,70 +1,46 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// // File : SALOMEDS_AttributeTarget_i.cxx -// Author : Yves FRICAUD +// Author : Sergey RUIN // Module : SALOME -// $Header$ -#include -#include -#include -#include +using namespace std; #include "SALOMEDS_AttributeTarget_i.hxx" -#include "SALOMEDS_SObject_i.hxx" +#include "SALOMEDSImpl_SObject.hxx" +#include "SALOMEDS.hxx" -using namespace std; +#include +#include -void SALOMEDS_AttributeTarget_i::Add(SALOMEDS::SObject_ptr anObject) +void SALOMEDS_AttributeTarget_i::Add(SALOMEDS::SObject_ptr anObject) { + SALOMEDS::Locker lock; TDF_Label aLabel; - TDF_Tool::Label(_myAttr->Label().Data(),anObject->GetID(),aLabel,1); - _myAttr->Append(aLabel); + TDF_Tool::Label(_impl->Label().Data(),anObject->GetID(),aLabel,1); + (Handle(SALOMEDSImpl_AttributeTarget)::DownCast(_impl))->Append(aLabel); } -SALOMEDS::Study::ListOfSObject* SALOMEDS_AttributeTarget_i::Get() { +SALOMEDS::Study::ListOfSObject* SALOMEDS_AttributeTarget_i::Get() +{ + SALOMEDS::Locker lock; TDF_LabelList aLList; - - _myAttr->Get(aLList); 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); - SALOMEDS_Study_i* aStudy = _mySObject->GetStudyServant(); - for(int index = 0; anIter.More(); anIter.Next(), index++){ - const TDF_Label& aLabel = anIter.Value(); - aSList[index] = SALOMEDS_SObject_i::NewRef(aStudy,aLabel)._retn(); + int index; + for(index=0;anIter.More();anIter.Next(),index++) { + SALOMEDS_SObject_i* anSO = new SALOMEDS_SObject_i(new SALOMEDSImpl_SObject(anIter.Value()), _orb); + aSList[index] = anSO->_this(); } return aSList._retn(); } -void SALOMEDS_AttributeTarget_i::Remove(SALOMEDS::SObject_ptr anObject) { +void SALOMEDS_AttributeTarget_i::Remove(SALOMEDS::SObject_ptr anObject) +{ + SALOMEDS::Locker lock; TDF_Label aLabel; - CORBA::String_var anID = anObject->GetID(); - TDF_Tool::Label(_myAttr->Label().Data(),anID.inout(),aLabel,1); - _myAttr->Remove(aLabel); + TDF_Tool::Label(_impl->Label().Data(),anObject->GetID(),aLabel,1); + (Handle(SALOMEDSImpl_AttributeTarget)::DownCast(_impl))->Remove(aLabel); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeTarget_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeTarget_i.hxx index d6181dbcb..03e70cd89 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTarget_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTarget_i.hxx @@ -1,30 +1,6 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// // File : SALOMEDS_AttributeTarget_i.hxx -// Author : Yves FRICAUD +// Author : Sergey RUIN // Module : SALOME -// $Header: #ifndef SALOMEDS_AttributeTarget_i_HeaderFile #define SALOMEDS_AttributeTarget_i_HeaderFile @@ -32,24 +8,22 @@ // IDL headers #include #include CORBA_SERVER_HEADER(SALOMEDS_Attributes) - -#include "SALOMEDS_TargetAttribute.hxx" #include "SALOMEDS_GenericAttribute_i.hxx" +#include "SALOMEDSImpl_AttributeTarget.hxx" -DEFINE_DERIVED_ATTR(AttributeTarget,SALOMEDS_TargetAttribute,false); - -class SALOMEDS_AttributeTarget_i: - public virtual POA_SALOMEDS::AttributeTarget, - public virtual SALOMEDS_TAttributeTarget_i +class SALOMEDS_AttributeTarget_i: public virtual POA_SALOMEDS::AttributeTarget, + public virtual SALOMEDS_GenericAttribute_i { - DEFINE_DERIVED_ATTR_METH_DEFAULT(AttributeTarget,SALOMEDS_TargetAttribute); public: + + SALOMEDS_AttributeTarget_i(const Handle(SALOMEDSImpl_AttributeTarget)& theAttr, CORBA::ORB_ptr orb) + :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; + + ~SALOMEDS_AttributeTarget_i() {}; + virtual void Add(SALOMEDS::SObject_ptr anObject) ; virtual SALOMEDS::Study::ListOfSObject* Get(); virtual void Remove(SALOMEDS::SObject_ptr anObject); - }; - - #endif diff --git a/src/SALOMEDS/SALOMEDS_AttributeTextColor_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeTextColor_i.cxx index 32a79e68c..7ce8f7666 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTextColor_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTextColor_i.cxx @@ -1,39 +1,17 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// // File : SALOMEDS_AttributeTextColor_i.cxx -// Author : Yves FRICAUD +// Author : Sergey RUIN // Module : SALOME -// $Header$ +using namespace std; #include "SALOMEDS_AttributeTextColor_i.hxx" +#include "SALOMEDS.hxx" #include -using namespace std; - -SALOMEDS::Color SALOMEDS_AttributeTextColor_i::TextColor() { +SALOMEDS::Color SALOMEDS_AttributeTextColor_i::TextColor() +{ + SALOMEDS::Locker lock; SALOMEDS::Color TextColor; - Handle(TColStd_HArray1OfReal) anArray = Handle(SALOMEDS_TextColorAttribute)::DownCast(_myAttr)->Array(); + Handle(TColStd_HArray1OfReal) anArray = Handle(SALOMEDSImpl_AttributeTextColor)::DownCast(_impl)->GetTextColor(); if (anArray.IsNull() || anArray->Length()!=3) { TextColor.R = 0; TextColor.G = 0; @@ -47,28 +25,14 @@ SALOMEDS::Color SALOMEDS_AttributeTextColor_i::TextColor() { return TextColor; } -void SALOMEDS_AttributeTextColor_i::SetTextColor(const SALOMEDS::Color& value) { +void SALOMEDS_AttributeTextColor_i::SetTextColor(const SALOMEDS::Color& value) +{ + SALOMEDS::Locker lock; CheckLocked(); Handle(TColStd_HArray1OfReal) anArray = new TColStd_HArray1OfReal(1,3); anArray->SetValue(1, value.R); anArray->SetValue(2, value.G); anArray->SetValue(3, value.B); - Handle(SALOMEDS_TextColorAttribute)::DownCast(_myAttr)->ChangeArray(anArray); + Handle(SALOMEDSImpl_AttributeTextColor)::DownCast(_impl)->ChangeArray(anArray); } -char* SALOMEDS_AttributeTextColor_i::Store() { - SALOMEDS::Color aColor = TextColor(); - char *Val = new char[75]; - sprintf(Val, "%f %f %f", (float)aColor.R, (float)aColor.G, (float)aColor.B); - return Val; -} - -void SALOMEDS_AttributeTextColor_i::Restore(const char* value) { - SALOMEDS::Color aColor; - float r, g, b; - sscanf(value, "%f %f %f", &r, &g, &b); - aColor.R = r; - aColor.G = g; - aColor.B = b; - SetTextColor(aColor); -} diff --git a/src/SALOMEDS/SALOMEDS_AttributeTextColor_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeTextColor_i.hxx index 765eb1c16..4a83a08a0 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTextColor_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTextColor_i.hxx @@ -1,28 +1,5 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// // File : SALOMEDS_AttributeTextColor_i.hxx -// Author : Yves FRICAUD +// Author : Sergey RUIN // Module : SALOME // $Header$ @@ -33,23 +10,22 @@ #include #include CORBA_SERVER_HEADER(SALOMEDS_Attributes) -#include "SALOMEDS_TextColorAttribute.hxx" #include "SALOMEDS_GenericAttribute_i.hxx" +#include "SALOMEDSImpl_AttributeTextColor.hxx" -DEFINE_DERIVED_ATTR(AttributeTextColor,SALOMEDS_TextColorAttribute,false); - -class SALOMEDS_AttributeTextColor_i: - public virtual POA_SALOMEDS::AttributeTextColor, - public virtual SALOMEDS_TAttributeTextColor_i +class SALOMEDS_AttributeTextColor_i: public virtual POA_SALOMEDS::AttributeTextColor, + public virtual SALOMEDS_GenericAttribute_i { - DEFINE_DERIVED_ATTR_METH_DEFAULT(AttributeTextColor,SALOMEDS_TextColorAttribute); public: + + SALOMEDS_AttributeTextColor_i(const Handle(SALOMEDSImpl_AttributeTextColor)& theAttr, CORBA::ORB_ptr orb) + :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; + + ~SALOMEDS_AttributeTextColor_i() {}; + SALOMEDS::Color TextColor(); void SetTextColor(const SALOMEDS::Color& value); - char* Store(); - void Restore(const char*); - }; diff --git a/src/SALOMEDS/SALOMEDS_AttributeTextHighlightColor_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeTextHighlightColor_i.cxx index 672d81c45..152438f32 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTextHighlightColor_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTextHighlightColor_i.cxx @@ -1,39 +1,17 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// // File : SALOMEDS_AttributeTextHighlightColor_i.cxx -// Author : Yves FRICAUD +// Author : Sergey RUIN // Module : SALOME -// $Header$ +using namespace std; #include "SALOMEDS_AttributeTextHighlightColor_i.hxx" +#include "SALOMEDS.hxx" #include -using namespace std; - -SALOMEDS::Color SALOMEDS_AttributeTextHighlightColor_i::TextHighlightColor() { +SALOMEDS::Color SALOMEDS_AttributeTextHighlightColor_i::TextHighlightColor() +{ + SALOMEDS::Locker lock; SALOMEDS::Color TextHighlightColor; - Handle(TColStd_HArray1OfReal) anArray = Handle(SALOMEDS_TextHighlightColorAttribute)::DownCast(_myAttr)->Array(); + Handle(TColStd_HArray1OfReal) anArray=Handle(SALOMEDSImpl_AttributeTextHighlightColor)::DownCast(_impl)->GetTextColor(); if (anArray.IsNull() || anArray->Length()!=3) { TextHighlightColor.R = 0; TextHighlightColor.G = 0; @@ -47,28 +25,13 @@ SALOMEDS::Color SALOMEDS_AttributeTextHighlightColor_i::TextHighlightColor() { return TextHighlightColor; } -void SALOMEDS_AttributeTextHighlightColor_i::SetTextHighlightColor(const SALOMEDS::Color& value) { +void SALOMEDS_AttributeTextHighlightColor_i::SetTextHighlightColor(const SALOMEDS::Color& value) +{ + SALOMEDS::Locker lock; CheckLocked(); Handle(TColStd_HArray1OfReal) anArray = new TColStd_HArray1OfReal(1,3); anArray->SetValue(1, value.R); anArray->SetValue(2, value.G); anArray->SetValue(3, value.B); - Handle(SALOMEDS_TextHighlightColorAttribute)::DownCast(_myAttr)->ChangeArray(anArray); -} - -char* SALOMEDS_AttributeTextHighlightColor_i::Store() { - SALOMEDS::Color aColor = TextHighlightColor(); - char *Val = new char[75]; - sprintf(Val, "%f %f %f", (float)aColor.R, (float)aColor.G, (float)aColor.B); - return Val; -} - -void SALOMEDS_AttributeTextHighlightColor_i::Restore(const char* value) { - SALOMEDS::Color aColor; - float r, g, b; - sscanf(value, "%f %f %f", &r, &g, &b); - aColor.R = r; - aColor.G = g; - aColor.B = b; - SetTextHighlightColor(aColor); + Handle(SALOMEDSImpl_AttributeTextHighlightColor)::DownCast(_impl)->ChangeArray(anArray); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeTextHighlightColor_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeTextHighlightColor_i.hxx index aa3ead5d2..da6fe461a 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTextHighlightColor_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTextHighlightColor_i.hxx @@ -1,30 +1,6 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// // File : SALOMEDS_AttributeTextHighlightColor_i.hxx -// Author : Yves FRICAUD +// Author : Sergey RUIN // Module : SALOME -// $Header$ #ifndef SALOMEDS_AttributeTextHighlightColor_i_HeaderFile #define SALOMEDS_AttributeTextHighlightColor_i_HeaderFile @@ -33,23 +9,21 @@ #include #include CORBA_SERVER_HEADER(SALOMEDS_Attributes) -#include "SALOMEDS_TextHighlightColorAttribute.hxx" #include "SALOMEDS_GenericAttribute_i.hxx" +#include "SALOMEDSImpl_AttributeTextHighlightColor.hxx" -DEFINE_DERIVED_ATTR(AttributeTextHighlightColor,SALOMEDS_TextHighlightColorAttribute,false); - -class SALOMEDS_AttributeTextHighlightColor_i: - public virtual POA_SALOMEDS::AttributeTextHighlightColor, - public virtual SALOMEDS_TAttributeTextHighlightColor_i +class SALOMEDS_AttributeTextHighlightColor_i: public virtual POA_SALOMEDS::AttributeTextHighlightColor, + public virtual SALOMEDS_GenericAttribute_i { - DEFINE_DERIVED_ATTR_METH_DEFAULT(AttributeTextHighlightColor,SALOMEDS_TextHighlightColorAttribute); public: - SALOMEDS::Color TextHighlightColor(); - void SetTextHighlightColor(const SALOMEDS::Color& value); + + SALOMEDS_AttributeTextHighlightColor_i(const Handle(SALOMEDSImpl_AttributeTextHighlightColor)& theAttr, CORBA::ORB_ptr orb) + :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; - char* Store(); - void Restore(const char*); + ~SALOMEDS_AttributeTextHighlightColor_i() {}; + SALOMEDS::Color TextHighlightColor(); + void SetTextHighlightColor(const SALOMEDS::Color& value); }; diff --git a/src/SALOMEDS/SALOMEDS_AttributeTreeNode_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeTreeNode_i.cxx index 15449d603..83a467215 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTreeNode_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTreeNode_i.cxx @@ -1,47 +1,23 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// // File : SALOMEDS_AttributeTreeNode_i.cxx -// Author : Yves FRICAUD +// Author : Sergey RUIN // Module : SALOME -// $Header$ - -#include -#include +using namespace std; #include "SALOMEDS_AttributeTreeNode_i.hxx" - #include "utilities.h" +#include "SALOMEDS.hxx" +#include +#include +#include +#include -using namespace std; - -static Handle(TDataStd_TreeNode) GetNode(SALOMEDS::AttributeTreeNode_ptr value, - const Handle(TDataStd_TreeNode)& aNode) +static Handle(SALOMEDSImpl_AttributeTreeNode) GetNode(SALOMEDS::AttributeTreeNode_ptr value, + const Handle(SALOMEDSImpl_AttributeTreeNode)& aNode) { - Handle(TDataStd_TreeNode) aResult = new TDataStd_TreeNode; - CORBA::String_var aString = CORBA::string_dup(value->Label()); + Handle(SALOMEDSImpl_AttributeTreeNode) aResult = new SALOMEDSImpl_AttributeTreeNode; + TCollection_AsciiString anEntry = value->Label(); TDF_Label aLabel; - TDF_Tool::Label(aNode->Label().Data(), TCollection_AsciiString(aString), aLabel, 0); + TDF_Tool::Label(aNode->Label().Data(), anEntry, aLabel); if (aLabel.IsNull()) { MESSAGE("SALOMEDS_AttributeTreeNode_i class: no such label") MESSAGE("SALOMEDS_AttributeTreeNode_i class: no such label") @@ -54,177 +30,191 @@ static Handle(TDataStd_TreeNode) GetNode(SALOMEDS::AttributeTreeNode_ptr value, return aResult; } -void SALOMEDS_AttributeTreeNode_i::SetFather(SALOMEDS::AttributeTreeNode_ptr theValue) { +void SALOMEDS_AttributeTreeNode_i::SetFather(SALOMEDS::AttributeTreeNode_ptr value) +{ + SALOMEDS::Locker lock; CheckLocked(); - _myAttr->SetFather(GetNode(theValue,_myAttr)); + Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl); + aNode->SetFather(GetNode(value, aNode)); } -CORBA::Boolean SALOMEDS_AttributeTreeNode_i::HasFather() { - return _myAttr->HasFather(); +CORBA::Boolean SALOMEDS_AttributeTreeNode_i::HasFather() +{ + SALOMEDS::Locker lock; + return Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl)->HasFather(); } -SALOMEDS::AttributeTreeNode_ptr SALOMEDS_AttributeTreeNode_i::GetFather() { - SALOMEDS_AttributeTreeNode_i* aTreeNode = - new SALOMEDS_AttributeTreeNode_i(_myAttr->Father(),_mySObject); - return aTreeNode->_this(); +SALOMEDS::AttributeTreeNode_ptr SALOMEDS_AttributeTreeNode_i::GetFather() +{ + SALOMEDS::Locker lock; + SALOMEDS_AttributeTreeNode_i* aFather; + aFather = new SALOMEDS_AttributeTreeNode_i(Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl)->GetFather(), _orb); + return aFather->POA_SALOMEDS::AttributeTreeNode::_this(); } -void SALOMEDS_AttributeTreeNode_i::SetPrevious(SALOMEDS::AttributeTreeNode_ptr theValue) { +void SALOMEDS_AttributeTreeNode_i::SetPrevious(SALOMEDS::AttributeTreeNode_ptr value) +{ + SALOMEDS::Locker lock; CheckLocked(); - _myAttr->SetPrevious(GetNode(theValue,_myAttr)); + Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl); + aNode->SetPrevious(GetNode(value, aNode)); } -CORBA::Boolean SALOMEDS_AttributeTreeNode_i::HasPrevious() { - return _myAttr->HasPrevious(); +CORBA::Boolean SALOMEDS_AttributeTreeNode_i::HasPrevious() +{ + SALOMEDS::Locker lock; + return Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl)->HasPrevious(); } -SALOMEDS::AttributeTreeNode_ptr SALOMEDS_AttributeTreeNode_i::GetPrevious() { - SALOMEDS_AttributeTreeNode_i* aTreeNode = - new SALOMEDS_AttributeTreeNode_i(_myAttr->Previous(),_mySObject); - return aTreeNode->_this(); +SALOMEDS::AttributeTreeNode_ptr SALOMEDS_AttributeTreeNode_i::GetPrevious() +{ + SALOMEDS::Locker lock; + SALOMEDS_AttributeTreeNode_i* aPrevious; + aPrevious=new SALOMEDS_AttributeTreeNode_i(Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl)->GetPrevious(), _orb); + return aPrevious->POA_SALOMEDS::AttributeTreeNode::_this(); } -void SALOMEDS_AttributeTreeNode_i::SetNext(SALOMEDS::AttributeTreeNode_ptr theValue) { +void SALOMEDS_AttributeTreeNode_i::SetNext(SALOMEDS::AttributeTreeNode_ptr value) +{ + SALOMEDS::Locker lock; CheckLocked(); - _myAttr->SetNext(GetNode(theValue,_myAttr)); + Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl); + aNode->SetNext(GetNode(value, aNode)); } -CORBA::Boolean SALOMEDS_AttributeTreeNode_i::HasNext() { - return _myAttr->HasNext(); +CORBA::Boolean SALOMEDS_AttributeTreeNode_i::HasNext() +{ + SALOMEDS::Locker lock; + return Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl)->HasNext(); } -SALOMEDS::AttributeTreeNode_ptr SALOMEDS_AttributeTreeNode_i::GetNext() { - SALOMEDS_AttributeTreeNode_i* aTreeNode = - new SALOMEDS_AttributeTreeNode_i(_myAttr->Next(),_mySObject); - return aTreeNode->_this(); +SALOMEDS::AttributeTreeNode_ptr SALOMEDS_AttributeTreeNode_i::GetNext() +{ + SALOMEDS::Locker lock; + SALOMEDS_AttributeTreeNode_i* aNext; + aNext = new SALOMEDS_AttributeTreeNode_i(Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl)->GetNext(), _orb); + return aNext->POA_SALOMEDS::AttributeTreeNode::_this(); } -void SALOMEDS_AttributeTreeNode_i::SetFirst(SALOMEDS::AttributeTreeNode_ptr theValue) { +void SALOMEDS_AttributeTreeNode_i::SetFirst(SALOMEDS::AttributeTreeNode_ptr value) +{ + SALOMEDS::Locker lock; CheckLocked(); - _myAttr->SetFirst(GetNode(theValue,_myAttr)); + Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl); + aNode->SetFirst(GetNode(value, aNode)); } -CORBA::Boolean SALOMEDS_AttributeTreeNode_i::HasFirst() { - return _myAttr->HasFirst(); +CORBA::Boolean SALOMEDS_AttributeTreeNode_i::HasFirst() +{ + SALOMEDS::Locker lock; + return Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl)->HasFirst(); } -SALOMEDS::AttributeTreeNode_ptr SALOMEDS_AttributeTreeNode_i::GetFirst() { - SALOMEDS_AttributeTreeNode_i* aTreeNode = - new SALOMEDS_AttributeTreeNode_i(_myAttr->First(),_mySObject); - return aTreeNode->_this(); +SALOMEDS::AttributeTreeNode_ptr SALOMEDS_AttributeTreeNode_i::GetFirst() +{ + SALOMEDS::Locker lock; + SALOMEDS_AttributeTreeNode_i* aFirst; + aFirst = new SALOMEDS_AttributeTreeNode_i(Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl)->GetFirst(), _orb); + return aFirst->POA_SALOMEDS::AttributeTreeNode::_this(); } -void SALOMEDS_AttributeTreeNode_i::SetTreeID(const char* value) { +void SALOMEDS_AttributeTreeNode_i::SetTreeID(const char* value) +{ + SALOMEDS::Locker lock; CheckLocked(); - _myAttr->SetTreeID(Standard_GUID(_myAttr->ID())); + Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl); + aNode->SetTreeID(Standard_GUID(aNode->ID())); } -char* SALOMEDS_AttributeTreeNode_i::GetTreeID() { +char* SALOMEDS_AttributeTreeNode_i::GetTreeID() +{ + SALOMEDS::Locker lock; + Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl); char aGUID[40]; - _myAttr->ID().ToCString(aGUID); - return CORBA::string_dup(aGUID); + aNode->ID().ToCString(aGUID); + return CORBA::String_var(CORBA::string_dup(aGUID))._retn(); } -void SALOMEDS_AttributeTreeNode_i::Append(SALOMEDS::AttributeTreeNode_ptr theValue) { +void SALOMEDS_AttributeTreeNode_i::Append(SALOMEDS::AttributeTreeNode_ptr value) +{ + SALOMEDS::Locker lock; CheckLocked(); - _myAttr->Append(GetNode(theValue,_myAttr)); + Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl); + aNode->Append(GetNode(value, aNode)); } -void SALOMEDS_AttributeTreeNode_i::Prepend(SALOMEDS::AttributeTreeNode_ptr theValue) { +void SALOMEDS_AttributeTreeNode_i::Prepend(SALOMEDS::AttributeTreeNode_ptr value) +{ + SALOMEDS::Locker lock; CheckLocked(); - _myAttr->Prepend(GetNode(theValue,_myAttr)); + Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl); + aNode->Prepend(GetNode(value, aNode)); } -void SALOMEDS_AttributeTreeNode_i::InsertBefore(SALOMEDS::AttributeTreeNode_ptr theValue) { +void SALOMEDS_AttributeTreeNode_i::InsertBefore(SALOMEDS::AttributeTreeNode_ptr value) +{ + SALOMEDS::Locker lock; CheckLocked(); - _myAttr->InsertBefore(GetNode(theValue,_myAttr)); + Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl); + aNode->InsertBefore(GetNode(value, aNode)); } -void SALOMEDS_AttributeTreeNode_i::InsertAfter(SALOMEDS::AttributeTreeNode_ptr theValue) { +void SALOMEDS_AttributeTreeNode_i::InsertAfter(SALOMEDS::AttributeTreeNode_ptr value) +{ + SALOMEDS::Locker lock; CheckLocked(); - _myAttr->InsertAfter(GetNode(theValue,_myAttr)); + Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl); + aNode->InsertAfter(GetNode(value, aNode)); } -void SALOMEDS_AttributeTreeNode_i::Remove() { +void SALOMEDS_AttributeTreeNode_i::Remove() +{ + SALOMEDS::Locker lock; CheckLocked(); - _myAttr->Remove(); + Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl); + aNode->Remove(); } -CORBA::Long SALOMEDS_AttributeTreeNode_i::Depth() { - return _myAttr->Depth(); +CORBA::Long SALOMEDS_AttributeTreeNode_i::Depth() +{ + SALOMEDS::Locker lock; + Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl); + return aNode->Depth(); } -CORBA::Boolean SALOMEDS_AttributeTreeNode_i::IsRoot() { - return _myAttr->IsRoot(); +CORBA::Boolean SALOMEDS_AttributeTreeNode_i::IsRoot() +{ + SALOMEDS::Locker lock; + Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl); + return aNode->IsRoot(); } -CORBA::Boolean SALOMEDS_AttributeTreeNode_i::IsDescendant(SALOMEDS::AttributeTreeNode_ptr theValue) { - return _myAttr->IsDescendant(GetNode(theValue,_myAttr)); +CORBA::Boolean SALOMEDS_AttributeTreeNode_i::IsDescendant(SALOMEDS::AttributeTreeNode_ptr value) +{ + SALOMEDS::Locker lock; + Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl); + return aNode->IsDescendant(GetNode(value, aNode)); } -CORBA::Boolean SALOMEDS_AttributeTreeNode_i::IsFather(SALOMEDS::AttributeTreeNode_ptr theValue) { - return _myAttr->IsFather(GetNode(theValue,_myAttr)); +CORBA::Boolean SALOMEDS_AttributeTreeNode_i::IsFather(SALOMEDS::AttributeTreeNode_ptr value) +{ + SALOMEDS::Locker lock; + Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl); + return aNode->IsFather(GetNode(value, aNode)); } -CORBA::Boolean SALOMEDS_AttributeTreeNode_i::IsChild(SALOMEDS::AttributeTreeNode_ptr theValue) { - return _myAttr->IsChild(GetNode(theValue,_myAttr)); +CORBA::Boolean SALOMEDS_AttributeTreeNode_i::IsChild(SALOMEDS::AttributeTreeNode_ptr value) +{ + SALOMEDS::Locker lock; + Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl); + return aNode->IsChild(GetNode(value, aNode)); } -char* SALOMEDS_AttributeTreeNode_i::Label() { +char* SALOMEDS_AttributeTreeNode_i::Label() +{ + SALOMEDS::Locker lock; TCollection_AsciiString aLabelName; - TDF_Tool::Entry(_myAttr->Label(),aLabelName); - return CORBA::string_dup(aLabelName.ToCString()); -} - -char* SALOMEDS_AttributeTreeNode_i::Store() { - char* aStr[4]; - - if (HasFather()) aStr[0] = GetFather()->Label(); else aStr[0] = "!"; - if (HasPrevious()) aStr[1] = GetPrevious()->Label(); else aStr[1] = "!"; - if (HasNext()) aStr[2] = GetNext()->Label(); else aStr[2] = "!"; - if (HasFirst()) aStr[3] = GetFirst()->Label(); else aStr[3] = "!"; - - int aLength = 4; - aLength += strlen(aStr[0]) + strlen(aStr[1]) + strlen(aStr[2]) + strlen(aStr[3]); - CORBA::String_var aResult = new char[aLength]; - sprintf(aResult, "%s %s %s %s", aStr[0], aStr[1], aStr[2], aStr[3]); - return aResult._retn(); + TDF_Tool::Entry(_impl->Label(),aLabelName); + return CORBA::String_var(CORBA::string_dup(aLabelName.ToCString()))._retn(); } -void SALOMEDS_AttributeTreeNode_i::Restore(const char* value) { - Handle(TDataStd_TreeNode) aNode = Handle(TDataStd_TreeNode)::DownCast(_myAttr); - Handle(TDF_Data) DF = TDocStd_Document::Get(_myAttr->Label())->GetData(); - - char* aCopy = strdup(value); - char* adr = strtok(aCopy, " "); - - TDF_Label aLabel; - Handle(TDataStd_TreeNode) aDepNode; - - if (adr && adr[0] != '!') { - TDF_Tool::Label(DF, adr, aLabel, 1); - if (!aLabel.FindAttribute(aNode->ID(), aDepNode)) aDepNode = TDataStd_TreeNode::Set(aLabel, aNode->ID()); - aNode->SetFather(aDepNode); - } - - adr = strtok(NULL, " "); - if (adr && adr[0] != '!') { - TDF_Tool::Label(DF, adr, aLabel, 1); - if (!aLabel.FindAttribute(aNode->ID(), aDepNode)) aDepNode = TDataStd_TreeNode::Set(aLabel, aNode->ID()); - aNode->SetPrevious(aDepNode); - } - - adr = strtok(NULL, " "); - if (adr && adr[0] != '!') { - TDF_Tool::Label(DF, adr, aLabel, 1); - if (!aLabel.FindAttribute(aNode->ID(), aDepNode)) aDepNode = TDataStd_TreeNode::Set(aLabel, aNode->ID()); - aNode->SetNext(aDepNode); - } - - adr = strtok(NULL, " "); - if (adr && adr[0] != '!') { - TDF_Tool::Label(DF, adr, aLabel, 1); - if (!aLabel.FindAttribute(aNode->ID(), aDepNode)) aDepNode = TDataStd_TreeNode::Set(aLabel, aNode->ID()); - aNode->SetFirst(aDepNode); - } -} diff --git a/src/SALOMEDS/SALOMEDS_AttributeTreeNode_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeTreeNode_i.hxx index 718ffc641..e57c10c7c 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTreeNode_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTreeNode_i.hxx @@ -1,30 +1,6 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// // File : SALOMEDS_AttributeTreeNode_i.hxx -// Author : Yves FRICAUD +// Author : Sergey RUIN // Module : SALOME -// $Header: #ifndef SALOMEDS_AttributeTreeNode_i_HeaderFile #define SALOMEDS_AttributeTreeNode_i_HeaderFile @@ -33,18 +9,18 @@ #include #include CORBA_SERVER_HEADER(SALOMEDS_Attributes) -#include #include "SALOMEDS_GenericAttribute_i.hxx" +#include "SALOMEDSImpl_AttributeTreeNode.hxx" -DEFINE_DERIVED_ATTR(AttributeTreeNode,TDataStd_TreeNode,false); - -class SALOMEDS_AttributeTreeNode_i: - public virtual POA_SALOMEDS::AttributeTreeNode, - public virtual SALOMEDS_TAttributeTreeNode_i -{ - DEFINE_DERIVED_ATTR_METH(AttributeTreeNode,TDataStd_TreeNode::GetDefaultTreeID()); - +class SALOMEDS_AttributeTreeNode_i: public virtual POA_SALOMEDS::AttributeTreeNode, + public virtual SALOMEDS_GenericAttribute_i { public: + + SALOMEDS_AttributeTreeNode_i(const Handle(SALOMEDSImpl_AttributeTreeNode)& theAttr, CORBA::ORB_ptr orb) + :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; + + ~SALOMEDS_AttributeTreeNode_i() {}; + void SetFather(SALOMEDS::AttributeTreeNode_ptr value); CORBA::Boolean HasFather(); SALOMEDS::AttributeTreeNode_ptr GetFather(); @@ -71,10 +47,6 @@ public: CORBA::Boolean IsChild(SALOMEDS::AttributeTreeNode_ptr value); char* Label(); - char* Store(); - void Restore(const char*); - }; - #endif diff --git a/src/SALOMEDS/SALOMEDS_AttributeUserID_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeUserID_i.cxx index 6a3d2d3cd..1e74b0e92 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeUserID_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeUserID_i.cxx @@ -1,52 +1,26 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// // File : SALOMEDS_AttributeName_i.cxx -// Author : Yves FRICAUD +// Author : Sergey RUIN // Module : SALOME -// $Header$ +using namespace std; #include "SALOMEDS_AttributeUserID_i.hxx" +#include "SALOMEDS.hxx" #include -using namespace std; - -char* SALOMEDS_AttributeUserID_i::Value() { +char* SALOMEDS_AttributeUserID_i::Value() +{ + SALOMEDS::Locker lock; char aGUID[40]; - Handle(TDataStd_UAttribute)::DownCast(_myAttr)->ID().ToCString(aGUID); + Handle(SALOMEDSImpl_AttributeUserID)::DownCast(_impl)->ID().ToCString(aGUID); CORBA::String_var c_s = CORBA::string_dup(aGUID); return c_s._retn(); } -void SALOMEDS_AttributeUserID_i::SetValue(const char* value) { +void SALOMEDS_AttributeUserID_i::SetValue(const char* value) +{ + SALOMEDS::Locker lock; CheckLocked(); CORBA::String_var Str = CORBA::string_dup(value); - Handle(TDataStd_UAttribute)::DownCast(_myAttr)->SetID(Standard_GUID(Standard_CString(Str))); + Handle(SALOMEDSImpl_AttributeUserID)::DownCast(_impl)->SetValue(Standard_GUID(Standard_CString(Str))); } -char* SALOMEDS_AttributeUserID_i::Store() { - return ""; -} - -void SALOMEDS_AttributeUserID_i::Restore(const char* value) { -} diff --git a/src/SALOMEDS/SALOMEDS_AttributeUserID_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeUserID_i.hxx index d23f6d589..34884fb91 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeUserID_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeUserID_i.hxx @@ -1,30 +1,6 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// // File : SALOMEDS_AttributeUserID_i.hxx -// Author : Yves FRICAUD +// Author : Sergey RUIN // Module : SALOME -// $Header: #ifndef SALOMEDS_AttributeUserID_i_HeaderFile #define SALOMEDS_AttributeUserID_i_HeaderFile @@ -33,25 +9,28 @@ #include #include CORBA_SERVER_HEADER(SALOMEDS_Attributes) -#include #include "SALOMEDS_GenericAttribute_i.hxx" +#include "SALOMEDSImpl_AttributeUserID.hxx" -DEFINE_DERIVED_ATTR(AttributeUserID,TDataStd_UAttribute,false); +class SALOMEDS_AttributeUserID_i: public virtual POA_SALOMEDS::AttributeUserID, + public virtual SALOMEDS_GenericAttribute_i { +public: + + SALOMEDS_AttributeUserID_i(const Handle(SALOMEDSImpl_AttributeUserID)& theAttr, CORBA::ORB_ptr orb) + :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; -class SALOMEDS_AttributeUserID_i: - public virtual POA_SALOMEDS::AttributeUserID, - public virtual SALOMEDS_TAttributeUserID_i -{ - DEFINE_DERIVED_ATTR_METH(AttributeUserID,"FFFFFFFF-D9CD-11d6-945D-1050DA506788"); + ~SALOMEDS_AttributeUserID_i() {}; -public: char* Value(); void SetValue(const char* value); - char* Store(); - void Restore(const char*); + static const Standard_GUID& DefaultID() { + return SALOMEDSImpl_AttributeUserID::DefaultID(); + } }; + + #endif diff --git a/src/SALOMEDS/SALOMEDS_Attributes.hxx b/src/SALOMEDS/SALOMEDS_Attributes.hxx new file mode 100644 index 000000000..b818ad9e9 --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_Attributes.hxx @@ -0,0 +1,106 @@ +// File : SALOMEDS_Attributes.hxx +// Author : Sergey RUIN +// Module : SALOME + +#ifndef __SALOMEDS_ATTRIBUTES__H__ +#define __SALOMEDS_ATTRIBUTES__H__ + +#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_AttributeReference.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_i.hxx" +#include "SALOMEDS_AttributeName_i.hxx" +#include "SALOMEDS_AttributeComment_i.hxx" +#include "SALOMEDS_AttributeInteger_i.hxx" +#include "SALOMEDS_AttributeReal_i.hxx" +#include "SALOMEDS_AttributeTreeNode_i.hxx" +#include "SALOMEDS_AttributeUserID_i.hxx" +#include "SALOMEDS_AttributeSequenceOfReal_i.hxx" +#include "SALOMEDS_AttributeSequenceOfInteger_i.hxx" +#include "SALOMEDS_AttributeIOR_i.hxx" +#include "SALOMEDS_AttributePersistentRef_i.hxx" +#include "SALOMEDS_AttributeDrawable_i.hxx" +#include "SALOMEDS_AttributeSelectable_i.hxx" +#include "SALOMEDS_AttributeExpandable_i.hxx" +#include "SALOMEDS_AttributeOpened_i.hxx" +#include "SALOMEDS_AttributeTextColor_i.hxx" +#include "SALOMEDS_AttributeTextHighlightColor_i.hxx" +#include "SALOMEDS_AttributePixMap_i.hxx" +#include "SALOMEDS_AttributeLocalID_i.hxx" +#include "SALOMEDS_AttributeTarget_i.hxx" +#include "SALOMEDS_AttributeTableOfInteger_i.hxx" +#include "SALOMEDS_AttributeTableOfReal_i.hxx" +#include "SALOMEDS_AttributeTableOfString_i.hxx" +#include "SALOMEDS_AttributeStudyProperties_i.hxx" +#include "SALOMEDS_AttributePythonObject_i.hxx" +#include "SALOMEDS_AttributeExternalFileDef_i.hxx" +#include "SALOMEDS_AttributeFileType_i.hxx" +#include "SALOMEDS_AttributeFlags_i.hxx" +#include "SALOMEDS_AttributeGraphic_i.hxx" + +#define __CreateCORBAAttribute(CORBA_Name) if (strcmp(aTypeOfAttribute, #CORBA_Name) == 0) { \ + Handle(SALOMEDSImpl_##CORBA_Name) A = Handle(SALOMEDSImpl_##CORBA_Name)::DownCast(theAttr); \ + SALOMEDS_##CORBA_Name##_i* Attr = new SALOMEDS_##CORBA_Name##_i(A, theOrb); \ + anAttribute = Attr->CORBA_Name::_this(); \ + } + + +#define __CreateGenericCORBAAttribute \ +__CreateCORBAAttribute(AttributeReal) \ +__CreateCORBAAttribute(AttributeInteger) \ +__CreateCORBAAttribute(AttributeSequenceOfReal) \ +__CreateCORBAAttribute(AttributeSequenceOfInteger) \ +__CreateCORBAAttribute(AttributeName) \ +__CreateCORBAAttribute(AttributeComment) \ +__CreateCORBAAttribute(AttributeIOR) \ +__CreateCORBAAttribute(AttributePixMap) \ +__CreateCORBAAttribute(AttributeLocalID) \ +__CreateCORBAAttribute(AttributeTableOfInteger) \ +__CreateCORBAAttribute(AttributeTableOfReal) \ +__CreateCORBAAttribute(AttributeTableOfString) \ +__CreateCORBAAttribute(AttributePythonObject) \ +__CreateCORBAAttribute(AttributePersistentRef) \ +__CreateCORBAAttribute(AttributeDrawable) \ +__CreateCORBAAttribute(AttributeSelectable) \ +__CreateCORBAAttribute(AttributeExpandable) \ +__CreateCORBAAttribute(AttributeOpened) \ +__CreateCORBAAttribute(AttributeTextColor) \ +__CreateCORBAAttribute(AttributeTextHighlightColor) \ +__CreateCORBAAttribute(AttributeTarget) \ +__CreateCORBAAttribute(AttributeStudyProperties) \ +__CreateCORBAAttribute(AttributeExternalFileDef) \ +__CreateCORBAAttribute(AttributeFileType) \ +__CreateCORBAAttribute(AttributeFlags) \ +__CreateCORBAAttribute(AttributeGraphic) \ +__CreateCORBAAttribute(AttributeTreeNode) \ +__CreateCORBAAttribute(AttributeUserID) + +#endif diff --git a/src/SALOMEDS/SALOMEDS_BasicAttributeFactory.cxx b/src/SALOMEDS/SALOMEDS_BasicAttributeFactory.cxx deleted file mode 100644 index 666958247..000000000 --- a/src/SALOMEDS/SALOMEDS_BasicAttributeFactory.cxx +++ /dev/null @@ -1,54 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : SALOMEDS_BasicAttributeFactory.cxx -// Author : Estelle Deville, CEA -// Module : SALOME -// $Header$ - -#include "SALOMEDS_BasicAttributeFactory.hxx" -#include "utilities.h" -using namespace std; - -//============================================================================ -/*! Function : Create - * Purpose : create new basic attributes - */ -//============================================================================ -SALOMEDS_BasicAttribute_i* BasicAttributeFactory::Create(const char* type) - throw (SALOME_Exception) -{ - try { - if (!strcmp(type,"AttReal")) - { - SALOMEDS_AttReal_i *A = new SALOMEDS_AttReal_i(); - return A; - } - else if(!strcmp(type,"AttLong")) - { - SALOMEDS_AttLong_i *A = new SALOMEDS_AttLong_i(); - return A; - } - else throw(SALOME_Exception(LOCALIZED("bad attribute type name"))); - } catch (...) {throw(SALOME_Exception(LOCALIZED("Unexpected exception was caught")));} -} diff --git a/src/SALOMEDS/SALOMEDS_BasicAttributeFactory.hxx b/src/SALOMEDS/SALOMEDS_BasicAttributeFactory.hxx deleted file mode 100644 index 9ae6f0ea3..000000000 --- a/src/SALOMEDS/SALOMEDS_BasicAttributeFactory.hxx +++ /dev/null @@ -1,48 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : SALOMEDS_BasicAttributeFactory.hxx -// Author : Estelle Deville, CEA -// Module : SALOME -// $Header$ - -#ifndef _BASIC_ATTRIBUTEFACTORY_HXX_ -#define _BASIC_ATTRIBUTEFACTORY_HXX_ -#include "SALOMEDS_BasicAttribute_i.hxx" -// Add new Attribute type here -#include "SALOMEDS_AttReal_i.hxx" -#include "SALOMEDS_AttLong_i.hxx" - -#include "Utils_SALOME_Exception.hxx" - -class BasicAttributeFactory -{ -public: - BasicAttributeFactory() {}; - virtual ~BasicAttributeFactory() {}; - - SALOMEDS_BasicAttribute_i* Create(const char* type) - throw (SALOME_Exception); -}; - -#endif diff --git a/src/SALOMEDS/SALOMEDS_BasicAttribute_i.hxx b/src/SALOMEDS/SALOMEDS_BasicAttribute_i.hxx deleted file mode 100644 index 9d1ffedc0..000000000 --- a/src/SALOMEDS/SALOMEDS_BasicAttribute_i.hxx +++ /dev/null @@ -1,55 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : SALOMEDS_BasicAttribute_i.hxx -// Author : Estelle Deville, CEA -// Module : SALOME -// $Header$ - -#ifndef _BASIC_ATTRIBUTE_I_HXX_ -#define _BASIC_ATTRIBUTE_I_HXX_ - -// IDL headers -#include -#include CORBA_SERVER_HEADER(SALOMEDS) -#include - -class SALOMEDS_BasicAttribute_i: public POA_SALOMEDS::BasicAttribute, - public PortableServer::RefCountServantBase { -protected: - TDF_Label _Lab; - -public: - SALOMEDS_BasicAttribute_i() {}; - - ~SALOMEDS_BasicAttribute_i() {}; - - virtual char * Save() =0; - virtual void Load () =0; - CORBA::Boolean GetPtr(SALOMEDS::SObject so); - void SetLabel(const TDF_Label Lab); - virtual char* GetType() = 0; - -}; - -#endif diff --git a/src/SALOMEDS/SALOMEDS_Callback_i.hxx b/src/SALOMEDS/SALOMEDS_Callback_i.hxx index 315db4767..572ba5b40 100644 --- a/src/SALOMEDS/SALOMEDS_Callback_i.hxx +++ b/src/SALOMEDS/SALOMEDS_Callback_i.hxx @@ -15,16 +15,18 @@ #include #include CORBA_SERVER_HEADER(SALOMEDS) -class SALOMEDS_Callback_i: public virtual POA_SALOMEDS::Callback, - public virtual PortableServer::RefCountServantBase -{ +class SALOMEDS_Callback_i: public POA_SALOMEDS::Callback, + public PortableServer::RefCountServantBase { + private: + CORBA::ORB_var _orb; SALOMEDS::UseCaseBuilder_var _builder; public: - SALOMEDS_Callback_i(SALOMEDS::UseCaseBuilder_ptr theBuilder) { - _builder = SALOMEDS::UseCaseBuilder::_duplicate(theBuilder); + SALOMEDS_Callback_i(SALOMEDS::UseCaseBuilder_ptr builder, CORBA::ORB_ptr orb) { + _orb = CORBA::ORB::_duplicate(orb); + _builder = SALOMEDS::UseCaseBuilder::_duplicate(builder); } virtual void OnAddSObject(SALOMEDS::SObject_ptr theObject) { diff --git a/src/SALOMEDS/SALOMEDS_ChildIterator_i.cxx b/src/SALOMEDS/SALOMEDS_ChildIterator_i.cxx index d256bb669..8ff093bad 100644 --- a/src/SALOMEDS/SALOMEDS_ChildIterator_i.cxx +++ b/src/SALOMEDS/SALOMEDS_ChildIterator_i.cxx @@ -1,51 +1,26 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// // File : SALOMEDS_ChildIterator_i.cxx -// Author : Yves FRICAUD +// Author : Sergey RUIN // Module : SALOME -// $Header$ - -#include +using namespace std; #include "SALOMEDS_ChildIterator_i.hxx" #include "SALOMEDS_SObject_i.hxx" +#include "SALOMEDS.hxx" +#include "SALOMEDSImpl_SObject.hxx" #include "utilities.h" -using namespace std; - //============================================================================ /*! Function : constructor * Purpose : */ //============================================================================ -SALOMEDS_ChildIterator_i::SALOMEDS_ChildIterator_i(SALOMEDS_Study_i* theStudy, - const TDF_Label& theLabel, - bool theIsAllLevels): - _it(theLabel,theIsAllLevels), - _lab(theLabel), - _study(theStudy) +SALOMEDS_ChildIterator_i::SALOMEDS_ChildIterator_i(TDF_Label lab, + CORBA::ORB_ptr orb) + : _lab(lab) { + SALOMEDS::Locker lock; + _orb = CORBA::ORB::_duplicate(orb); + _it.Initialize (lab); } //============================================================================ @@ -64,7 +39,8 @@ SALOMEDS_ChildIterator_i::~SALOMEDS_ChildIterator_i() //============================================================================ void SALOMEDS_ChildIterator_i::Init() { - _it.Initialize(_lab); + SALOMEDS::Locker lock; + _it.Initialize (_lab); } //============================================================================ @@ -72,9 +48,10 @@ void SALOMEDS_ChildIterator_i::Init() * */ //============================================================================ -void SALOMEDS_ChildIterator_i::InitEx(CORBA::Boolean theIsAllLevels) +void SALOMEDS_ChildIterator_i::InitEx(CORBA::Boolean allLevels) { - _it.Initialize(_lab,theIsAllLevels); + SALOMEDS::Locker lock; + _it.Initialize (_lab, allLevels); } //============================================================================ @@ -84,6 +61,7 @@ void SALOMEDS_ChildIterator_i::InitEx(CORBA::Boolean theIsAllLevels) //============================================================================ CORBA::Boolean SALOMEDS_ChildIterator_i::More() { + SALOMEDS::Locker lock; return _it.More(); } @@ -94,6 +72,7 @@ CORBA::Boolean SALOMEDS_ChildIterator_i::More() //============================================================================ void SALOMEDS_ChildIterator_i::Next() { + SALOMEDS::Locker lock; _it.Next(); } @@ -106,10 +85,10 @@ void SALOMEDS_ChildIterator_i::Next() SALOMEDS::SObject_ptr SALOMEDS_ChildIterator_i::Value() { - return SALOMEDS_SObject_i::NewRef(_study,_it.Value())._retn(); + SALOMEDS::Locker lock; + Handle(SALOMEDSImpl_SObject) aSO = new SALOMEDSImpl_SObject(_it.Value()); + SALOMEDS_SObject_i * so_servant = new SALOMEDS_SObject_i (aSO, _orb); + SALOMEDS::SObject_var so = SALOMEDS::SObject::_narrow(so_servant->_this()); + return so; } -SALOMEDS_SObject_i* SALOMEDS_ChildIterator_i::GetValue() -{ - return SALOMEDS_SObject_i::NewPtr(_study,_it.Value()); -} diff --git a/src/SALOMEDS/SALOMEDS_ChildIterator_i.hxx b/src/SALOMEDS/SALOMEDS_ChildIterator_i.hxx index dc7cfbe9c..dd0a10914 100644 --- a/src/SALOMEDS/SALOMEDS_ChildIterator_i.hxx +++ b/src/SALOMEDS/SALOMEDS_ChildIterator_i.hxx @@ -1,71 +1,42 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// // File : SALOMEDS_ChildIterator_i.hxx -// Author : Yves FRICAUD +// Author : Sergey RUIN // Module : SALOME -// $Header$ #ifndef __SALOMEDS_CHILDITERATOR_I_H__ #define __SALOMEDS_CHILDITERATOR_I_H__ +// std C++ headers +#include + // IDL headers #include #include CORBA_SERVER_HEADER(SALOMEDS) + + // Cascade headers #include #include - -class SALOMEDS_Study_i; -class SALOMEDS_SObject_i; +#include class SALOMEDS_ChildIterator_i: public POA_SALOMEDS::ChildIterator, - public PortableServer::RefCountServantBase -{ - SALOMEDS_ChildIterator_i(); // Not implemented - void operator=(const SALOMEDS_ChildIterator_i&); // Not implemented - + public PortableServer::RefCountServantBase { private: - SALOMEDS_Study_i* _study; + CORBA::ORB_ptr _orb; TDF_Label _lab; TDF_ChildIterator _it; - public: - SALOMEDS_ChildIterator_i(SALOMEDS_Study_i* theStudy, - const TDF_Label& theLabel, - bool theIsAllLevels = false); + //! standard constructor + SALOMEDS_ChildIterator_i(TDF_Label lab,CORBA::ORB_ptr); + + //! standard destructor ~SALOMEDS_ChildIterator_i(); - SALOMEDS_SObject_i* GetValue(); - virtual void Init(); virtual void InitEx(CORBA::Boolean); virtual CORBA::Boolean More(); virtual void Next(); virtual SALOMEDS::SObject_ptr Value(); }; - - #endif diff --git a/src/SALOMEDS/SALOMEDS_DataMapIteratorOfDataMapOfIntegerString.hxx b/src/SALOMEDS/SALOMEDS_DataMapIteratorOfDataMapOfIntegerString.hxx deleted file mode 100644 index 89eb9b96d..000000000 --- a/src/SALOMEDS/SALOMEDS_DataMapIteratorOfDataMapOfIntegerString.hxx +++ /dev/null @@ -1,95 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// -// -// File : SALOMEDS_DataMapIteratorOfDataMapOfIntegerString.hxx -// Author : Sergey Ruin -// Module : SALOME - -#ifndef _SALOMEDS_DataMapIteratorOfDataMapOfIntegerString_HeaderFile -#define _SALOMEDS_DataMapIteratorOfDataMapOfIntegerString_HeaderFile - -#ifndef _TCollection_BasicMapIterator_HeaderFile -#include -#endif -#ifndef _Standard_Real_HeaderFile -#include -#endif -#ifndef _Handle_SALOMEDS_DataMapNodeOfDataMapOfIntegerString_HeaderFile -#include -#endif -class Standard_NoSuchObject; -class TCollection_ExtendedString; -class TColStd_MapIntegerHasher; -class SALOMEDS_DataMapOfIntegerString; -class SALOMEDS_DataMapNodeOfDataMapOfIntegerString; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - -class SALOMEDS_DataMapIteratorOfDataMapOfIntegerString : public TCollection_BasicMapIterator { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // -Standard_EXPORT SALOMEDS_DataMapIteratorOfDataMapOfIntegerString(); -Standard_EXPORT SALOMEDS_DataMapIteratorOfDataMapOfIntegerString(const SALOMEDS_DataMapOfIntegerString& aMap); -Standard_EXPORT void Initialize(const SALOMEDS_DataMapOfIntegerString& aMap) ; -Standard_EXPORT const Standard_Real& Key() const; -Standard_EXPORT const TCollection_ExtendedString& Value() const; - - - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - -}; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/SALOMEDS/SALOMEDS_DataMapIteratorOfDataMapOfIntegerString_0.cxx b/src/SALOMEDS/SALOMEDS_DataMapIteratorOfDataMapOfIntegerString_0.cxx deleted file mode 100644 index e564a093c..000000000 --- a/src/SALOMEDS/SALOMEDS_DataMapIteratorOfDataMapOfIntegerString_0.cxx +++ /dev/null @@ -1,46 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// -// -// File : SALOMEDS_DataMapIteratorOfDataMapOfIntegerString_0.cxx -// Author : Sergey Ruin -// Module : SALOME - -#include - -#ifndef _Standard_NoSuchObject_HeaderFile -#include -#endif -#ifndef _TCollection_ExtendedString_HeaderFile -#include -#endif -#ifndef _TColStd_MapIntegerHasher_HeaderFile -#include -#endif -#ifndef _SALOMEDS_DataMapOfIntegerString_HeaderFile -#include -#endif -#ifndef _SALOMEDS_DataMapNodeOfDataMapOfIntegerString_HeaderFile -#include -#endif -using namespace std; - - -#define TheKey Standard_Real -#define TheKey_hxx -#define TheItem TCollection_ExtendedString -#define TheItem_hxx -#define Hasher TColStd_MapIntegerHasher -#define Hasher_hxx -#define TCollection_DataMapNode SALOMEDS_DataMapNodeOfDataMapOfIntegerString -#define TCollection_DataMapNode_hxx -#define TCollection_DataMapIterator SALOMEDS_DataMapIteratorOfDataMapOfIntegerString -#define TCollection_DataMapIterator_hxx -#define Handle_TCollection_DataMapNode Handle_SALOMEDS_DataMapNodeOfDataMapOfIntegerString -#define TCollection_DataMapNode_Type_() SALOMEDS_DataMapNodeOfDataMapOfIntegerString_Type_() -#define TCollection_DataMap SALOMEDS_DataMapOfIntegerString -#define TCollection_DataMap_hxx -#include - diff --git a/src/SALOMEDS/SALOMEDS_DataMapIteratorOfDataMapStringLabel.hxx b/src/SALOMEDS/SALOMEDS_DataMapIteratorOfDataMapStringLabel.hxx deleted file mode 100644 index 98c011e27..000000000 --- a/src/SALOMEDS/SALOMEDS_DataMapIteratorOfDataMapStringLabel.hxx +++ /dev/null @@ -1,114 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : SALOMEDS_DataMapIteratorOfDataMapStringLabel.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _SALOMEDS_DataMapIteratorOfDataMapStringLabel_HeaderFile -#define _SALOMEDS_DataMapIteratorOfDataMapStringLabel_HeaderFile - -#ifndef _TCollection_BasicMapIterator_HeaderFile -#include -#endif -#ifndef _Handle_SALOMEDS_DataMapNodeOfDataMapStringLabel_HeaderFile -#include -#endif -class Standard_NoSuchObject; -class TCollection_ExtendedString; -class TDF_Label; -class SALOMEDS_DataMapStringLabel; -class SALOMEDS_DataMapNodeOfDataMapStringLabel; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - -class SALOMEDS_DataMapIteratorOfDataMapStringLabel : public TCollection_BasicMapIterator { - -public: - - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - // Methods PUBLIC - // -Standard_EXPORT SALOMEDS_DataMapIteratorOfDataMapStringLabel(); -Standard_EXPORT SALOMEDS_DataMapIteratorOfDataMapStringLabel(const SALOMEDS_DataMapStringLabel& aMap); -Standard_EXPORT void Initialize(const SALOMEDS_DataMapStringLabel& aMap) ; -Standard_EXPORT const TCollection_ExtendedString& Key() const; -Standard_EXPORT const TDF_Label& Value() const; - - - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - -}; - - - - - -// other inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/SALOMEDS/SALOMEDS_DataMapIteratorOfDataMapStringLabel_0.cxx b/src/SALOMEDS/SALOMEDS_DataMapIteratorOfDataMapStringLabel_0.cxx deleted file mode 100644 index b261e4409..000000000 --- a/src/SALOMEDS/SALOMEDS_DataMapIteratorOfDataMapStringLabel_0.cxx +++ /dev/null @@ -1,64 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : SALOMEDS_DataMapIteratorOfDataMapStringLabel_0.cxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_DataMapIteratorOfDataMapStringLabel.hxx" - -#ifndef _Standard_NoSuchObject_HeaderFile -#include -#endif -#ifndef _TCollection_ExtendedString_HeaderFile -#include -#endif -#ifndef _TDF_Label_HeaderFile -#include -#endif -#ifndef _SALOMEDS_DataMapStringLabel_HeaderFile -#include "SALOMEDS_DataMapStringLabel.hxx" -#endif -#ifndef _SALOMEDS_DataMapNodeOfDataMapStringLabel_HeaderFile -#include "SALOMEDS_DataMapNodeOfDataMapStringLabel.hxx" -#endif - using namespace std; - - -#define TheKey TCollection_ExtendedString -#define TheKey_hxx -#define TheItem TDF_Label -#define TheItem_hxx -#define Hasher TCollection_ExtendedString -#define Hasher_hxx -#define TCollection_DataMapNode SALOMEDS_DataMapNodeOfDataMapStringLabel -#define TCollection_DataMapNode_hxx "SALOMEDS_DataMapNodeOfDataMapStringLabel.hxx" -#define TCollection_DataMapIterator SALOMEDS_DataMapIteratorOfDataMapStringLabel -#define TCollection_DataMapIterator_hxx "SALOMEDS_DataMapIteratorOfDataMapStringLabel.hxx" -#define Handle_TCollection_DataMapNode Handle_SALOMEDS_DataMapNodeOfDataMapStringLabel -#define TCollection_DataMapNode_Type_() SALOMEDS_DataMapNodeOfDataMapStringLabel_Type_() -#define TCollection_DataMap SALOMEDS_DataMapStringLabel -#define TCollection_DataMap_hxx "SALOMEDS_DataMapStringLabel.hxx" -#include - diff --git a/src/SALOMEDS/SALOMEDS_DataMapNodeOfDataMapOfIntegerString.hxx b/src/SALOMEDS/SALOMEDS_DataMapNodeOfDataMapOfIntegerString.hxx deleted file mode 100644 index bf2c70ce5..000000000 --- a/src/SALOMEDS/SALOMEDS_DataMapNodeOfDataMapOfIntegerString.hxx +++ /dev/null @@ -1,132 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// -// -// File : SALOMEDS_DataMapNodeOfDataMapOfIntegerString.hxx -// Author : Sergey Ruin -// Module : SALOME - -#ifndef _SALOMEDS_DataMapNodeOfDataMapOfIntegerString_HeaderFile -#define _SALOMEDS_DataMapNodeOfDataMapOfIntegerString_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_SALOMEDS_DataMapNodeOfDataMapOfIntegerString_HeaderFile -#include -#endif - -#ifndef _Standard_Real_HeaderFile -#include -#endif -#ifndef _TCollection_ExtendedString_HeaderFile -#include -#endif -#ifndef _TCollection_MapNode_HeaderFile -#include -#endif -#ifndef _TCollection_MapNodePtr_HeaderFile -#include -#endif -class TCollection_ExtendedString; -class TColStd_MapIntegerHasher; -class SALOMEDS_DataMapOfIntegerString; -class SALOMEDS_DataMapIteratorOfDataMapOfIntegerString; - - -class SALOMEDS_DataMapNodeOfDataMapOfIntegerString : public TCollection_MapNode { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // -SALOMEDS_DataMapNodeOfDataMapOfIntegerString(const Standard_Real& K,const TCollection_ExtendedString& I,const TCollection_MapNodePtr& n); - Standard_Real& Key() const; - TCollection_ExtendedString& Value() const; -Standard_EXPORT ~SALOMEDS_DataMapNodeOfDataMapOfIntegerString(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_DataMapNodeOfDataMapOfIntegerString_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // -Standard_Real myKey; -TCollection_ExtendedString myValue; - - -}; - -#define TheKey Standard_Real -#define TheKey_hxx -#define TheItem TCollection_ExtendedString -#define TheItem_hxx -#define Hasher TColStd_MapIntegerHasher -#define Hasher_hxx -#define TCollection_DataMapNode SALOMEDS_DataMapNodeOfDataMapOfIntegerString -#define TCollection_DataMapNode_hxx -#define TCollection_DataMapIterator SALOMEDS_DataMapIteratorOfDataMapOfIntegerString -#define TCollection_DataMapIterator_hxx -#define Handle_TCollection_DataMapNode Handle_SALOMEDS_DataMapNodeOfDataMapOfIntegerString -#define TCollection_DataMapNode_Type_() SALOMEDS_DataMapNodeOfDataMapOfIntegerString_Type_() -#define TCollection_DataMap SALOMEDS_DataMapOfIntegerString -#define TCollection_DataMap_hxx - -#include - -#undef TheKey -#undef TheKey_hxx -#undef TheItem -#undef TheItem_hxx -#undef Hasher -#undef Hasher_hxx -#undef TCollection_DataMapNode -#undef TCollection_DataMapNode_hxx -#undef TCollection_DataMapIterator -#undef TCollection_DataMapIterator_hxx -#undef Handle_TCollection_DataMapNode -#undef TCollection_DataMapNode_Type_ -#undef TCollection_DataMap -#undef TCollection_DataMap_hxx - - -// other Inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/SALOMEDS/SALOMEDS_DataMapNodeOfDataMapOfIntegerString_0.cxx b/src/SALOMEDS/SALOMEDS_DataMapNodeOfDataMapOfIntegerString_0.cxx deleted file mode 100644 index 737d4614a..000000000 --- a/src/SALOMEDS/SALOMEDS_DataMapNodeOfDataMapOfIntegerString_0.cxx +++ /dev/null @@ -1,95 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// -// -// File : SALOMEDS_DataMapNodeOfDataMapOfIntegerString_0.cxx -// Author : Sergey Ruin -// Module : SALOME - -#include - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -#ifndef _TCollection_ExtendedString_HeaderFile -#include -#endif -#ifndef _TColStd_MapIntegerHasher_HeaderFile -#include -#endif -#ifndef _SALOMEDS_DataMapOfIntegerString_HeaderFile -#include -#endif -#ifndef _SALOMEDS_DataMapIteratorOfDataMapOfIntegerString_HeaderFile -#include -#endif -using namespace std; -SALOMEDS_DataMapNodeOfDataMapOfIntegerString::~SALOMEDS_DataMapNodeOfDataMapOfIntegerString() {} - - - -Standard_EXPORT Handle_Standard_Type& SALOMEDS_DataMapNodeOfDataMapOfIntegerString_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TCollection_MapNode); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TCollection_MapNode); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_DataMapNodeOfDataMapOfIntegerString", - sizeof(SALOMEDS_DataMapNodeOfDataMapOfIntegerString), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(SALOMEDS_DataMapNodeOfDataMapOfIntegerString) Handle(SALOMEDS_DataMapNodeOfDataMapOfIntegerString)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(SALOMEDS_DataMapNodeOfDataMapOfIntegerString) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_DataMapNodeOfDataMapOfIntegerString))) { - _anOtherObject = Handle(SALOMEDS_DataMapNodeOfDataMapOfIntegerString)((Handle(SALOMEDS_DataMapNodeOfDataMapOfIntegerString)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& SALOMEDS_DataMapNodeOfDataMapOfIntegerString::DynamicType() const -{ - return STANDARD_TYPE(SALOMEDS_DataMapNodeOfDataMapOfIntegerString) ; -} -Standard_Boolean SALOMEDS_DataMapNodeOfDataMapOfIntegerString::IsKind(const Handle(Standard_Type)& AType) const -{ - return (STANDARD_TYPE(SALOMEDS_DataMapNodeOfDataMapOfIntegerString) == AType || TCollection_MapNode::IsKind(AType)); -} -Handle_SALOMEDS_DataMapNodeOfDataMapOfIntegerString::~Handle_SALOMEDS_DataMapNodeOfDataMapOfIntegerString() {} -#define TheKey Standard_Real -#define TheKey_hxx -#define TheItem TCollection_ExtendedString -#define TheItem_hxx -#define Hasher TColStd_MapIntegerHasher -#define Hasher_hxx -#define TCollection_DataMapNode SALOMEDS_DataMapNodeOfDataMapOfIntegerString -#define TCollection_DataMapNode_hxx -#define TCollection_DataMapIterator SALOMEDS_DataMapIteratorOfDataMapOfIntegerString -#define TCollection_DataMapIterator_hxx -#define Handle_TCollection_DataMapNode Handle_SALOMEDS_DataMapNodeOfDataMapOfIntegerString -#define TCollection_DataMapNode_Type_() SALOMEDS_DataMapNodeOfDataMapOfIntegerString_Type_() -#define TCollection_DataMap SALOMEDS_DataMapOfIntegerString -#define TCollection_DataMap_hxx -#include - diff --git a/src/SALOMEDS/SALOMEDS_DataMapNodeOfDataMapStringLabel.hxx b/src/SALOMEDS/SALOMEDS_DataMapNodeOfDataMapStringLabel.hxx deleted file mode 100644 index 5fa7a9f17..000000000 --- a/src/SALOMEDS/SALOMEDS_DataMapNodeOfDataMapStringLabel.hxx +++ /dev/null @@ -1,154 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : SALOMEDS_DataMapNodeOfDataMapStringLabel.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _SALOMEDS_DataMapNodeOfDataMapStringLabel_HeaderFile -#define _SALOMEDS_DataMapNodeOfDataMapStringLabel_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_SALOMEDS_DataMapNodeOfDataMapStringLabel_HeaderFile -#include -#endif - -#ifndef _TCollection_ExtendedString_HeaderFile -#include -#endif -#ifndef _TDF_Label_HeaderFile -#include -#endif -#ifndef _TCollection_MapNode_HeaderFile -#include -#endif -#ifndef _TCollection_MapNodePtr_HeaderFile -#include -#endif -class TCollection_ExtendedString; -class TDF_Label; -class SALOMEDS_DataMapStringLabel; -class SALOMEDS_DataMapIteratorOfDataMapStringLabel; - - -class SALOMEDS_DataMapNodeOfDataMapStringLabel : public TCollection_MapNode { - -public: - - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - // Methods PUBLIC - // -Standard_EXPORT inline SALOMEDS_DataMapNodeOfDataMapStringLabel(const TCollection_ExtendedString& K,const TDF_Label& I,const TCollection_MapNodePtr& n); -Standard_EXPORT inline TCollection_ExtendedString& Key() const; -Standard_EXPORT inline TDF_Label& Value() const; -Standard_EXPORT ~SALOMEDS_DataMapNodeOfDataMapStringLabel(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_DataMapNodeOfDataMapStringLabel_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // -TCollection_ExtendedString myKey; -TDF_Label myValue; - - -}; - -#define TheKey TCollection_ExtendedString -#define TheKey_hxx -#define TheItem TDF_Label -#define TheItem_hxx -#define Hasher TCollection_ExtendedString -#define Hasher_hxx -#define TCollection_DataMapNode SALOMEDS_DataMapNodeOfDataMapStringLabel -#define TCollection_DataMapNode_hxx "SALOMEDS_DataMapNodeOfDataMapStringLabel.hxx" -#define TCollection_DataMapIterator SALOMEDS_DataMapIteratorOfDataMapStringLabel -#define TCollection_DataMapIterator_hxx "SALOMEDS_DataMapIteratorOfDataMapStringLabel.hxx" -#define Handle_TCollection_DataMapNode Handle_SALOMEDS_DataMapNodeOfDataMapStringLabel -#define TCollection_DataMapNode_Type_() SALOMEDS_DataMapNodeOfDataMapStringLabel_Type_() -#define TCollection_DataMap SALOMEDS_DataMapStringLabel -#define TCollection_DataMap_hxx "SALOMEDS_DataMapStringLabel.hxx" - -#include - -#undef TheKey -#undef TheKey_hxx -#undef TheItem -#undef TheItem_hxx -#undef Hasher -#undef Hasher_hxx -#undef TCollection_DataMapNode -#undef TCollection_DataMapNode_hxx -#undef TCollection_DataMapIterator -#undef TCollection_DataMapIterator_hxx -#undef Handle_TCollection_DataMapNode -#undef TCollection_DataMapNode_Type_ -#undef TCollection_DataMap -#undef TCollection_DataMap_hxx - - -// other inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/SALOMEDS/SALOMEDS_DataMapNodeOfDataMapStringLabel_0.cxx b/src/SALOMEDS/SALOMEDS_DataMapNodeOfDataMapStringLabel_0.cxx deleted file mode 100644 index ea3912899..000000000 --- a/src/SALOMEDS/SALOMEDS_DataMapNodeOfDataMapStringLabel_0.cxx +++ /dev/null @@ -1,113 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : Handle_SALOMEDS_DataMapNodeOfDataMapStringLabel_0.cxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_DataMapNodeOfDataMapStringLabel.hxx" - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -#ifndef _TCollection_ExtendedString_HeaderFile -#include -#endif -#ifndef _TDF_Label_HeaderFile -#include -#endif -#ifndef _SALOMEDS_DataMapStringLabel_HeaderFile -#include "SALOMEDS_DataMapStringLabel.hxx" -#endif -#ifndef _SALOMEDS_DataMapIteratorOfDataMapStringLabel_HeaderFile -#include "SALOMEDS_DataMapIteratorOfDataMapStringLabel.hxx" -#endif -using namespace std; -SALOMEDS_DataMapNodeOfDataMapStringLabel::~SALOMEDS_DataMapNodeOfDataMapStringLabel() {} - - - -Standard_EXPORT Handle_Standard_Type& SALOMEDS_DataMapNodeOfDataMapStringLabel_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TCollection_MapNode); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TCollection_MapNode); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_DataMapNodeOfDataMapStringLabel", - sizeof(SALOMEDS_DataMapNodeOfDataMapStringLabel), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(SALOMEDS_DataMapNodeOfDataMapStringLabel) Handle(SALOMEDS_DataMapNodeOfDataMapStringLabel)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(SALOMEDS_DataMapNodeOfDataMapStringLabel) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_DataMapNodeOfDataMapStringLabel))) { - _anOtherObject = Handle(SALOMEDS_DataMapNodeOfDataMapStringLabel)((Handle(SALOMEDS_DataMapNodeOfDataMapStringLabel)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& SALOMEDS_DataMapNodeOfDataMapStringLabel::DynamicType() const -{ - return STANDARD_TYPE(SALOMEDS_DataMapNodeOfDataMapStringLabel) ; -} -Standard_Boolean SALOMEDS_DataMapNodeOfDataMapStringLabel::IsKind(const Handle(Standard_Type)& AType) const -{ - return (STANDARD_TYPE(SALOMEDS_DataMapNodeOfDataMapStringLabel) == AType || TCollection_MapNode::IsKind(AType)); -} -Handle_SALOMEDS_DataMapNodeOfDataMapStringLabel::~Handle_SALOMEDS_DataMapNodeOfDataMapStringLabel() {} -#define TheKey TCollection_ExtendedString -#define TheKey_hxx -#define TheItem TDF_Label -#define TheItem_hxx -#define Hasher TCollection_ExtendedString -#define Hasher_hxx -#define TCollection_DataMapNode SALOMEDS_DataMapNodeOfDataMapStringLabel -#define TCollection_DataMapNode_hxx "SALOMEDS_DataMapNodeOfDataMapStringLabel.hxx" -#define TCollection_DataMapIterator SALOMEDS_DataMapIteratorOfDataMapStringLabel -#define TCollection_DataMapIterator_hxx "SALOMEDS_DataMapIteratorOfDataMapStringLabel.hxx" -#define Handle_TCollection_DataMapNode Handle_SALOMEDS_DataMapNodeOfDataMapStringLabel -#define TCollection_DataMapNode_Type_() SALOMEDS_DataMapNodeOfDataMapStringLabel_Type_() -#define TCollection_DataMap SALOMEDS_DataMapStringLabel -#define TCollection_DataMap_hxx "SALOMEDS_DataMapStringLabel.hxx" -#include - diff --git a/src/SALOMEDS/SALOMEDS_DataMapOfIntegerString.hxx b/src/SALOMEDS/SALOMEDS_DataMapOfIntegerString.hxx deleted file mode 100644 index d26c6d376..000000000 --- a/src/SALOMEDS/SALOMEDS_DataMapOfIntegerString.hxx +++ /dev/null @@ -1,127 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// -// -// File : SALOMEDS_DataMapOfIntegerString.hxx -// Author : Sergey Ruin -// Module : SALOME - -#ifndef _SALOMEDS_DataMapOfIntegerString_HeaderFile -#define _SALOMEDS_DataMapOfIntegerString_HeaderFile - -#ifndef _TCollection_BasicMap_HeaderFile -#include -#endif -#ifndef _Standard_Real_HeaderFile -#include -#endif -#ifndef _Handle_SALOMEDS_DataMapNodeOfDataMapOfIntegerString_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -class Standard_DomainError; -class Standard_NoSuchObject; -class TCollection_ExtendedString; -class TColStd_MapIntegerHasher; -class SALOMEDS_DataMapNodeOfDataMapOfIntegerString; -class SALOMEDS_DataMapIteratorOfDataMapOfIntegerString; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - -class SALOMEDS_DataMapOfIntegerString : public TCollection_BasicMap { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // -Standard_EXPORT SALOMEDS_DataMapOfIntegerString(const Standard_Integer NbBuckets = 1); -Standard_EXPORT SALOMEDS_DataMapOfIntegerString& Assign(const SALOMEDS_DataMapOfIntegerString& Other) ; - SALOMEDS_DataMapOfIntegerString& operator =(const SALOMEDS_DataMapOfIntegerString& Other) -{ - return Assign(Other); -} - -Standard_EXPORT void ReSize(const Standard_Integer NbBuckets) ; -Standard_EXPORT void Clear() ; -~SALOMEDS_DataMapOfIntegerString() -{ - Clear(); -} - -Standard_EXPORT Standard_Boolean Bind(const Standard_Real& K,const TCollection_ExtendedString& I) ; -Standard_EXPORT Standard_Boolean IsBound(const Standard_Real& K) const; -Standard_EXPORT Standard_Boolean UnBind(const Standard_Real& K) ; -Standard_EXPORT const TCollection_ExtendedString& Find(const Standard_Real& K) const; - const TCollection_ExtendedString& operator()(const Standard_Real& K) const -{ - return Find(K); -} - -Standard_EXPORT TCollection_ExtendedString& ChangeFind(const Standard_Real& K) ; - TCollection_ExtendedString& operator()(const Standard_Real& K) -{ - return ChangeFind(K); -} - - - - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // -Standard_EXPORT SALOMEDS_DataMapOfIntegerString(const SALOMEDS_DataMapOfIntegerString& Other); - - - // Fields PRIVATE - // - - -}; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/SALOMEDS/SALOMEDS_DataMapOfIntegerString_0.cxx b/src/SALOMEDS/SALOMEDS_DataMapOfIntegerString_0.cxx deleted file mode 100644 index 652532351..000000000 --- a/src/SALOMEDS/SALOMEDS_DataMapOfIntegerString_0.cxx +++ /dev/null @@ -1,49 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// -// -// File : SALOMEDS_DataMapOfIntegerString_0.cxx -// Author : Sergey Ruin -// Module : SALOME - -#include - -#ifndef _Standard_DomainError_HeaderFile -#include -#endif -#ifndef _Standard_NoSuchObject_HeaderFile -#include -#endif -#ifndef _TCollection_ExtendedString_HeaderFile -#include -#endif -#ifndef _TColStd_MapIntegerHasher_HeaderFile -#include -#endif -#ifndef _SALOMEDS_DataMapNodeOfDataMapOfIntegerString_HeaderFile -#include -#endif -#ifndef _SALOMEDS_DataMapIteratorOfDataMapOfIntegerString_HeaderFile -#include -#endif - using namespace std; - - -#define TheKey Standard_Real -#define TheKey_hxx -#define TheItem TCollection_ExtendedString -#define TheItem_hxx -#define Hasher TColStd_MapIntegerHasher -#define Hasher_hxx -#define TCollection_DataMapNode SALOMEDS_DataMapNodeOfDataMapOfIntegerString -#define TCollection_DataMapNode_hxx -#define TCollection_DataMapIterator SALOMEDS_DataMapIteratorOfDataMapOfIntegerString -#define TCollection_DataMapIterator_hxx -#define Handle_TCollection_DataMapNode Handle_SALOMEDS_DataMapNodeOfDataMapOfIntegerString -#define TCollection_DataMapNode_Type_() SALOMEDS_DataMapNodeOfDataMapOfIntegerString_Type_() -#define TCollection_DataMap SALOMEDS_DataMapOfIntegerString -#define TCollection_DataMap_hxx -#include - diff --git a/src/SALOMEDS/SALOMEDS_DataMapStringLabel.hxx b/src/SALOMEDS/SALOMEDS_DataMapStringLabel.hxx deleted file mode 100644 index 7de27e8e1..000000000 --- a/src/SALOMEDS/SALOMEDS_DataMapStringLabel.hxx +++ /dev/null @@ -1,146 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : SALOMEDS_DataMapStringLabel.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _SALOMEDS_DataMapStringLabel_HeaderFile -#define _SALOMEDS_DataMapStringLabel_HeaderFile - -#ifndef _TCollection_BasicMap_HeaderFile -#include -#endif -#ifndef _Handle_SALOMEDS_DataMapNodeOfDataMapStringLabel_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -class Standard_DomainError; -class Standard_NoSuchObject; -class TCollection_ExtendedString; -class TDF_Label; -class SALOMEDS_DataMapNodeOfDataMapStringLabel; -class SALOMEDS_DataMapIteratorOfDataMapStringLabel; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - -class SALOMEDS_DataMapStringLabel : public TCollection_BasicMap { - -public: - - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - // Methods PUBLIC - // -Standard_EXPORT SALOMEDS_DataMapStringLabel(const Standard_Integer NbBuckets = 1); -Standard_EXPORT SALOMEDS_DataMapStringLabel& Assign(const SALOMEDS_DataMapStringLabel& Other) ; - SALOMEDS_DataMapStringLabel& operator =(const SALOMEDS_DataMapStringLabel& Other) -{ - return Assign(Other); -} - -Standard_EXPORT void ReSize(const Standard_Integer NbBuckets) ; -Standard_EXPORT void Clear() ; -~SALOMEDS_DataMapStringLabel() -{ - Clear(); -} - -Standard_EXPORT Standard_Boolean Bind(const TCollection_ExtendedString& K,const TDF_Label& I) ; -Standard_EXPORT Standard_Boolean IsBound(const TCollection_ExtendedString& K) const; -Standard_EXPORT Standard_Boolean UnBind(const TCollection_ExtendedString& K) ; -Standard_EXPORT const TDF_Label& Find(const TCollection_ExtendedString& K) const; - const TDF_Label& operator()(const TCollection_ExtendedString& K) const -{ - return Find(K); -} - -Standard_EXPORT TDF_Label& ChangeFind(const TCollection_ExtendedString& K) ; - TDF_Label& operator()(const TCollection_ExtendedString& K) -{ - return ChangeFind(K); -} - - - - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // -Standard_EXPORT SALOMEDS_DataMapStringLabel(const SALOMEDS_DataMapStringLabel& Other); - - - // Fields PRIVATE - // - - -}; - - - - - -// other inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/SALOMEDS/SALOMEDS_DataMapStringLabel_0.cxx b/src/SALOMEDS/SALOMEDS_DataMapStringLabel_0.cxx deleted file mode 100644 index c5976f385..000000000 --- a/src/SALOMEDS/SALOMEDS_DataMapStringLabel_0.cxx +++ /dev/null @@ -1,67 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : SALOMEDS_DataMapStringLabel_0.cxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_DataMapStringLabel.hxx" - -#ifndef _Standard_DomainError_HeaderFile -#include -#endif -#ifndef _Standard_NoSuchObject_HeaderFile -#include -#endif -#ifndef _TCollection_ExtendedString_HeaderFile -#include -#endif -#ifndef _TDF_Label_HeaderFile -#include -#endif -#ifndef _SALOMEDS_DataMapNodeOfDataMapStringLabel_HeaderFile -#include "SALOMEDS_DataMapNodeOfDataMapStringLabel.hxx" -#endif -#ifndef _SALOMEDS_DataMapIteratorOfDataMapStringLabel_HeaderFile -#include "SALOMEDS_DataMapIteratorOfDataMapStringLabel.hxx" -#endif - using namespace std; - - -#define TheKey TCollection_ExtendedString -#define TheKey_hxx -#define TheItem TDF_Label -#define TheItem_hxx -#define Hasher TCollection_ExtendedString -#define Hasher_hxx -#define TCollection_DataMapNode SALOMEDS_DataMapNodeOfDataMapStringLabel -#define TCollection_DataMapNode_hxx "SALOMEDS_DataMapNodeOfDataMapStringLabel.hxx" -#define TCollection_DataMapIterator SALOMEDS_DataMapIteratorOfDataMapStringLabel -#define TCollection_DataMapIterator_hxx "SALOMEDS_DataMapIteratorOfDataMapStringLabel.hxx" -#define Handle_TCollection_DataMapNode Handle_SALOMEDS_DataMapNodeOfDataMapStringLabel -#define TCollection_DataMapNode_Type_() SALOMEDS_DataMapNodeOfDataMapStringLabel_Type_() -#define TCollection_DataMap SALOMEDS_DataMapStringLabel -#define TCollection_DataMap_hxx "SALOMEDS_DataMapStringLabel.hxx" -#include - diff --git a/src/SALOMEDS/SALOMEDS_DrawableAttribute.cdl b/src/SALOMEDS/SALOMEDS_DrawableAttribute.cdl deleted file mode 100644 index dd8b25396..000000000 --- a/src/SALOMEDS/SALOMEDS_DrawableAttribute.cdl +++ /dev/null @@ -1,77 +0,0 @@ --- SALOME SALOMEDS : data structure of SALOME and sources of Salome data server --- --- Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, --- CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS --- --- This library is free software; you can redistribute it and/or --- modify it under the terms of the GNU Lesser General Public --- License as published by the Free Software Foundation; either --- version 2.1 of the License. --- --- This library is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --- Lesser General Public License for more details. --- --- You should have received a copy of the GNU Lesser General Public --- License along with this library; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --- --- See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org --- --- --- --- File : SALOMEDS_DrawableAttribute.cdl --- Author : Yves FRICAUD --- Module : SALOME - -class DrawableAttribute from SALOMEDS inherits Integer from TDataStd - - ---Purpose: - - -uses Attribute from TDF, - Label from TDF, - GUID from Standard, - ExtendedString from TCollection, - DataSet from TDF, - RelocationTable from TDF, - AttributeSequence from TDF, - Data from TDF, - Comment from TDataStd - - -is - - - ---Purpose: class methods - -- ============= - - GetID (myclass) - ---C++: return const & - returns GUID from Standard; - - Set (myclass; label : Label from TDF; value : Integer from Standard) - ---Purpose: Find, or create a Comment attribute and set the string. - -- the Comment attribute is returned. - returns DrawableAttribute from SALOMEDS; - - ---Purpose: Comment methods - -- ============ - - Create - returns mutable DrawableAttribute from SALOMEDS; - - ID (me) - ---C++: return const & - returns GUID from Standard; - - Restore (me: mutable; with : Attribute from TDF); - - NewEmpty (me) - returns mutable Attribute from TDF; - - Paste (me; into : mutable Attribute from TDF; - RT : mutable RelocationTable from TDF); - -end DrawableAttribute; diff --git a/src/SALOMEDS/SALOMEDS_DrawableAttribute.cxx b/src/SALOMEDS/SALOMEDS_DrawableAttribute.cxx deleted file mode 100644 index 1a1db8c38..000000000 --- a/src/SALOMEDS/SALOMEDS_DrawableAttribute.cxx +++ /dev/null @@ -1,114 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : SALOMEDS_DrawableAttribute.cxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_DrawableAttribute.ixx" -#include -using namespace std; - -//======================================================================= -//function : GetID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_DrawableAttribute::GetID () -{ - static Standard_GUID SALOMEDS_DrawableAttributeID ("12837184-8F52-11d6-A8A3-0001021E8C7F"); - return SALOMEDS_DrawableAttributeID; -} - - - -//======================================================================= -//function : Set -//purpose : -//======================================================================= - -Handle(SALOMEDS_DrawableAttribute) SALOMEDS_DrawableAttribute::Set (const TDF_Label& L, - const Standard_Integer value) -{ - Handle(SALOMEDS_DrawableAttribute) A; - if (!L.FindAttribute(SALOMEDS_DrawableAttribute::GetID(),A)) { - A = new SALOMEDS_DrawableAttribute(); - L.AddAttribute(A); - } - - (Handle(TDataStd_Integer)::DownCast(A))->Set (value); - return A; -} - - -//======================================================================= -//function : constructor -//purpose : -//======================================================================= -SALOMEDS_DrawableAttribute::SALOMEDS_DrawableAttribute() -{ - TDataStd_Integer::Set(0); -} - -//======================================================================= -//function : ID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_DrawableAttribute::ID () const { return GetID(); } - - -//======================================================================= -//function : NewEmpty -//purpose : -//======================================================================= - -Handle(TDF_Attribute) SALOMEDS_DrawableAttribute::NewEmpty () const -{ - return new SALOMEDS_DrawableAttribute(); -} - -//======================================================================= -//function : Restore -//purpose : -//======================================================================= - -void SALOMEDS_DrawableAttribute::Restore(const Handle(TDF_Attribute)& with) -{ - Standard_Integer s = Handle(TDataStd_Integer)::DownCast (with)->Get (); - TDataStd_Integer::Set(s); - return; -} - -//======================================================================= -//function : Paste -//purpose : -//======================================================================= - -void SALOMEDS_DrawableAttribute::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& RT) const -{ - Handle(TDataStd_Integer)::DownCast (into)->Set (Get()); -} - diff --git a/src/SALOMEDS/SALOMEDS_DrawableAttribute.hxx b/src/SALOMEDS/SALOMEDS_DrawableAttribute.hxx deleted file mode 100644 index 6bffe9e41..000000000 --- a/src/SALOMEDS/SALOMEDS_DrawableAttribute.hxx +++ /dev/null @@ -1,127 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : SALOMEDS_DrawableAttribute.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _SALOMEDS_DrawableAttribute_HeaderFile -#define _SALOMEDS_DrawableAttribute_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_SALOMEDS_DrawableAttribute_HeaderFile -#include -#endif - -#ifndef _TDataStd_Integer_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Handle_TDF_Attribute_HeaderFile -#include -#endif -#ifndef _Handle_TDF_RelocationTable_HeaderFile -#include -#endif -class Standard_GUID; -class TDF_Label; -class TDF_Attribute; -class TDF_RelocationTable; - - -class SALOMEDS_DrawableAttribute : public TDataStd_Integer { - -public: - - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - // Methods PUBLIC - // -Standard_EXPORT static const Standard_GUID& GetID() ; -Standard_EXPORT static Handle_SALOMEDS_DrawableAttribute Set(const TDF_Label& label,const Standard_Integer value) ; -Standard_EXPORT SALOMEDS_DrawableAttribute(); -Standard_EXPORT const Standard_GUID& ID() const; -Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ; -Standard_EXPORT Handle_TDF_Attribute NewEmpty() const; -Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const; -Standard_EXPORT ~SALOMEDS_DrawableAttribute(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_DrawableAttribute_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - -}; - - - - - -// other inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/SALOMEDS/SALOMEDS_DrawableAttribute.ixx b/src/SALOMEDS/SALOMEDS_DrawableAttribute.ixx deleted file mode 100644 index 1a7b4047a..000000000 --- a/src/SALOMEDS/SALOMEDS_DrawableAttribute.ixx +++ /dev/null @@ -1,87 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : SALOMEDS_DrawableAttribute.ixx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_DrawableAttribute.jxx" - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -SALOMEDS_DrawableAttribute::~SALOMEDS_DrawableAttribute() {} - - - -Standard_EXPORT Handle_Standard_Type& SALOMEDS_DrawableAttribute_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TDataStd_Integer); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDataStd_Integer); - static Handle_Standard_Type aType2 = STANDARD_TYPE(TDF_Attribute); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(TDF_Attribute); - static Handle_Standard_Type aType3 = STANDARD_TYPE(MMgt_TShared); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType4 = STANDARD_TYPE(Standard_Transient); - if ( aType4.IsNull()) aType4 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_DrawableAttribute", - sizeof(SALOMEDS_DrawableAttribute), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(SALOMEDS_DrawableAttribute) Handle(SALOMEDS_DrawableAttribute)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(SALOMEDS_DrawableAttribute) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_DrawableAttribute))) { - _anOtherObject = Handle(SALOMEDS_DrawableAttribute)((Handle(SALOMEDS_DrawableAttribute)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& SALOMEDS_DrawableAttribute::DynamicType() const -{ - return STANDARD_TYPE(SALOMEDS_DrawableAttribute) ; -} -Standard_Boolean SALOMEDS_DrawableAttribute::IsKind(const Handle(Standard_Type)& AType) const -{ - return (STANDARD_TYPE(SALOMEDS_DrawableAttribute) == AType || TDataStd_Integer::IsKind(AType)); -} -Handle_SALOMEDS_DrawableAttribute::~Handle_SALOMEDS_DrawableAttribute() {} - diff --git a/src/SALOMEDS/SALOMEDS_DrawableAttribute.jxx b/src/SALOMEDS/SALOMEDS_DrawableAttribute.jxx deleted file mode 100644 index fbdf20b9a..000000000 --- a/src/SALOMEDS/SALOMEDS_DrawableAttribute.jxx +++ /dev/null @@ -1,43 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : SALOMEDS_DrawableAttribute.jxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _Standard_GUID_HeaderFile -#include -#endif -#ifndef _TDF_Label_HeaderFile -#include -#endif -#ifndef _TDF_Attribute_HeaderFile -#include -#endif -#ifndef _TDF_RelocationTable_HeaderFile -#include -#endif -#ifndef _SALOMEDS_DrawableAttribute_HeaderFile -#include "SALOMEDS_DrawableAttribute.hxx" -#endif diff --git a/src/SALOMEDS/SALOMEDS_Driver_i.cxx b/src/SALOMEDS/SALOMEDS_Driver_i.cxx new file mode 100644 index 000000000..551b640ef --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_Driver_i.cxx @@ -0,0 +1,269 @@ +using namespace std; + +#include "SALOMEDS_Driver_i.hxx" +#include "utilities.h" +#include "SALOMEDS_SObject_i.hxx" +#include "SALOMEDS_SComponent_i.hxx" +#include "SALOMEDS_Study_i.hxx" +#include "SALOMEDS.hxx" +#include + +unsigned char* SALOMEDS_Driver_i::Save(const Handle(SALOMEDSImpl_SComponent)& theComponent, + const TCollection_AsciiString& theURL, + long& theStreamLength, + bool isMultiFile) +{ + SALOMEDS_SComponent_i * so_servant = new SALOMEDS_SComponent_i (theComponent, _orb); + SALOMEDS::SComponent_var sco = SALOMEDS::SComponent::_narrow(so_servant->SComponent::_this()); + SALOMEDS::TMPFile_var aStream; + CORBA::String_var url = CORBA::string_dup(theURL.ToCString()); + aStream = _driver->Save(sco.in(), url, isMultiFile); + theStreamLength = aStream->length(); + unsigned char* aRetStream = NULL; + if(theStreamLength > 0) { + aRetStream = new unsigned char[theStreamLength]; + memcpy(aRetStream, aStream->NP_data(), theStreamLength); + } + return aRetStream; +} + +unsigned char* SALOMEDS_Driver_i::SaveASCII(const Handle(SALOMEDSImpl_SComponent)& theComponent, + const TCollection_AsciiString& theURL, + long& theStreamLength, + bool isMultiFile) +{ + SALOMEDS_SComponent_i * so_servant = new SALOMEDS_SComponent_i (theComponent, _orb); + SALOMEDS::SComponent_var sco = SALOMEDS::SComponent::_narrow(so_servant->SComponent::_this()); + SALOMEDS::TMPFile_var aStream; + CORBA::String_var url = CORBA::string_dup(theURL.ToCString()); + aStream = _driver->SaveASCII(sco.in(), url, isMultiFile); + theStreamLength = aStream->length(); + unsigned char* aRetStream = NULL; + if(theStreamLength > 0) { + aRetStream = new unsigned char[theStreamLength]; + memcpy(aRetStream, aStream->NP_data(), theStreamLength); + } + return aRetStream; +} + +bool SALOMEDS_Driver_i::Load(const Handle(SALOMEDSImpl_SComponent)& theComponent, + const unsigned char* theStream, + const long theStreamLength, + const TCollection_AsciiString& theURL, + bool isMultiFile) +{ + SALOMEDS::Locker lock; + SALOMEDS_SComponent_i * so_servant = new SALOMEDS_SComponent_i (theComponent, _orb); + SALOMEDS::SComponent_var sco = SALOMEDS::SComponent::_narrow(so_servant->SComponent::_this()); + CORBA::String_var url = CORBA::string_dup(theURL.ToCString()); + CORBA::Octet* anOctetBuf = (CORBA::Octet*)theStream; + + SALOMEDS::TMPFile_var aStream; + if(theStreamLength > 0) + aStream = new SALOMEDS::TMPFile(theStreamLength, theStreamLength, anOctetBuf, 0); + else + aStream = new SALOMEDS::TMPFile(0); + + SALOMEDS::unlock(); + return _driver->Load(sco.in(), aStream.in(), url, isMultiFile); +} + +bool SALOMEDS_Driver_i::LoadASCII(const Handle(SALOMEDSImpl_SComponent)& theComponent, + const unsigned char* theStream, + const long theStreamLength, + const TCollection_AsciiString& theURL, + bool isMultiFile) +{ + SALOMEDS::Locker lock; + SALOMEDS_SComponent_i * so_servant = new SALOMEDS_SComponent_i (theComponent, _orb); + SALOMEDS::SComponent_var sco = SALOMEDS::SComponent::_narrow(so_servant->SComponent::_this()); + CORBA::String_var url = CORBA::string_dup(theURL.ToCString()); + CORBA::Octet* anOctetBuf = (CORBA::Octet*)theStream; + + SALOMEDS::TMPFile_var aStream; + if(theStreamLength > 0) + aStream = new SALOMEDS::TMPFile(theStreamLength, theStreamLength, anOctetBuf, 0); + else + aStream = new SALOMEDS::TMPFile(0); + + SALOMEDS::unlock(); + return _driver->LoadASCII(sco.in(), aStream.in(), url, isMultiFile); +} + +void SALOMEDS_Driver_i::Close(const Handle(SALOMEDSImpl_SComponent)& theComponent) +{ + SALOMEDS_SComponent_i * so_servant = new SALOMEDS_SComponent_i (theComponent, _orb); + SALOMEDS::SComponent_var sco = SALOMEDS::SComponent::_narrow(so_servant->SComponent::_this()); + _driver->Close(sco.in()); +} + + + +TCollection_AsciiString SALOMEDS_Driver_i::IORToLocalPersistentID(const Handle(SALOMEDSImpl_SObject)& theSObject, + const TCollection_AsciiString& IORString, + bool isMultiFile, + bool isASCII) +{ + SALOMEDS::Locker lock; + SALOMEDS_SObject_i * so_servant = new SALOMEDS_SObject_i (theSObject, _orb); + SALOMEDS::SObject_var so = SALOMEDS::SObject::_narrow(so_servant->_this()); + CORBA::String_var ior = CORBA::string_dup(IORString.ToCString()); + SALOMEDS::unlock(); + CORBA::String_var pers_string =_driver->IORToLocalPersistentID(so.in(), ior.in(), isMultiFile, isASCII); + SALOMEDS::lock(); + return TCollection_AsciiString(pers_string); +} + + +TCollection_AsciiString SALOMEDS_Driver_i::LocalPersistentIDToIOR(const Handle(SALOMEDSImpl_SObject)& theObject, + const TCollection_AsciiString& aLocalPersistentID, + bool isMultiFile, + bool isASCII) +{ + SALOMEDS::Locker lock; + SALOMEDS_SObject_i * so_servant = new SALOMEDS_SObject_i (theObject, _orb); + SALOMEDS::SObject_var so = SALOMEDS::SObject::_narrow(so_servant->_this()); + CORBA::String_var pers_string = CORBA::string_dup(aLocalPersistentID.ToCString()); + SALOMEDS::unlock(); + CORBA::String_var IOR =_driver->LocalPersistentIDToIOR(so.in(), pers_string.in(), isMultiFile, isASCII); + SALOMEDS::lock(); + return TCollection_AsciiString(IOR); +} + +bool SALOMEDS_Driver_i::CanCopy(const Handle(SALOMEDSImpl_SObject)& theObject) +{ + SALOMEDS_SObject_i * so_servant = new SALOMEDS_SObject_i (theObject, _orb); + SALOMEDS::SObject_var so = SALOMEDS::SObject::_narrow(so_servant->_this()); + return _driver->CanCopy(so.in()); +} + +/* +#include +#include +#include +*/ + +unsigned char* SALOMEDS_Driver_i::CopyFrom(const Handle(SALOMEDSImpl_SObject)& theObject, + int& theObjectID, + long& theStreamLength) +{ + SALOMEDS::Locker lock; + + SALOMEDS_SObject_i * so_servant = new SALOMEDS_SObject_i (theObject, _orb); + SALOMEDS::SObject_var so = SALOMEDS::SObject::_narrow(so_servant->_this()); + SALOMEDS::TMPFile_var aStream; + CORBA::Long anObjectID; + + SALOMEDS::unlock(); + aStream = _driver->CopyFrom(so.in(), anObjectID); + SALOMEDS::lock(); + + theObjectID = anObjectID; + theStreamLength = aStream->length(); + + unsigned char* aRetStream = NULL; + if(theStreamLength > 0) { + aRetStream = new unsigned char[theStreamLength]; + memcpy(aRetStream, aStream->NP_data(), theStreamLength); + } + +/* + int fd = open("/dn05/salome/srn/sh_copy.brep", O_CREAT | O_WRONLY); + cout << "Written " << write(fd, (char*)aRetStream, theStreamLength) << endl; + close(fd); +*/ + return aRetStream; +} + +bool SALOMEDS_Driver_i::CanPaste(const TCollection_AsciiString& theComponentName, int theObjectID) +{ + return _driver->CanPaste(theComponentName.ToCString(), theObjectID); +} + +TCollection_AsciiString SALOMEDS_Driver_i::PasteInto(const unsigned char* theStream, + const long theStreamLength, + int theObjectID, + const Handle(SALOMEDSImpl_SObject)& theObject) +{ + SALOMEDS::Locker lock; + + SALOMEDS_SObject_i * so_servant = new SALOMEDS_SObject_i (theObject, _orb); + SALOMEDS::SObject_var so = SALOMEDS::SObject::_narrow(so_servant->_this()); + CORBA::Octet* anOctetBuf = (CORBA::Octet*)theStream; + + SALOMEDS::TMPFile_var aStream; + if(theStreamLength > 0) + aStream = new SALOMEDS::TMPFile(theStreamLength, theStreamLength, anOctetBuf, 0); + else + aStream = new SALOMEDS::TMPFile(0); + + SALOMEDS::unlock(); + SALOMEDS::SObject_var ret_so = _driver->PasteInto(aStream.in(), theObjectID, so.in()); + SALOMEDS::lock(); + + return TCollection_AsciiString((char*)ret_so->GetID()); +} + +unsigned char* SALOMEDS_Driver_i::DumpPython(const Handle(SALOMEDSImpl_Study)& theStudy, + bool isPublished, + bool& isValidScript, + long& theStreamLength) +{ + SALOMEDS_Study_i * st_servant = new SALOMEDS_Study_i (theStudy, _orb); + SALOMEDS::Study_var st = SALOMEDS::Study::_narrow(st_servant->_this()); + Engines::TMPFile_var aStream; + CORBA::Boolean aValidScript, aPublished; + aPublished = isPublished; + Engines::Component_ptr aComponent = Engines::Component::_narrow(_driver); + aStream = aComponent->DumpPython(st.in(), aPublished, aValidScript); + isValidScript = aValidScript; + theStreamLength = aStream->length(); + unsigned char* aRetStream = NULL; + + if(theStreamLength > 0) { + aRetStream = new unsigned char[theStreamLength]; + memcpy(aRetStream, aStream->NP_data(), theStreamLength); + } + + return aRetStream; +} + +//############################################################################################################### +// SALOMEDS_DriverFactory +//############################################################################################################### + +SALOMEDSImpl_Driver* SALOMEDS_DriverFactory_i::GetDriverByType(const TCollection_AsciiString& theComponentType) +{ + CORBA::Object_var obj; + + TCollection_AsciiString aFactoryType; + if (theComponentType == "SUPERV") aFactoryType = "SuperVisionContainer"; + else aFactoryType = "FactoryServer"; + + obj = SALOME_LifeCycleCORBA(_name_service).FindOrLoad_Component(aFactoryType.ToCString(), + theComponentType.ToCString()); + + if (CORBA::is_nil(obj)) { + obj = SALOME_LifeCycleCORBA(_name_service).FindOrLoad_Component("FactoryServerPy", theComponentType.ToCString()); + } + + if (!CORBA::is_nil(obj)) { + SALOMEDS::Driver_var aDriver = SALOMEDS::Driver::_narrow(obj); + return new SALOMEDS_Driver_i(aDriver, _orb); + } + + return NULL; +} + +SALOMEDSImpl_Driver* SALOMEDS_DriverFactory_i::GetDriverByIOR(const TCollection_AsciiString& theIOR) +{ + CORBA::Object_var obj; + obj = _orb->string_to_object(theIOR.ToCString()); + + if (!CORBA::is_nil(obj)) { + SALOMEDS::Driver_var aDriver = SALOMEDS::Driver::_narrow(obj); + return new SALOMEDS_Driver_i(aDriver, _orb); + } + + return NULL; +} diff --git a/src/SALOMEDS/SALOMEDS_Driver_i.hxx b/src/SALOMEDS/SALOMEDS_Driver_i.hxx new file mode 100644 index 000000000..f5bf3ad81 --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_Driver_i.hxx @@ -0,0 +1,122 @@ +#ifndef __SALOMEDS_DRIVER_I_H__ +#define __SALOMEDS_DRIVER_I_H__ + +#include +#include +#include "SALOMEDSImpl_Driver.hxx" +#include "SALOMEDSImpl_SComponent.hxx" +#include "SALOMEDSImpl_SObject.hxx" + +#include +#include CORBA_SERVER_HEADER(SALOMEDS) +#include CORBA_SERVER_HEADER(SALOME_Component) + +class SALOMEDS_Driver_i : public virtual SALOMEDSImpl_Driver +{ +protected: + SALOMEDS::Driver_var _driver; + CORBA::ORB_ptr _orb; + +public: + + SALOMEDS_Driver_i(SALOMEDS::Driver_ptr theDriver, CORBA::ORB_ptr theORB) + { + _driver = SALOMEDS::Driver::_duplicate(theDriver); + _orb = CORBA::ORB::_duplicate(theORB); + } + + virtual TCollection_AsciiString GetIOR() + { + CORBA::String_var ior = _orb->object_to_string(_driver); + return TCollection_AsciiString(ior); + } + + virtual unsigned char* Save(const Handle(SALOMEDSImpl_SComponent)& theComponent, + const TCollection_AsciiString& theURL, + long& theStreamLength, + bool isMultiFile); + + virtual unsigned char* SaveASCII(const Handle(SALOMEDSImpl_SComponent)& theComponent, + const TCollection_AsciiString& theURL, + long& theStreamLength, + bool isMultiFile); + + virtual bool Load(const Handle(SALOMEDSImpl_SComponent)& theComponent, + const unsigned char* theStream, + const long theStreamLength, + const TCollection_AsciiString& theURL, + bool isMultiFile); + + virtual bool LoadASCII(const Handle(SALOMEDSImpl_SComponent)& theComponent, + const unsigned char* theStream, + const long theStreamLength, + const TCollection_AsciiString& theURL, + bool isMultiFile); + + virtual void Close(const Handle(SALOMEDSImpl_SComponent)& theComponent); + + virtual TCollection_AsciiString ComponentDataType() + { + CORBA::String_var ior = _driver->ComponentDataType(); + return TCollection_AsciiString(ior); + } + + + virtual TCollection_AsciiString IORToLocalPersistentID(const Handle(SALOMEDSImpl_SObject)& theSObject, + const TCollection_AsciiString& IORString, + bool isMultiFile, + bool isASCII); + + virtual TCollection_AsciiString LocalPersistentIDToIOR(const Handle(SALOMEDSImpl_SObject)& theSObject, + const TCollection_AsciiString& aLocalPersistentID, + bool isMultiFile, + bool isASCII); + + virtual bool CanCopy(const Handle(SALOMEDSImpl_SObject)& theObject); + + virtual unsigned char* CopyFrom(const Handle(SALOMEDSImpl_SObject)& theObject, + int& theObjectID, + long& theStreamLength); + + virtual bool CanPaste(const TCollection_AsciiString& theComponentName, int theObjectID); + + virtual TCollection_AsciiString PasteInto(const unsigned char* theStream, + const long theStreamLength, + int theObjectID, + const Handle(SALOMEDSImpl_SObject)& theObject); + + virtual unsigned char* DumpPython(const Handle(SALOMEDSImpl_Study)& theStudy, + bool isPublished, + bool& isValidScript, + long& theStreamLength); +}; + +#include "SALOME_NamingService.hxx" +#include "SALOME_LifeCycleCORBA.hxx" + +class SALOMEDS_DriverFactory_i : public virtual SALOMEDSImpl_DriverFactory +{ +protected: + CORBA::ORB_ptr _orb; + SALOME_NamingService* _name_service; + +public: + + SALOMEDS_DriverFactory_i(CORBA::ORB_ptr theORB) + { + _orb = CORBA::ORB::_duplicate(theORB); + _name_service = new SALOME_NamingService(_orb); + } + + + ~SALOMEDS_DriverFactory_i() + { + delete _name_service; + } + + virtual SALOMEDSImpl_Driver* GetDriverByType(const TCollection_AsciiString& theComponentType); + + virtual SALOMEDSImpl_Driver* GetDriverByIOR(const TCollection_AsciiString& theIOR); +}; + +#endif diff --git a/src/SALOMEDS/SALOMEDS_ExpandableAttribute.cdl b/src/SALOMEDS/SALOMEDS_ExpandableAttribute.cdl deleted file mode 100644 index 7b325db3d..000000000 --- a/src/SALOMEDS/SALOMEDS_ExpandableAttribute.cdl +++ /dev/null @@ -1,77 +0,0 @@ --- SALOME SALOMEDS : data structure of SALOME and sources of Salome data server --- --- Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, --- CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS --- --- This library is free software; you can redistribute it and/or --- modify it under the terms of the GNU Lesser General Public --- License as published by the Free Software Foundation; either --- version 2.1 of the License. --- --- This library is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --- Lesser General Public License for more details. --- --- You should have received a copy of the GNU Lesser General Public --- License along with this library; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --- --- See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org --- --- --- --- File : SALOMEDS_ExpandableAttribute.cdl --- Author : Yves FRICAUD --- Module : SALOME - -class ExpandableAttribute from SALOMEDS inherits Integer from TDataStd - - ---Purpose: - - -uses Attribute from TDF, - Label from TDF, - GUID from Standard, - ExtendedString from TCollection, - DataSet from TDF, - RelocationTable from TDF, - AttributeSequence from TDF, - Data from TDF, - Comment from TDataStd - - -is - - - ---Purpose: class methods - -- ============= - - GetID (myclass) - ---C++: return const & - returns GUID from Standard; - - Set (myclass; label : Label from TDF; value : Integer from Standard) - ---Purpose: Find, or create a Comment attribute and set the string. - -- the Comment attribute is returned. - returns ExpandableAttribute from SALOMEDS; - - ---Purpose: Comment methods - -- ============ - - Create - returns mutable ExpandableAttribute from SALOMEDS; - - ID (me) - ---C++: return const & - returns GUID from Standard; - - Restore (me: mutable; with : Attribute from TDF); - - NewEmpty (me) - returns mutable Attribute from TDF; - - Paste (me; into : mutable Attribute from TDF; - RT : mutable RelocationTable from TDF); - -end ExpandableAttribute; diff --git a/src/SALOMEDS/SALOMEDS_ExpandableAttribute.cxx b/src/SALOMEDS/SALOMEDS_ExpandableAttribute.cxx deleted file mode 100644 index 2ab9ebdd5..000000000 --- a/src/SALOMEDS/SALOMEDS_ExpandableAttribute.cxx +++ /dev/null @@ -1,114 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : SALOMEDS_ExpandableAttribute.cxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_ExpandableAttribute.ixx" -#include -using namespace std; - -//======================================================================= -//function : GetID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_ExpandableAttribute::GetID () -{ - static Standard_GUID SALOMEDS_ExpandableAttributeID ("12837185-8F52-11d6-A8A3-0001021E8C7F"); - return SALOMEDS_ExpandableAttributeID; -} - - - -//======================================================================= -//function : Set -//purpose : -//======================================================================= - -Handle(SALOMEDS_ExpandableAttribute) SALOMEDS_ExpandableAttribute::Set (const TDF_Label& L, - const Standard_Integer value) -{ - Handle(SALOMEDS_ExpandableAttribute) A; - if (!L.FindAttribute(SALOMEDS_ExpandableAttribute::GetID(),A)) { - A = new SALOMEDS_ExpandableAttribute(); - L.AddAttribute(A); - } - - (Handle(TDataStd_Integer)::DownCast(A))->Set (value); - return A; -} - - -//======================================================================= -//function : constructor -//purpose : -//======================================================================= -SALOMEDS_ExpandableAttribute::SALOMEDS_ExpandableAttribute() -{ - TDataStd_Integer::Set(0); -} - -//======================================================================= -//function : ID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_ExpandableAttribute::ID () const { return GetID(); } - - -//======================================================================= -//function : NewEmpty -//purpose : -//======================================================================= - -Handle(TDF_Attribute) SALOMEDS_ExpandableAttribute::NewEmpty () const -{ - return new SALOMEDS_ExpandableAttribute(); -} - -//======================================================================= -//function : Restore -//purpose : -//======================================================================= - -void SALOMEDS_ExpandableAttribute::Restore(const Handle(TDF_Attribute)& with) -{ - Standard_Integer s = Handle(TDataStd_Integer)::DownCast (with)->Get (); - TDataStd_Integer::Set(s); - return; -} - -//======================================================================= -//function : Paste -//purpose : -//======================================================================= - -void SALOMEDS_ExpandableAttribute::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& RT) const -{ - Handle(TDataStd_Integer)::DownCast (into)->Set (Get()); -} - diff --git a/src/SALOMEDS/SALOMEDS_ExpandableAttribute.hxx b/src/SALOMEDS/SALOMEDS_ExpandableAttribute.hxx deleted file mode 100644 index 118f356b4..000000000 --- a/src/SALOMEDS/SALOMEDS_ExpandableAttribute.hxx +++ /dev/null @@ -1,127 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : SALOMEDS_ExpandableAttribute.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _SALOMEDS_ExpandableAttribute_HeaderFile -#define _SALOMEDS_ExpandableAttribute_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_SALOMEDS_ExpandableAttribute_HeaderFile -#include -#endif - -#ifndef _TDataStd_Integer_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Handle_TDF_Attribute_HeaderFile -#include -#endif -#ifndef _Handle_TDF_RelocationTable_HeaderFile -#include -#endif -class Standard_GUID; -class TDF_Label; -class TDF_Attribute; -class TDF_RelocationTable; - - -class SALOMEDS_ExpandableAttribute : public TDataStd_Integer { - -public: - - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - // Methods PUBLIC - // -Standard_EXPORT static const Standard_GUID& GetID() ; -Standard_EXPORT static Handle_SALOMEDS_ExpandableAttribute Set(const TDF_Label& label,const Standard_Integer value) ; -Standard_EXPORT SALOMEDS_ExpandableAttribute(); -Standard_EXPORT const Standard_GUID& ID() const; -Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ; -Standard_EXPORT Handle_TDF_Attribute NewEmpty() const; -Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const; -Standard_EXPORT ~SALOMEDS_ExpandableAttribute(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_ExpandableAttribute_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - -}; - - - - - -// other inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/SALOMEDS/SALOMEDS_ExpandableAttribute.ixx b/src/SALOMEDS/SALOMEDS_ExpandableAttribute.ixx deleted file mode 100644 index 7000b202a..000000000 --- a/src/SALOMEDS/SALOMEDS_ExpandableAttribute.ixx +++ /dev/null @@ -1,87 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : SALOMEDS_ExpandableAttribute.ixx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_ExpandableAttribute.jxx" - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -SALOMEDS_ExpandableAttribute::~SALOMEDS_ExpandableAttribute() {} - - - -Standard_EXPORT Handle_Standard_Type& SALOMEDS_ExpandableAttribute_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TDataStd_Integer); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDataStd_Integer); - static Handle_Standard_Type aType2 = STANDARD_TYPE(TDF_Attribute); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(TDF_Attribute); - static Handle_Standard_Type aType3 = STANDARD_TYPE(MMgt_TShared); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType4 = STANDARD_TYPE(Standard_Transient); - if ( aType4.IsNull()) aType4 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_ExpandableAttribute", - sizeof(SALOMEDS_ExpandableAttribute), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(SALOMEDS_ExpandableAttribute) Handle(SALOMEDS_ExpandableAttribute)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(SALOMEDS_ExpandableAttribute) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_ExpandableAttribute))) { - _anOtherObject = Handle(SALOMEDS_ExpandableAttribute)((Handle(SALOMEDS_ExpandableAttribute)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& SALOMEDS_ExpandableAttribute::DynamicType() const -{ - return STANDARD_TYPE(SALOMEDS_ExpandableAttribute) ; -} -Standard_Boolean SALOMEDS_ExpandableAttribute::IsKind(const Handle(Standard_Type)& AType) const -{ - return (STANDARD_TYPE(SALOMEDS_ExpandableAttribute) == AType || TDataStd_Integer::IsKind(AType)); -} -Handle_SALOMEDS_ExpandableAttribute::~Handle_SALOMEDS_ExpandableAttribute() {} - diff --git a/src/SALOMEDS/SALOMEDS_ExpandableAttribute.jxx b/src/SALOMEDS/SALOMEDS_ExpandableAttribute.jxx deleted file mode 100644 index 8e7ac5daa..000000000 --- a/src/SALOMEDS/SALOMEDS_ExpandableAttribute.jxx +++ /dev/null @@ -1,43 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : SALOMEDS_ExpandableAttribute.jxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _Standard_GUID_HeaderFile -#include -#endif -#ifndef _TDF_Label_HeaderFile -#include -#endif -#ifndef _TDF_Attribute_HeaderFile -#include -#endif -#ifndef _TDF_RelocationTable_HeaderFile -#include -#endif -#ifndef _SALOMEDS_ExpandableAttribute_HeaderFile -#include "SALOMEDS_ExpandableAttribute.hxx" -#endif diff --git a/src/SALOMEDS/SALOMEDS_ExternalFileDef.cdl b/src/SALOMEDS/SALOMEDS_ExternalFileDef.cdl deleted file mode 100644 index a5ab6d282..000000000 --- a/src/SALOMEDS/SALOMEDS_ExternalFileDef.cdl +++ /dev/null @@ -1,76 +0,0 @@ --- SALOME SALOMEDS : data structure of SALOME and sources of Salome data server --- --- Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, --- CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS --- --- This library is free software; you can redistribute it and/or --- modify it under the terms of the GNU Lesser General Public --- License as published by the Free Software Foundation; either --- version 2.1 of the License. --- --- This library is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --- Lesser General Public License for more details. --- --- You should have received a copy of the GNU Lesser General Public --- License along with this library; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --- --- See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org --- --- --- --- File : SALOMEDS_ExternalFileDef.cdl --- Author : Yves FRICAUD --- Module : SALOME - -class ExternalFileDef from SALOMEDS inherits Comment from TDataStd - - ---Purpose: - - -uses Attribute from TDF, - Label from TDF, - GUID from Standard, - ExtendedString from TCollection, - DataSet from TDF, - RelocationTable from TDF, - AttributeSequence from TDF, - Data from TDF, - Comment from TDataStd - - -is - - - ---Purpose: class methods - -- ============= - - GetID (myclass) - ---C++: return const & - returns GUID from Standard; - - Set (myclass; label : Label from TDF; - Name : ExtendedString from TCollection) - returns ExternalFileDef from SALOMEDS; - - ---Purpose: Comment methods - -- ============ - - Create - returns mutable ExternalFileDef from SALOMEDS; - - ID (me) - ---C++: return const & - returns GUID from Standard; - - Restore (me: mutable; with : Attribute from TDF); - - NewEmpty (me) - returns mutable Attribute from TDF; - - Paste (me; into : mutable Attribute from TDF; - RT : mutable RelocationTable from TDF); - -end ExternalFileDef; diff --git a/src/SALOMEDS/SALOMEDS_ExternalFileDef.cxx b/src/SALOMEDS/SALOMEDS_ExternalFileDef.cxx deleted file mode 100644 index 3b5af8399..000000000 --- a/src/SALOMEDS/SALOMEDS_ExternalFileDef.cxx +++ /dev/null @@ -1,114 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : SALOMEDS_ExternalFileDef.cxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_ExternalFileDef.ixx" -#include -#include -using namespace std; - -//======================================================================= -//function : GetID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_ExternalFileDef::GetID () -{ - static Standard_GUID SALOMEDS_ExternalFileDefID ("7123AD4C-ACDB-4e3a-8FDC-70EA164D2CBE"); - return SALOMEDS_ExternalFileDefID; -} - - - -//======================================================================= -//function : Set -//purpose : -//======================================================================= - -Handle(SALOMEDS_ExternalFileDef) SALOMEDS_ExternalFileDef::Set (const TDF_Label& L, - const TCollection_ExtendedString& S) -{ - - Handle(SALOMEDS_ExternalFileDef) A; - if (!L.FindAttribute(SALOMEDS_ExternalFileDef::GetID(),A)) { - A = new SALOMEDS_ExternalFileDef(); - L.AddAttribute(A); - } - - (Handle(TDataStd_Comment)::DownCast(A))->Set (S); - return A; -} - - -//======================================================================= -//function : constructor -//purpose : -//======================================================================= -SALOMEDS_ExternalFileDef::SALOMEDS_ExternalFileDef() -{} - -//======================================================================= -//function : ID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_ExternalFileDef::ID () const { return GetID(); } - - -//======================================================================= -//function : NewEmpty -//purpose : -//======================================================================= - -Handle(TDF_Attribute) SALOMEDS_ExternalFileDef::NewEmpty () const -{ - return new SALOMEDS_ExternalFileDef(); -} - -//======================================================================= -//function : Restore -//purpose : -//======================================================================= - -void SALOMEDS_ExternalFileDef::Restore(const Handle(TDF_Attribute)& with) -{ - TCollection_ExtendedString s = Handle(TDataStd_Comment)::DownCast (with)->Get (); - TDataStd_Comment::Set(s); - return; -} - -//======================================================================= -//function : Paste -//purpose : -//======================================================================= - -void SALOMEDS_ExternalFileDef::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& RT) const -{ - Handle(TDataStd_Comment)::DownCast (into)->Set (Get()); -} - diff --git a/src/SALOMEDS/SALOMEDS_ExternalFileDef.hxx b/src/SALOMEDS/SALOMEDS_ExternalFileDef.hxx deleted file mode 100644 index 5abb1838f..000000000 --- a/src/SALOMEDS/SALOMEDS_ExternalFileDef.hxx +++ /dev/null @@ -1,108 +0,0 @@ -// File generated by CPPExt (Transient) -// -// Copyright (C) 1991,1995 by -// -// MATRA DATAVISION, FRANCE -// -// This software is furnished in accordance with the terms and conditions -// of the contract and with the inclusion of the above copyright notice. -// This software or any other copy thereof may not be provided or otherwise -// be made available to any other person. No title to an ownership of the -// software is hereby transferred. -// -// At the termination of the contract, the software and all copies of this -// software must be deleted. -// -#ifndef _SALOMEDS_ExternalFileDef_HeaderFile -#define _SALOMEDS_ExternalFileDef_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_SALOMEDS_ExternalFileDef_HeaderFile -#include -#endif - -#ifndef _TDataStd_Comment_HeaderFile -#include -#endif -#ifndef _Handle_TDF_Attribute_HeaderFile -#include -#endif -#ifndef _Handle_TDF_RelocationTable_HeaderFile -#include -#endif -class Standard_GUID; -class TDF_Label; -class TCollection_ExtendedString; -class TDF_Attribute; -class TDF_RelocationTable; - - -class SALOMEDS_ExternalFileDef : public TDataStd_Comment { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // -Standard_EXPORT static const Standard_GUID& GetID() ; -Standard_EXPORT static Handle_SALOMEDS_ExternalFileDef Set(const TDF_Label& label,const TCollection_ExtendedString& Name) ; -Standard_EXPORT SALOMEDS_ExternalFileDef(); -Standard_EXPORT const Standard_GUID& ID() const; -Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ; -Standard_EXPORT Handle_TDF_Attribute NewEmpty() const; -Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const; -Standard_EXPORT ~SALOMEDS_ExternalFileDef(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_ExternalFileDef_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - -}; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/SALOMEDS/SALOMEDS_ExternalFileDef.ixx b/src/SALOMEDS/SALOMEDS_ExternalFileDef.ixx deleted file mode 100644 index 2235302e0..000000000 --- a/src/SALOMEDS/SALOMEDS_ExternalFileDef.ixx +++ /dev/null @@ -1,73 +0,0 @@ -// File generated by CPPExt (Transient) -// Copyright (C) 1991,1995 by -// -// MATRA DATAVISION, FRANCE -// -// This software is furnished in accordance with the terms and conditions -// of the contract and with the inclusion of the above copyright notice. -// This software or any other copy thereof may not be provided or otherwise -// be made available to any other person. No title to an ownership of the -// software is hereby transferred. -// -// At the termination of the contract, the software and all copies of this -// software must be deleted. -// -#include - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -SALOMEDS_ExternalFileDef::~SALOMEDS_ExternalFileDef() {} - - - -Standard_EXPORT Handle_Standard_Type& SALOMEDS_ExternalFileDef_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TDataStd_Comment); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDataStd_Comment); - static Handle_Standard_Type aType2 = STANDARD_TYPE(TDF_Attribute); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(TDF_Attribute); - static Handle_Standard_Type aType3 = STANDARD_TYPE(MMgt_TShared); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType4 = STANDARD_TYPE(Standard_Transient); - if ( aType4.IsNull()) aType4 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_ExternalFileDef", - sizeof(SALOMEDS_ExternalFileDef), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(SALOMEDS_ExternalFileDef) Handle(SALOMEDS_ExternalFileDef)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(SALOMEDS_ExternalFileDef) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_ExternalFileDef))) { - _anOtherObject = Handle(SALOMEDS_ExternalFileDef)((Handle(SALOMEDS_ExternalFileDef)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& SALOMEDS_ExternalFileDef::DynamicType() const -{ - return STANDARD_TYPE(SALOMEDS_ExternalFileDef) ; -} -Standard_Boolean SALOMEDS_ExternalFileDef::IsKind(const Handle(Standard_Type)& AType) const -{ - return (STANDARD_TYPE(SALOMEDS_ExternalFileDef) == AType || TDataStd_Comment::IsKind(AType)); -} -Handle_SALOMEDS_ExternalFileDef::~Handle_SALOMEDS_ExternalFileDef() {} - diff --git a/src/SALOMEDS/SALOMEDS_ExternalFileDef.jxx b/src/SALOMEDS/SALOMEDS_ExternalFileDef.jxx deleted file mode 100644 index 32adbec66..000000000 --- a/src/SALOMEDS/SALOMEDS_ExternalFileDef.jxx +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef _Standard_GUID_HeaderFile -#include -#endif -#ifndef _TDF_Label_HeaderFile -#include -#endif -#ifndef _TCollection_ExtendedString_HeaderFile -#include -#endif -#ifndef _TDF_Attribute_HeaderFile -#include -#endif -#ifndef _TDF_RelocationTable_HeaderFile -#include -#endif -#ifndef _SALOMEDS_ExternalFileDef_HeaderFile -#include -#endif diff --git a/src/SALOMEDS/SALOMEDS_FileType.cdl b/src/SALOMEDS/SALOMEDS_FileType.cdl deleted file mode 100644 index d9e43f29c..000000000 --- a/src/SALOMEDS/SALOMEDS_FileType.cdl +++ /dev/null @@ -1,76 +0,0 @@ --- SALOME SALOMEDS : data structure of SALOME and sources of Salome data server --- --- Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, --- CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS --- --- This library is free software; you can redistribute it and/or --- modify it under the terms of the GNU Lesser General Public --- License as published by the Free Software Foundation; either --- version 2.1 of the License. --- --- This library is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --- Lesser General Public License for more details. --- --- You should have received a copy of the GNU Lesser General Public --- License along with this library; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --- --- See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org --- --- --- --- File : SALOMEDS_FileType.cdl --- Author : Yves FRICAUD --- Module : SALOME - -class FileType from SALOMEDS inherits Comment from TDataStd - - ---Purpose: - - -uses Attribute from TDF, - Label from TDF, - GUID from Standard, - ExtendedString from TCollection, - DataSet from TDF, - RelocationTable from TDF, - AttributeSequence from TDF, - Data from TDF, - Comment from TDataStd - - -is - - - ---Purpose: class methods - -- ============= - - GetID (myclass) - ---C++: return const & - returns GUID from Standard; - - Set (myclass; label : Label from TDF; - Name : ExtendedString from TCollection) - returns FileType from SALOMEDS; - - ---Purpose: Comment methods - -- ============ - - Create - returns mutable FileType from SALOMEDS; - - ID (me) - ---C++: return const & - returns GUID from Standard; - - Restore (me: mutable; with : Attribute from TDF); - - NewEmpty (me) - returns mutable Attribute from TDF; - - Paste (me; into : mutable Attribute from TDF; - RT : mutable RelocationTable from TDF); - -end FileType; diff --git a/src/SALOMEDS/SALOMEDS_FileType.cxx b/src/SALOMEDS/SALOMEDS_FileType.cxx deleted file mode 100644 index a26ebe3f4..000000000 --- a/src/SALOMEDS/SALOMEDS_FileType.cxx +++ /dev/null @@ -1,114 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : SALOMEDS_FileType.cxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_FileType.ixx" -#include -#include -using namespace std; - -//======================================================================= -//function : GetID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_FileType::GetID () -{ - static Standard_GUID SALOMEDS_FileTypeID ("0181B525-3F15-4ab2-9DE3-5E2F54B5F340"); - return SALOMEDS_FileTypeID; -} - - - -//======================================================================= -//function : Set -//purpose : -//======================================================================= - -Handle(SALOMEDS_FileType) SALOMEDS_FileType::Set (const TDF_Label& L, - const TCollection_ExtendedString& S) -{ - - Handle(SALOMEDS_FileType) A; - if (!L.FindAttribute(SALOMEDS_FileType::GetID(),A)) { - A = new SALOMEDS_FileType(); - L.AddAttribute(A); - } - - (Handle(TDataStd_Comment)::DownCast(A))->Set (S); - return A; -} - - -//======================================================================= -//function : constructor -//purpose : -//======================================================================= -SALOMEDS_FileType::SALOMEDS_FileType() -{} - -//======================================================================= -//function : ID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_FileType::ID () const { return GetID(); } - - -//======================================================================= -//function : NewEmpty -//purpose : -//======================================================================= - -Handle(TDF_Attribute) SALOMEDS_FileType::NewEmpty () const -{ - return new SALOMEDS_FileType(); -} - -//======================================================================= -//function : Restore -//purpose : -//======================================================================= - -void SALOMEDS_FileType::Restore(const Handle(TDF_Attribute)& with) -{ - TCollection_ExtendedString s = Handle(TDataStd_Comment)::DownCast (with)->Get (); - TDataStd_Comment::Set(s); - return; -} - -//======================================================================= -//function : Paste -//purpose : -//======================================================================= - -void SALOMEDS_FileType::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& RT) const -{ - Handle(TDataStd_Comment)::DownCast (into)->Set (Get()); -} - diff --git a/src/SALOMEDS/SALOMEDS_FileType.hxx b/src/SALOMEDS/SALOMEDS_FileType.hxx deleted file mode 100644 index d912aaafc..000000000 --- a/src/SALOMEDS/SALOMEDS_FileType.hxx +++ /dev/null @@ -1,108 +0,0 @@ -// File generated by CPPExt (Transient) -// -// Copyright (C) 1991,1995 by -// -// MATRA DATAVISION, FRANCE -// -// This software is furnished in accordance with the terms and conditions -// of the contract and with the inclusion of the above copyright notice. -// This software or any other copy thereof may not be provided or otherwise -// be made available to any other person. No title to an ownership of the -// software is hereby transferred. -// -// At the termination of the contract, the software and all copies of this -// software must be deleted. -// -#ifndef _SALOMEDS_FileType_HeaderFile -#define _SALOMEDS_FileType_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_SALOMEDS_FileType_HeaderFile -#include -#endif - -#ifndef _TDataStd_Comment_HeaderFile -#include -#endif -#ifndef _Handle_TDF_Attribute_HeaderFile -#include -#endif -#ifndef _Handle_TDF_RelocationTable_HeaderFile -#include -#endif -class Standard_GUID; -class TDF_Label; -class TCollection_ExtendedString; -class TDF_Attribute; -class TDF_RelocationTable; - - -class SALOMEDS_FileType : public TDataStd_Comment { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // -Standard_EXPORT static const Standard_GUID& GetID() ; -Standard_EXPORT static Handle_SALOMEDS_FileType Set(const TDF_Label& label,const TCollection_ExtendedString& Name) ; -Standard_EXPORT SALOMEDS_FileType(); -Standard_EXPORT const Standard_GUID& ID() const; -Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ; -Standard_EXPORT Handle_TDF_Attribute NewEmpty() const; -Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const; -Standard_EXPORT ~SALOMEDS_FileType(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_FileType_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - -}; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/SALOMEDS/SALOMEDS_FileType.ixx b/src/SALOMEDS/SALOMEDS_FileType.ixx deleted file mode 100644 index 505e39dab..000000000 --- a/src/SALOMEDS/SALOMEDS_FileType.ixx +++ /dev/null @@ -1,73 +0,0 @@ -// File generated by CPPExt (Transient) -// Copyright (C) 1991,1995 by -// -// MATRA DATAVISION, FRANCE -// -// This software is furnished in accordance with the terms and conditions -// of the contract and with the inclusion of the above copyright notice. -// This software or any other copy thereof may not be provided or otherwise -// be made available to any other person. No title to an ownership of the -// software is hereby transferred. -// -// At the termination of the contract, the software and all copies of this -// software must be deleted. -// -#include - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -SALOMEDS_FileType::~SALOMEDS_FileType() {} - - - -Standard_EXPORT Handle_Standard_Type& SALOMEDS_FileType_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TDataStd_Comment); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDataStd_Comment); - static Handle_Standard_Type aType2 = STANDARD_TYPE(TDF_Attribute); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(TDF_Attribute); - static Handle_Standard_Type aType3 = STANDARD_TYPE(MMgt_TShared); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType4 = STANDARD_TYPE(Standard_Transient); - if ( aType4.IsNull()) aType4 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_FileType", - sizeof(SALOMEDS_FileType), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(SALOMEDS_FileType) Handle(SALOMEDS_FileType)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(SALOMEDS_FileType) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_FileType))) { - _anOtherObject = Handle(SALOMEDS_FileType)((Handle(SALOMEDS_FileType)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& SALOMEDS_FileType::DynamicType() const -{ - return STANDARD_TYPE(SALOMEDS_FileType) ; -} -Standard_Boolean SALOMEDS_FileType::IsKind(const Handle(Standard_Type)& AType) const -{ - return (STANDARD_TYPE(SALOMEDS_FileType) == AType || TDataStd_Comment::IsKind(AType)); -} -Handle_SALOMEDS_FileType::~Handle_SALOMEDS_FileType() {} - diff --git a/src/SALOMEDS/SALOMEDS_FileType.jxx b/src/SALOMEDS/SALOMEDS_FileType.jxx deleted file mode 100644 index 0d838e429..000000000 --- a/src/SALOMEDS/SALOMEDS_FileType.jxx +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef _Standard_GUID_HeaderFile -#include -#endif -#ifndef _TDF_Label_HeaderFile -#include -#endif -#ifndef _TCollection_ExtendedString_HeaderFile -#include -#endif -#ifndef _TDF_Attribute_HeaderFile -#include -#endif -#ifndef _TDF_RelocationTable_HeaderFile -#include -#endif -#ifndef _SALOMEDS_FileType_HeaderFile -#include -#endif diff --git a/src/SALOMEDS/SALOMEDS_FlagsAttribute.cxx b/src/SALOMEDS/SALOMEDS_FlagsAttribute.cxx deleted file mode 100644 index 96ed5bd5d..000000000 --- a/src/SALOMEDS/SALOMEDS_FlagsAttribute.cxx +++ /dev/null @@ -1,162 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : SALOMEDS_FlagsAttribute.cxx -// Author : Sergey LITONIN -// Module : SALOME - -#include "SALOMEDS_FlagsAttribute.hxx" -#include -#include -#include - -using namespace std; - - -/* - Class : SALOMEDS_FlagsAttribute - Description : This class is intended for storing different object attributes that - have only two states (0 and 1). -*/ - -IMPLEMENT_STANDARD_HANDLE( SALOMEDS_FlagsAttribute, TDataStd_Integer ) -IMPLEMENT_STANDARD_RTTIEXT( SALOMEDS_FlagsAttribute, TDataStd_Integer ) - -//======================================================================= -//function : SALOMEDS_FlagsAttribute::GetID -//purpose : Get GUID of this attribute -//======================================================================= -const Standard_GUID& SALOMEDS_FlagsAttribute::GetID () -{ - static Standard_GUID SALOMEDS_FlagsAttributeID( "866EEC9F-A517-4cb4-88E6-E208DB8FC96F" ); - return SALOMEDS_FlagsAttributeID; -} - -//======================================================================= -//function : SALOMEDS_FlagsAttribute::Set -//purpose : Set value of the attribute -//======================================================================= -Handle(SALOMEDS_FlagsAttribute) SALOMEDS_FlagsAttribute::Set( const TDF_Label& L, - const Standard_Integer value ) -{ - Handle(SALOMEDS_FlagsAttribute) A; - if ( !L.FindAttribute(SALOMEDS_FlagsAttribute::GetID(),A ) ) - { - A = new SALOMEDS_FlagsAttribute(); - L.AddAttribute( A ); - } - - ( Handle(TDataStd_Integer)::DownCast( A ) )->Set( value ); - return A; -} - -//======================================================================= -//function : SALOMEDS_FlagsAttribute::SALOMEDS_FlagsAttribute -//purpose : Constructor -//======================================================================= -SALOMEDS_FlagsAttribute::SALOMEDS_FlagsAttribute() -{ - TDataStd_Integer::Set( 0 ); -} - -SALOMEDS_FlagsAttribute::~SALOMEDS_FlagsAttribute() -{ -} - -//======================================================================= -//function : SALOMEDS_FlagsAttribute::ID -//purpose : Get GUID of this attribute -//======================================================================= -const Standard_GUID& SALOMEDS_FlagsAttribute::ID () const -{ - return GetID(); -} - -//======================================================================= -//function : SALOMEDS_FlagsAttribute::NewEmpty -//purpose : Create new empty attribute -//======================================================================= - -Handle(TDF_Attribute) SALOMEDS_FlagsAttribute::NewEmpty () const -{ - return new SALOMEDS_FlagsAttribute(); -} - -//======================================================================= -//function : SALOMEDS_FlagsAttribute::Restore -//purpose : Assign given value to the attribute -//======================================================================= -void SALOMEDS_FlagsAttribute::Restore( const Handle(TDF_Attribute)& with ) -{ - Standard_Integer s = Handle(TDataStd_Integer)::DownCast( with )->Get(); - TDataStd_Integer::Set( s ); - return; -} - -//======================================================================= -//function : SALOMEDS_FlagsAttribute::Paste -//purpose : Assign internal value to the given attribute -//======================================================================= -void SALOMEDS_FlagsAttribute::Paste( const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& RT ) const -{ - Handle(TDataStd_Integer)::DownCast( into )->Set( Get() ); -} - -//======================================================================= -//function : SALOMEDS_FlagsAttribute::Set -//purpose : Set value -//======================================================================= -void SALOMEDS_FlagsAttribute::Set( const Standard_Integer v ) -{ - TDataStd_Integer::Set( v ); -} - -//======================================================================= -//function : SALOMEDS_FlagsAttribute::Get -//purpose : GetValue -//======================================================================= -Standard_Integer SALOMEDS_FlagsAttribute::Get() const -{ - return TDataStd_Integer::Get(); -} - - - - - - - - - - - - - - - - - - - - diff --git a/src/SALOMEDS/SALOMEDS_FlagsAttribute.hxx b/src/SALOMEDS/SALOMEDS_FlagsAttribute.hxx deleted file mode 100644 index 9163156c3..000000000 --- a/src/SALOMEDS/SALOMEDS_FlagsAttribute.hxx +++ /dev/null @@ -1,72 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : SALOMEDS_FlagsAttribute.hxx -// Author : Sergey LITONIN -// Module : SALOME - -#ifndef SALOMEDS_FlagsAttribute_HeaderFile -#define SALOMEDS_FlagsAttribute_HeaderFile - -#include -#include -#include - -class Standard_GUID; -class TDF_Label; -class Handle(TDF_Attribute); -class Handle(TDF_RelocationTable); - - -/* - Class : SALOMEDS_FlagsAttribute - Description : This class is intended for storing different object attributes that - have only two states (0 and 1). -*/ - -DEFINE_STANDARD_HANDLE( SALOMEDS_FlagsAttribute, TDataStd_Integer ) - -class Standard_EXPORT SALOMEDS_FlagsAttribute : public TDataStd_Integer -{ -public: - -static const Standard_GUID& GetID() ; -static Handle(SALOMEDS_FlagsAttribute) Set( const TDF_Label&, - const Standard_Integer ); - - SALOMEDS_FlagsAttribute(); -virtual ~SALOMEDS_FlagsAttribute(); - -const Standard_GUID& ID() const; -void Restore( const Handle(TDF_Attribute)& with ); -Handle_TDF_Attribute NewEmpty() const; -void Paste( const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& RT ) const; -void Set( const Standard_Integer ); -Standard_Integer Get() const; - -public: - DEFINE_STANDARD_RTTI( SALOMEDS_FlagsAttribute ) -}; - -#endif diff --git a/src/SALOMEDS/SALOMEDS_GenericAttribute_i.cxx b/src/SALOMEDS/SALOMEDS_GenericAttribute_i.cxx index b9a24946a..837bce858 100644 --- a/src/SALOMEDS/SALOMEDS_GenericAttribute_i.cxx +++ b/src/SALOMEDS/SALOMEDS_GenericAttribute_i.cxx @@ -1,59 +1,67 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// -// // File : SALOMEDS_GenericAttribute_i.cxx -// Author : Mikhail PONIKAROV +// Author : Sergey RUIN // Module : SALOME -// $Header$ - -#include "SALOMEDS_GenericAttribute_i.hxx" -#include "SALOMEDS_SObject_i.hxx" -#include "SALOMEDS_Study_i.hxx" using namespace std; +#include "utilities.h" +#include "SALOMEDS_GenericAttribute_i.hxx" +#include "SALOMEDS_Attributes.hxx" +#include "SALOMEDS.hxx" +#include "SALOMEDSImpl_SObject.hxx" +#include "Utils_ExceptHandlers.hxx" +#include +UNEXPECT_CATCH(GALockProtection, SALOMEDS::GenericAttribute::LockProtection); -SALOMEDS_GenericAttribute_i::SALOMEDS_GenericAttribute_i(const Handle(TDF_Attribute)& theAttr, - SALOMEDS_SObject_i* theSObject): - _myBasicAttr(theAttr), - _mySObject(theSObject) +SALOMEDS_GenericAttribute_i::SALOMEDS_GenericAttribute_i(const Handle(TDF_Attribute)& theImpl, CORBA::ORB_ptr theOrb) { + _orb = CORBA::ORB::_duplicate(theOrb); + _impl = theImpl; } - -SALOMEDS_GenericAttribute_i::~SALOMEDS_GenericAttribute_i() +void SALOMEDS_GenericAttribute_i::CheckLocked() throw (SALOMEDS::GenericAttribute::LockProtection) { + SALOMEDS::Locker lock; + Unexpect aCatch(GALockProtection); + + if (!_impl.IsNull() && _impl->IsValid() && !CORBA::is_nil(_orb)) { + try { + SALOMEDSImpl_GenericAttribute::Impl_CheckLocked(_impl); + } + catch (...) { + throw SALOMEDS::GenericAttribute::LockProtection(); + } + } } - -char* SALOMEDS_GenericAttribute_i::Store() -{ - return CORBA::string_dup(""); -} - - -void SALOMEDS_GenericAttribute_i::Restore(const char*) +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 = new SALOMEDSImpl_SObject(_impl->Label()); + SALOMEDS_SObject_i * so_servant = new SALOMEDS_SObject_i (so_impl, _orb); + SALOMEDS::SObject_var so = SALOMEDS::SObject::_narrow(so_servant->_this()); + return so._retn(); } char* SALOMEDS_GenericAttribute_i::Type() { - return CORBA::string_dup(SALOMEDS::GetType(_myBasicAttr).c_str()); -} + SALOMEDS::Locker lock; + if (!_impl.IsNull()) { + return CORBA::string_dup(SALOMEDSImpl_GenericAttribute::Impl_GetType(_impl)); + } - -SALOMEDS::SObject_ptr SALOMEDS_GenericAttribute_i::GetSObject() -{ - return _mySObject->_this();; + return ""; } -void SALOMEDS_GenericAttribute_i::CheckLocked() - throw (SALOMEDS::GenericAttribute::LockProtection) +SALOMEDS::GenericAttribute_ptr SALOMEDS_GenericAttribute_i::CreateAttribute(const Handle(TDF_Attribute)& theAttr, + CORBA::ORB_ptr theOrb) { - _mySObject->GetStudyServant()->CheckLocked(); -} + SALOMEDS::Locker lock; + char* aTypeOfAttribute = Handle(SALOMEDSImpl_GenericAttribute)::DownCast(theAttr)->GetClassType().ToCString(); + SALOMEDS::GenericAttribute_var anAttribute; + __CreateGenericCORBAAttribute + return anAttribute._retn(); +} diff --git a/src/SALOMEDS/SALOMEDS_GenericAttribute_i.hxx b/src/SALOMEDS/SALOMEDS_GenericAttribute_i.hxx index 80a7c96e0..c3c2406a2 100644 --- a/src/SALOMEDS/SALOMEDS_GenericAttribute_i.hxx +++ b/src/SALOMEDS/SALOMEDS_GenericAttribute_i.hxx @@ -1,160 +1,42 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// // File : SALOMEDS_GenericAttribute_i.hxx -// Author : Yves FRICAUD +// Author : Sergey RUIN // Module : SALOME -// $Header$ #ifndef _GENERIC_ATTRIBUTE_I_HXX_ #define _GENERIC_ATTRIBUTE_I_HXX_ -#include -#include - // IDL headers #include #include CORBA_SERVER_HEADER(SALOMEDS) +#include +#include "SALOMEDS_SObject_i.hxx" +#include "SALOMEDSImpl_GenericAttribute.hxx" -class SALOMEDS_SObject_i; - -class SALOMEDS_GenericAttribute_i: - public virtual POA_SALOMEDS::GenericAttribute, - public virtual PortableServer::RefCountServantBase -{ -private: - friend class SALOMEDS_SObject_i; - - SALOMEDS_GenericAttribute_i(); // Not implemented - void operator=(const SALOMEDS_GenericAttribute_i&); //Not implemented +class SALOMEDS_GenericAttribute_i: public POA_SALOMEDS::GenericAttribute, + public PortableServer::RefCountServantBase +{ protected: - SALOMEDS_SObject_i* _mySObject; - Handle(TDF_Attribute) _myBasicAttr; - - SALOMEDS_GenericAttribute_i(const Handle(TDF_Attribute)& theAttr, - SALOMEDS_SObject_i* theSObject); - - virtual ~SALOMEDS_GenericAttribute_i(); + Handle(TDF_Attribute) _impl; + CORBA::ORB_ptr _orb; - void SetBasicAttribute(const Handle(TDF_Attribute)& theAttr){ - _myBasicAttr = theAttr; - } - public: - void Restore(const char*); + SALOMEDS_GenericAttribute_i(const Handle(TDF_Attribute)& theImpl, CORBA::ORB_ptr theOrb); + virtual ~SALOMEDS_GenericAttribute_i() {}; - char* Store(); - - char* Type(); + void CheckLocked() throw (SALOMEDS::GenericAttribute::LockProtection); - SALOMEDS::SObject_ptr GetSObject(); - - void CheckLocked() - throw (SALOMEDS::GenericAttribute::LockProtection); - - virtual void SetAttribute(const Handle(TDF_Attribute)& theAttr) = 0; - - virtual const Handle(TDF_Attribute)& GetAttribute() const = 0; - -}; - - -template -class SALOMEDS_TGenericAttribute_i: - public virtual SALOMEDS_GenericAttribute_i -{ -public: - typedef TDFAttribute TAttr; - typedef TStoreTDFAttribute TStoreAttr; - - virtual void SetAttribute(const Handle(TDF_Attribute)& theAttr){ - _myAttr = TStoreAttr::DownCast(theAttr); - SetBasicAttribute(theAttr); - } - virtual const Handle(TDF_Attribute)& GetAttribute() const{ - return _myAttr; - } - static bool IsCheckLockedStudy(){ - return TIsCheckLockedStudy; - } - static Handle(TDF_Attribute) NewAttribute(){ - return new TAttr; - } - -protected: - TStoreAttr _myAttr; + char* Type(); - SALOMEDS_TGenericAttribute_i(const Handle(TDF_Attribute)& theAttr, - SALOMEDS_SObject_i* theSObject): - SALOMEDS_GenericAttribute_i(theAttr,theSObject), - _myAttr(TStoreAttr::DownCast(theAttr)) - { - } + SALOMEDS::SObject_ptr GetSObject(); -private: - friend class SALOMEDS_SObject_i; + virtual Handle(TDF_Attribute) GetImpl() { return _impl; } - SALOMEDS_TGenericAttribute_i(); //Not implemented - void operator=(const SALOMEDS_TGenericAttribute_i&); //Not implemented + static SALOMEDS::GenericAttribute_ptr CreateAttribute(const Handle(TDF_Attribute)& theAttr, CORBA::ORB_ptr theOrb); + //SRN (Feb 14, 2005): Depricated, to be removed from IDL + virtual char* Store() {return ""; }; + virtual void Restore(const char*) {}; }; - -#define DEFINE_DERIVED_ATTR(TName,TAttr,TCheck) \ - typedef SALOMEDS_TGenericAttribute_i \ - SALOMEDS_T##TName##_i - - -#define DEFINE_DERIVED_ATTR_METH_BASE(TName) \ -public: \ - friend class SALOMEDS_SObject_i; \ - static SALOMEDS_GenericAttribute_i* \ - NewInstance(const Handle(TDF_Attribute)& theAttr, \ - SALOMEDS_SObject_i* theSObject) \ - { return new SALOMEDS_##TName##_i(theAttr,theSObject);} \ -private: \ - SALOMEDS_##TName##_i(const Handle(TDF_Attribute)& theAttr, \ - SALOMEDS_SObject_i* theSObject): \ - SALOMEDS_GenericAttribute_i(theAttr,theSObject), \ - SALOMEDS_T##TName##_i(theAttr,theSObject) \ - {} \ - void operator=(const SALOMEDS_##TName##_i&); \ - SALOMEDS_##TName##_i() - - -#define DEFINE_DERIVED_ATTR_METH_DEFAULT(TName,TAttr) \ -DEFINE_DERIVED_ATTR_METH_BASE(TName); \ -public: \ - static Standard_GUID GetGUID(){ return TAttr::GetID(); } \ -private: - - -#define DEFINE_DERIVED_ATTR_METH(TName,theGUID) \ -DEFINE_DERIVED_ATTR_METH_BASE(TName); \ -public: \ - static Standard_GUID GetGUID(){ return theGUID; } \ -private: - - #endif diff --git a/src/SALOMEDS/SALOMEDS_GraphicAttribute.cxx b/src/SALOMEDS/SALOMEDS_GraphicAttribute.cxx deleted file mode 100644 index 0b858947e..000000000 --- a/src/SALOMEDS/SALOMEDS_GraphicAttribute.cxx +++ /dev/null @@ -1,185 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : SALOMEDS_GraphicAttribute.cxx -// Author : Sergey LITONIN -// Module : SALOME - -#include "SALOMEDS_GraphicAttribute.hxx" -#include -#include -#include -#include - -/* - Class : SALOMEDS_GraphicAttribute - Description : This class is intended for storing information about - graphic representation of objects in dirrent views -*/ - -IMPLEMENT_STANDARD_HANDLE( SALOMEDS_GraphicAttribute, TDF_Attribute ) -IMPLEMENT_STANDARD_RTTIEXT( SALOMEDS_GraphicAttribute, TDF_Attribute ) - -//======================================================================= -//function : GetID -//purpose : Get GUID of this attribute -//======================================================================= -const Standard_GUID& SALOMEDS_GraphicAttribute::GetID() -{ - static Standard_GUID SALOMEDS_GraphicAttributeID( "F17AE8F0-E354-4d6f-8E42-38385C36E67E" ); - return SALOMEDS_GraphicAttributeID; -} - -//======================================================================= -//function : SALOMEDS_GraphicAttribute -//purpose : Empty Constructor -//======================================================================= -SALOMEDS_GraphicAttribute::SALOMEDS_GraphicAttribute() -{ -} - -//======================================================================= -//function : ~SALOMEDS_GraphicAttribute -//purpose : Destructor -//======================================================================= -SALOMEDS_GraphicAttribute::~SALOMEDS_GraphicAttribute() -{ -} - -//======================================================================= -//function : SetVisibility -//purpose : Set visibility of object in given view -//======================================================================= -void SALOMEDS_GraphicAttribute::SetVisibility( const Standard_Integer theViewId, - const Standard_Boolean theValue ) -{ - if ( myVisibility.IsBound( theViewId ) && myVisibility( theViewId ) == theValue ) - return; - - Backup(); - if ( myVisibility.IsBound( theViewId ) ) - myVisibility.ChangeFind( theViewId ) = theValue ? 1 : 0; - else - myVisibility.Bind( theViewId, theValue ? 1 : 0 ); -} - - -//======================================================================= -//function : Get -//purpose : Get visibility of object in given view -//======================================================================= -Standard_Boolean SALOMEDS_GraphicAttribute::GetVisibility( - const Standard_Integer theViewId ) const -{ - return myVisibility.IsBound( theViewId ) ? myVisibility( theViewId ) : false; -} - - -//======================================================================= -//function : ID -//purpose : Get GUID of this attribute -//======================================================================= -const Standard_GUID& SALOMEDS_GraphicAttribute::ID () const -{ - return GetID(); -} - - -//======================================================================= -//function : NewEmpty -//purpose : Create new empty attribute -//======================================================================= -Handle(TDF_Attribute) SALOMEDS_GraphicAttribute::NewEmpty () const -{ - return new SALOMEDS_GraphicAttribute (); -} - -//======================================================================= -//function : SetVisibility -//purpose : Set visibility of object in all views -//======================================================================= -void SALOMEDS_GraphicAttribute::SetVisibility( const TColStd_DataMapOfIntegerInteger& theMap ) -{ - myVisibility = theMap; -} - -//======================================================================= -//function : SetVisibility -//purpose : Get visibility of object in all views -//======================================================================= -const TColStd_DataMapOfIntegerInteger& SALOMEDS_GraphicAttribute::GetVisibility() -{ - return myVisibility; -} - -//======================================================================= -//function : Restore -//purpose : Restore value of attribute with value of theWith one -//======================================================================= -void SALOMEDS_GraphicAttribute::Restore( const Handle(TDF_Attribute)& theWith ) -{ - Handle(SALOMEDS_GraphicAttribute) anAttr = - Handle(SALOMEDS_GraphicAttribute)::DownCast( theWith ); - - if ( !anAttr.IsNull() ) - SetVisibility( anAttr->GetVisibility() ); -} - -//======================================================================= -//function : Paste -//purpose : Paste value of current attribute to the value of entry one -//======================================================================= -void SALOMEDS_GraphicAttribute::Paste( const Handle(TDF_Attribute)& theInto, - const Handle(TDF_RelocationTable)& ) const -{ - Handle(SALOMEDS_GraphicAttribute) anAttr = - Handle(SALOMEDS_GraphicAttribute)::DownCast( theInto ); - - if ( !anAttr.IsNull() ) - anAttr->SetVisibility( myVisibility ); -} - -//======================================================================= -//function : Dump -//purpose : Dump -//======================================================================= -Standard_OStream& SALOMEDS_GraphicAttribute::Dump( Standard_OStream& anOS ) const -{ - anOS << "Visibility of object:" << endl; - TColStd_DataMapIteratorOfDataMapOfIntegerInteger anIter( myVisibility ); - for ( ; anIter.More(); anIter.Next() ) - { - char str[ 100 ]; - - if ( GetVisibility( anIter.Key() ) ) - sprintf( str, "Viewer ID = 0x%X State = VISIBLE\n", anIter.Key() ); - else - sprintf( str, "Viewer ID = 0x%X State = INVISIBLE\n", anIter.Key() ); - - anOS << str; - } - - anOS << "Integer"; - return anOS; -} - diff --git a/src/SALOMEDS/SALOMEDS_GraphicAttribute.hxx b/src/SALOMEDS/SALOMEDS_GraphicAttribute.hxx deleted file mode 100644 index b70112bfc..000000000 --- a/src/SALOMEDS/SALOMEDS_GraphicAttribute.hxx +++ /dev/null @@ -1,80 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : SALOMEDS_GraphicAttribute.hxx -// Author : Sergey LITONIN -// Module : SALOME - -#ifndef SALOMEDS_GraphicAttribute_HeaderFile -#define SALOMEDS_GraphicAttribute_HeaderFile - -#include -#include -#include -#include - -class Standard_GUID; -class TDF_Label; -class Handle(TDF_Attribute); -class Handle(TDF_RelocationTable); - - -/* - Class : SALOMEDS_GraphicAttribute - Description : This class is intended for storing information about - graphic representation of objects in dirrent views -*/ - -DEFINE_STANDARD_HANDLE( SALOMEDS_GraphicAttribute, TDF_Attribute ) - -class Standard_EXPORT SALOMEDS_GraphicAttribute : public TDF_Attribute -{ - -public: - SALOMEDS_GraphicAttribute(); - ~SALOMEDS_GraphicAttribute(); - - static const Standard_GUID& GetID() ; - - void SetVisibility( const Standard_Integer, - const Standard_Boolean ); - Standard_Boolean GetVisibility( const Standard_Integer ) const; - const Standard_GUID& ID() const; - void Restore( const Handle(TDF_Attribute)& theWith ); - Handle(TDF_Attribute) NewEmpty() const; - void Paste( const Handle(TDF_Attribute)& theInto, - const Handle(TDF_RelocationTable)& ) const; - virtual Standard_OStream& Dump( Standard_OStream& anOS ) const; - - void SetVisibility( const TColStd_DataMapOfIntegerInteger& ); - - const TColStd_DataMapOfIntegerInteger& GetVisibility(); - -private: - TColStd_DataMapOfIntegerInteger myVisibility; - -public: - DEFINE_STANDARD_RTTI( SALOMEDS_GraphicAttribute ) -}; - -#endif diff --git a/src/SALOMEDS/SALOMEDS_IORAttribute.cdl b/src/SALOMEDS/SALOMEDS_IORAttribute.cdl deleted file mode 100644 index 2f155a2ba..000000000 --- a/src/SALOMEDS/SALOMEDS_IORAttribute.cdl +++ /dev/null @@ -1,77 +0,0 @@ --- SALOME SALOMEDS : data structure of SALOME and sources of Salome data server --- --- Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, --- CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS --- --- This library is free software; you can redistribute it and/or --- modify it under the terms of the GNU Lesser General Public --- License as published by the Free Software Foundation; either --- version 2.1 of the License. --- --- This library is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --- Lesser General Public License for more details. --- --- You should have received a copy of the GNU Lesser General Public --- License along with this library; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --- --- See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org --- --- --- --- File : SALOMEDS_IORAttribute.cdl --- Author : Yves FRICAUD --- Module : SALOME - -class IORAttribute from SALOMEDS inherits Comment from TDataStd - - ---Purpose: - - -uses Attribute from TDF, - Label from TDF, - GUID from Standard, - ExtendedString from TCollection, - DataSet from TDF, - RelocationTable from TDF, - AttributeSequence from TDF, - Data from TDF, - Comment from TDataStd - - -is - - - ---Purpose: class methods - -- ============= - - GetID (myclass) - ---C++: return const & - returns GUID from Standard; - - Set (myclass; label : Label from TDF; string : ExtendedString from TCollection) - ---Purpose: Find, or create a Comment attribute and set the string. - -- the Comment attribute is returned. - returns IORAttribute from SALOMEDS; - - ---Purpose: Comment methods - -- ============ - - Create - returns mutable IORAttribute from SALOMEDS; - - ID (me) - ---C++: return const & - returns GUID from Standard; - - Restore (me: mutable; with : Attribute from TDF); - - NewEmpty (me) - returns mutable Attribute from TDF; - - Paste (me; into : mutable Attribute from TDF; - RT : mutable RelocationTable from TDF); - -end IORAttribute; diff --git a/src/SALOMEDS/SALOMEDS_IORAttribute.cxx b/src/SALOMEDS/SALOMEDS_IORAttribute.cxx deleted file mode 100644 index b749c5464..000000000 --- a/src/SALOMEDS/SALOMEDS_IORAttribute.cxx +++ /dev/null @@ -1,117 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : SALOMEDS_IORAttribute.cxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include -#include - -#include "SALOMEDS_IORAttribute.ixx" -#include "SALOMEDS_Study_i.hxx" - -using namespace std; - -//======================================================================= -//function : GetID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_IORAttribute::GetID () -{ - static Standard_GUID SALOMEDS_IORAttributeID ("92888E01-7074-11d5-A690-0800369C8A03"); - return SALOMEDS_IORAttributeID; -} - - - -//======================================================================= -//function : Set -//purpose : -//======================================================================= - -Handle(SALOMEDS_IORAttribute) SALOMEDS_IORAttribute::Set (const TDF_Label& L, - const TCollection_ExtendedString& S, - SALOMEDS_Study_i* theStudy) -{ - Handle(SALOMEDS_IORAttribute) A; - if (!L.FindAttribute(SALOMEDS_IORAttribute::GetID(),A)) { - A = new SALOMEDS_IORAttribute(); - L.AddAttribute(A); - } - - (Handle(TDataStd_Comment)::DownCast(A))->Set (S); - theStudy->IORUpdated(A); - return A; -} - -//======================================================================= -//function : constructor -//purpose : -//======================================================================= -SALOMEDS_IORAttribute::SALOMEDS_IORAttribute() -{} - -//======================================================================= -//function : ID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_IORAttribute::ID () const { return GetID(); } - - -//======================================================================= -//function : NewEmpty -//purpose : -//======================================================================= - -Handle(TDF_Attribute) SALOMEDS_IORAttribute::NewEmpty () const -{ - return new SALOMEDS_IORAttribute(); -} - -//======================================================================= -//function : Restore -//purpose : -//======================================================================= - -void SALOMEDS_IORAttribute::Restore(const Handle(TDF_Attribute)& with) -{ - TCollection_ExtendedString s = Handle(TDataStd_Comment)::DownCast (with)->Get (); - TDataStd_Comment::Set(s); - return; -} - -//======================================================================= -//function : Paste -//purpose : -//======================================================================= - -void SALOMEDS_IORAttribute::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& RT) const -{ - Handle(TDataStd_Comment)::DownCast (into)->Set (Get()); -} - diff --git a/src/SALOMEDS/SALOMEDS_IORAttribute.hxx b/src/SALOMEDS/SALOMEDS_IORAttribute.hxx deleted file mode 100644 index 8f9fd314a..000000000 --- a/src/SALOMEDS/SALOMEDS_IORAttribute.hxx +++ /dev/null @@ -1,131 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : SALOMEDS_IORAttribute.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _SALOMEDS_IORAttribute_HeaderFile -#define _SALOMEDS_IORAttribute_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_SALOMEDS_IORAttribute_HeaderFile -#include "Handle_SALOMEDS_IORAttribute.hxx" -#endif - -#ifndef _TDataStd_Comment_HeaderFile -#include -#endif -#ifndef _Handle_TDF_Attribute_HeaderFile -#include -#endif -#ifndef _Handle_TDF_RelocationTable_HeaderFile -#include -#endif - -#include -#include CORBA_SERVER_HEADER(SALOMEDS) - -class Standard_GUID; -class TDF_Label; -class TCollection_ExtendedString; -class TDF_Attribute; -class TDF_RelocationTable; -class SALOMEDS_Study_i; - -class SALOMEDS_IORAttribute : public TDataStd_Comment { - -public: - - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - // Methods PUBLIC - // -Standard_EXPORT static const Standard_GUID& GetID() ; -Standard_EXPORT static Handle_SALOMEDS_IORAttribute Set(const TDF_Label& label, - const TCollection_ExtendedString& string, - SALOMEDS_Study_i* theStudy) ; -Standard_EXPORT SALOMEDS_IORAttribute(); -Standard_EXPORT const Standard_GUID& ID() const; -Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ; -Standard_EXPORT Handle_TDF_Attribute NewEmpty() const; -Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const; -Standard_EXPORT ~SALOMEDS_IORAttribute(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_IORAttribute_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - -}; - - - - - -// other inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/SALOMEDS/SALOMEDS_IORAttribute.ixx b/src/SALOMEDS/SALOMEDS_IORAttribute.ixx deleted file mode 100644 index 33b6734ff..000000000 --- a/src/SALOMEDS/SALOMEDS_IORAttribute.ixx +++ /dev/null @@ -1,87 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : SALOMEDS_IORAttribute.ixx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_IORAttribute.jxx" - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -SALOMEDS_IORAttribute::~SALOMEDS_IORAttribute() {} - - - -Standard_EXPORT Handle_Standard_Type& SALOMEDS_IORAttribute_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TDataStd_Comment); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDataStd_Comment); - static Handle_Standard_Type aType2 = STANDARD_TYPE(TDF_Attribute); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(TDF_Attribute); - static Handle_Standard_Type aType3 = STANDARD_TYPE(MMgt_TShared); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType4 = STANDARD_TYPE(Standard_Transient); - if ( aType4.IsNull()) aType4 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_IORAttribute", - sizeof(SALOMEDS_IORAttribute), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(SALOMEDS_IORAttribute) Handle(SALOMEDS_IORAttribute)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(SALOMEDS_IORAttribute) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_IORAttribute))) { - _anOtherObject = Handle(SALOMEDS_IORAttribute)((Handle(SALOMEDS_IORAttribute)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& SALOMEDS_IORAttribute::DynamicType() const -{ - return STANDARD_TYPE(SALOMEDS_IORAttribute) ; -} -Standard_Boolean SALOMEDS_IORAttribute::IsKind(const Handle(Standard_Type)& AType) const -{ - return (STANDARD_TYPE(SALOMEDS_IORAttribute) == AType || TDataStd_Comment::IsKind(AType)); -} -Handle_SALOMEDS_IORAttribute::~Handle_SALOMEDS_IORAttribute() {} - diff --git a/src/SALOMEDS/SALOMEDS_IORAttribute.jxx b/src/SALOMEDS/SALOMEDS_IORAttribute.jxx deleted file mode 100644 index d2799cba7..000000000 --- a/src/SALOMEDS/SALOMEDS_IORAttribute.jxx +++ /dev/null @@ -1,44 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : SALOMEDS_IORAttribute.jxx -// Module : SALOME - -#ifndef _Standard_GUID_HeaderFile -#include -#endif -#ifndef _TDF_Label_HeaderFile -#include -#endif -#ifndef _TCollection_ExtendedString_HeaderFile -#include -#endif -#ifndef _TDF_Attribute_HeaderFile -#include -#endif -#ifndef _TDF_RelocationTable_HeaderFile -#include -#endif -#ifndef _SALOMEDS_IORAttribute_HeaderFile -#include "SALOMEDS_IORAttribute.hxx" -#endif diff --git a/src/SALOMEDS/SALOMEDS_LocalIDAttribute.cdl b/src/SALOMEDS/SALOMEDS_LocalIDAttribute.cdl deleted file mode 100644 index ed2eb6c2a..000000000 --- a/src/SALOMEDS/SALOMEDS_LocalIDAttribute.cdl +++ /dev/null @@ -1,75 +0,0 @@ --- SALOME SALOMEDS : data structure of SALOME and sources of Salome data server --- --- Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, --- CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS --- --- This library is free software; you can redistribute it and/or --- modify it under the terms of the GNU Lesser General Public --- License as published by the Free Software Foundation; either --- version 2.1 of the License. --- --- This library is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --- Lesser General Public License for more details. --- --- You should have received a copy of the GNU Lesser General Public --- License along with this library; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --- --- See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org --- --- --- --- File : SALOMEDS_LocalIDAttribute.cdl --- Author : Yves FRICAUD --- Module : SALOME - -class LocalIDAttribute from SALOMEDS inherits Integer from TDataStd - - ---Purpose: - - -uses Attribute from TDF, - Label from TDF, - GUID from Standard, - ExtendedString from TCollection, - DataSet from TDF, - RelocationTable from TDF, - AttributeSequence from TDF, - Data from TDF, - Comment from TDataStd - - -is - - - ---Purpose: class methods - -- ============= - - GetID (myclass) - ---C++: return const & - returns GUID from Standard; - - Set (myclass; label : Label from TDF; value : Integer from Standard) - returns OpenedAttribute from SALOMEDS; - - ---Purpose: Comment methods - -- ============ - - Create - returns mutable OpenedAttribute from SALOMEDS; - - ID (me) - ---C++: return const & - returns GUID from Standard; - - Restore (me: mutable; with : Attribute from TDF); - - NewEmpty (me) - returns mutable Attribute from TDF; - - Paste (me; into : mutable Attribute from TDF; - RT : mutable RelocationTable from TDF); - -end LocalIDAttribute; diff --git a/src/SALOMEDS/SALOMEDS_LocalIDAttribute.cxx b/src/SALOMEDS/SALOMEDS_LocalIDAttribute.cxx deleted file mode 100644 index 406cde57e..000000000 --- a/src/SALOMEDS/SALOMEDS_LocalIDAttribute.cxx +++ /dev/null @@ -1,114 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : SALOMEDS_LocalIDAttribute.cxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_LocalIDAttribute.ixx" -#include -using namespace std; - -//======================================================================= -//function : GetID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_LocalIDAttribute::GetID () -{ - static Standard_GUID SALOMEDS_OpenedAttributeID ("12837196-8F52-11d6-A8A3-0001021E8C7F"); - return SALOMEDS_OpenedAttributeID; -} - - - -//======================================================================= -//function : Set -//purpose : -//======================================================================= - -Handle(SALOMEDS_LocalIDAttribute) SALOMEDS_LocalIDAttribute::Set (const TDF_Label& L, - const Standard_Integer value) -{ - Handle(SALOMEDS_LocalIDAttribute) A; - if (!L.FindAttribute(SALOMEDS_LocalIDAttribute::GetID(),A)) { - A = new SALOMEDS_LocalIDAttribute(); - L.AddAttribute(A); - } - - (Handle(TDataStd_Integer)::DownCast(A))->Set (value); - return A; -} - - -//======================================================================= -//function : constructor -//purpose : -//======================================================================= -SALOMEDS_LocalIDAttribute::SALOMEDS_LocalIDAttribute() -{ - TDataStd_Integer::Set(0); -} - -//======================================================================= -//function : ID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_LocalIDAttribute::ID () const { return GetID(); } - - -//======================================================================= -//function : NewEmpty -//purpose : -//======================================================================= - -Handle(TDF_Attribute) SALOMEDS_LocalIDAttribute::NewEmpty () const -{ - return new SALOMEDS_LocalIDAttribute(); -} - -//======================================================================= -//function : Restore -//purpose : -//======================================================================= - -void SALOMEDS_LocalIDAttribute::Restore(const Handle(TDF_Attribute)& with) -{ - Standard_Integer s = Handle(TDataStd_Integer)::DownCast (with)->Get (); - TDataStd_Integer::Set(s); - return; -} - -//======================================================================= -//function : Paste -//purpose : -//======================================================================= - -void SALOMEDS_LocalIDAttribute::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& RT) const -{ - Handle(TDataStd_Integer)::DownCast (into)->Set (Get()); -} - diff --git a/src/SALOMEDS/SALOMEDS_LocalIDAttribute.hxx b/src/SALOMEDS/SALOMEDS_LocalIDAttribute.hxx deleted file mode 100644 index 0e930f04f..000000000 --- a/src/SALOMEDS/SALOMEDS_LocalIDAttribute.hxx +++ /dev/null @@ -1,127 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : SALOMEDS_LocalIDAttribute.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _SALOMEDS_LocalIDAttribute_HeaderFile -#define _SALOMEDS_LocalIDAttribute_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_SALOMEDS_LocalIDAttribute_HeaderFile -#include -#endif - -#ifndef _TDataStd_Integer_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Handle_TDF_Attribute_HeaderFile -#include -#endif -#ifndef _Handle_TDF_RelocationTable_HeaderFile -#include -#endif -class Standard_GUID; -class TDF_Label; -class TDF_Attribute; -class TDF_RelocationTable; - - -class SALOMEDS_LocalIDAttribute : public TDataStd_Integer { - -public: - - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - // Methods PUBLIC - // -Standard_EXPORT static const Standard_GUID& GetID() ; -Standard_EXPORT static Handle_SALOMEDS_LocalIDAttribute Set(const TDF_Label& label,const Standard_Integer value) ; -Standard_EXPORT SALOMEDS_LocalIDAttribute(); -Standard_EXPORT const Standard_GUID& ID() const; -Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ; -Standard_EXPORT Handle_TDF_Attribute NewEmpty() const; -Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const; -Standard_EXPORT ~SALOMEDS_LocalIDAttribute(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_LocalIDAttribute_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - -}; - - - - - -// other inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/SALOMEDS/SALOMEDS_LocalIDAttribute.ixx b/src/SALOMEDS/SALOMEDS_LocalIDAttribute.ixx deleted file mode 100644 index 56d6d331b..000000000 --- a/src/SALOMEDS/SALOMEDS_LocalIDAttribute.ixx +++ /dev/null @@ -1,87 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : SALOMEDS_LocalIDAttribute.ixx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_LocalIDAttribute.jxx" - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -SALOMEDS_LocalIDAttribute::~SALOMEDS_LocalIDAttribute() {} - - - -Standard_EXPORT Handle_Standard_Type& SALOMEDS_LocalIDAttribute_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TDataStd_Integer); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDataStd_Integer); - static Handle_Standard_Type aType2 = STANDARD_TYPE(TDF_Attribute); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(TDF_Attribute); - static Handle_Standard_Type aType3 = STANDARD_TYPE(MMgt_TShared); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType4 = STANDARD_TYPE(Standard_Transient); - if ( aType4.IsNull()) aType4 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_LocalIDAttribute", - sizeof(SALOMEDS_LocalIDAttribute), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(SALOMEDS_LocalIDAttribute) Handle(SALOMEDS_LocalIDAttribute)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(SALOMEDS_LocalIDAttribute) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_LocalIDAttribute))) { - _anOtherObject = Handle(SALOMEDS_LocalIDAttribute)((Handle(SALOMEDS_LocalIDAttribute)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& SALOMEDS_LocalIDAttribute::DynamicType() const -{ - return STANDARD_TYPE(SALOMEDS_LocalIDAttribute) ; -} -Standard_Boolean SALOMEDS_LocalIDAttribute::IsKind(const Handle(Standard_Type)& AType) const -{ - return (STANDARD_TYPE(SALOMEDS_LocalIDAttribute) == AType || TDataStd_Integer::IsKind(AType)); -} -Handle_SALOMEDS_LocalIDAttribute::~Handle_SALOMEDS_LocalIDAttribute() {} - diff --git a/src/SALOMEDS/SALOMEDS_LocalIDAttribute.jxx b/src/SALOMEDS/SALOMEDS_LocalIDAttribute.jxx deleted file mode 100644 index fc43ec07d..000000000 --- a/src/SALOMEDS/SALOMEDS_LocalIDAttribute.jxx +++ /dev/null @@ -1,43 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : SALOMEDS_LocalIDAttribute.jxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _Standard_GUID_HeaderFile -#include -#endif -#ifndef _TDF_Label_HeaderFile -#include -#endif -#ifndef _TDF_Attribute_HeaderFile -#include -#endif -#ifndef _TDF_RelocationTable_HeaderFile -#include -#endif -#ifndef _SALOMEDS_LocalIDAttribute_HeaderFile -#include "SALOMEDS_LocalIDAttribute.hxx" -#endif diff --git a/src/SALOMEDS/SALOMEDS_OCAFApplication.cdl b/src/SALOMEDS/SALOMEDS_OCAFApplication.cdl deleted file mode 100644 index 118c2988c..000000000 --- a/src/SALOMEDS/SALOMEDS_OCAFApplication.cdl +++ /dev/null @@ -1,49 +0,0 @@ --- SALOME SALOMEDS : data structure of SALOME and sources of Salome data server --- --- Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, --- CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS --- --- This library is free software; you can redistribute it and/or --- modify it under the terms of the GNU Lesser General Public --- License as published by the Free Software Foundation; either --- version 2.1 of the License. --- --- This library is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --- Lesser General Public License for more details. --- --- You should have received a copy of the GNU Lesser General Public --- License along with this library; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --- --- See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org --- --- --- --- File : SALOMEDS_OCAFApplication.cdl --- Author : Yves FRICAUD --- Module : SALOME - -class OCAFApplication from SALOMEDS inherits Application from TDocStd - - ---Purpose: - -uses - Label from TDF, - SequenceOfExtendedString from TColStd, - CString from Standard, - Document from TDocStd - - -is - - Create - returns mutable OCAFApplication from SALOMEDS; - - Formats(me: mutable; Formats: out SequenceOfExtendedString from TColStd) - is redefined; - - ResourcesName (me: mutable) returns CString from Standard; - -end OCAFApplication; diff --git a/src/SALOMEDS/SALOMEDS_OCAFApplication.cxx b/src/SALOMEDS/SALOMEDS_OCAFApplication.cxx deleted file mode 100644 index 5913c6842..000000000 --- a/src/SALOMEDS/SALOMEDS_OCAFApplication.cxx +++ /dev/null @@ -1,66 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : SALOMEDS_OCAFApplication.cxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_OCAFApplication.ixx" -using namespace std; - -//======================================================================= -//function : SALOMEDS_OCAFApplication -//purpose : -//======================================================================= - -SALOMEDS_OCAFApplication::SALOMEDS_OCAFApplication() -{ -} - - -//======================================================================= -//function : Formats -//purpose : -//======================================================================= - -void SALOMEDS_OCAFApplication::Formats(TColStd_SequenceOfExtendedString& Formats) -{ - Formats.Append(TCollection_ExtendedString ("SALOME_STUDY")); -} - - -//======================================================================= -//function : ResourcesName -//purpose : -//======================================================================= - -Standard_CString SALOMEDS_OCAFApplication::ResourcesName() -{ - return Standard_CString ("SALOMEDS_Resources"); -} - - - - - diff --git a/src/SALOMEDS/SALOMEDS_OCAFApplication.hxx b/src/SALOMEDS/SALOMEDS_OCAFApplication.hxx deleted file mode 100644 index 57273253f..000000000 --- a/src/SALOMEDS/SALOMEDS_OCAFApplication.hxx +++ /dev/null @@ -1,114 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : SALOMEDS_OCAFApplication.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _SALOMEDS_OCAFApplication_HeaderFile -#define _SALOMEDS_OCAFApplication_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_SALOMEDS_OCAFApplication_HeaderFile -#include "Handle_SALOMEDS_OCAFApplication.hxx" -#endif - -#ifndef _TDocStd_Application_HeaderFile -#include -#endif -#ifndef _Standard_CString_HeaderFile -#include -#endif -class TColStd_SequenceOfExtendedString; - - -class SALOMEDS_OCAFApplication : public TDocStd_Application { - -public: - - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - // Methods PUBLIC - // -Standard_EXPORT SALOMEDS_OCAFApplication(); -Standard_EXPORT virtual void Formats(TColStd_SequenceOfExtendedString& Formats) ; -Standard_EXPORT Standard_CString ResourcesName() ; -Standard_EXPORT ~SALOMEDS_OCAFApplication(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_OCAFApplication_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - -}; - - - - - -// other inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/SALOMEDS/SALOMEDS_OCAFApplication.ixx b/src/SALOMEDS/SALOMEDS_OCAFApplication.ixx deleted file mode 100644 index 272651bf4..000000000 --- a/src/SALOMEDS/SALOMEDS_OCAFApplication.ixx +++ /dev/null @@ -1,87 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : SALOMEDS_OCAFApplication.ixx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_OCAFApplication.jxx" - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -SALOMEDS_OCAFApplication::~SALOMEDS_OCAFApplication() {} - - - -Standard_EXPORT Handle_Standard_Type& SALOMEDS_OCAFApplication_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TDocStd_Application); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDocStd_Application); - static Handle_Standard_Type aType2 = STANDARD_TYPE(CDF_Application); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(CDF_Application); - static Handle_Standard_Type aType3 = STANDARD_TYPE(CDM_Application); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(CDM_Application); - static Handle_Standard_Type aType4 = STANDARD_TYPE(Standard_Transient); - if ( aType4.IsNull()) aType4 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_OCAFApplication", - sizeof(SALOMEDS_OCAFApplication), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(SALOMEDS_OCAFApplication) Handle(SALOMEDS_OCAFApplication)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(SALOMEDS_OCAFApplication) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_OCAFApplication))) { - _anOtherObject = Handle(SALOMEDS_OCAFApplication)((Handle(SALOMEDS_OCAFApplication)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& SALOMEDS_OCAFApplication::DynamicType() const -{ - return STANDARD_TYPE(SALOMEDS_OCAFApplication) ; -} -Standard_Boolean SALOMEDS_OCAFApplication::IsKind(const Handle(Standard_Type)& AType) const -{ - return (STANDARD_TYPE(SALOMEDS_OCAFApplication) == AType || TDocStd_Application::IsKind(AType)); -} -Handle_SALOMEDS_OCAFApplication::~Handle_SALOMEDS_OCAFApplication() {} - diff --git a/src/SALOMEDS/SALOMEDS_OCAFApplication.jxx b/src/SALOMEDS/SALOMEDS_OCAFApplication.jxx deleted file mode 100644 index 226dad19b..000000000 --- a/src/SALOMEDS/SALOMEDS_OCAFApplication.jxx +++ /dev/null @@ -1,32 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : SALOMEDS_OCAFApplication.jxx -// Module : SALOME - -#ifndef _TColStd_SequenceOfExtendedString_HeaderFile -#include -#endif -#ifndef _SALOMEDS_OCAFApplication_HeaderFile -#include "SALOMEDS_OCAFApplication.hxx" -#endif diff --git a/src/SALOMEDS/SALOMEDS_OpenedAttribute.cdl b/src/SALOMEDS/SALOMEDS_OpenedAttribute.cdl deleted file mode 100644 index f845a3423..000000000 --- a/src/SALOMEDS/SALOMEDS_OpenedAttribute.cdl +++ /dev/null @@ -1,77 +0,0 @@ --- SALOME SALOMEDS : data structure of SALOME and sources of Salome data server --- --- Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, --- CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS --- --- This library is free software; you can redistribute it and/or --- modify it under the terms of the GNU Lesser General Public --- License as published by the Free Software Foundation; either --- version 2.1 of the License. --- --- This library is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --- Lesser General Public License for more details. --- --- You should have received a copy of the GNU Lesser General Public --- License along with this library; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --- --- See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org --- --- --- --- File : SALOMEDS_OpenedAttribute.cdl --- Author : Yves FRICAUD --- Module : SALOME - -class OpenedAttribute from SALOMEDS inherits Integer from TDataStd - - ---Purpose: - - -uses Attribute from TDF, - Label from TDF, - GUID from Standard, - ExtendedString from TCollection, - DataSet from TDF, - RelocationTable from TDF, - AttributeSequence from TDF, - Data from TDF, - Comment from TDataStd - - -is - - - ---Purpose: class methods - -- ============= - - GetID (myclass) - ---C++: return const & - returns GUID from Standard; - - Set (myclass; label : Label from TDF; value : Integer from Standard) - ---Purpose: Find, or create a Comment attribute and set the string. - -- the Comment attribute is returned. - returns OpenedAttribute from SALOMEDS; - - ---Purpose: Comment methods - -- ============ - - Create - returns mutable OpenedAttribute from SALOMEDS; - - ID (me) - ---C++: return const & - returns GUID from Standard; - - Restore (me: mutable; with : Attribute from TDF); - - NewEmpty (me) - returns mutable Attribute from TDF; - - Paste (me; into : mutable Attribute from TDF; - RT : mutable RelocationTable from TDF); - -end OpenedAttribute; diff --git a/src/SALOMEDS/SALOMEDS_OpenedAttribute.cxx b/src/SALOMEDS/SALOMEDS_OpenedAttribute.cxx deleted file mode 100644 index f7c17c3ef..000000000 --- a/src/SALOMEDS/SALOMEDS_OpenedAttribute.cxx +++ /dev/null @@ -1,114 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : SALOMEDS_OpenedAttribute.cxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_OpenedAttribute.ixx" -#include -using namespace std; - -//======================================================================= -//function : GetID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_OpenedAttribute::GetID () -{ - static Standard_GUID SALOMEDS_OpenedAttributeID ("12837186-8F52-11d6-A8A3-0001021E8C7F"); - return SALOMEDS_OpenedAttributeID; -} - - - -//======================================================================= -//function : Set -//purpose : -//======================================================================= - -Handle(SALOMEDS_OpenedAttribute) SALOMEDS_OpenedAttribute::Set (const TDF_Label& L, - const Standard_Integer value) -{ - Handle(SALOMEDS_OpenedAttribute) A; - if (!L.FindAttribute(SALOMEDS_OpenedAttribute::GetID(),A)) { - A = new SALOMEDS_OpenedAttribute(); - L.AddAttribute(A); - } - - (Handle(TDataStd_Integer)::DownCast(A))->Set (value); - return A; -} - - -//======================================================================= -//function : constructor -//purpose : -//======================================================================= -SALOMEDS_OpenedAttribute::SALOMEDS_OpenedAttribute() -{ - TDataStd_Integer::Set(0); -} - -//======================================================================= -//function : ID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_OpenedAttribute::ID () const { return GetID(); } - - -//======================================================================= -//function : NewEmpty -//purpose : -//======================================================================= - -Handle(TDF_Attribute) SALOMEDS_OpenedAttribute::NewEmpty () const -{ - return new SALOMEDS_OpenedAttribute(); -} - -//======================================================================= -//function : Restore -//purpose : -//======================================================================= - -void SALOMEDS_OpenedAttribute::Restore(const Handle(TDF_Attribute)& with) -{ - Standard_Integer s = Handle(TDataStd_Integer)::DownCast (with)->Get (); - TDataStd_Integer::Set(s); - return; -} - -//======================================================================= -//function : Paste -//purpose : -//======================================================================= - -void SALOMEDS_OpenedAttribute::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& RT) const -{ - Handle(TDataStd_Integer)::DownCast (into)->Set (Get()); -} - diff --git a/src/SALOMEDS/SALOMEDS_OpenedAttribute.hxx b/src/SALOMEDS/SALOMEDS_OpenedAttribute.hxx deleted file mode 100644 index 43fd81aac..000000000 --- a/src/SALOMEDS/SALOMEDS_OpenedAttribute.hxx +++ /dev/null @@ -1,127 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : SALOMEDS_OpenedAttribute.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _SALOMEDS_OpenedAttribute_HeaderFile -#define _SALOMEDS_OpenedAttribute_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_SALOMEDS_OpenedAttribute_HeaderFile -#include -#endif - -#ifndef _TDataStd_Integer_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Handle_TDF_Attribute_HeaderFile -#include -#endif -#ifndef _Handle_TDF_RelocationTable_HeaderFile -#include -#endif -class Standard_GUID; -class TDF_Label; -class TDF_Attribute; -class TDF_RelocationTable; - - -class SALOMEDS_OpenedAttribute : public TDataStd_Integer { - -public: - - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - // Methods PUBLIC - // -Standard_EXPORT static const Standard_GUID& GetID() ; -Standard_EXPORT static Handle_SALOMEDS_OpenedAttribute Set(const TDF_Label& label,const Standard_Integer value) ; -Standard_EXPORT SALOMEDS_OpenedAttribute(); -Standard_EXPORT const Standard_GUID& ID() const; -Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ; -Standard_EXPORT Handle_TDF_Attribute NewEmpty() const; -Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const; -Standard_EXPORT ~SALOMEDS_OpenedAttribute(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_OpenedAttribute_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - -}; - - - - - -// other inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/SALOMEDS/SALOMEDS_OpenedAttribute.ixx b/src/SALOMEDS/SALOMEDS_OpenedAttribute.ixx deleted file mode 100644 index 175708b84..000000000 --- a/src/SALOMEDS/SALOMEDS_OpenedAttribute.ixx +++ /dev/null @@ -1,87 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : SALOMEDS_OpenedAttribute.ixx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_OpenedAttribute.jxx" - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -SALOMEDS_OpenedAttribute::~SALOMEDS_OpenedAttribute() {} - - - -Standard_EXPORT Handle_Standard_Type& SALOMEDS_OpenedAttribute_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TDataStd_Integer); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDataStd_Integer); - static Handle_Standard_Type aType2 = STANDARD_TYPE(TDF_Attribute); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(TDF_Attribute); - static Handle_Standard_Type aType3 = STANDARD_TYPE(MMgt_TShared); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType4 = STANDARD_TYPE(Standard_Transient); - if ( aType4.IsNull()) aType4 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_OpenedAttribute", - sizeof(SALOMEDS_OpenedAttribute), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(SALOMEDS_OpenedAttribute) Handle(SALOMEDS_OpenedAttribute)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(SALOMEDS_OpenedAttribute) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_OpenedAttribute))) { - _anOtherObject = Handle(SALOMEDS_OpenedAttribute)((Handle(SALOMEDS_OpenedAttribute)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& SALOMEDS_OpenedAttribute::DynamicType() const -{ - return STANDARD_TYPE(SALOMEDS_OpenedAttribute) ; -} -Standard_Boolean SALOMEDS_OpenedAttribute::IsKind(const Handle(Standard_Type)& AType) const -{ - return (STANDARD_TYPE(SALOMEDS_OpenedAttribute) == AType || TDataStd_Integer::IsKind(AType)); -} -Handle_SALOMEDS_OpenedAttribute::~Handle_SALOMEDS_OpenedAttribute() {} - diff --git a/src/SALOMEDS/SALOMEDS_OpenedAttribute.jxx b/src/SALOMEDS/SALOMEDS_OpenedAttribute.jxx deleted file mode 100644 index fa0e2007d..000000000 --- a/src/SALOMEDS/SALOMEDS_OpenedAttribute.jxx +++ /dev/null @@ -1,43 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : SALOMEDS_OpenedAttribute.jxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _Standard_GUID_HeaderFile -#include -#endif -#ifndef _TDF_Label_HeaderFile -#include -#endif -#ifndef _TDF_Attribute_HeaderFile -#include -#endif -#ifndef _TDF_RelocationTable_HeaderFile -#include -#endif -#ifndef _SALOMEDS_OpenedAttribute_HeaderFile -#include "SALOMEDS_OpenedAttribute.hxx" -#endif diff --git a/src/SALOMEDS/SALOMEDS_PersRefAttribute.cdl b/src/SALOMEDS/SALOMEDS_PersRefAttribute.cdl deleted file mode 100644 index 6807993f5..000000000 --- a/src/SALOMEDS/SALOMEDS_PersRefAttribute.cdl +++ /dev/null @@ -1,77 +0,0 @@ --- SALOME SALOMEDS : data structure of SALOME and sources of Salome data server --- --- Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, --- CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS --- --- This library is free software; you can redistribute it and/or --- modify it under the terms of the GNU Lesser General Public --- License as published by the Free Software Foundation; either --- version 2.1 of the License. --- --- This library is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --- Lesser General Public License for more details. --- --- You should have received a copy of the GNU Lesser General Public --- License along with this library; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --- --- See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org --- --- --- --- File : SALOMEDS_PersRefAttribute.cdl --- Author : Yves FRICAUD --- Module : SALOME - -class PersRefAttribute from SALOMEDS inherits Comment from TDataStd - - ---Purpose: - - -uses Attribute from TDF, - Label from TDF, - GUID from Standard, - ExtendedString from TCollection, - DataSet from TDF, - RelocationTable from TDF, - AttributeSequence from TDF, - Data from TDF, - Comment from TDataStd - - -is - - - ---Purpose: class methods - -- ============= - - GetID (myclass) - ---C++: return const & - returns GUID from Standard; - - Set (myclass; label : Label from TDF; string : ExtendedString from TCollection) - ---Purpose: Find, or create a Comment attribute and set the string. - -- the Comment attribute is returned. - returns PersRefAttribute from SALOMEDS; - - ---Purpose: Comment methods - -- ============ - - Create - returns mutable PersRefAttribute from SALOMEDS; - - ID (me) - ---C++: return const & - returns GUID from Standard; - - Restore (me: mutable; with : Attribute from TDF); - - NewEmpty (me) - returns mutable Attribute from TDF; - - Paste (me; into : mutable Attribute from TDF; - RT : mutable RelocationTable from TDF); - -end PersRefAttribute; diff --git a/src/SALOMEDS/SALOMEDS_PersRefAttribute.cxx b/src/SALOMEDS/SALOMEDS_PersRefAttribute.cxx deleted file mode 100644 index 8d57af837..000000000 --- a/src/SALOMEDS/SALOMEDS_PersRefAttribute.cxx +++ /dev/null @@ -1,113 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : SALOMEDS_PersRefAttribute.cxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_PersRefAttribute.ixx" -#include -#include -using namespace std; - -//======================================================================= -//function : GetID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_PersRefAttribute::GetID () -{ - static Standard_GUID SALOMEDS_PersRefAttributeID ("92888E06-7074-11d5-A690-0800369C8A03"); - return SALOMEDS_PersRefAttributeID; -} - - - -//======================================================================= -//function : Set -//purpose : -//======================================================================= - -Handle(SALOMEDS_PersRefAttribute) SALOMEDS_PersRefAttribute::Set (const TDF_Label& L, - const TCollection_ExtendedString& S) -{ - Handle(SALOMEDS_PersRefAttribute) A; - if (!L.FindAttribute(SALOMEDS_PersRefAttribute::GetID(),A)) { - A = new SALOMEDS_PersRefAttribute(); - L.AddAttribute(A); - } - - (Handle(TDataStd_Comment)::DownCast(A))->Set (S); - return A; -} - - -//======================================================================= -//function : constructor -//purpose : -//======================================================================= -SALOMEDS_PersRefAttribute::SALOMEDS_PersRefAttribute() -{} - -//======================================================================= -//function : ID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_PersRefAttribute::ID () const { return GetID(); } - - -//======================================================================= -//function : NewEmpty -//purpose : -//======================================================================= - -Handle(TDF_Attribute) SALOMEDS_PersRefAttribute::NewEmpty () const -{ - return new SALOMEDS_PersRefAttribute(); -} - -//======================================================================= -//function : Restore -//purpose : -//======================================================================= - -void SALOMEDS_PersRefAttribute::Restore(const Handle(TDF_Attribute)& with) -{ - TCollection_ExtendedString s = Handle(TDataStd_Comment)::DownCast (with)->Get (); - TDataStd_Comment::Set(s); - return; -} - -//======================================================================= -//function : Paste -//purpose : -//======================================================================= - -void SALOMEDS_PersRefAttribute::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& RT) const -{ - Handle(TDataStd_Comment)::DownCast (into)->Set (Get()); -} - diff --git a/src/SALOMEDS/SALOMEDS_PersRefAttribute.hxx b/src/SALOMEDS/SALOMEDS_PersRefAttribute.hxx deleted file mode 100644 index 786cdb09b..000000000 --- a/src/SALOMEDS/SALOMEDS_PersRefAttribute.hxx +++ /dev/null @@ -1,125 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : SALOMEDS_PersRefAttribute.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _SALOMEDS_PersRefAttribute_HeaderFile -#define _SALOMEDS_PersRefAttribute_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_SALOMEDS_PersRefAttribute_HeaderFile -#include -#endif - -#ifndef _TDataStd_Comment_HeaderFile -#include -#endif -#ifndef _Handle_TDF_Attribute_HeaderFile -#include -#endif -#ifndef _Handle_TDF_RelocationTable_HeaderFile -#include -#endif -class Standard_GUID; -class TDF_Label; -class TCollection_ExtendedString; -class TDF_Attribute; -class TDF_RelocationTable; - - -class SALOMEDS_PersRefAttribute : public TDataStd_Comment { - -public: - - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - // Methods PUBLIC - // -Standard_EXPORT static const Standard_GUID& GetID() ; -Standard_EXPORT static Handle_SALOMEDS_PersRefAttribute Set(const TDF_Label& label,const TCollection_ExtendedString& string) ; -Standard_EXPORT SALOMEDS_PersRefAttribute(); -Standard_EXPORT const Standard_GUID& ID() const; -Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ; -Standard_EXPORT Handle_TDF_Attribute NewEmpty() const; -Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const; -Standard_EXPORT ~SALOMEDS_PersRefAttribute(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_PersRefAttribute_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - -}; - - - - - -// other inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/SALOMEDS/SALOMEDS_PersRefAttribute.ixx b/src/SALOMEDS/SALOMEDS_PersRefAttribute.ixx deleted file mode 100644 index 7f993a153..000000000 --- a/src/SALOMEDS/SALOMEDS_PersRefAttribute.ixx +++ /dev/null @@ -1,87 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : SALOMEDS_PersRefAttribute.ixx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_PersRefAttribute.jxx" - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -SALOMEDS_PersRefAttribute::~SALOMEDS_PersRefAttribute() {} - - - -Standard_EXPORT Handle_Standard_Type& SALOMEDS_PersRefAttribute_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TDataStd_Comment); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDataStd_Comment); - static Handle_Standard_Type aType2 = STANDARD_TYPE(TDF_Attribute); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(TDF_Attribute); - static Handle_Standard_Type aType3 = STANDARD_TYPE(MMgt_TShared); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType4 = STANDARD_TYPE(Standard_Transient); - if ( aType4.IsNull()) aType4 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_PersRefAttribute", - sizeof(SALOMEDS_PersRefAttribute), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(SALOMEDS_PersRefAttribute) Handle(SALOMEDS_PersRefAttribute)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(SALOMEDS_PersRefAttribute) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_PersRefAttribute))) { - _anOtherObject = Handle(SALOMEDS_PersRefAttribute)((Handle(SALOMEDS_PersRefAttribute)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& SALOMEDS_PersRefAttribute::DynamicType() const -{ - return STANDARD_TYPE(SALOMEDS_PersRefAttribute) ; -} -Standard_Boolean SALOMEDS_PersRefAttribute::IsKind(const Handle(Standard_Type)& AType) const -{ - return (STANDARD_TYPE(SALOMEDS_PersRefAttribute) == AType || TDataStd_Comment::IsKind(AType)); -} -Handle_SALOMEDS_PersRefAttribute::~Handle_SALOMEDS_PersRefAttribute() {} - diff --git a/src/SALOMEDS/SALOMEDS_PersRefAttribute.jxx b/src/SALOMEDS/SALOMEDS_PersRefAttribute.jxx deleted file mode 100644 index abd04a554..000000000 --- a/src/SALOMEDS/SALOMEDS_PersRefAttribute.jxx +++ /dev/null @@ -1,44 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : SALOMEDS_PersRefAttribute.jxx -// Module : SALOME - -#ifndef _Standard_GUID_HeaderFile -#include -#endif -#ifndef _TDF_Label_HeaderFile -#include -#endif -#ifndef _TCollection_ExtendedString_HeaderFile -#include -#endif -#ifndef _TDF_Attribute_HeaderFile -#include -#endif -#ifndef _TDF_RelocationTable_HeaderFile -#include -#endif -#ifndef _SALOMEDS_PersRefAttribute_HeaderFile -#include "SALOMEDS_PersRefAttribute.hxx" -#endif diff --git a/src/SALOMEDS/SALOMEDS_PixMapAttribute.cdl b/src/SALOMEDS/SALOMEDS_PixMapAttribute.cdl deleted file mode 100644 index 58491d14d..000000000 --- a/src/SALOMEDS/SALOMEDS_PixMapAttribute.cdl +++ /dev/null @@ -1,77 +0,0 @@ --- SALOME SALOMEDS : data structure of SALOME and sources of Salome data server --- --- Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, --- CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS --- --- This library is free software; you can redistribute it and/or --- modify it under the terms of the GNU Lesser General Public --- License as published by the Free Software Foundation; either --- version 2.1 of the License. --- --- This library is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --- Lesser General Public License for more details. --- --- You should have received a copy of the GNU Lesser General Public --- License along with this library; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --- --- See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org --- --- --- --- File : SALOMEDS_PixMapAttribute.cdl --- Author : Yves FRICAUD --- Module : SALOME - -class PixMapAttribute from SALOMEDS inherits Comment from TDataStd - - ---Purpose: - - -uses Attribute from TDF, - Label from TDF, - GUID from Standard, - ExtendedString from TCollection, - DataSet from TDF, - RelocationTable from TDF, - AttributeSequence from TDF, - Data from TDF, - Comment from TDataStd - - -is - - - ---Purpose: class methods - -- ============= - - GetID (myclass) - ---C++: return const & - returns GUID from Standard; - - Set (myclass; label : Label from TDF; string : ExtendedString from TCollection) - ---Purpose: Find, or create a Comment attribute and set the string. - -- the Comment attribute is returned. - returns PixMapAttribute from SALOMEDS; - - ---Purpose: Comment methods - -- ============ - - Create - returns mutable PixMapAttribute from SALOMEDS; - - ID (me) - ---C++: return const & - returns GUID from Standard; - - Restore (me: mutable; with : Attribute from TDF); - - NewEmpty (me) - returns mutable Attribute from TDF; - - Paste (me; into : mutable Attribute from TDF; - RT : mutable RelocationTable from TDF); - -end PixMapAttribute; diff --git a/src/SALOMEDS/SALOMEDS_PixMapAttribute.cxx b/src/SALOMEDS/SALOMEDS_PixMapAttribute.cxx deleted file mode 100644 index 32c570500..000000000 --- a/src/SALOMEDS/SALOMEDS_PixMapAttribute.cxx +++ /dev/null @@ -1,113 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : SALOMEDS_PixMapAttribute.cxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_PixMapAttribute.ixx" -#include -#include -using namespace std; - -//======================================================================= -//function : GetID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_PixMapAttribute::GetID () -{ - static Standard_GUID SALOMEDS_PixMapAttributeID ("12837187-8F52-11d6-A8A3-0001021E8C7F"); - return SALOMEDS_PixMapAttributeID; -} - - - -//======================================================================= -//function : Set -//purpose : -//======================================================================= - -Handle(SALOMEDS_PixMapAttribute) SALOMEDS_PixMapAttribute::Set (const TDF_Label& L, - const TCollection_ExtendedString& S) -{ - Handle(SALOMEDS_PixMapAttribute) A; - if (!L.FindAttribute(SALOMEDS_PixMapAttribute::GetID(),A)) { - A = new SALOMEDS_PixMapAttribute(); - L.AddAttribute(A); - } - - (Handle(TDataStd_Comment)::DownCast(A))->Set (S); - return A; -} - - -//======================================================================= -//function : constructor -//purpose : -//======================================================================= -SALOMEDS_PixMapAttribute::SALOMEDS_PixMapAttribute() -{TDataStd_Comment::Set("None");} - -//======================================================================= -//function : ID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_PixMapAttribute::ID () const { return GetID(); } - - -//======================================================================= -//function : NewEmpty -//purpose : -//======================================================================= - -Handle(TDF_Attribute) SALOMEDS_PixMapAttribute::NewEmpty () const -{ - return new SALOMEDS_PixMapAttribute(); -} - -//======================================================================= -//function : Restore -//purpose : -//======================================================================= - -void SALOMEDS_PixMapAttribute::Restore(const Handle(TDF_Attribute)& with) -{ - TCollection_ExtendedString s = Handle(TDataStd_Comment)::DownCast (with)->Get (); - TDataStd_Comment::Set(s); - return; -} - -//======================================================================= -//function : Paste -//purpose : -//======================================================================= - -void SALOMEDS_PixMapAttribute::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& RT) const -{ - Handle(TDataStd_Comment)::DownCast (into)->Set (Get()); -} - diff --git a/src/SALOMEDS/SALOMEDS_PixMapAttribute.hxx b/src/SALOMEDS/SALOMEDS_PixMapAttribute.hxx deleted file mode 100644 index d9f425f48..000000000 --- a/src/SALOMEDS/SALOMEDS_PixMapAttribute.hxx +++ /dev/null @@ -1,125 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : SALOMEDS_PixMapAttribute.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _SALOMEDS_PixMapAttribute_HeaderFile -#define _SALOMEDS_PixMapAttribute_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_SALOMEDS_PixMapAttribute_HeaderFile -#include -#endif - -#ifndef _TDataStd_Comment_HeaderFile -#include -#endif -#ifndef _Handle_TDF_Attribute_HeaderFile -#include -#endif -#ifndef _Handle_TDF_RelocationTable_HeaderFile -#include -#endif -class Standard_GUID; -class TDF_Label; -class TCollection_ExtendedString; -class TDF_Attribute; -class TDF_RelocationTable; - - -class SALOMEDS_PixMapAttribute : public TDataStd_Comment { - -public: - - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - // Methods PUBLIC - // -Standard_EXPORT static const Standard_GUID& GetID() ; -Standard_EXPORT static Handle_SALOMEDS_PixMapAttribute Set(const TDF_Label& label,const TCollection_ExtendedString& string) ; -Standard_EXPORT SALOMEDS_PixMapAttribute(); -Standard_EXPORT const Standard_GUID& ID() const; -Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ; -Standard_EXPORT Handle_TDF_Attribute NewEmpty() const; -Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const; -Standard_EXPORT ~SALOMEDS_PixMapAttribute(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_PixMapAttribute_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - -}; - - - - - -// other inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/SALOMEDS/SALOMEDS_PixMapAttribute.ixx b/src/SALOMEDS/SALOMEDS_PixMapAttribute.ixx deleted file mode 100644 index 3848133af..000000000 --- a/src/SALOMEDS/SALOMEDS_PixMapAttribute.ixx +++ /dev/null @@ -1,87 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : SALOMEDS_PixMapAttribute.ixx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_PixMapAttribute.jxx" - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -SALOMEDS_PixMapAttribute::~SALOMEDS_PixMapAttribute() {} - - - -Standard_EXPORT Handle_Standard_Type& SALOMEDS_PixMapAttribute_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TDataStd_Comment); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDataStd_Comment); - static Handle_Standard_Type aType2 = STANDARD_TYPE(TDF_Attribute); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(TDF_Attribute); - static Handle_Standard_Type aType3 = STANDARD_TYPE(MMgt_TShared); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType4 = STANDARD_TYPE(Standard_Transient); - if ( aType4.IsNull()) aType4 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_PixMapAttribute", - sizeof(SALOMEDS_PixMapAttribute), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(SALOMEDS_PixMapAttribute) Handle(SALOMEDS_PixMapAttribute)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(SALOMEDS_PixMapAttribute) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_PixMapAttribute))) { - _anOtherObject = Handle(SALOMEDS_PixMapAttribute)((Handle(SALOMEDS_PixMapAttribute)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& SALOMEDS_PixMapAttribute::DynamicType() const -{ - return STANDARD_TYPE(SALOMEDS_PixMapAttribute) ; -} -Standard_Boolean SALOMEDS_PixMapAttribute::IsKind(const Handle(Standard_Type)& AType) const -{ - return (STANDARD_TYPE(SALOMEDS_PixMapAttribute) == AType || TDataStd_Comment::IsKind(AType)); -} -Handle_SALOMEDS_PixMapAttribute::~Handle_SALOMEDS_PixMapAttribute() {} - diff --git a/src/SALOMEDS/SALOMEDS_PixMapAttribute.jxx b/src/SALOMEDS/SALOMEDS_PixMapAttribute.jxx deleted file mode 100644 index 3eaadbffc..000000000 --- a/src/SALOMEDS/SALOMEDS_PixMapAttribute.jxx +++ /dev/null @@ -1,46 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : SALOMEDS_PixMapAttribute.jxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _Standard_GUID_HeaderFile -#include -#endif -#ifndef _TDF_Label_HeaderFile -#include -#endif -#ifndef _TCollection_ExtendedString_HeaderFile -#include -#endif -#ifndef _TDF_Attribute_HeaderFile -#include -#endif -#ifndef _TDF_RelocationTable_HeaderFile -#include -#endif -#ifndef _SALOMEDS_PixMapAttribute_HeaderFile -#include "SALOMEDS_PixMapAttribute.hxx" -#endif diff --git a/src/SALOMEDS/SALOMEDS_PythonObjectAttribute.cdl b/src/SALOMEDS/SALOMEDS_PythonObjectAttribute.cdl deleted file mode 100644 index 145cd8c95..000000000 --- a/src/SALOMEDS/SALOMEDS_PythonObjectAttribute.cdl +++ /dev/null @@ -1,68 +0,0 @@ --- SALOME SALOMEDS : data structure of SALOME and sources of Salome data server --- --- Copyright (C) 2003 CEA/DEN, EDF R&D --- --- --- --- File : SALOMEDS_PythonObjectAttribute.cdl --- Author : Michael Ponikarov --- Module : SALOME - -class PythonObjectAttribute from SALOMEDS inherits Attribute from TDF - - ---Purpose: - - -uses Attribute from TDF, - Label from TDF, - GUID from Standard, - DataSet from TDF, - RelocationTable from TDF, - Data from TDF, - HArray1OfCharacter from TColStd - -is - - - ---Purpose: class methods - -- ============= - - GetID (myclass) - ---C++: return const & - returns GUID from Standard; - - Set (myclass; label : Label from TDF) - returns PythonObjectAttribute from SALOMEDS; - - ---Purpose: Common methods - -- ============ - - Create - returns mutable PythonObjectAttribute from SALOMEDS; - - SetObject(me: mutable; theSequence : CString from Standard; theScript : Boolean from Standard); - - GetObject(me) returns CString from Standard; - - IsScript(me) returns Boolean from Standard; - - GetLength(me) returns Integer from Standard; - - ID (me) - ---C++: return const & - returns GUID from Standard; - - Restore (me: mutable; with : Attribute from TDF); - - NewEmpty (me) - returns mutable Attribute from TDF; - - Paste (me; into : mutable Attribute from TDF; - RT : mutable RelocationTable from TDF); - -fields - - mySequence : CString from Standard; - myIsScript : Boolean from Standard; - -end PythonObjectAttribute; diff --git a/src/SALOMEDS/SALOMEDS_PythonObjectAttribute.cxx b/src/SALOMEDS/SALOMEDS_PythonObjectAttribute.cxx deleted file mode 100644 index f8c8d9de4..000000000 --- a/src/SALOMEDS/SALOMEDS_PythonObjectAttribute.cxx +++ /dev/null @@ -1,89 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// -// -// File : SALOMEDS_PythonObjectAttribute.cxx -// Author : Michael Ponikarov -// Module : SALOME -// $Header$ - -#include "SALOMEDS_PythonObjectAttribute.ixx" -#include -using namespace std; - -const Standard_GUID& SALOMEDS_PythonObjectAttribute::GetID() -{ - static Standard_GUID SALOMEDS_PythonObjectAttributeID ("128371A3-8F52-11d6-A8A3-0001021E8C7F"); - return SALOMEDS_PythonObjectAttributeID; -} - -Handle(SALOMEDS_PythonObjectAttribute) SALOMEDS_PythonObjectAttribute::Set(const TDF_Label& label) -{ - Handle(SALOMEDS_PythonObjectAttribute) anAttr; - if (!label.FindAttribute(SALOMEDS_PythonObjectAttribute::GetID(),anAttr)) { - anAttr = new SALOMEDS_PythonObjectAttribute(); - label.AddAttribute(anAttr); - } - return anAttr; -} - -SALOMEDS_PythonObjectAttribute::SALOMEDS_PythonObjectAttribute() -{ -} - -void SALOMEDS_PythonObjectAttribute::SetObject(const Standard_CString theSequence, - const Standard_Boolean theScript) -{ - Backup(); - if(mySequence != NULL) delete mySequence; - if (theSequence == NULL) { - mySequence = NULL; - } else { - mySequence = new char[strlen(theSequence)+1]; - strcpy(mySequence, theSequence); - } - - myIsScript = theScript; -} - -Standard_CString SALOMEDS_PythonObjectAttribute::GetObject() const -{ - return mySequence; -} - -Standard_Boolean SALOMEDS_PythonObjectAttribute::IsScript() const -{ - return myIsScript; -} - -Standard_Integer SALOMEDS_PythonObjectAttribute::GetLength() const -{ - if (mySequence == NULL) return 0; - return (strlen(mySequence)+1); -} - -const Standard_GUID& SALOMEDS_PythonObjectAttribute::ID() const -{ - return GetID(); -} - -void SALOMEDS_PythonObjectAttribute::Restore(const Handle(TDF_Attribute)& with) -{ - Handle(SALOMEDS_PythonObjectAttribute) anObj = Handle(SALOMEDS_PythonObjectAttribute)::DownCast(with); - SetObject(anObj->GetObject(),anObj->IsScript()); -} - -Handle(TDF_Attribute) SALOMEDS_PythonObjectAttribute::NewEmpty() const -{ - return new SALOMEDS_PythonObjectAttribute(); -} - -void SALOMEDS_PythonObjectAttribute::Paste(const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)&) const -{ - Handle(SALOMEDS_PythonObjectAttribute) anObj = Handle(SALOMEDS_PythonObjectAttribute)::DownCast(into); - anObj->SetObject(GetObject(),IsScript()); -} - diff --git a/src/SALOMEDS/SALOMEDS_PythonObjectAttribute.hxx b/src/SALOMEDS/SALOMEDS_PythonObjectAttribute.hxx deleted file mode 100644 index 353c14763..000000000 --- a/src/SALOMEDS/SALOMEDS_PythonObjectAttribute.hxx +++ /dev/null @@ -1,126 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// -// -// File : SALOMEDS_PythonObjectAttribute.hxx -// Author : Michael Ponikarov -// Module : SALOME -// $Header$ - -#ifndef _SALOMEDS_PythonObjectAttribute_HeaderFile -#define _SALOMEDS_PythonObjectAttribute_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_SALOMEDS_PythonObjectAttribute_HeaderFile -#include -#endif - -#ifndef _Handle_TColStd_HArray1OfCharacter_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -#ifndef _TDF_Attribute_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Standard_CString_HeaderFile -#include -#endif -#ifndef _Handle_TDF_Attribute_HeaderFile -#include -#endif -#ifndef _Handle_TDF_RelocationTable_HeaderFile -#include -#endif -class TColStd_HArray1OfCharacter; -class Standard_GUID; -class TDF_Label; -class TDF_Attribute; -class TDF_RelocationTable; - - -class SALOMEDS_PythonObjectAttribute : public TDF_Attribute { - -public: - - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - // Methods PUBLIC - // -Standard_EXPORT static const Standard_GUID& GetID() ; -Standard_EXPORT static Handle_SALOMEDS_PythonObjectAttribute Set(const TDF_Label& label) ; -Standard_EXPORT SALOMEDS_PythonObjectAttribute(); -Standard_EXPORT void SetObject(const Standard_CString theSequence,const Standard_Boolean theScript) ; -Standard_EXPORT Standard_CString GetObject() const; -Standard_EXPORT Standard_Boolean IsScript() const; -Standard_EXPORT Standard_Integer GetLength() const; -Standard_EXPORT const Standard_GUID& ID() const; -Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ; -Standard_EXPORT Handle_TDF_Attribute NewEmpty() const; -Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const; -Standard_EXPORT ~SALOMEDS_PythonObjectAttribute(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_PythonObjectAttribute_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // -Standard_CString mySequence; -Standard_Boolean myIsScript; - - -}; - - - - - -// other inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/SALOMEDS/SALOMEDS_PythonObjectAttribute.ixx b/src/SALOMEDS/SALOMEDS_PythonObjectAttribute.ixx deleted file mode 100644 index fcb6d59a2..000000000 --- a/src/SALOMEDS/SALOMEDS_PythonObjectAttribute.ixx +++ /dev/null @@ -1,68 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// -// -// File : SALOMEDS_PythonObjectAttribute.ixx -// Author : Michael Ponikarov -// Module : SALOME -// $Header$ - -#include "SALOMEDS_PythonObjectAttribute.jxx" - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -SALOMEDS_PythonObjectAttribute::~SALOMEDS_PythonObjectAttribute() {} - - - -Standard_EXPORT Handle_Standard_Type& SALOMEDS_PythonObjectAttribute_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TDF_Attribute); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDF_Attribute); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_PythonObjectAttribute", - sizeof(SALOMEDS_PythonObjectAttribute), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(SALOMEDS_PythonObjectAttribute) Handle(SALOMEDS_PythonObjectAttribute)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(SALOMEDS_PythonObjectAttribute) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_PythonObjectAttribute))) { - _anOtherObject = Handle(SALOMEDS_PythonObjectAttribute)((Handle(SALOMEDS_PythonObjectAttribute)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& SALOMEDS_PythonObjectAttribute::DynamicType() const -{ - return STANDARD_TYPE(SALOMEDS_PythonObjectAttribute) ; -} -Standard_Boolean SALOMEDS_PythonObjectAttribute::IsKind(const Handle(Standard_Type)& AType) const -{ - return (STANDARD_TYPE(SALOMEDS_PythonObjectAttribute) == AType || TDF_Attribute::IsKind(AType)); -} -Handle_SALOMEDS_PythonObjectAttribute::~Handle_SALOMEDS_PythonObjectAttribute() {} - diff --git a/src/SALOMEDS/SALOMEDS_PythonObjectAttribute.jxx b/src/SALOMEDS/SALOMEDS_PythonObjectAttribute.jxx deleted file mode 100644 index 1fefc3ef5..000000000 --- a/src/SALOMEDS/SALOMEDS_PythonObjectAttribute.jxx +++ /dev/null @@ -1,29 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// -// -// File : SALOMEDS_PythonObjectAttribute.jxx -// Author : Michael Ponikarov -// Module : SALOME -// $Header$ - -#ifndef _TColStd_HArray1OfCharacter_HeaderFile -#include -#endif -#ifndef _Standard_GUID_HeaderFile -#include -#endif -#ifndef _TDF_Label_HeaderFile -#include -#endif -#ifndef _TDF_Attribute_HeaderFile -#include -#endif -#ifndef _TDF_RelocationTable_HeaderFile -#include -#endif -#ifndef _SALOMEDS_PythonObjectAttribute_HeaderFile -#include "SALOMEDS_PythonObjectAttribute.hxx" -#endif diff --git a/src/SALOMEDS/SALOMEDS_SComponentIterator_i.cxx b/src/SALOMEDS/SALOMEDS_SComponentIterator_i.cxx index adf77476a..57cbcf25e 100644 --- a/src/SALOMEDS/SALOMEDS_SComponentIterator_i.cxx +++ b/src/SALOMEDS/SALOMEDS_SComponentIterator_i.cxx @@ -1,35 +1,11 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// // File : SALOMEDS_SComponentIterator_i.cxx -// Author : Yves FRICAUD +// Author : Sergey RUIN // Module : SALOME -// $Header$ - -#include "SALOMEDS_SComponentIterator_i.hxx" -#include "SALOMEDS_SComponent_i.hxx" using namespace std; +#include "SALOMEDS_SComponentIterator_i.hxx" +#include "SALOMEDS.hxx" +#include "SALOMEDSImpl_SComponent.hxx" //============================================================================ /*! Function : constructor @@ -37,12 +13,11 @@ using namespace std; */ //============================================================================ -SALOMEDS_SComponentIterator_i::SALOMEDS_SComponentIterator_i(SALOMEDS_Study_i* theStudy, - const Handle(TDocStd_Document)& theDocument): - _it(theDocument->Main()), - _lab(theDocument->Main()), - _study(theStudy) +SALOMEDS_SComponentIterator_i::SALOMEDS_SComponentIterator_i(const SALOMEDSImpl_SComponentIterator& theImpl, + CORBA::ORB_ptr orb) +:_impl(theImpl) { + _orb = CORBA::ORB::_duplicate(orb); } //============================================================================ @@ -61,7 +36,8 @@ SALOMEDS_SComponentIterator_i::~SALOMEDS_SComponentIterator_i() //============================================================================ void SALOMEDS_SComponentIterator_i::Init() { - _it.Initialize (_lab); + SALOMEDS::Locker lock; + _impl.Init(); } //============================================================================ @@ -71,13 +47,8 @@ void SALOMEDS_SComponentIterator_i::Init() //============================================================================ CORBA::Boolean SALOMEDS_SComponentIterator_i::More() { - if (!_it.More()) - return false; - TDF_Label L = _it.Value(); - if (SALOMEDS_SComponent_i::IsA(L)) - return true; - - return _it.More(); + SALOMEDS::Locker lock; + return _impl.More(); } //============================================================================ @@ -85,8 +56,9 @@ CORBA::Boolean SALOMEDS_SComponentIterator_i::More() */ //============================================================================ void SALOMEDS_SComponentIterator_i::Next() -{ - _it.Next(); +{ + SALOMEDS::Locker lock; + _impl.Next(); } @@ -97,6 +69,9 @@ void SALOMEDS_SComponentIterator_i::Next() //============================================================================ SALOMEDS::SComponent_ptr SALOMEDS_SComponentIterator_i::Value() { - return SALOMEDS_SComponent_i::NewRef(_study,_it.Value())._retn(); + SALOMEDS::Locker lock; + SALOMEDS_SComponent_i * so_servant = new SALOMEDS_SComponent_i (_impl.Value(), _orb); + SALOMEDS::SComponent_var so = SALOMEDS::SComponent::_narrow(so_servant->SComponent::_this()); + return so; } diff --git a/src/SALOMEDS/SALOMEDS_SComponentIterator_i.hxx b/src/SALOMEDS/SALOMEDS_SComponentIterator_i.hxx index 919f65fab..740fba5bc 100644 --- a/src/SALOMEDS/SALOMEDS_SComponentIterator_i.hxx +++ b/src/SALOMEDS/SALOMEDS_SComponentIterator_i.hxx @@ -1,69 +1,39 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// // File : SALOMEDS_SComponentIterator_i.hxx -// Author : Yves FRICAUD +// Author : Sergey RUIN // Module : SALOME -// $Header$ #ifndef __SALOMEDS_SCOMPONENTITERATOR_I_H__ #define __SALOMEDS_SCOMPONENTITERATOR_I_H__ +// std C++ headers +#include + // IDL headers #include #include CORBA_SERVER_HEADER(SALOMEDS) -// Cascade headers -#include -#include -#include - -class SALOMEDS_Study_i; +//SALOMEDS headers +#include "SALOMEDS_SComponent_i.hxx" +#include "SALOMEDSImpl_SComponentIterator.hxx" -class SALOMEDS_SComponentIterator_i:public virtual POA_SALOMEDS::SComponentIterator, - public virtual PortableServer::RefCountServantBase +class SALOMEDS_SComponentIterator_i:public POA_SALOMEDS::SComponentIterator, + public PortableServer::RefCountServantBase { - SALOMEDS_SComponentIterator_i(); // Not implemented - void operator=(const SALOMEDS_SComponentIterator_i&); // Not implemented private: - TDF_ChildIterator _it; - TDF_Label _lab; - SALOMEDS_Study_i* _study; + + CORBA::ORB_ptr _orb; + SALOMEDSImpl_SComponentIterator _impl; public: - SALOMEDS_SComponentIterator_i(SALOMEDS_Study_i* theStudy, - const Handle(TDocStd_Document)& theDocument); + + SALOMEDS_SComponentIterator_i(const SALOMEDSImpl_SComponentIterator& theImpl, CORBA::ORB_ptr); ~SALOMEDS_SComponentIterator_i(); - TDF_Label GetValue() { return _it.Value();} - virtual void Init(); virtual CORBA::Boolean More(); virtual void Next(); virtual SALOMEDS::SComponent_ptr Value(); }; - - #endif diff --git a/src/SALOMEDS/SALOMEDS_SComponent_i.cxx b/src/SALOMEDS/SALOMEDS_SComponent_i.cxx index c9cc82ac6..80f6591d2 100644 --- a/src/SALOMEDS/SALOMEDS_SComponent_i.cxx +++ b/src/SALOMEDS/SALOMEDS_SComponent_i.cxx @@ -1,85 +1,21 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// // File : SALOMEDS_SComponent_i.cxx -// Author : Yves FRICAUD +// Author : Sergey RUIN // Module : SALOME -// $Header$ +using namespace std; #include "SALOMEDS_SComponent_i.hxx" -#include "SALOMEDS_Study_i.hxx" - +#include "SALOMEDS.hxx" #include "utilities.h" -using namespace std; - -SALOMEDS_Study_i::TSObjectHolder -SALOMEDS_SComponent_i::New(SALOMEDS_Study_i* theStudy, - const TDF_Label& theLabel) -{ - SALOMEDS_Study_i::TSObjectHolder aSObjectHolder; - SALOMEDS_Study_i::TSObjectMap& anSObjectMap = theStudy->GetSObjectMap(); - SALOMEDS_Study_i::TSObjectMap::const_iterator anIter = anSObjectMap.find(theLabel); - if(anIter != anSObjectMap.end()){ - aSObjectHolder = anIter->second; - SALOMEDS_SObject_i* aSObject = aSObjectHolder.first; - if(dynamic_cast(aSObject)) - return aSObjectHolder; - } - TCollection_AsciiString anEntry; - TDF_Tool::Entry(theLabel,anEntry); - SALOMEDS_SComponent_i* aSComponent = new SALOMEDS_SComponent_i(theStudy,theLabel); - aSObjectHolder.first = aSComponent; - aSObjectHolder.second = aSComponent->_this(); - anSObjectMap[theLabel] = aSObjectHolder; - - return aSObjectHolder; -} - -SALOMEDS_SComponent_i* -SALOMEDS_SComponent_i::NewPtr(SALOMEDS_Study_i* theStudy, - const TDF_Label& theLabel) -{ - return dynamic_cast(New(theStudy,theLabel).first); -} - -SALOMEDS::SComponent_var -SALOMEDS_SComponent_i::NewRef(SALOMEDS_Study_i* theStudy, - const TDF_Label& theLabel) -{ - return SALOMEDS::SComponent::_narrow(New(theStudy,theLabel).second); -} //============================================================================ /*! Function : constructor * Purpose : */ //============================================================================ -SALOMEDS_SComponent_i::SALOMEDS_SComponent_i(SALOMEDS_Study_i* theStudy, - const TDF_Label& theLabel): - SALOMEDS_SObject_i(theStudy,theLabel) -{ -} +SALOMEDS_SComponent_i::SALOMEDS_SComponent_i(const Handle(SALOMEDSImpl_SComponent)& theImpl, CORBA::ORB_ptr orb) + :SALOMEDS_SObject_i(theImpl, orb) +{} //============================================================================ /*! Function : destructor @@ -87,10 +23,8 @@ SALOMEDS_SComponent_i::SALOMEDS_SComponent_i(SALOMEDS_Study_i* theStudy, */ //============================================================================ SALOMEDS_SComponent_i::~SALOMEDS_SComponent_i() -{ -} - - +{} + //============================================================================ /*! Function : ComponentDataType * Purpose : @@ -98,21 +32,9 @@ SALOMEDS_SComponent_i::~SALOMEDS_SComponent_i() //============================================================================ char* SALOMEDS_SComponent_i::ComponentDataType() { - //DEB - // MESSAGE("In SALOMEDS_SComponent_i::ComponentDataType"); - // TCollection_AsciiString anEntry; - // TDF_Tool::Entry (_lab,anEntry); - // MESSAGE("in SALOMEDS_SComponent_i, Entry :"<Get()); - res = ch.ToCString(); - } - - return CORBA::string_dup(res); + SALOMEDS::Locker lock; + TCollection_AsciiString aType = Handle(SALOMEDSImpl_SComponent)::DownCast(_impl)->ComponentDataType(); + return CORBA::string_dup(aType.ToCString()); } @@ -123,28 +45,9 @@ char* SALOMEDS_SComponent_i::ComponentDataType() //============================================================================ CORBA::Boolean SALOMEDS_SComponent_i::ComponentIOR(CORBA::String_out IOR) { - Handle(SALOMEDS_IORAttribute) ior; - if (!_lab.FindAttribute(SALOMEDS_IORAttribute::GetID(),ior) ) - return false; - TCollection_AsciiString ch(ior->Get()); - IOR = CORBA::string_dup(ch.ToCString()); + SALOMEDS::Locker lock; + TCollection_AsciiString ior; + if(!Handle(SALOMEDSImpl_SComponent)::DownCast(_impl)->ComponentIOR(ior)) return false; + IOR = CORBA::string_dup(ior.ToCString()); return true; } - - -//============================================================================ -/*! Function : IsA - * Purpose : - */ -//============================================================================ -Standard_Boolean SALOMEDS_SComponent_i::IsA(const TDF_Label& Lab) -{ - Handle(TDF_Attribute) Att; - // scomponent must contain comment and belong to the 2th depth label - if ( Lab.FindAttribute(TDataStd_Comment::GetID(), Att) && Lab.Depth() == 2) { - return Standard_True; - } - return Standard_False; -} - - diff --git a/src/SALOMEDS/SALOMEDS_SComponent_i.hxx b/src/SALOMEDS/SALOMEDS_SComponent_i.hxx index 1018b7bb5..f35cffcda 100644 --- a/src/SALOMEDS/SALOMEDS_SComponent_i.hxx +++ b/src/SALOMEDS/SALOMEDS_SComponent_i.hxx @@ -1,71 +1,35 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// // File : SALOMEDS_SComponent_i.hxx -// Author : Yves FRICAUD +// Author : Sergey RUIN // Module : SALOME -// $Header$ #ifndef __SALOMEDS_SCOMPONENT_I_H__ #define __SALOMEDS_SCOMPONENT_I_H__ -#include "SALOMEDS_SObject_i.hxx" +// std C++ headers +#include -class SALOMEDS_SComponent_i: public virtual POA_SALOMEDS::SComponent, - public virtual SALOMEDS_SObject_i -{ - SALOMEDS_SComponent_i(); // Not implemented - void operator=(const SALOMEDS_SComponent_i&); // Not implemented +// IDL headers +#include +#include CORBA_SERVER_HEADER(SALOMEDS) - SALOMEDS_SComponent_i(SALOMEDS_Study_i* theStudy, - const TDF_Label& theLabel); - -public: - - static - SALOMEDS_Study_i::TSObjectHolder - New(SALOMEDS_Study_i* theStudy, - const TDF_Label& theLabel); +//SALOMEDS headers +#include "SALOMEDS_SObject_i.hxx" - static - SALOMEDS_SComponent_i* - NewPtr(SALOMEDS_Study_i* theStudy, - const TDF_Label& theLabel); +#include "SALOMEDSImpl_SObject.hxx" +#include "SALOMEDSImpl_SComponent.hxx" - static - SALOMEDS::SComponent_var - NewRef(SALOMEDS_Study_i* theStudy, - const TDF_Label& theLabel); +class SALOMEDS_SComponent_i: public POA_SALOMEDS::SComponent, + public SALOMEDS_SObject_i +{ - ~SALOMEDS_SComponent_i(); +public: - virtual char* ComponentDataType(); + SALOMEDS_SComponent_i(const Handle(SALOMEDSImpl_SComponent)&, CORBA::ORB_ptr); + + virtual ~SALOMEDS_SComponent_i(); + virtual char* ComponentDataType(); virtual CORBA::Boolean ComponentIOR(CORBA::String_out theID); - - static Standard_Boolean IsA(const TDF_Label& Lab); }; - - #endif diff --git a/src/SALOMEDS/SALOMEDS_SObject_i.cxx b/src/SALOMEDS/SALOMEDS_SObject_i.cxx index 35c5087af..4f474bf15 100644 --- a/src/SALOMEDS/SALOMEDS_SObject_i.cxx +++ b/src/SALOMEDS/SALOMEDS_SObject_i.cxx @@ -1,328 +1,35 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// // File : SALOMEDS_SObject_i.cxx -// Author : Yves FRICAUD +// Author : Sergey RUIN // Module : SALOME -// $Header$ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include +using namespace std; +#include "utilities.h" #include "SALOMEDS_SObject_i.hxx" - -//SALOMEDS Headers -#include "SALOMEDS_Study_i.hxx" -#include "SALOMEDS_StudyManager_i.hxx" #include "SALOMEDS_SComponent_i.hxx" - -#include "SALOMEDS_AttributeComment_i.hxx" - -#include "SALOMEDS_AttributeTreeNode_i.hxx" -#include "SALOMEDS_AttributeUserID_i.hxx" - -#include "SALOMEDS_AttributePersistentRef_i.hxx" -#include "SALOMEDS_AttributeIOR_i.hxx" -#include "SALOMEDS_AttributeExternalFileDef_i.hxx" -#include "SALOMEDS_AttributeFileType_i.hxx" -#include "SALOMEDS_AttributeName_i.hxx" -#include "SALOMEDS_AttributeSequenceOfInteger_i.hxx" -#include "SALOMEDS_AttributeSequenceOfReal_i.hxx" -#include "SALOMEDS_AttributeTableOfInteger_i.hxx" -#include "SALOMEDS_AttributeTableOfReal_i.hxx" -#include "SALOMEDS_AttributeTableOfString_i.hxx" -#include "SALOMEDS_AttributeInteger_i.hxx" -#include "SALOMEDS_AttributeReal_i.hxx" -#include "SALOMEDS_AttributeDrawable_i.hxx" -#include "SALOMEDS_AttributeSelectable_i.hxx" -#include "SALOMEDS_AttributeExpandable_i.hxx" -#include "SALOMEDS_AttributeOpened_i.hxx" -#include "SALOMEDS_AttributeTextColor_i.hxx" -#include "SALOMEDS_AttributeTextHighlightColor_i.hxx" -#include "SALOMEDS_AttributePixMap_i.hxx" -#include "SALOMEDS_AttributeTarget_i.hxx" -#include "SALOMEDS_AttributeLocalID_i.hxx" -#include "SALOMEDS_AttributeStudyProperties_i.hxx" -#include "SALOMEDS_AttributePythonObject_i.hxx" - -#include "SALOMEDS_AttributeGraphic_i.hxx" -#include "SALOMEDS_AttributeFlags_i.hxx" - -#include "Utils_ExceptHandlers.hxx" -UNEXPECT_CATCH(GALockProtection, SALOMEDS::GenericAttribute::LockProtection); - -#include "utilities.h" - -using namespace std; -using namespace SALOMEDS; - - -inline bool operator<(const Standard_GUID& theLeft, const Standard_GUID& theRight) -{ - char aLeft[40] = ""; - theLeft.ToCString(aLeft); - - char aRight[40] = ""; - theRight.ToCString(aRight); - - return strcmp(aLeft,aRight) < 0; -} - - -namespace SALOMEDS{ - - const char* Str(const TCollection_ExtendedString& theString) - { - return TCollection_AsciiString(theString).ToCString(); - } - - typedef std::string TAttributeID; - - typedef Standard_GUID (*TGetGUID)(); - typedef bool (*TIsCheckLockedStudy)(); - typedef Handle(TDF_Attribute) (*TNewAttribute)(); - typedef SALOMEDS_GenericAttribute_i* (*TNewInstance)(const Handle(TDF_Attribute)&, SALOMEDS_SObject_i*); - - struct TAttrFun{ - TAttrFun(const TGetGUID& theGetGUID, - const TIsCheckLockedStudy& theIsCheckLockedStudy, - const TNewAttribute& theNewAttribute, - const TNewInstance& theNewInstance): - myGetGUID(theGetGUID), - myIsCheckLockedStudy(theIsCheckLockedStudy), - myNewAttribute(theNewAttribute), - myNewInstance(theNewInstance) - { - } - - TGetGUID myGetGUID; - TIsCheckLockedStudy myIsCheckLockedStudy; - TNewAttribute myNewAttribute; - TNewInstance myNewInstance; - }; - - typedef std::map TAttrID2FunMap; - static TAttrID2FunMap __AttrID2FunMap__; - - - typedef std::map TGUID2AttrIDMap; - static TGUID2AttrIDMap __GUID2AttrIDMap__; - - bool Init() - { - -#define ADD_ATTRID2FUNMAP_ITEM(theName) \ - __AttrID2FunMap__.insert( \ - TAttrID2FunMap::value_type(#theName,TAttrFun( \ - &(SALOMEDS_##theName##_i::GetGUID), \ - &(SALOMEDS_##theName##_i::IsCheckLockedStudy), \ - &(SALOMEDS_##theName##_i::NewAttribute), \ - &(SALOMEDS_##theName##_i::NewInstance) \ - ))) - - ADD_ATTRID2FUNMAP_ITEM(AttributeName); - ADD_ATTRID2FUNMAP_ITEM(AttributeComment); - ADD_ATTRID2FUNMAP_ITEM(AttributeIOR); - ADD_ATTRID2FUNMAP_ITEM(AttributeReal); - ADD_ATTRID2FUNMAP_ITEM(AttributeInteger); - ADD_ATTRID2FUNMAP_ITEM(AttributeSequenceOfInteger); - ADD_ATTRID2FUNMAP_ITEM(AttributeSequenceOfReal); - ADD_ATTRID2FUNMAP_ITEM(AttributeTableOfInteger); - ADD_ATTRID2FUNMAP_ITEM(AttributeTableOfReal); - ADD_ATTRID2FUNMAP_ITEM(AttributeTableOfString); - ADD_ATTRID2FUNMAP_ITEM(AttributeLocalID); - ADD_ATTRID2FUNMAP_ITEM(AttributePythonObject); - - ADD_ATTRID2FUNMAP_ITEM(AttributeUserID); - ADD_ATTRID2FUNMAP_ITEM(AttributeTreeNode); - - ADD_ATTRID2FUNMAP_ITEM(AttributePersistentRef); - ADD_ATTRID2FUNMAP_ITEM(AttributeDrawable); - ADD_ATTRID2FUNMAP_ITEM(AttributeSelectable); - ADD_ATTRID2FUNMAP_ITEM(AttributeExpandable); - ADD_ATTRID2FUNMAP_ITEM(AttributeOpened); - ADD_ATTRID2FUNMAP_ITEM(AttributeTextColor); - ADD_ATTRID2FUNMAP_ITEM(AttributeTextHighlightColor); - ADD_ATTRID2FUNMAP_ITEM(AttributePixMap); - ADD_ATTRID2FUNMAP_ITEM(AttributeTarget); - ADD_ATTRID2FUNMAP_ITEM(AttributeStudyProperties); - ADD_ATTRID2FUNMAP_ITEM(AttributeExternalFileDef); - ADD_ATTRID2FUNMAP_ITEM(AttributeFileType); - - ADD_ATTRID2FUNMAP_ITEM(AttributeGraphic); - ADD_ATTRID2FUNMAP_ITEM(AttributeFlags); - - TAttrID2FunMap::const_iterator anIter = __AttrID2FunMap__.begin(); - TAttrID2FunMap::const_iterator anEnd = __AttrID2FunMap__.end(); - for(; anIter != anEnd; anIter++){ - const TAttrID2FunMap::key_type& aKey = anIter->first; - const TAttrID2FunMap::mapped_type& aValue = anIter->second; - __GUID2AttrIDMap__[aValue.myGetGUID()] = aKey; - }; - -#undef ADD_ATTRID2FUNMAP_ITEM - return true; - } - - - static bool __IsInitilized__ = Init(); - - - //============================================================================ - bool GetAttrFun(const Standard_GUID& theGUID, TAttrFun& theAttrFun) - { - TGUID2AttrIDMap::const_iterator anIter = __GUID2AttrIDMap__.find(theGUID); - if(anIter != __GUID2AttrIDMap__.end()) - { - const TAttributeID& anAttributeID = anIter->second; - TAttrID2FunMap::const_iterator anIter2 = __AttrID2FunMap__.find(anAttributeID); - if(anIter2 != __AttrID2FunMap__.end()) - { - theAttrFun = anIter2->second; - return true; - } - } - return false; - } - - - //============================================================================ - Standard_GUID GetGUID(const char* theType) - { - TAttrID2FunMap::const_iterator anIter = __AttrID2FunMap__.find(theType); - if(anIter != __AttrID2FunMap__.end()){ - const TAttrID2FunMap::mapped_type& aValue = anIter->second; - return aValue.myGetGUID(); - } - // create tree node GUID by name - if(strncmp(theType,"AttributeTreeNodeGUID",21) == 0){ - char aGUIDString[40] = ""; - sprintf(aGUIDString,&theType[21]); - return aGUIDString; - } - - return Standard_GUID(); - } - - - //============================================================================ - std::string GetType(const Handle(TDF_Attribute)& theAttr) - { - if(theAttr.IsNull()) - return CORBA::string_dup(""); - - Standard_GUID aGUID = theAttr->ID(); - TGUID2AttrIDMap::const_iterator anIter = __GUID2AttrIDMap__.find(aGUID); - if(anIter != __GUID2AttrIDMap__.end()) - { - const TAttributeID& anAttributeID = anIter->second; - return anAttributeID; - } - - char aType[60] = ""; - { - Handle(TDataStd_TreeNode) anAttr = Handle(TDataStd_TreeNode)::DownCast(theAttr); - if (!anAttr.IsNull()) { - char aGUID[40] = ""; - anAttr->ID().ToCString(aGUID); - sprintf(aType, "AttributeTreeNodeGUID%s",aGUID); - return aType; - } - } - { - Handle(TDataStd_UAttribute) anAttr = Handle(TDataStd_UAttribute)::DownCast(theAttr); - if (!anAttr.IsNull()) { - char aGUID[40] = ""; - anAttr->ID().ToCString(aGUID); - sprintf(aType, "AttributeUserID_%s",aGUID); - return aType; - } - } - return aType; - } - -} - -//============================================================================ -SALOMEDS_Study_i::TSObjectHolder -SALOMEDS_SObject_i::New(SALOMEDS_Study_i* theStudy, - const TDF_Label& theLabel) -{ - SALOMEDS_Study_i::TSObjectHolder aSObjectHolder; - SALOMEDS_Study_i::TSObjectMap& anSObjectMap = theStudy->GetSObjectMap(); - SALOMEDS_Study_i::TSObjectMap::const_iterator anIter = anSObjectMap.find(theLabel); - if(anIter != anSObjectMap.end()) - aSObjectHolder = anIter->second; - else{ - SALOMEDS_SObject_i* aSObject = new SALOMEDS_SObject_i(theStudy,theLabel); - aSObjectHolder.first = aSObject; - aSObjectHolder.second = aSObject->_this(); - anSObjectMap[theLabel] = aSObjectHolder; - - //TCollection_AsciiString anEntry; - //TDF_Tool::Entry(theLabel,anEntry); - //cout<<"APO - SALOMEDS_SObject_i::New - anEntry = "< +#include +#include //============================================================================ /*! Function : constructor * Purpose : */ //============================================================================ -SALOMEDS_SObject_i::SALOMEDS_SObject_i(SALOMEDS_Study_i* theStudy, - const TDF_Label& theLabel): - _lab(theLabel), - _study(theStudy) +SALOMEDS_SObject_i::SALOMEDS_SObject_i(const Handle(SALOMEDSImpl_SObject)& impl, CORBA::ORB_ptr orb) + :_impl(impl) { + _orb = CORBA::ORB::_duplicate(orb); } + //============================================================================ /*! Function : destructor @@ -330,65 +37,44 @@ SALOMEDS_SObject_i::SALOMEDS_SObject_i(SALOMEDS_Study_i* theStudy, */ //============================================================================ SALOMEDS_SObject_i::~SALOMEDS_SObject_i() -{ -} +{} + - -//============================================================================ -CORBA::ORB_var SALOMEDS_SObject_i::GetORB() const -{ - return _study->GetORB(); -} - - -//============================================================================ -PortableServer::POA_var SALOMEDS_SObject_i::GetPOA() const -{ - return _study->GetPOA(); -} - - //============================================================================ -/*! Function : +/*! Function :GetID * Purpose : */ //============================================================================ char* SALOMEDS_SObject_i::GetID() { - TCollection_AsciiString anEntry; - TDF_Tool::Entry(_lab,anEntry); - return CORBA::string_dup(anEntry.ToCString()); + SALOMEDS::Locker lock; + return CORBA::string_dup(_impl->GetID().ToCString()); } //============================================================================ -/*! Function : +/*! Function : GetFatherComponent * Purpose : */ //============================================================================ -TDF_Label SALOMEDS_SObject_i::GetFatherComponentLabel() -{ - TDF_Label aLabel = _lab; - while(!SALOMEDS_SComponent_i::IsA(aLabel) && !aLabel.IsRoot()) - aLabel = aLabel.Father(); - - return aLabel; -} - SALOMEDS::SComponent_ptr SALOMEDS_SObject_i::GetFatherComponent() { - TDF_Label aSCompLabel = GetFatherComponentLabel(); - - return SALOMEDS_SComponent_i::NewRef(_study,aSCompLabel)._retn(); + SALOMEDS::Locker lock; + SALOMEDS_SComponent_i * so_servant = new SALOMEDS_SComponent_i (_impl->GetFatherComponent(), _orb); + SALOMEDS::SComponent_var so = SALOMEDS::SComponent::_narrow(so_servant->SComponent::_this()); + return so; } //============================================================================ -/*! Function : +/*! Function : GetFather * Purpose : */ //============================================================================ SALOMEDS::SObject_ptr SALOMEDS_SObject_i::GetFather() { - return SALOMEDS_SObject_i::NewRef(_study,_lab.Father())._retn(); + SALOMEDS::Locker lock; + SALOMEDS_SObject_i * so_servant = new SALOMEDS_SObject_i (_impl->GetFather(), _orb); + SALOMEDS::SObject_var so = SALOMEDS::SObject::_narrow(so_servant->_this()); + return so; } //============================================================================ @@ -398,363 +84,195 @@ SALOMEDS::SObject_ptr SALOMEDS_SObject_i::GetFather() //============================================================================ SALOMEDS::Study_ptr SALOMEDS_SObject_i::GetStudy() { - return _study->_this(); + SALOMEDS::Locker lock; + Handle(SALOMEDSImpl_Study) aStudy = _impl->GetStudy(); + if(aStudy.IsNull()) { + MESSAGE("Problem GetStudy"); + return SALOMEDS::Study::_nil(); + } + + TCollection_AsciiString IOR = aStudy->GetTransientReference(); + CORBA::Object_var obj = _orb->string_to_object(IOR.ToCString()); + SALOMEDS::Study_var Study = SALOMEDS::Study::_narrow(obj) ; + ASSERT(!CORBA::is_nil(Study)); + return SALOMEDS::Study::_duplicate(Study); } +//============================================================================ +/*! Function : FindAttribute + * Purpose : Find attribute of given type on this SObject + */ +//============================================================================ +CORBA::Boolean SALOMEDS_SObject_i::FindAttribute (SALOMEDS::GenericAttribute_out anAttribute, + const char* aTypeOfAttribute) +{ + SALOMEDS::Locker lock; + Handle(TDF_Attribute) anAttr; + if(_impl->FindAttribute(anAttr, (char*)aTypeOfAttribute)) { + anAttribute = SALOMEDS::GenericAttribute::_duplicate(SALOMEDS_GenericAttribute_i::CreateAttribute(anAttr, _orb)); + return Standard_True; + } + + return Standard_False; +} + +//============================================================================ +/*! Function : GetAllAttributes + * Purpose : Returns list of all attributes for this sobject + */ +//============================================================================ + +SALOMEDS::ListOfAttributes* SALOMEDS_SObject_i::GetAllAttributes() +{ + SALOMEDS::Locker lock; + Handle(TColStd_HSequenceOfTransient) aSeq = _impl->GetAllAttributes(); + SALOMEDS::ListOfAttributes_var SeqOfAttr = new SALOMEDS::ListOfAttributes; + Standard_Integer length = aSeq->Length(); + + SeqOfAttr->length(length); + + if (length != 0) { + for(int i = 1; i<= length; i++) { + Handle(SALOMEDSImpl_GenericAttribute) anAttr = Handle(SALOMEDSImpl_GenericAttribute)::DownCast(aSeq->Value(i)); + SALOMEDS::GenericAttribute_var anAttribute; + anAttribute = SALOMEDS::GenericAttribute::_duplicate(SALOMEDS_GenericAttribute_i::CreateAttribute(anAttr, _orb)); + if (!CORBA::is_nil(anAttribute)) { + SeqOfAttr[i - 1] = anAttribute; + } + } + } + return SeqOfAttr._retn(); +} + + //============================================================================ /*! Function : ReferencedObject * Purpose : */ //============================================================================ -CORBA::Boolean SALOMEDS_SObject_i::ReferencedObject(SALOMEDS::SObject_out theSObject) +CORBA::Boolean SALOMEDS_SObject_i::ReferencedObject(SALOMEDS::SObject_out obj) { - Handle(TDF_Reference) aRef; - if (!_lab.FindAttribute(TDF_Reference::GetID(),aRef)) - return false; - - theSObject = SALOMEDS_SObject_i::NewRef(_study,aRef->Get())._retn(); + SALOMEDS::Locker lock; + Handle(SALOMEDSImpl_SObject) aRefObj; + if(!_impl->ReferencedObject(aRefObj)) return false; + + SALOMEDS_SObject_i * so_servant = new SALOMEDS_SObject_i (aRefObj, _orb); + obj = SALOMEDS::SObject::_narrow(so_servant->_this()); return true; } //============================================================================ -/*! Function : +/*! Function : FindSubObject * Purpose : */ //============================================================================ -CORBA::Boolean SALOMEDS_SObject_i::FindSubObject(CORBA::Long theTag, SALOMEDS::SObject_out theSObject) +CORBA::Boolean SALOMEDS_SObject_i::FindSubObject(long atag, SALOMEDS::SObject_out obj) { - TDF_Label aLabel = _lab.FindChild(theTag,false); - if(aLabel.IsNull()) - return false; - - theSObject = SALOMEDS_SObject_i::NewRef(_study,aLabel)._retn(); + SALOMEDS::Locker lock; + Handle(SALOMEDSImpl_SObject) aSubObj; + if(!_impl->FindSubObject(atag, aSubObj)) return false; + + SALOMEDS_SObject_i * so_servant = new SALOMEDS_SObject_i (aSubObj, _orb); + obj = SALOMEDS::SObject::_narrow(so_servant->_this()); return true; + } //============================================================================ -/*! Function : - * Purpose : +/*! Function : Name + * Purpose : gets a name */ //============================================================================ char* SALOMEDS_SObject_i::Name() { - return CORBA::string_dup(_name.c_str()); + SALOMEDS::Locker lock; + return CORBA::string_dup(_impl->Name().ToCString()); } //============================================================================ -/*! Function : - * Purpose : +/*! Function : Name + * Purpose : sets a name */ //============================================================================ -void SALOMEDS_SObject_i::Name(const char* theName) +void SALOMEDS_SObject_i::Name(const char* name) { - _name = theName; + SALOMEDS::Locker lock; + TCollection_AsciiString aName((char*)name); + _impl->Name(aName); } //============================================================================ -/*! Function : +/*! Function : Tag * Purpose : */ //============================================================================ CORBA::Short SALOMEDS_SObject_i::Tag() { - return _lab.Tag(); + SALOMEDS::Locker lock; + return _impl->Tag(); } //============================================================================ -/*! Function : +/*! Function : Depth * Purpose : */ //============================================================================ CORBA::Short SALOMEDS_SObject_i::Depth() { - return _lab.Depth(); + SALOMEDS::Locker lock; + return _impl->Depth(); } //============================================================================ -/*! Function : +/*! Function : GetObject * Purpose : */ //============================================================================ CORBA::Object_ptr SALOMEDS_SObject_i::GetObject() { + SALOMEDS::Locker lock; + CORBA::Object_ptr obj = CORBA::Object::_nil(); try { - Handle(SALOMEDS_IORAttribute) anAttr; - if(_lab.FindAttribute(SALOMEDS_IORAttribute::GetID(),anAttr)){ - CORBA::ORB_var anORB = _study->GetStudyManager()->GetORB(); - return anORB->string_to_object(Str(anAttr->Get())); - } - }catch(...){ - } - return CORBA::Object::_nil(); -} - -//============================================================================ -/*! Function : - * Purpose : - */ -//============================================================================ -char* SALOMEDS_SObject_i::GetName() { - Handle(TDataStd_Name) anAttr; - if(_lab.FindAttribute(TDataStd_Name::GetID(),anAttr)) - return CORBA::string_dup(Str(anAttr->Get())); - - return CORBA::string_dup(""); -} - -//============================================================================ -/*! Function : - * Purpose : - */ -//============================================================================ -char* SALOMEDS_SObject_i::GetComment() { - Handle(TDataStd_Comment) anAttr; - if(_lab.FindAttribute(TDataStd_Comment::GetID(), anAttr)) - return CORBA::string_dup(Str(anAttr->Get())); - - return CORBA::string_dup(""); + TCollection_AsciiString IOR = _impl->GetIOR(); + char* c_ior = CORBA::string_dup(IOR.ToCString()); + obj = _orb->string_to_object(c_ior); + CORBA::string_free(c_ior); + } catch(...) {} + return obj; } //============================================================================ -/*! Function : +/*! Function : GetName * Purpose : */ //============================================================================ -char* SALOMEDS_SObject_i::GetIOR() { - Handle(SALOMEDS_IORAttribute) anAttr; - if(_lab.FindAttribute(SALOMEDS_IORAttribute::GetID(),anAttr)) - return CORBA::string_dup(Str(anAttr->Get())); - - return CORBA::string_dup(""); -} - - -//============================================================================ -/*! Function : GetAllAttributes - * Purpose : Returns list of all attributes for this sobject - */ -//============================================================================ -SALOMEDS_SObject_i::TAttrHolder -SALOMEDS_SObject_i::_FindGenAttribute(const Handle(TDF_Attribute)& theAttr) -{ - std::string aType = GetType(theAttr); - return _FindGenAttribute(aType.c_str()); -} - - -SALOMEDS::ListOfAttributes* SALOMEDS_SObject_i::GetAllAttributes() -{ - SALOMEDS::ListOfAttributes_var aSeqOfAttr = new SALOMEDS::ListOfAttributes; - if(_lab.NbAttributes() > 0){ - Standard_Integer i = 0; - for(TDF_AttributeIterator iter(_lab); iter.More(); iter.Next()) { - Handle(TDF_Attribute) anAttr = iter.Value(); - TAttrHolder anAttrHolder = _FindGenAttribute(anAttr); - SALOMEDS::GenericAttribute_var anGenAttr = anAttrHolder.second; - if(!anGenAttr->_is_nil()) - { - aSeqOfAttr->length(++i); - aSeqOfAttr[i-1] = anGenAttr._retn(); - } - } - } - - return aSeqOfAttr._retn(); -} - - -//============================================================================ -/*! Function : FindAttribute - * Purpose : Find attribute of given type on this SObject - */ -//============================================================================ -SALOMEDS_SObject_i::TAttrHolder -SALOMEDS_SObject_i::_CreateGenAttribute(const Handle(TDF_Attribute)& theAttr, - const char* theType) +char* SALOMEDS_SObject_i::GetName() { - SALOMEDS_GenericAttribute_i* anAttr; - TAttrID2FunMap::const_iterator anIter = __AttrID2FunMap__.find(theType); - if(anIter != __AttrID2FunMap__.end()){ - const TAttrID2FunMap::mapped_type& aValue = anIter->second; - - //if(aValue.myIsCheckLockedStudy()) // mpv 03.02.05: creation of CORBA objects does not modify the study - // _study->CheckLocked(); - - anAttr = aValue.myNewInstance(theAttr,this); - return TAttrHolder(anAttr,anAttr->_this()); - } - - if(strncmp(theType,"AttributeTreeNode",17) == 0){ - anAttr = new SALOMEDS_AttributeTreeNode_i(theAttr,this); - return TAttrHolder(anAttr,anAttr->_this()); - } - - if(strncmp(theType,"AttributeUserID",15) == 0){ - anAttr = new SALOMEDS_AttributeUserID_i(theAttr,this); - return TAttrHolder(anAttr,anAttr->_this()); - } - - return TAttrHolder(); + SALOMEDS::Locker lock; + CORBA::String_var aStr = CORBA::string_dup(_impl->GetName().ToCString()); + return aStr._retn(); } - -SALOMEDS_SObject_i::TAttrHolder -SALOMEDS_SObject_i::_FindGenAttribute(const char* theType) -{ - TAttrHolder anAttrHolder; - TAttrMap::const_iterator anIter = myAttrMap.find(theType); - if(anIter != myAttrMap.end()) - anAttrHolder = anIter->second; - - Standard_GUID aGUID = ::GetGUID(theType); - Handle(TDF_Attribute) anAttr; - - if(_lab.FindAttribute(aGUID,anAttr)){ - SALOMEDS_GenericAttribute_i* aGenAttr = anAttrHolder.first; - if(aGenAttr != NULL){ - if(aGenAttr->GetAttribute() != anAttr) - aGenAttr->SetAttribute(anAttr); - }else{ - anAttrHolder = _CreateGenAttribute(anAttr,theType); - } - aGenAttr = anAttrHolder.first; - if(aGenAttr != NULL) - myAttrMap[theType] = anAttrHolder; - }else{ - //myAttrMap.erase(theType); - //if(anGenAttr != NULL) - // anGenAttr->Destroy(); - return TAttrHolder(); - } - - return anAttrHolder; -} - - -CORBA::Boolean -SALOMEDS_SObject_i::FindAttribute(SALOMEDS::GenericAttribute_out theAttribute, - const char* theType) -{ - TAttrHolder anAttr = _FindGenAttribute(theType); - SALOMEDS::GenericAttribute_var anGenAttr = anAttr.second; - if(!CORBA::is_nil(anGenAttr)){ - theAttribute = SALOMEDS::GenericAttribute::_duplicate(anGenAttr); - return true; - } - return false; -} - - //============================================================================ -/*! Function : FindAttribute - * Purpose : Find attribute of given type on this SObject +/*! Function : GetComment + * Purpose : */ //============================================================================ -Handle(TDF_Attribute) - SALOMEDS_SObject_i::_AddAttribute(const char* theType) -{ - Handle(TDF_Attribute) anAttr; - TAttrID2FunMap::const_iterator anIter = __AttrID2FunMap__.find(theType); - if(anIter != __AttrID2FunMap__.end()){ - const TAttrID2FunMap::mapped_type& aValue = anIter->second; - - if(aValue.myIsCheckLockedStudy()) - _study->CheckLocked(); - - anAttr = aValue.myNewAttribute(); - _lab.AddAttribute(anAttr); - return anAttr; - } - - if(strncmp(theType, "AttributeTreeNode",17) == 0){ - Standard_GUID aGUID; - if(strcmp(theType, "AttributeTreeNode") == 0){ - aGUID = TDataStd_TreeNode::GetDefaultTreeID(); - }else{ - char aString[40] = ""; - sprintf(aString, &theType[21]); - aGUID = Standard_GUID(aString); // create tree node GUID by name - } - if(!_lab.FindAttribute(aGUID,anAttr)){ - _study->CheckLocked(); - anAttr = TDataStd_TreeNode::Set(_lab,aGUID); - return anAttr; - } - } - - if(strncmp(theType, "AttributeUserID",15) == 0){ - Standard_GUID aGUID = SALOMEDS_AttributeUserID_i::GetGUID(); - if(!_lab.FindAttribute(aGUID,anAttr)){ - _study->CheckLocked(); - anAttr = TDataStd_UAttribute::Set(_lab,aGUID); - return anAttr; - } - } - - - return anAttr; -} - - -SALOMEDS::GenericAttribute_ptr -SALOMEDS_SObject_i::FindOrCreateAttribute(const char* theType) +char* SALOMEDS_SObject_i::GetComment() { - TAttrHolder anAttrHolder = _FindGenAttribute(theType); - SALOMEDS::GenericAttribute_var anGenAttr = anAttrHolder.second; - if(!anGenAttr->_is_nil()) - return anGenAttr._retn(); - - Handle(TDF_Attribute) anAttr = _AddAttribute(theType); - if(!anAttr.IsNull()){ - anAttrHolder = _CreateGenAttribute(anAttr,theType); - anGenAttr = anAttrHolder.second; - if(!anGenAttr->_is_nil()) - return anGenAttr._retn(); - } - - return SALOMEDS::GenericAttribute::_nil(); + SALOMEDS::Locker lock; + CORBA::String_var aStr = CORBA::string_dup(_impl->GetComment().ToCString()); + return aStr._retn(); } - //============================================================================ -/*! Function : FindAttribute - * Purpose : Find attribute of given type on this SObject +/*! Function : GetIOR + * Purpose : */ //============================================================================ -void SALOMEDS_SObject_i::RemoveAttribute(const char* theType) +char* SALOMEDS_SObject_i::GetIOR() { - _study->CheckLocked(); - if(strcmp(theType, "AttributeIOR") == 0) { // postponed removing of CORBA objects - Handle(SALOMEDS_IORAttribute) anAttr; - if(_lab.FindAttribute(SALOMEDS_IORAttribute::GetID(), anAttr)) - _study->AddPostponed(Str(anAttr->Get())); - else - return; - } - TAttrMap::iterator anIter = myAttrMap.find(theType); - if(anIter != myAttrMap.end()){ - //myAttrMap.erase(anIter); - } - _lab.ForgetAttribute(::GetGUID(theType)); -} - - -void SALOMEDS_SObject_i::OnRemove() -{ - Handle(TDF_Reference) aReference; - if(_lab.FindAttribute(TDF_Reference::GetID(),aReference)){ - Handle(SALOMEDS_TargetAttribute) aTarget; - if(aReference->Get().FindAttribute(SALOMEDS_TargetAttribute::GetID(),aTarget)) - aTarget->Remove(_lab); - } - - Handle(SALOMEDS_IORAttribute) anAttr; // postponed removing of CORBA objects - if(_lab.FindAttribute(SALOMEDS_IORAttribute::GetID(),anAttr)){ - _study->AddPostponed(TCollection_AsciiString(anAttr->Get()).ToCString()); - } - - //myAttrMap.clear(); - - //SALOMEDS_Study_i::TSObjectMap& anSObjectMap = _study->GetSObjectMap(); - //anSObjectMap.erase(_lab); + SALOMEDS::Locker lock; + CORBA::String_var aStr = CORBA::string_dup(_impl->GetIOR().ToCString()); + return aStr._retn(); } diff --git a/src/SALOMEDS/SALOMEDS_SObject_i.hxx b/src/SALOMEDS/SALOMEDS_SObject_i.hxx index c5f534180..a393cffe3 100644 --- a/src/SALOMEDS/SALOMEDS_SObject_i.hxx +++ b/src/SALOMEDS/SALOMEDS_SObject_i.hxx @@ -1,157 +1,51 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// // File : SALOMEDS_SObject_i.hxx -// Author : Yves FRICAUD +// Author : Sergey RUIN // Module : SALOME -// $Header$ #ifndef __SALOMEDS_SOBJECT_I_H__ #define __SALOMEDS_SOBJECT_I_H__ -#include -#include - -// Cascade headers -#include -#include -#include - -#include "SALOMEDS_Study_i.hxx" +// std C++ headers +#include // IDL headers #include #include CORBA_SERVER_HEADER(SALOMEDS) -class SALOMEDS_GenericAttribute_i; - - -namespace SALOMEDS -{ - const char* Str(const TCollection_ExtendedString& theString); - - std::string GetType(const Handle(TDF_Attribute)& theAttr); - - Standard_GUID GetGUID(const char* theType); - -} +// Cascade headers +#include "SALOMEDSImpl_SObject.hxx" +class SALOMEDS_SObject_i: public POA_SALOMEDS::SObject, + public PortableServer::RefCountServantBase { +protected: + CORBA::ORB_ptr _orb; + Handle(SALOMEDSImpl_SObject) _impl; -class SALOMEDS_SObject_i: public virtual POA_SALOMEDS::SObject, - public virtual PortableServer::RefCountServantBase -{ public: - static - SALOMEDS_Study_i::TSObjectHolder - New(SALOMEDS_Study_i* theStudy, - const TDF_Label& theLabel); - - static - SALOMEDS_SObject_i* - NewPtr(SALOMEDS_Study_i* theStudy, - const TDF_Label& theLabel); - - static - SALOMEDS::SObject_var - NewRef(SALOMEDS_Study_i* theStudy, - const TDF_Label& theLabel); - - virtual SALOMEDS::SObject_ptr GetFather() ; + + SALOMEDS_SObject_i(const Handle(SALOMEDSImpl_SObject)&, CORBA::ORB_ptr); + + virtual ~SALOMEDS_SObject_i(); + + virtual char* GetID(); virtual SALOMEDS::SComponent_ptr GetFatherComponent(); - virtual CORBA::Boolean ReferencedObject(SALOMEDS::SObject_out theSObject); - virtual CORBA::Boolean FindSubObject(CORBA::Long theTag, SALOMEDS::SObject_out theSObject); + virtual SALOMEDS::SObject_ptr GetFather() ; + virtual CORBA::Boolean FindAttribute(SALOMEDS::GenericAttribute_out anAttribute, const char* aTypeOfAttribute); + virtual CORBA::Boolean ReferencedObject(SALOMEDS::SObject_out obj) ; + virtual CORBA::Boolean FindSubObject(long atag, SALOMEDS::SObject_out obj ); - virtual SALOMEDS::Study_ptr GetStudy(); + virtual SALOMEDS::Study_ptr GetStudy() ; + virtual char* Name(); + virtual void Name(const char*); virtual SALOMEDS::ListOfAttributes* GetAllAttributes(); virtual CORBA::Object_ptr GetObject(); - virtual char* GetID(); - virtual CORBA::Short Tag(); - virtual CORBA::Short Depth(); - - virtual char* Name(); - virtual void Name(const char* theName); - virtual char* GetName(); virtual char* GetComment(); virtual char* GetIOR(); - CORBA::Boolean - FindAttribute(SALOMEDS::GenericAttribute_out theAttribute, - const char* theTypeOfAttribute); - - SALOMEDS::GenericAttribute_ptr - FindOrCreateAttribute(const char* theTypeOfAttribute); - - void RemoveAttribute(const char* theTypeOfAttribute); - void OnRemove(); - - SALOMEDS_Study_i* GetStudyServant(){ return _study;} - - TDF_Label GetLabel(){ return _lab;} - TDF_Label GetFatherLabel(){ return _lab.Father();} - TDF_Label GetFatherComponentLabel(); - - CORBA::ORB_var GetORB() const; - - PortableServer::POA_var GetPOA() const; - -protected: - friend class SALOMEDS_GenericAttribute_i; - - typedef std::string TAttributeID; - typedef std::pair TAttrHolder; - typedef std::map TAttrMap; - TAttrMap myAttrMap; - - TAttrHolder - _FindGenAttribute(const Handle(TDF_Attribute)& theAttr); - - TAttrHolder - _CreateGenAttribute(const Handle(TDF_Attribute)& theAttr, - const char* theTypeOfAttribute); - - TAttrHolder - _FindGenAttribute(const char* theTypeOfAttribute); - - Handle(TDF_Attribute) - _AddAttribute(const char* theTypeOfAttribute); - - SALOMEDS_Study_i* _study; - std::string _name; - TDF_Label _lab; - - SALOMEDS_SObject_i(SALOMEDS_Study_i* theStudy, - const TDF_Label& theLabel); - - ~SALOMEDS_SObject_i(); - -private: - SALOMEDS_SObject_i(); // Not implemented - void operator=(const SALOMEDS_SObject_i&); // Not implemented - + virtual CORBA::Short Tag(); + virtual CORBA::Short Depth(); }; - - #endif diff --git a/src/SALOMEDS/SALOMEDS_SelectableAttribute.cdl b/src/SALOMEDS/SALOMEDS_SelectableAttribute.cdl deleted file mode 100644 index 245b19b4f..000000000 --- a/src/SALOMEDS/SALOMEDS_SelectableAttribute.cdl +++ /dev/null @@ -1,77 +0,0 @@ --- SALOME SALOMEDS : data structure of SALOME and sources of Salome data server --- --- Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, --- CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS --- --- This library is free software; you can redistribute it and/or --- modify it under the terms of the GNU Lesser General Public --- License as published by the Free Software Foundation; either --- version 2.1 of the License. --- --- This library is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --- Lesser General Public License for more details. --- --- You should have received a copy of the GNU Lesser General Public --- License along with this library; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --- --- See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org --- --- --- --- File : SALOMEDS_SelectableAttribute.cdl --- Author : Yves FRICAUD --- Module : SALOME - -class SelectableAttribute from SALOMEDS inherits Integer from TDataStd - - ---Purpose: - - -uses Attribute from TDF, - Label from TDF, - GUID from Standard, - ExtendedString from TCollection, - DataSet from TDF, - RelocationTable from TDF, - AttributeSequence from TDF, - Data from TDF, - Comment from TDataStd - - -is - - - ---Purpose: class methods - -- ============= - - GetID (myclass) - ---C++: return const & - returns GUID from Standard; - - Set (myclass; label : Label from TDF; value : Integer from Standard) - ---Purpose: Find, or create a Comment attribute and set the string. - -- the Comment attribute is returned. - returns SelectableAttribute from SALOMEDS; - - ---Purpose: Comment methods - -- ============ - - Create - returns mutable SelectableAttribute from SALOMEDS; - - ID (me) - ---C++: return const & - returns GUID from Standard; - - Restore (me: mutable; with : Attribute from TDF); - - NewEmpty (me) - returns mutable Attribute from TDF; - - Paste (me; into : mutable Attribute from TDF; - RT : mutable RelocationTable from TDF); - -end SelectableAttribute; diff --git a/src/SALOMEDS/SALOMEDS_SelectableAttribute.cxx b/src/SALOMEDS/SALOMEDS_SelectableAttribute.cxx deleted file mode 100644 index 9bd6406b2..000000000 --- a/src/SALOMEDS/SALOMEDS_SelectableAttribute.cxx +++ /dev/null @@ -1,114 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : SALOMEDS_SelectableAttribute.cxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_SelectableAttribute.ixx" -#include -using namespace std; - -//======================================================================= -//function : GetID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_SelectableAttribute::GetID () -{ - static Standard_GUID SALOMEDS_SelectableAttributeID ("12837188-8F52-11d6-A8A3-0001021E8C7F"); - return SALOMEDS_SelectableAttributeID; -} - - - -//======================================================================= -//function : Set -//purpose : -//======================================================================= - -Handle(SALOMEDS_SelectableAttribute) SALOMEDS_SelectableAttribute::Set (const TDF_Label& L, - const Standard_Integer value) -{ - Handle(SALOMEDS_SelectableAttribute) A; - if (!L.FindAttribute(SALOMEDS_SelectableAttribute::GetID(),A)) { - A = new SALOMEDS_SelectableAttribute(); - L.AddAttribute(A); - } - - (Handle(TDataStd_Integer)::DownCast(A))->Set (value); - return A; -} - - -//======================================================================= -//function : constructor -//purpose : -//======================================================================= -SALOMEDS_SelectableAttribute::SALOMEDS_SelectableAttribute() -{ - TDataStd_Integer::Set(0); -} - -//======================================================================= -//function : ID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_SelectableAttribute::ID () const { return GetID(); } - - -//======================================================================= -//function : NewEmpty -//purpose : -//======================================================================= - -Handle(TDF_Attribute) SALOMEDS_SelectableAttribute::NewEmpty () const -{ - return new SALOMEDS_SelectableAttribute(); -} - -//======================================================================= -//function : Restore -//purpose : -//======================================================================= - -void SALOMEDS_SelectableAttribute::Restore(const Handle(TDF_Attribute)& with) -{ - Standard_Integer s = Handle(TDataStd_Integer)::DownCast (with)->Get (); - TDataStd_Integer::Set(s); - return; -} - -//======================================================================= -//function : Paste -//purpose : -//======================================================================= - -void SALOMEDS_SelectableAttribute::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& RT) const -{ - Handle(TDataStd_Integer)::DownCast (into)->Set (Get()); -} - diff --git a/src/SALOMEDS/SALOMEDS_SelectableAttribute.hxx b/src/SALOMEDS/SALOMEDS_SelectableAttribute.hxx deleted file mode 100644 index 0a5d5dcf7..000000000 --- a/src/SALOMEDS/SALOMEDS_SelectableAttribute.hxx +++ /dev/null @@ -1,127 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : SALOMEDS_SelectableAttribute.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _SALOMEDS_SelectableAttribute_HeaderFile -#define _SALOMEDS_SelectableAttribute_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_SALOMEDS_SelectableAttribute_HeaderFile -#include -#endif - -#ifndef _TDataStd_Integer_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Handle_TDF_Attribute_HeaderFile -#include -#endif -#ifndef _Handle_TDF_RelocationTable_HeaderFile -#include -#endif -class Standard_GUID; -class TDF_Label; -class TDF_Attribute; -class TDF_RelocationTable; - - -class SALOMEDS_SelectableAttribute : public TDataStd_Integer { - -public: - - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - // Methods PUBLIC - // -Standard_EXPORT static const Standard_GUID& GetID() ; -Standard_EXPORT static Handle_SALOMEDS_SelectableAttribute Set(const TDF_Label& label,const Standard_Integer value) ; -Standard_EXPORT SALOMEDS_SelectableAttribute(); -Standard_EXPORT const Standard_GUID& ID() const; -Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ; -Standard_EXPORT Handle_TDF_Attribute NewEmpty() const; -Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const; -Standard_EXPORT ~SALOMEDS_SelectableAttribute(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_SelectableAttribute_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - -}; - - - - - -// other inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/SALOMEDS/SALOMEDS_SelectableAttribute.ixx b/src/SALOMEDS/SALOMEDS_SelectableAttribute.ixx deleted file mode 100644 index 52fa3f9e9..000000000 --- a/src/SALOMEDS/SALOMEDS_SelectableAttribute.ixx +++ /dev/null @@ -1,87 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : SALOMEDS_SelectableAttribute.ixx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_SelectableAttribute.jxx" - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -SALOMEDS_SelectableAttribute::~SALOMEDS_SelectableAttribute() {} - - - -Standard_EXPORT Handle_Standard_Type& SALOMEDS_SelectableAttribute_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TDataStd_Integer); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDataStd_Integer); - static Handle_Standard_Type aType2 = STANDARD_TYPE(TDF_Attribute); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(TDF_Attribute); - static Handle_Standard_Type aType3 = STANDARD_TYPE(MMgt_TShared); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType4 = STANDARD_TYPE(Standard_Transient); - if ( aType4.IsNull()) aType4 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_SelectableAttribute", - sizeof(SALOMEDS_SelectableAttribute), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(SALOMEDS_SelectableAttribute) Handle(SALOMEDS_SelectableAttribute)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(SALOMEDS_SelectableAttribute) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_SelectableAttribute))) { - _anOtherObject = Handle(SALOMEDS_SelectableAttribute)((Handle(SALOMEDS_SelectableAttribute)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& SALOMEDS_SelectableAttribute::DynamicType() const -{ - return STANDARD_TYPE(SALOMEDS_SelectableAttribute) ; -} -Standard_Boolean SALOMEDS_SelectableAttribute::IsKind(const Handle(Standard_Type)& AType) const -{ - return (STANDARD_TYPE(SALOMEDS_SelectableAttribute) == AType || TDataStd_Integer::IsKind(AType)); -} -Handle_SALOMEDS_SelectableAttribute::~Handle_SALOMEDS_SelectableAttribute() {} - diff --git a/src/SALOMEDS/SALOMEDS_SelectableAttribute.jxx b/src/SALOMEDS/SALOMEDS_SelectableAttribute.jxx deleted file mode 100644 index 0e83b06be..000000000 --- a/src/SALOMEDS/SALOMEDS_SelectableAttribute.jxx +++ /dev/null @@ -1,43 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : SALOMEDS_SelectableAttribute.jxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _Standard_GUID_HeaderFile -#include -#endif -#ifndef _TDF_Label_HeaderFile -#include -#endif -#ifndef _TDF_Attribute_HeaderFile -#include -#endif -#ifndef _TDF_RelocationTable_HeaderFile -#include -#endif -#ifndef _SALOMEDS_SelectableAttribute_HeaderFile -#include "SALOMEDS_SelectableAttribute.hxx" -#endif diff --git a/src/SALOMEDS/SALOMEDS_SequenceOfIntegerAttribute.cdl b/src/SALOMEDS/SALOMEDS_SequenceOfIntegerAttribute.cdl deleted file mode 100644 index 4cd5b50ef..000000000 --- a/src/SALOMEDS/SALOMEDS_SequenceOfIntegerAttribute.cdl +++ /dev/null @@ -1,104 +0,0 @@ --- SALOME SALOMEDS : data structure of SALOME and sources of Salome data server --- --- Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, --- CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS --- --- This library is free software; you can redistribute it and/or --- modify it under the terms of the GNU Lesser General Public --- License as published by the Free Software Foundation; either --- version 2.1 of the License. --- --- This library is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --- Lesser General Public License for more details. --- --- You should have received a copy of the GNU Lesser General Public --- License along with this library; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --- --- See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org --- --- --- --- File : SALOMEDS_SequenceOfIntegerAttribute.cdl --- Author : Yves FRICAUD --- Module : SALOME - -class SequenceOfIntegerAttribute from SALOMEDS inherits Attribute from TDF - - ---Purpose: - - -uses Attribute from TDF, - Label from TDF, - GUID from Standard, - HSequenceOfInteger from TColStd, - DataSet from TDF, - RelocationTable from TDF, - AttributeSequence from TDF, - Data from TDF, - Comment from TDataStd - - -is - - - ---Purpose: class methods - -- ============= - - GetID (myclass) - ---C++: return const & - returns GUID from Standard; - - Set (myclass; label : Label from TDF) - ---Purpose: Find, or create a Comment attribute and set the string. - -- the Comment attribute is returned. - returns SequenceOfIntegerAttribute from SALOMEDS; - - ---Purpose: Comment methods - -- ============ - - Create - returns mutable SequenceOfIntegerAttribute from SALOMEDS; - - ---Category: IntegerArray methods - -- =============== - - Assign(me : mutable; other : HSequenceOfInteger from TColStd); - ---Purpose: Initialize the inner sequence by other one - - ChangeValue (me : mutable; Index, Value : Integer from Standard); - ---Purpose: Sets the th element of the sequence to - - Add (me : mutable; value : Integer from Standard); - ---Purpose: Add new value - - Value (me : mutable; Index : Integer from Standard) returns Integer; - ---Purpose: Value of index - - Remove (me : mutable; Index : Integer from Standard); - ---Purpose: Remove element on index - - Length (me : mutable) returns Integer; - ---Purpose: Returns length of sequence - - - - ID (me) - ---C++: return const & - returns GUID from Standard; - - Restore (me: mutable; with : Attribute from TDF); - - NewEmpty (me) - returns mutable Attribute from TDF; - - Paste (me; into : mutable Attribute from TDF; - RT : mutable RelocationTable from TDF); - -fields - - myValue : HSequenceOfInteger from TColStd; - -end SequenceOfIntegerAttribute; diff --git a/src/SALOMEDS/SALOMEDS_SequenceOfIntegerAttribute.cxx b/src/SALOMEDS/SALOMEDS_SequenceOfIntegerAttribute.cxx deleted file mode 100644 index b18143181..000000000 --- a/src/SALOMEDS/SALOMEDS_SequenceOfIntegerAttribute.cxx +++ /dev/null @@ -1,151 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : SALOMEDS_SequenceOfIntegerAttribute.cxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_SequenceOfIntegerAttribute.ixx" -using namespace std; - -//======================================================================= -//function : GetID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_SequenceOfIntegerAttribute::GetID () -{ - static Standard_GUID SALOMEDS_SequenceOfIntegerAttributeID ("12837182-8F52-11d6-A8A3-0001021E8C7F"); - return SALOMEDS_SequenceOfIntegerAttributeID; -} - - - -//======================================================================= -//function : Set -//purpose : -//======================================================================= - -Handle(SALOMEDS_SequenceOfIntegerAttribute) SALOMEDS_SequenceOfIntegerAttribute::Set (const TDF_Label& L) -{ - Handle(SALOMEDS_SequenceOfIntegerAttribute) A; - if (!L.FindAttribute(SALOMEDS_SequenceOfIntegerAttribute::GetID(),A)) { - A = new SALOMEDS_SequenceOfIntegerAttribute(); - L.AddAttribute(A); - } - return A; -} - - -//======================================================================= -//function : constructor -//purpose : -//======================================================================= -SALOMEDS_SequenceOfIntegerAttribute::SALOMEDS_SequenceOfIntegerAttribute() -{myValue = new TColStd_HSequenceOfInteger();} - -//======================================================================= -//function : ID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_SequenceOfIntegerAttribute::ID () const { return GetID(); } - - -//======================================================================= -//function : NewEmpty -//purpose : -//======================================================================= - -Handle(TDF_Attribute) SALOMEDS_SequenceOfIntegerAttribute::NewEmpty () const -{ - return new SALOMEDS_SequenceOfIntegerAttribute(); -} - -//======================================================================= -//function : Restore -//purpose : -//======================================================================= - -void SALOMEDS_SequenceOfIntegerAttribute::Restore(const Handle(TDF_Attribute)& with) -{ - Standard_Integer i; - Handle(SALOMEDS_SequenceOfIntegerAttribute) anSeq = Handle(SALOMEDS_SequenceOfIntegerAttribute)::DownCast(with); - if(!anSeq->myValue.IsNull()) { - myValue = new TColStd_HSequenceOfInteger(); - Standard_Integer Len = anSeq->Length(); - for(i = 1; i<=Len; i++) Add(anSeq->Value(i)); - } - else - myValue.Nullify(); - return; -} - -//======================================================================= -//function : Paste -//purpose : -//======================================================================= - -void SALOMEDS_SequenceOfIntegerAttribute::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& ) const -{ - if(!myValue.IsNull()) { - Handle(SALOMEDS_SequenceOfIntegerAttribute)::DownCast (into)->Assign(myValue); - } -} - -void SALOMEDS_SequenceOfIntegerAttribute::Assign(const Handle(TColStd_HSequenceOfInteger)& other) -{ - Backup(); - if (myValue.IsNull()) myValue = new TColStd_HSequenceOfInteger; - myValue->ChangeSequence() = other->Sequence(); -} - -void SALOMEDS_SequenceOfIntegerAttribute::ChangeValue(const Standard_Integer Index,const Standard_Integer Value) -{ - Backup(); - myValue->SetValue(Index, Value); -} - -void SALOMEDS_SequenceOfIntegerAttribute::Add(const Standard_Integer Value) -{ - Backup(); - myValue->Append(Value); -} - -void SALOMEDS_SequenceOfIntegerAttribute::Remove(const Standard_Integer Index) -{ - Backup(); - myValue->Remove(Index); -} - -Standard_Integer SALOMEDS_SequenceOfIntegerAttribute::Length() -{ - return myValue->Length(); -} -Standard_Integer SALOMEDS_SequenceOfIntegerAttribute::Value(const Standard_Integer Index) -{ - return myValue->Value(Index); -} - diff --git a/src/SALOMEDS/SALOMEDS_SequenceOfIntegerAttribute.hxx b/src/SALOMEDS/SALOMEDS_SequenceOfIntegerAttribute.hxx deleted file mode 100644 index 85e265638..000000000 --- a/src/SALOMEDS/SALOMEDS_SequenceOfIntegerAttribute.hxx +++ /dev/null @@ -1,134 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : SALOMEDS_SequenceOfIntegerAttribute.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _SALOMEDS_SequenceOfIntegerAttribute_HeaderFile -#define _SALOMEDS_SequenceOfIntegerAttribute_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_SALOMEDS_SequenceOfIntegerAttribute_HeaderFile -#include -#endif - -#ifndef _Handle_TColStd_HSequenceOfInteger_HeaderFile -#include -#endif -#ifndef _TDF_Attribute_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Handle_TDF_Attribute_HeaderFile -#include -#endif -#ifndef _Handle_TDF_RelocationTable_HeaderFile -#include -#endif -class TColStd_HSequenceOfInteger; -class Standard_GUID; -class TDF_Label; -class TDF_Attribute; -class TDF_RelocationTable; - - -class SALOMEDS_SequenceOfIntegerAttribute : public TDF_Attribute { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // -Standard_EXPORT static const Standard_GUID& GetID() ; -Standard_EXPORT static Handle_SALOMEDS_SequenceOfIntegerAttribute Set(const TDF_Label& label) ; -Standard_EXPORT SALOMEDS_SequenceOfIntegerAttribute(); -Standard_EXPORT void Assign(const Handle(TColStd_HSequenceOfInteger)& other) ; -Standard_EXPORT void ChangeValue(const Standard_Integer Index,const Standard_Integer Value) ; -Standard_EXPORT void Add(const Standard_Integer value) ; -Standard_EXPORT Standard_Integer Value(const Standard_Integer Index) ; -Standard_EXPORT void Remove(const Standard_Integer Index) ; -Standard_EXPORT Standard_Integer Length() ; -Standard_EXPORT const Standard_GUID& ID() const; -Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ; -Standard_EXPORT Handle_TDF_Attribute NewEmpty() const; -Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const; -Standard_EXPORT ~SALOMEDS_SequenceOfIntegerAttribute(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_SequenceOfIntegerAttribute_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // -Handle_TColStd_HSequenceOfInteger myValue; - - -}; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/SALOMEDS/SALOMEDS_SequenceOfIntegerAttribute.ixx b/src/SALOMEDS/SALOMEDS_SequenceOfIntegerAttribute.ixx deleted file mode 100644 index c8feebedd..000000000 --- a/src/SALOMEDS/SALOMEDS_SequenceOfIntegerAttribute.ixx +++ /dev/null @@ -1,85 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : SALOMEDS_SequenceOfIntegerAttribute.ixx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_SequenceOfIntegerAttribute.jxx" - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -SALOMEDS_SequenceOfIntegerAttribute::~SALOMEDS_SequenceOfIntegerAttribute() {} - - - -Standard_EXPORT Handle_Standard_Type& SALOMEDS_SequenceOfIntegerAttribute_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TDF_Attribute); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDF_Attribute); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_SequenceOfIntegerAttribute", - sizeof(SALOMEDS_SequenceOfIntegerAttribute), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(SALOMEDS_SequenceOfIntegerAttribute) Handle(SALOMEDS_SequenceOfIntegerAttribute)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(SALOMEDS_SequenceOfIntegerAttribute) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_SequenceOfIntegerAttribute))) { - _anOtherObject = Handle(SALOMEDS_SequenceOfIntegerAttribute)((Handle(SALOMEDS_SequenceOfIntegerAttribute)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& SALOMEDS_SequenceOfIntegerAttribute::DynamicType() const -{ - return STANDARD_TYPE(SALOMEDS_SequenceOfIntegerAttribute) ; -} -Standard_Boolean SALOMEDS_SequenceOfIntegerAttribute::IsKind(const Handle(Standard_Type)& AType) const -{ - return (STANDARD_TYPE(SALOMEDS_SequenceOfIntegerAttribute) == AType || TDF_Attribute::IsKind(AType)); -} -Handle_SALOMEDS_SequenceOfIntegerAttribute::~Handle_SALOMEDS_SequenceOfIntegerAttribute() {} - diff --git a/src/SALOMEDS/SALOMEDS_SequenceOfIntegerAttribute.jxx b/src/SALOMEDS/SALOMEDS_SequenceOfIntegerAttribute.jxx deleted file mode 100644 index 71586ee7e..000000000 --- a/src/SALOMEDS/SALOMEDS_SequenceOfIntegerAttribute.jxx +++ /dev/null @@ -1,46 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : SALOMEDS_SequenceOfIntegerAttribute.jxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _TColStd_HSequenceOfInteger_HeaderFile -#include -#endif -#ifndef _Standard_GUID_HeaderFile -#include -#endif -#ifndef _TDF_Label_HeaderFile -#include -#endif -#ifndef _TDF_Attribute_HeaderFile -#include -#endif -#ifndef _TDF_RelocationTable_HeaderFile -#include -#endif -#ifndef _SALOMEDS_SequenceOfIntegerAttribute_HeaderFile -#include "SALOMEDS_SequenceOfIntegerAttribute.hxx" -#endif diff --git a/src/SALOMEDS/SALOMEDS_SequenceOfRealAttribute.cdl b/src/SALOMEDS/SALOMEDS_SequenceOfRealAttribute.cdl deleted file mode 100644 index 35f6948f3..000000000 --- a/src/SALOMEDS/SALOMEDS_SequenceOfRealAttribute.cdl +++ /dev/null @@ -1,104 +0,0 @@ --- SALOME SALOMEDS : data structure of SALOME and sources of Salome data server --- --- Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, --- CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS --- --- This library is free software; you can redistribute it and/or --- modify it under the terms of the GNU Lesser General Public --- License as published by the Free Software Foundation; either --- version 2.1 of the License. --- --- This library is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --- Lesser General Public License for more details. --- --- You should have received a copy of the GNU Lesser General Public --- License along with this library; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --- --- See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org --- --- --- --- File : SALOMEDS_SequenceOfRealAttribute.cdl --- Author : Yves FRICAUD --- Module : SALOME - -class SequenceOfRealAttribute from SALOMEDS inherits Attribute from TDF - - ---Purpose: - - -uses Attribute from TDF, - Label from TDF, - GUID from Standard, - HSequenceOfReal from TColStd, - DataSet from TDF, - RelocationTable from TDF, - AttributeSequence from TDF, - Data from TDF, - Comment from TDataStd - - -is - - - ---Purpose: class methods - -- ============= - - GetID (myclass) - ---C++: return const & - returns GUID from Standard; - - Set (myclass; label : Label from TDF) - ---Purpose: Find, or create a Comment attribute and set the string. - -- the Comment attribute is returned. - returns SequenceOfRealAttribute from SALOMEDS; - - ---Purpose: Comment methods - -- ============ - - Create - returns mutable SequenceOfRealAttribute from SALOMEDS; - - ---Category: IntegerArray methods - -- =============== - - Assign(me : mutable; other : HSequenceOfReal from TColStd); - ---Purpose: Initialize the inner sequence by other one - - ChangeValue (me : mutable; Index : Integer from Standard; Value : Real); - ---Purpose: Sets the th element of the sequence to - - Add (me : mutable; Value : Real from Standard); - ---Purpose: Add new value - - Value (me : mutable; Index : Integer from Standard) returns Real; - ---Purpose: Value of index - - Remove (me : mutable; Index : Integer from Standard); - ---Purpose: Remove element on index - - Length (me : mutable) returns Integer; - ---Purpose: Returns length of sequence - - - - ID (me) - ---C++: return const & - returns GUID from Standard; - - Restore (me: mutable; with : Attribute from TDF); - - NewEmpty (me) - returns mutable Attribute from TDF; - - Paste (me; into : mutable Attribute from TDF; - RT : mutable RelocationTable from TDF); - -fields - - myValue : HSequenceOfReal from TColStd; - -end SequenceOfRealAttribute; diff --git a/src/SALOMEDS/SALOMEDS_SequenceOfRealAttribute.cxx b/src/SALOMEDS/SALOMEDS_SequenceOfRealAttribute.cxx deleted file mode 100644 index 13d242526..000000000 --- a/src/SALOMEDS/SALOMEDS_SequenceOfRealAttribute.cxx +++ /dev/null @@ -1,153 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : SALOMEDS_SequenceOfRealAttribute.cxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_SequenceOfRealAttribute.ixx" -#include -using namespace std; - -//======================================================================= -//function : GetID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_SequenceOfRealAttribute::GetID () -{ - static Standard_GUID SALOMEDS_SequenceOfRealAttributeID ("12837183-8F52-11d6-A8A3-0001021E8C7F"); - return SALOMEDS_SequenceOfRealAttributeID; -} - - - -//======================================================================= -//function : Set -//purpose : -//======================================================================= - -Handle(SALOMEDS_SequenceOfRealAttribute) SALOMEDS_SequenceOfRealAttribute::Set (const TDF_Label& L) -{ - Handle(SALOMEDS_SequenceOfRealAttribute) A; - if (!L.FindAttribute(SALOMEDS_SequenceOfRealAttribute::GetID(),A)) { - A = new SALOMEDS_SequenceOfRealAttribute(); - L.AddAttribute(A); - } - return A; -} - - -//======================================================================= -//function : constructor -//purpose : -//======================================================================= -SALOMEDS_SequenceOfRealAttribute::SALOMEDS_SequenceOfRealAttribute() -{myValue = new TColStd_HSequenceOfReal();} - -//======================================================================= -//function : ID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_SequenceOfRealAttribute::ID () const { return GetID(); } - - -//======================================================================= -//function : NewEmpty -//purpose : -//======================================================================= - -Handle(TDF_Attribute) SALOMEDS_SequenceOfRealAttribute::NewEmpty () const -{ - return new SALOMEDS_SequenceOfRealAttribute(); -} - -//======================================================================= -//function : Restore -//purpose : -//======================================================================= - -void SALOMEDS_SequenceOfRealAttribute::Restore(const Handle(TDF_Attribute)& with) -{ - Standard_Integer i; - Handle(SALOMEDS_SequenceOfRealAttribute) anSeq = Handle(SALOMEDS_SequenceOfRealAttribute)::DownCast(with); - if(!anSeq->myValue.IsNull()) { - myValue = new TColStd_HSequenceOfReal(); - Standard_Integer Len = anSeq->Length(); - for(i = 1; i<=Len; i++) Add(anSeq->Value(i)); - } - else - myValue.Nullify(); - return; -} - -//======================================================================= -//function : Paste -//purpose : -//======================================================================= - -void SALOMEDS_SequenceOfRealAttribute::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& ) const -{ - if(!myValue.IsNull()) { - Handle(SALOMEDS_SequenceOfRealAttribute)::DownCast (into)->Assign(myValue); - } -} - -void SALOMEDS_SequenceOfRealAttribute::Assign(const Handle(TColStd_HSequenceOfReal)& other) -{ - Backup(); - if (myValue.IsNull()) myValue = new TColStd_HSequenceOfReal; - myValue->ChangeSequence() = other->Sequence(); -} - -void SALOMEDS_SequenceOfRealAttribute::ChangeValue(const Standard_Integer Index,const Standard_Real Value) -{ - Backup(); - myValue->SetValue(Index, Value); -} - -void SALOMEDS_SequenceOfRealAttribute::Add(const Standard_Real Value) -{ - Backup(); - myValue->Append(Value); -} - -void SALOMEDS_SequenceOfRealAttribute::Remove(const Standard_Integer Index) -{ - Backup(); - myValue->Remove(Index); -} - -Standard_Integer SALOMEDS_SequenceOfRealAttribute::Length() -{ - return myValue->Length(); -} - -Standard_Real SALOMEDS_SequenceOfRealAttribute::Value(const Standard_Integer Index) -{ - return myValue->Value(Index); -} - diff --git a/src/SALOMEDS/SALOMEDS_SequenceOfRealAttribute.hxx b/src/SALOMEDS/SALOMEDS_SequenceOfRealAttribute.hxx deleted file mode 100644 index 79cda424f..000000000 --- a/src/SALOMEDS/SALOMEDS_SequenceOfRealAttribute.hxx +++ /dev/null @@ -1,137 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : SALOMEDS_SequenceOfRealAttribute.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _SALOMEDS_SequenceOfRealAttribute_HeaderFile -#define _SALOMEDS_SequenceOfRealAttribute_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_SALOMEDS_SequenceOfRealAttribute_HeaderFile -#include -#endif - -#ifndef _Handle_TColStd_HSequenceOfReal_HeaderFile -#include -#endif -#ifndef _TDF_Attribute_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Standard_Real_HeaderFile -#include -#endif -#ifndef _Handle_TDF_Attribute_HeaderFile -#include -#endif -#ifndef _Handle_TDF_RelocationTable_HeaderFile -#include -#endif -class TColStd_HSequenceOfReal; -class Standard_GUID; -class TDF_Label; -class TDF_Attribute; -class TDF_RelocationTable; - - -class SALOMEDS_SequenceOfRealAttribute : public TDF_Attribute { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // -Standard_EXPORT static const Standard_GUID& GetID() ; -Standard_EXPORT static Handle_SALOMEDS_SequenceOfRealAttribute Set(const TDF_Label& label) ; -Standard_EXPORT SALOMEDS_SequenceOfRealAttribute(); -Standard_EXPORT void Assign(const Handle(TColStd_HSequenceOfReal)& other) ; -Standard_EXPORT void ChangeValue(const Standard_Integer Index,const Standard_Real Value) ; -Standard_EXPORT void Add(const Standard_Real Value) ; -Standard_EXPORT Standard_Real Value(const Standard_Integer Index) ; -Standard_EXPORT void Remove(const Standard_Integer Index) ; -Standard_EXPORT Standard_Integer Length() ; -Standard_EXPORT const Standard_GUID& ID() const; -Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ; -Standard_EXPORT Handle_TDF_Attribute NewEmpty() const; -Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const; -Standard_EXPORT ~SALOMEDS_SequenceOfRealAttribute(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_SequenceOfRealAttribute_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // -Handle_TColStd_HSequenceOfReal myValue; - - -}; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/SALOMEDS/SALOMEDS_SequenceOfRealAttribute.ixx b/src/SALOMEDS/SALOMEDS_SequenceOfRealAttribute.ixx deleted file mode 100644 index 5e4b09818..000000000 --- a/src/SALOMEDS/SALOMEDS_SequenceOfRealAttribute.ixx +++ /dev/null @@ -1,85 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : SALOMEDS_SequenceOfRealAttribute.ixx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_SequenceOfRealAttribute.jxx" - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -SALOMEDS_SequenceOfRealAttribute::~SALOMEDS_SequenceOfRealAttribute() {} - - - -Standard_EXPORT Handle_Standard_Type& SALOMEDS_SequenceOfRealAttribute_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TDF_Attribute); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDF_Attribute); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_SequenceOfRealAttribute", - sizeof(SALOMEDS_SequenceOfRealAttribute), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(SALOMEDS_SequenceOfRealAttribute) Handle(SALOMEDS_SequenceOfRealAttribute)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(SALOMEDS_SequenceOfRealAttribute) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_SequenceOfRealAttribute))) { - _anOtherObject = Handle(SALOMEDS_SequenceOfRealAttribute)((Handle(SALOMEDS_SequenceOfRealAttribute)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& SALOMEDS_SequenceOfRealAttribute::DynamicType() const -{ - return STANDARD_TYPE(SALOMEDS_SequenceOfRealAttribute) ; -} -Standard_Boolean SALOMEDS_SequenceOfRealAttribute::IsKind(const Handle(Standard_Type)& AType) const -{ - return (STANDARD_TYPE(SALOMEDS_SequenceOfRealAttribute) == AType || TDF_Attribute::IsKind(AType)); -} -Handle_SALOMEDS_SequenceOfRealAttribute::~Handle_SALOMEDS_SequenceOfRealAttribute() {} - diff --git a/src/SALOMEDS/SALOMEDS_SequenceOfRealAttribute.jxx b/src/SALOMEDS/SALOMEDS_SequenceOfRealAttribute.jxx deleted file mode 100644 index ec639c846..000000000 --- a/src/SALOMEDS/SALOMEDS_SequenceOfRealAttribute.jxx +++ /dev/null @@ -1,46 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : SALOMEDS_SequenceOfRealAttribute.jxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _TColStd_HSequenceOfReal_HeaderFile -#include -#endif -#ifndef _Standard_GUID_HeaderFile -#include -#endif -#ifndef _TDF_Label_HeaderFile -#include -#endif -#ifndef _TDF_Attribute_HeaderFile -#include -#endif -#ifndef _TDF_RelocationTable_HeaderFile -#include -#endif -#ifndef _SALOMEDS_SequenceOfRealAttribute_HeaderFile -#include "SALOMEDS_SequenceOfRealAttribute.hxx" -#endif diff --git a/src/SALOMEDS/SALOMEDS_StudyBuilder_i.cxx b/src/SALOMEDS/SALOMEDS_StudyBuilder_i.cxx index 42aefe220..62855fb3e 100644 --- a/src/SALOMEDS/SALOMEDS_StudyBuilder_i.cxx +++ b/src/SALOMEDS/SALOMEDS_StudyBuilder_i.cxx @@ -1,73 +1,27 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// // File : SALOMEDS_StudyBuilder_i.cxx -// Author : Yves FRICAUD +// Author : Seregy RUIN // Module : SALOME -// $Header$ +using namespace std; +#include "utilities.h" #include "SALOMEDS_StudyBuilder_i.hxx" -#include "SALOMEDS_StudyManager_i.hxx" #include "SALOMEDS_Study_i.hxx" - #include "SALOMEDS_SObject_i.hxx" #include "SALOMEDS_SComponent_i.hxx" -#include "SALOMEDS_ChildIterator_i.hxx" +#include "SALOMEDS_GenericAttribute_i.hxx" +#include "SALOMEDS_Driver_i.hxx" +#include "SALOMEDS.hxx" -#include "SALOMEDS_TargetAttribute.hxx" -#include "SALOMEDS_IORAttribute.hxx" -#include "SALOMEDS_PersRefAttribute.hxx" -#include "SALOMEDS_LocalIDAttribute.hxx" -#include "SALOMEDS_StudyPropertiesAttribute.hxx" - -#include "SALOMEDS_Tool.hxx" +#include "SALOMEDSImpl_Study.hxx" +#include "SALOMEDSImpl_SObject.hxx" +#include "SALOMEDSImpl_SComponent.hxx" #include "Utils_CorbaException.hxx" #include "Utils_ExceptHandlers.hxx" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include +#include #include -#define USE_CASE_LABEL_TAG 2 -#define DIRECTORYID 16661 -#define FILELOCALID 26662 - -#include "utilities.h" - -using namespace std; - UNEXPECT_CATCH(SBSalomeException, SALOME::SALOME_Exception); UNEXPECT_CATCH(SBLockProtection, SALOMEDS::StudyBuilder::LockProtection); @@ -76,11 +30,11 @@ UNEXPECT_CATCH(SBLockProtection, SALOMEDS::StudyBuilder::LockProtection); * Purpose : */ //============================================================================ -SALOMEDS_StudyBuilder_i::SALOMEDS_StudyBuilder_i(SALOMEDS_Study_i* theStudy, - const Handle(TDocStd_Document)& theDocument): - _study(theStudy), - _doc(theDocument) +SALOMEDS_StudyBuilder_i::SALOMEDS_StudyBuilder_i(const Handle(SALOMEDSImpl_StudyBuilder) theImpl, + CORBA::ORB_ptr orb) { + _orb = CORBA::ORB::_duplicate(orb); + _impl = theImpl; } //============================================================================ @@ -89,54 +43,25 @@ SALOMEDS_StudyBuilder_i::SALOMEDS_StudyBuilder_i(SALOMEDS_Study_i* theStudy, */ //============================================================================ SALOMEDS_StudyBuilder_i::~SALOMEDS_StudyBuilder_i() -{ -} - - -//============================================================================ -CORBA::ORB_var SALOMEDS_StudyBuilder_i::GetORB() const -{ - return _study->GetORB(); -} - - -//============================================================================ -PortableServer::POA_var SALOMEDS_StudyBuilder_i::GetPOA() const -{ - return _study->GetPOA(); -} - +{} //============================================================================ /*! Function : NewComponent * Purpose : Create a new component (Scomponent) */ //============================================================================ -SALOMEDS::SComponent_ptr -SALOMEDS_StudyBuilder_i::NewComponent(const char* DataType) +SALOMEDS::SComponent_ptr SALOMEDS_StudyBuilder_i::NewComponent(const char* DataType) { + SALOMEDS::Locker lock; CheckLocked(); - //Always create component under main label. - TDF_Label L = _doc->Main(); - - // YFR DEBUG : 13/02/2002 TDF_Label NL = L.NewChild(); - - Standard_Integer imax = 0; - for (TDF_ChildIterator it(L); it.More(); it.Next()) { - if (it.Value().Tag() > imax) - imax = it.Value().Tag(); - } - imax++; - TDF_Label NL = L.FindChild(imax); + //char* aDataType = CORBA::string_dup(DataType); + Handle(SALOMEDSImpl_SComponent) aSCO = _impl->NewComponent(TCollection_AsciiString((char*)DataType)); + //CORBA::free_string(aDataType); + if(aSCO.IsNull()) return SALOMEDS::SComponent::_nil(); - TDataStd_Comment::Set(NL,Standard_CString(DataType)); - // TDataStd_Comment::Set(NL,Standard_CString(CORBA::string_dup(DataType))); - - SALOMEDS::SComponent_var aSComponent = SALOMEDS_SComponent_i::NewRef(_study,NL); - - OnAddSObject(aSComponent); - - return aSComponent._retn(); + SALOMEDS_SComponent_i * so_servant = new SALOMEDS_SComponent_i (aSCO,_orb); + SALOMEDS::SComponent_var so= SALOMEDS::SComponent::_narrow(so_servant->SComponent::_this()); + return so; } //============================================================================ @@ -144,22 +69,16 @@ SALOMEDS_StudyBuilder_i::NewComponent(const char* DataType) * Purpose : Add IOR attribute of a Scomponent */ //============================================================================ -void SALOMEDS_StudyBuilder_i::DefineComponentInstance(SALOMEDS::SComponent_ptr theComponent, - CORBA::Object_ptr theObject) +void SALOMEDS_StudyBuilder_i::DefineComponentInstance(SALOMEDS::SComponent_ptr aComponent, + CORBA::Object_ptr IOR) { + SALOMEDS::Locker lock; CheckLocked(); + Handle(SALOMEDSImpl_SComponent) aSCO; + aSCO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSComponent((char*)aComponent->GetID()); - if(CORBA::is_nil(theComponent) || CORBA::is_nil(theObject)) - return; - - //Find label - TDF_Label Lab; - CORBA::String_var aString = theComponent->GetID(); - TDF_Tool::Label(_doc->GetData(),const_cast(aString.in()),Lab); - - //add theObject definition - aString = GetORB()->object_to_string(theObject); - SALOMEDS_IORAttribute::Set(Lab,const_cast(aString.in()),_study); + CORBA::String_var iorstr = _orb->object_to_string(IOR); + _impl->DefineComponentInstance(aSCO, (char*)iorstr); } //============================================================================ @@ -167,11 +86,14 @@ void SALOMEDS_StudyBuilder_i::DefineComponentInstance(SALOMEDS::SComponent_ptr t * Purpose : Delete a Scomponent */ //============================================================================ -void -SALOMEDS_StudyBuilder_i::RemoveComponent(SALOMEDS::SComponent_ptr theComponent) +void SALOMEDS_StudyBuilder_i::RemoveComponent(SALOMEDS::SComponent_ptr aComponent) { + SALOMEDS::Locker lock; CheckLocked(); - RemoveObject(theComponent); + ASSERT(!CORBA::is_nil(aComponent)); + Handle(SALOMEDSImpl_SComponent) aSCO; + aSCO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSComponent((char*)aComponent->GetID()); + _impl->RemoveComponent(aSCO); } //============================================================================ @@ -179,36 +101,19 @@ SALOMEDS_StudyBuilder_i::RemoveComponent(SALOMEDS::SComponent_ptr theComponent) * Purpose : Create a new SObject */ //============================================================================ -SALOMEDS::SObject_ptr -SALOMEDS_StudyBuilder_i::NewObject(SALOMEDS::SObject_ptr theFatherObject) +SALOMEDS::SObject_ptr SALOMEDS_StudyBuilder_i::NewObject(SALOMEDS::SObject_ptr theFatherObject) { + SALOMEDS::Locker lock; CheckLocked(); - - if(CORBA::is_nil(theFatherObject)) - return SALOMEDS::SObject::_nil(); - - //Find label of father - TDF_Label aLabel; - TCollection_AsciiString anEntry; - - CORBA::String_var aFatherID = theFatherObject->GetID(); - TDF_Tool::Label(_doc->GetData(),aFatherID,aLabel); - - //Create a new label - //YFR DEBUG : 13/02/2002 TDF_Label NewLab = Lab.NewChild(); - Standard_Integer imax = 0; - for (TDF_ChildIterator it(aLabel); it.More(); it.Next()) { - if (it.Value().Tag() > imax) - imax = it.Value().Tag(); - } - imax++; - TDF_Label aNewLabel = aLabel.FindChild(imax); - SALOMEDS::SObject_var aSObject = SALOMEDS_SObject_i::NewRef(_study,aNewLabel); - - OnAddSObject(aSObject); + Handle(SALOMEDSImpl_SObject) aFO, aSO; + aFO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSObject((char*)theFatherObject->GetID()); + aSO = _impl->NewObject(aFO); + if(aSO.IsNull()) return SALOMEDS::SObject::_nil(); + SALOMEDS_SObject_i * so_servant = new SALOMEDS_SObject_i (aSO,_orb); + SALOMEDS::SObject_var so = SALOMEDS::SObject::_narrow(so_servant->_this()); - return aSObject._retn(); + return so; } //============================================================================ @@ -216,28 +121,18 @@ SALOMEDS_StudyBuilder_i::NewObject(SALOMEDS::SObject_ptr theFatherObject) * Purpose : */ //============================================================================ -SALOMEDS::SObject_ptr -SALOMEDS_StudyBuilder_i::NewObjectToTag(SALOMEDS::SObject_ptr theFatherObject, - CORBA::Long theTag) +SALOMEDS::SObject_ptr SALOMEDS_StudyBuilder_i::NewObjectToTag(SALOMEDS::SObject_ptr theFatherObject, + CORBA::Long atag) { + SALOMEDS::Locker lock; CheckLocked(); - - if(CORBA::is_nil(theFatherObject)) - return SALOMEDS::SObject::_nil(); - - //Find label of father - TDF_Label Lab; - CORBA::String_var aFatherID = theFatherObject->GetID(); - TDF_Tool::Label(_doc->GetData(),aFatherID,Lab); - - //Create or find label - TDF_Label aNewLab = Lab.FindChild(theTag,1); - - SALOMEDS::SObject_var aSObject = SALOMEDS_SObject_i::NewRef(_study,aNewLab); - - OnAddSObject(aSObject); - - return aSObject._retn(); + Handle(SALOMEDSImpl_SObject) aFO, aSO; + aFO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSObject((char*)theFatherObject->GetID()); + aSO = _impl->NewObjectToTag(aFO, atag); + if(aSO.IsNull()) return SALOMEDS::SObject::_nil(); + SALOMEDS_SObject_i * so_servant = new SALOMEDS_SObject_i (aSO, _orb); + SALOMEDS::SObject_var so = SALOMEDS::SObject::_narrow(so_servant->_this()); + return so; } //============================================================================ @@ -245,28 +140,13 @@ SALOMEDS_StudyBuilder_i::NewObjectToTag(SALOMEDS::SObject_ptr theFatherObject, * Purpose : */ //============================================================================ -void SALOMEDS_StudyBuilder_i::RemoveObject(SALOMEDS::SObject_ptr theSObject) -{ - RemoveSObject(theSObject); -} - -SALOMEDS_SObject_i* -SALOMEDS_StudyBuilder_i::RemoveSObject(SALOMEDS::SObject_ptr theSObject, - bool theIsForgetAllAttributes) +void SALOMEDS_StudyBuilder_i::RemoveObject(SALOMEDS::SObject_ptr anObject) { + SALOMEDS::Locker lock; CheckLocked(); - - if(SALOMEDS_SObject_i* aSObject = _study->DownCast(theSObject)){ - OnRemoveSObject(theSObject); - aSObject->OnRemove(); - if(theIsForgetAllAttributes){ - TDF_Label aLabel = aSObject->GetLabel(); - aLabel.ForgetAllAttributes(); - } - return aSObject; - } - - return NULL; + Handle(SALOMEDSImpl_SObject) aSO; + aSO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSObject((char*)anObject->GetID()); + _impl->RemoveObject(aSO); } //============================================================================ @@ -274,53 +154,13 @@ SALOMEDS_StudyBuilder_i::RemoveSObject(SALOMEDS::SObject_ptr theSObject, * Purpose : */ //============================================================================ -void SALOMEDS_StudyBuilder_i::RemoveObjectWithChildren(SALOMEDS::SObject_ptr theSObject) +void SALOMEDS_StudyBuilder_i::RemoveObjectWithChildren(SALOMEDS::SObject_ptr anObject) { - if(SALOMEDS_SObject_i* aSObject = RemoveSObject(theSObject,false)){ - SALOMEDS_ChildIterator_i aChildIter(_study,aSObject->GetLabel(),true); - for(; aChildIter.More(); aChildIter.Next()){ - if(SALOMEDS_SObject_i* aSObj = aChildIter.GetValue()) - aSObj->OnRemove(); - } - TDF_Label aLabel = aSObject->GetLabel(); - aLabel.ForgetAllAttributes(Standard_True); - } -} - -//============================================================================ -/*! Function : Translate_persistentID_to_IOR - * Purpose : - */ -//============================================================================ -static void Translate_persistentID_to_IOR(TDF_Label theLabel, - SALOMEDS::Driver_ptr theDriver, - SALOMEDS_Study_i* theStudy, - CORBA::Boolean theIsMultiFile, - CORBA::Boolean theIsASCII) -{ - if(CORBA::is_nil(theDriver)) - return; - - for (TDF_ChildIterator aChildIter (theLabel); aChildIter.More(); aChildIter.Next()){ - TDF_Label aCurrentLabel = aChildIter.Value(); - Handle(TDF_Attribute) anAttr; - if(aCurrentLabel.FindAttribute(SALOMEDS_PersRefAttribute::GetID(),anAttr)){ - Handle(SALOMEDS_LocalIDAttribute) anID; - if (aCurrentLabel.FindAttribute(SALOMEDS_LocalIDAttribute::GetID(),anID)) - if (anID->Get() == FILELOCALID) continue; //SRN: This attribute store a file name, skip it - - TCollection_ExtendedString res = Handle(TDataStd_Comment)::DownCast(anAttr)->Get(); - TCollection_AsciiString ch(res); - - SALOMEDS::SObject_var aSObject = SALOMEDS_SObject_i::NewRef(theStudy,aCurrentLabel); - - CORBA::String_var anIOR = - theDriver->LocalPersistentIDToIOR(aSObject,ch.ToCString(),theIsMultiFile,theIsASCII); - SALOMEDS_IORAttribute::Set(aCurrentLabel,const_cast(anIOR.in()),theStudy); - } - - Translate_persistentID_to_IOR(aCurrentLabel,theDriver,theStudy,theIsMultiFile,theIsASCII); - } + SALOMEDS::Locker lock; + CheckLocked(); + Handle(SALOMEDSImpl_SObject) aSO; + aSO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSObject((char*)anObject->GetID()); + _impl->RemoveObjectWithChildren(aSO); } //============================================================================ @@ -328,153 +168,21 @@ static void Translate_persistentID_to_IOR(TDF_Label theLabel, * Purpose : */ //============================================================================ - -//============================================================================ -void SALOMEDS_StudyBuilder_i::LoadWith(SALOMEDS::SComponent_ptr theSComponent, - SALOMEDS::Driver_ptr theDriver) - throw(SALOME::SALOME_Exception) +void SALOMEDS_StudyBuilder_i::LoadWith(SALOMEDS::SComponent_ptr anSCO, + SALOMEDS::Driver_ptr aDriver) throw(SALOME::SALOME_Exception) { + SALOMEDS::Locker lock; Unexpect aCatch(SBSalomeException); - if(CORBA::is_nil(theSComponent)) - return; + Handle(SALOMEDSImpl_SComponent) aSCO; + aSCO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSComponent((char*)anSCO->GetID()); + SALOMEDS_Driver_i* driver = new SALOMEDS_Driver_i(aDriver, _orb); + bool isDone = _impl->LoadWith(aSCO, driver); + delete driver; - TDF_Label Lab; - CORBA::String_var aString = theSComponent->GetID(); - TDF_Tool::Label(_doc->GetData(),const_cast(aString.in()),Lab); - - //Find the current Url of the study - Handle(TDF_Attribute) Att; - if (_doc->Main().FindAttribute(SALOMEDS_PersRefAttribute::GetID(),Att)) { - if(CORBA::is_nil(theDriver)) - return; - - int aLocked = _study->GetProperties()->IsLocked(); - if(aLocked) - _study->GetProperties()->SetLocked(false); - - // mpv 06.03.2003: SAL1927 - if component data if already loaded, it is not necessary to do it again - if (Lab.FindAttribute(SALOMEDS_IORAttribute::GetID(), Att)) { - if(aLocked) - _study->GetProperties()->SetLocked(true); - return; - } - DefineComponentInstance (theSComponent,theDriver); - - TCollection_AsciiString aHDFPath(Handle(TDataStd_Comment)::DownCast(Att)->Get()); - - bool isASCII = false; - std::ostringstream anURLStream; - if(HDFascii::isASCII(aHDFPath.ToCString())){ - isASCII = true; - auto_ptr aResultPath(HDFascii::ConvertFromASCIIToHDF(aHDFPath.ToCString())); - anURLStream< hdf_file(new HDFfile(const_cast(aHDFUrl.c_str()))); - - char aMultifileState[2]; - char ASCIIfileState[2]; - try { - CORBA::String_var scoid = theSComponent->GetID(); - hdf_file->OpenOnDisk(HDF_RDONLY); - HDFgroup *hdf_group = new HDFgroup("DATACOMPONENT",hdf_file.get()); - hdf_group->OpenOnDisk(); - HDFgroup *hdf_sco_group = new HDFgroup(scoid, hdf_group); - hdf_sco_group->OpenOnDisk(); - - SALOMEDS::TMPFile_var aStreamFile; - if (hdf_sco_group->ExistInternalObject("FILE_STREAM")) { - HDFdataset *hdf_dataset = new HDFdataset("FILE_STREAM", hdf_sco_group); - hdf_dataset->OpenOnDisk(); - int aStreamSize = hdf_dataset->GetSize(); - unsigned char* aBuffer = new unsigned char[aStreamSize]; - if(aBuffer == NULL) - throw HDFexception("Unable to open dataset FILE_STREAM"); - hdf_dataset->ReadFromDisk(aBuffer); - aStreamFile = new SALOMEDS::TMPFile(aStreamSize, aStreamSize, aBuffer, 1); - hdf_dataset->CloseOnDisk(); - hdf_dataset = 0; - } else - aStreamFile = new SALOMEDS::TMPFile(0); - - HDFdataset *multifile_hdf_dataset = new HDFdataset("MULTIFILE_STATE", hdf_sco_group); - multifile_hdf_dataset->OpenOnDisk(); - multifile_hdf_dataset->ReadFromDisk(aMultifileState); - - HDFdataset *ascii_hdf_dataset = new HDFdataset("ASCII_STATE", hdf_sco_group); - ascii_hdf_dataset->OpenOnDisk(); - ascii_hdf_dataset->ReadFromDisk(ASCIIfileState); - - // set path without file name from URL - std::string aDir(aHDFPath.ToCString()); - aDir = aDir.substr(0,aDir.rfind('/') + 1); - - CORBA::Boolean aResult = (ASCIIfileState[0]=='A')? - theDriver->LoadASCII(theSComponent, aStreamFile.in(), aDir.c_str(), aMultifileState[0]=='M'): - theDriver->Load(theSComponent, aStreamFile.in(), aDir.c_str(), aMultifileState[0]=='M'); - if(!aResult) { - RemoveAttribute( theSComponent, "AttributeIOR" ); - if (isASCII) { - SALOMEDS::ListOfFileNames_var aFilesToRemove = new SALOMEDS::ListOfFileNames; - aFilesToRemove->length(1); - std::string aDir = SALOMEDS_Tool::GetDirFromPath(aHDFUrl); - aFilesToRemove[0] = CORBA::string_dup(&aHDFUrl[strlen(aDir.c_str())]); - SALOMEDS_Tool::RemoveTemporaryFiles(aDir,aFilesToRemove,true); - } - MESSAGE("Can't load component"); - THROW_SALOME_CORBA_EXCEPTION("Unable to load component data",SALOME::BAD_PARAM); - } - - multifile_hdf_dataset->CloseOnDisk(); - multifile_hdf_dataset = 0; - ascii_hdf_dataset->CloseOnDisk(); - ascii_hdf_dataset = 0; - hdf_sco_group->CloseOnDisk(); - hdf_sco_group = 0; - hdf_group->CloseOnDisk(); - hdf_group = 0; - hdf_file->CloseOnDisk(); - - if (isASCII) { - SALOMEDS::ListOfFileNames_var aFilesToRemove = new SALOMEDS::ListOfFileNames; - aFilesToRemove->length(1); - std::string aDir = SALOMEDS_Tool::GetDirFromPath(aHDFUrl); - aFilesToRemove[0] = CORBA::string_dup(&aHDFUrl[strlen(aDir.c_str())]); - SALOMEDS_Tool::RemoveTemporaryFiles(aDir,aFilesToRemove,true); - } - } - catch (HDFexception) { - INFOS("No persistent file Name"); - if (isASCII) { - SALOMEDS::ListOfFileNames_var aFilesToRemove = new SALOMEDS::ListOfFileNames; - aFilesToRemove->length(1); - std::string aDir = SALOMEDS_Tool::GetDirFromPath(aHDFUrl); - aFilesToRemove[0] = CORBA::string_dup(&aHDFUrl[strlen(aDir.c_str())]); - SALOMEDS_Tool::RemoveTemporaryFiles(aDir,aFilesToRemove,true); - } - if(aLocked) - _study->GetProperties()->SetLocked(true); - THROW_SALOME_CORBA_EXCEPTION("No persistent file Name found",SALOME::BAD_PARAM); - } - - try { - Translate_persistentID_to_IOR(Lab,theDriver,_study,aMultifileState[0]=='M',ASCIIfileState[0] == 'A'); - } catch (SALOME::SALOME_Exception) { - INFOS("Can't translate PersRef to IOR"); - if (aLocked) - _study->GetProperties()->SetLocked(true); - THROW_SALOME_CORBA_EXCEPTION("Unable to convert component persistent data to the transient",SALOME::BAD_PARAM); - // throw HDFexception("Unable to load component data"); - } - if(aLocked) - _study->GetProperties()->SetLocked(true); - } else - MESSAGE("No persistent file Name"); + if(!isDone && _impl->IsError()) { + THROW_SALOME_CORBA_EXCEPTION(_impl->GetErrorCode().ToCString(),SALOME::BAD_PARAM); + } } @@ -494,14 +202,26 @@ void SALOMEDS_StudyBuilder_i::Load(SALOMEDS::SObject_ptr sco) * existing one */ //============================================================================ -SALOMEDS::GenericAttribute_ptr -SALOMEDS_StudyBuilder_i::FindOrCreateAttribute(SALOMEDS::SObject_ptr theObject, - const char* theTypeOfAttribute) +SALOMEDS::GenericAttribute_ptr SALOMEDS_StudyBuilder_i::FindOrCreateAttribute(SALOMEDS::SObject_ptr anObject, + const char* aTypeOfAttribute) { - if(SALOMEDS_SObject_i* aSObject = _study->DownCast(theObject)) - return aSObject->FindOrCreateAttribute(theTypeOfAttribute); + SALOMEDS::Locker lock; + Handle(SALOMEDSImpl_SObject) aSO; + char* anID = anObject->GetID(); + aSO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSObject(anID); + delete anID; + Handle(TDF_Attribute) anAttr; + try { + anAttr = _impl->FindOrCreateAttribute(aSO, TCollection_AsciiString((char*)aTypeOfAttribute)); + } + catch (...) { + throw SALOMEDS::StudyBuilder::LockProtection(); + } - return SALOMEDS::GenericAttribute::_nil(); + SALOMEDS::GenericAttribute_var anAttribute; + anAttribute = SALOMEDS::GenericAttribute::_duplicate(SALOMEDS_GenericAttribute_i::CreateAttribute(anAttr, _orb)); + + return anAttribute._retn(); } //============================================================================ @@ -510,14 +230,20 @@ SALOMEDS_StudyBuilder_i::FindOrCreateAttribute(SALOMEDS::SObject_ptr theObject, */ //============================================================================ -CORBA::Boolean SALOMEDS_StudyBuilder_i::FindAttribute(SALOMEDS::SObject_ptr theObject, - SALOMEDS::GenericAttribute_out theAttr, - const char* theTypeOfAttribute) +CORBA::Boolean SALOMEDS_StudyBuilder_i::FindAttribute(SALOMEDS::SObject_ptr anObject, + SALOMEDS::GenericAttribute_out anAttribute, + const char* aTypeOfAttribute) { - if(SALOMEDS_SObject_i* aSObject = _study->DownCast(theObject)) - return aSObject->FindAttribute(theAttr,theTypeOfAttribute); + SALOMEDS::Locker lock; + ASSERT(!CORBA::is_nil(anObject)); + Handle(SALOMEDSImpl_SObject) aSO; + aSO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSObject((char*)anObject->GetID()); + Handle(TDF_Attribute) anAttr; - return Standard_False; + if(!_impl->FindAttribute(aSO, anAttr, TCollection_AsciiString((char*)aTypeOfAttribute))) return false; + + anAttribute = SALOMEDS::GenericAttribute::_duplicate(SALOMEDS_GenericAttribute_i::CreateAttribute(anAttr, _orb)); + return true; } //============================================================================ @@ -526,27 +252,15 @@ CORBA::Boolean SALOMEDS_StudyBuilder_i::FindAttribute(SALOMEDS::SObject_ptr theO */ //============================================================================ -void SALOMEDS_StudyBuilder_i::RemoveAttribute(SALOMEDS::SObject_ptr theSObject, +void SALOMEDS_StudyBuilder_i::RemoveAttribute(SALOMEDS::SObject_ptr anObject, const char* aTypeOfAttribute) { + SALOMEDS::Locker lock; CheckLocked(); - - if(CORBA::is_nil(theSObject)) - return; - - TDF_Label Lab; - CORBA::String_var anobid = theSObject->GetID(); - TDF_Tool::Label(_doc->GetData(),anobid,Lab); - - if (strcmp(aTypeOfAttribute, "AttributeIOR") == 0) { // postponed removing of CORBA objects - Handle(SALOMEDS_IORAttribute) anAttr; - if (Lab.FindAttribute(SALOMEDS_IORAttribute::GetID(), anAttr)) - _study->AddPostponed(TCollection_AsciiString(anAttr->Get()).ToCString()); - else - return; - } - - Lab.ForgetAttribute(SALOMEDS::GetGUID(aTypeOfAttribute)); + ASSERT(!CORBA::is_nil(anObject)); + Handle(SALOMEDSImpl_SObject) aSO; + aSO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSObject((char*)anObject->GetID()); + _impl->RemoveAttribute(aSO, TCollection_AsciiString((char*)aTypeOfAttribute)); } //============================================================================ @@ -554,27 +268,18 @@ void SALOMEDS_StudyBuilder_i::RemoveAttribute(SALOMEDS::SObject_ptr theSObject, * Purpose : */ //============================================================================ -void -SALOMEDS_StudyBuilder_i::Addreference(SALOMEDS::SObject_ptr me, - SALOMEDS::SObject_ptr theReferencedObject) +void SALOMEDS_StudyBuilder_i::Addreference(SALOMEDS::SObject_ptr me, + SALOMEDS::SObject_ptr theReferencedObject) { + SALOMEDS::Locker lock; CheckLocked(); - if(CORBA::is_nil(me) || CORBA::is_nil(theReferencedObject)) - return; - - TDF_Label Lab; - CORBA::String_var meid = me->GetID(); - TDF_Tool::Label(_doc->GetData(),meid,Lab); - - TDF_Label RefLab; - CORBA::String_var roid = theReferencedObject->GetID(); - TDF_Tool::Label(_doc->GetData(),roid,RefLab); - - TDF_Reference::Set(Lab,RefLab); - SALOMEDS_TargetAttribute::Set(RefLab)->Append(Lab); - - if(Lab.IsDescendant(_doc->Main())) - OnRemoveSObject(me); + ASSERT(!CORBA::is_nil(me)); + ASSERT(!CORBA::is_nil(theReferencedObject)); + + Handle(SALOMEDSImpl_SObject) aSO, aRefSO; + aSO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSObject((char*)me->GetID()); + aRefSO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSObject((char*)theReferencedObject->GetID()); + _impl->Addreference(aSO, aRefSO); } //============================================================================ @@ -584,28 +289,15 @@ SALOMEDS_StudyBuilder_i::Addreference(SALOMEDS::SObject_ptr me, //============================================================================ void SALOMEDS_StudyBuilder_i::RemoveReference(SALOMEDS::SObject_ptr me) { - SALOMEDS::SObject_var theReferencedObject; - if(!me->ReferencedObject(theReferencedObject)) return; //No reference is found - - if(CORBA::is_nil(me) || CORBA::is_nil(theReferencedObject)) - return; - + SALOMEDS::Locker lock; CheckLocked(); - TDF_Label Lab; - CORBA::String_var meid = me->GetID(); - TDF_Tool::Label(_doc->GetData(),meid,Lab); - - Lab.ForgetAttribute(TDF_Reference::GetID()); - - TDF_Label RefLab; - CORBA::String_var roid = theReferencedObject->GetID(); - TDF_Tool::Label(_doc->GetData(),roid,RefLab); - - RemoveAttribute(theReferencedObject, "AttributeTarget"); + ASSERT(!CORBA::is_nil(me)); + Handle(SALOMEDSImpl_SObject) aSO; + aSO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSObject((char*)me->GetID()); + _impl->RemoveReference(aSO); } - //============================================================================ /*! Function : AddDirectory * Purpose : adds a new directory with a path = thePath @@ -613,62 +305,15 @@ void SALOMEDS_StudyBuilder_i::RemoveReference(SALOMEDS::SObject_ptr me) //============================================================================ void SALOMEDS_StudyBuilder_i::AddDirectory(const char* thePath) { + SALOMEDS::Locker lock; CheckLocked(); if(thePath == NULL || strlen(thePath) == 0) throw SALOMEDS::Study::StudyInvalidDirectory(); - - TCollection_AsciiString aPath(CORBA::string_dup(thePath)), aContext(""), aFatherPath; - Handle(TDataStd_Name) aName; - TDF_Label aLabel; - SALOMEDS::SObject_var anObject = SALOMEDS_SObject_i::NewRef(_study,_doc->Main()); - - try { - anObject = _study->FindObjectByPath(thePath); //Check if the directory already exists - } - catch(...) { } - - if(!anObject->_is_nil()) throw SALOMEDS::Study::StudyNameAlreadyUsed(); - - if(aPath.Value(1) != '/') { //Relative path - aPath.Prepend('/'); - aPath = TCollection_AsciiString(_study->GetContext()) + aPath; + if(!_impl->AddDirectory(TCollection_AsciiString((char*)thePath))) { + TCollection_AsciiString anErrorCode = _impl->GetErrorCode(); + if(anErrorCode == "StudyNameAlreadyUsed") throw SALOMEDS::Study::StudyNameAlreadyUsed(); + if(anErrorCode == "StudyInvalidDirectory") throw SALOMEDS::Study::StudyInvalidDirectory(); + if(anErrorCode == "StudyInvalidComponent") throw SALOMEDS::Study::StudyInvalidComponent(); } - - TCollection_AsciiString aToken = aPath.Token("/", 1); - if(aToken.Length() == 0) aFatherPath = "/"; - - int i = 1; - while(aToken.Length() != 0) { - if(aPath.Token("/", i+1).Length() > 0) { - aFatherPath += "/"; - aFatherPath += aToken; - } - aToken = aPath.Token("/", ++i); - } - - anObject = SALOMEDS::SObject::_nil(); - try { - anObject = _study->FindObjectByPath(aFatherPath.ToCString()); //Check if the father directory exists - } - catch(...) { ; } - if(anObject->_is_nil()) - throw SALOMEDS::Study::StudyInvalidDirectory(); - - SALOMEDS::SObject_var aNewObject = NewObject(anObject); - TDF_Tool::Label(_doc->GetData(), aNewObject->GetID(), aLabel); - if(aLabel.IsNull()) { - MESSAGE("### NULL label"); - throw SALOMEDS::Study::StudyInvalidComponent(); - } - - TDataStd_Name::Set(aLabel, aPath.Token("/", i-1)); - - //Set LocalID attribute to identify the directory object - SALOMEDS::GenericAttribute_var anAttr = FindOrCreateAttribute(aNewObject, "AttributeLocalID"); - SALOMEDS::AttributeLocalID_var aPersRef = SALOMEDS::AttributeLocalID::_narrow(anAttr); - if(aPersRef->_is_nil()) - throw SALOMEDS::Study::StudyInvalidDirectory(); - - aPersRef->SetValue(DIRECTORYID); } @@ -679,15 +324,12 @@ void SALOMEDS_StudyBuilder_i::AddDirectory(const char* thePath) //============================================================================ void SALOMEDS_StudyBuilder_i::SetGUID(SALOMEDS::SObject_ptr anObject, const char* theGUID) { + SALOMEDS::Locker lock; CheckLocked(); - - if(CORBA::is_nil(anObject)) - return; - - TDF_Label aLabel; - CORBA::String_var anEntry = anObject->GetID(); - TDF_Tool::Label(_doc->GetData(), anEntry, aLabel); - TDataStd_UAttribute::Set(aLabel, (char*)theGUID); + ASSERT(!CORBA::is_nil(anObject)); + Handle(SALOMEDSImpl_SObject) aSO; + aSO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSObject((char*)anObject->GetID()); + _impl->SetGUID(aSO, TCollection_AsciiString((char*)theGUID)); } //============================================================================ @@ -697,13 +339,11 @@ void SALOMEDS_StudyBuilder_i::SetGUID(SALOMEDS::SObject_ptr anObject, const char //============================================================================ bool SALOMEDS_StudyBuilder_i::IsGUID(SALOMEDS::SObject_ptr anObject, const char* theGUID) { - if(CORBA::is_nil(anObject)) - return false; - - TDF_Label aLabel; - CORBA::String_var anEntry = anObject->GetID(); - TDF_Tool::Label(_doc->GetData(), anEntry, aLabel); - return aLabel.IsAttribute((char*)theGUID); + SALOMEDS::Locker lock; + ASSERT(!CORBA::is_nil(anObject)); + Handle(SALOMEDSImpl_SObject) aSO; + aSO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSObject((char*)anObject->GetID()); + return _impl->IsGUID(aSO, TCollection_AsciiString((char*)theGUID)); } @@ -714,15 +354,8 @@ bool SALOMEDS_StudyBuilder_i::IsGUID(SALOMEDS::SObject_ptr anObject, const char* //============================================================================ void SALOMEDS_StudyBuilder_i::NewCommand() { - // mpv: for SAL2114 - unset "lock changed" flag at the operation start - Handle(SALOMEDS_StudyPropertiesAttribute) anAttr; - if (!_doc->Main().FindAttribute(SALOMEDS_StudyPropertiesAttribute::GetID(), anAttr)) { - anAttr = new SALOMEDS_StudyPropertiesAttribute; - _doc->Main().AddAttribute(anAttr); - } - anAttr->IsLockChanged(true); - - _doc->NewCommand(); + SALOMEDS::Locker lock; + _impl->NewCommand(); } //============================================================================ @@ -732,23 +365,14 @@ void SALOMEDS_StudyBuilder_i::NewCommand() //============================================================================ void SALOMEDS_StudyBuilder_i::CommitCommand() throw (SALOMEDS::StudyBuilder::LockProtection) { + SALOMEDS::Locker lock; Unexpect aCatch(SBLockProtection); - Handle(SALOMEDS_StudyPropertiesAttribute) anAttr; - if (!_doc->Main().FindAttribute(SALOMEDS_StudyPropertiesAttribute::GetID(), anAttr)) { - anAttr = new SALOMEDS_StudyPropertiesAttribute; - _doc->Main().AddAttribute(anAttr); + try { + _impl->CommitCommand(); } - if (anAttr->IsLocked() && !anAttr->IsLockChanged(true)) { + catch(...) { MESSAGE("Locked document modification !!!"); - AbortCommand(); throw SALOMEDS::StudyBuilder::LockProtection(); - } else { - _study->RemovePostponed(_doc->GetUndoLimit()); - - int aModif = anAttr->GetModified(); - if (aModif < 0) aModif = 1000; // if user make undo and then - new transaction "modify" will never be zero - anAttr->SetModified(aModif+1); - _doc->CommitCommand(); } } @@ -759,7 +383,8 @@ void SALOMEDS_StudyBuilder_i::CommitCommand() throw (SALOMEDS::StudyBuilder::Loc //============================================================================ CORBA::Boolean SALOMEDS_StudyBuilder_i::HasOpenCommand() { - return _doc->HasOpenCommand(); + SALOMEDS::Locker lock; + return _impl->HasOpenCommand(); } //============================================================================ @@ -769,9 +394,8 @@ CORBA::Boolean SALOMEDS_StudyBuilder_i::HasOpenCommand() //============================================================================ void SALOMEDS_StudyBuilder_i::AbortCommand() { - _study->UndoPostponed(0); - - _doc->AbortCommand(); + SALOMEDS::Locker lock; + _impl->AbortCommand(); } //============================================================================ @@ -781,19 +405,14 @@ void SALOMEDS_StudyBuilder_i::AbortCommand() //============================================================================ void SALOMEDS_StudyBuilder_i::Undo() throw (SALOMEDS::StudyBuilder::LockProtection) { + SALOMEDS::Locker lock; Unexpect aCatch(SBLockProtection); - Handle(SALOMEDS_StudyPropertiesAttribute) anAttr; - if (!_doc->Main().FindAttribute(SALOMEDS_StudyPropertiesAttribute::GetID(), anAttr)) { - anAttr = new SALOMEDS_StudyPropertiesAttribute; - _doc->Main().AddAttribute(anAttr); - } - if (anAttr->IsLocked()) { + try { + _impl->Undo(); + } + catch(...) { MESSAGE("Locked document modification !!!"); throw SALOMEDS::StudyBuilder::LockProtection(); - } else { - _study->UndoPostponed(1); - _doc->Undo(); - anAttr->SetModified(anAttr->GetModified()-1); } } @@ -804,22 +423,16 @@ void SALOMEDS_StudyBuilder_i::Undo() throw (SALOMEDS::StudyBuilder::LockProtecti //============================================================================ void SALOMEDS_StudyBuilder_i::Redo() throw (SALOMEDS::StudyBuilder::LockProtection) { + SALOMEDS::Locker lock; Unexpect aCatch(SBLockProtection); - Handle(SALOMEDS_StudyPropertiesAttribute) anAttr; - if (!_doc->Main().FindAttribute(SALOMEDS_StudyPropertiesAttribute::GetID(), anAttr)) { - anAttr = new SALOMEDS_StudyPropertiesAttribute; - _doc->Main().AddAttribute(anAttr); + try { + _impl->Redo(); } - - if (anAttr->IsLocked()) { + catch(...) { MESSAGE("Locked document modification !!!"); throw SALOMEDS::StudyBuilder::LockProtection(); - } else { - _doc->Redo(); - _study->UndoPostponed(-1); - anAttr->SetModified(anAttr->GetModified()+1); } - } +} //============================================================================ /*! Function : GetAvailableUndos @@ -828,7 +441,8 @@ void SALOMEDS_StudyBuilder_i::Redo() throw (SALOMEDS::StudyBuilder::LockProtecti //============================================================================ CORBA::Boolean SALOMEDS_StudyBuilder_i::GetAvailableUndos() { - return _doc->GetAvailableUndos(); + SALOMEDS::Locker lock; + return _impl->GetAvailableUndos(); } //============================================================================ @@ -838,7 +452,8 @@ CORBA::Boolean SALOMEDS_StudyBuilder_i::GetAvailableUndos() //============================================================================ CORBA::Boolean SALOMEDS_StudyBuilder_i::GetAvailableRedos() { - return _doc->GetAvailableRedos(); + SALOMEDS::Locker lock; + return _impl->GetAvailableRedos(); } //============================================================================ @@ -848,7 +463,8 @@ CORBA::Boolean SALOMEDS_StudyBuilder_i::GetAvailableRedos() //============================================================================ CORBA::Long SALOMEDS_StudyBuilder_i::UndoLimit() { - return _doc->GetUndoLimit(); + SALOMEDS::Locker lock; + return _impl->UndoLimit(); } //============================================================================ @@ -858,8 +474,9 @@ CORBA::Long SALOMEDS_StudyBuilder_i::UndoLimit() //============================================================================ void SALOMEDS_StudyBuilder_i::UndoLimit(CORBA::Long n) { + SALOMEDS::Locker lock; CheckLocked(); - _doc->SetUndoLimit (n); + _impl->UndoLimit(n); } //============================================================================ @@ -867,14 +484,11 @@ void SALOMEDS_StudyBuilder_i::UndoLimit(CORBA::Long n) * Purpose : */ //============================================================================ -SALOMEDS::Callback_ptr SALOMEDS_StudyBuilder_i::SetOnAddSObject(SALOMEDS::Callback_ptr theCallback) -{ - return _study->SetOnAddSObject(theCallback); -} - -void SALOMEDS_StudyBuilder_i::OnAddSObject(SALOMEDS::SObject_ptr theObject) +SALOMEDS::Callback_ptr SALOMEDS_StudyBuilder_i::SetOnAddSObject(SALOMEDS::Callback_ptr) { - _study->OnAddSObject(theObject); + SALOMEDS::Locker lock; + MESSAGE("Not implemented on the CORBA level !!!"); + return SALOMEDS::Callback::_nil(); } //============================================================================ @@ -882,14 +496,11 @@ void SALOMEDS_StudyBuilder_i::OnAddSObject(SALOMEDS::SObject_ptr theObject) * Purpose : */ //============================================================================ -SALOMEDS::Callback_ptr SALOMEDS_StudyBuilder_i::SetOnRemoveSObject(SALOMEDS::Callback_ptr theCallback) -{ - return _study->SetOnRemoveSObject(theCallback); -} - -void SALOMEDS_StudyBuilder_i::OnRemoveSObject(SALOMEDS::SObject_ptr theObject) +SALOMEDS::Callback_ptr SALOMEDS_StudyBuilder_i::SetOnRemoveSObject(SALOMEDS::Callback_ptr) { - _study->OnRemoveSObject(theObject); + SALOMEDS::Locker lock; + MESSAGE("Not implemented on the CORBA level !!!"); + return SALOMEDS::Callback::_nil(); } //============================================================================ @@ -897,8 +508,16 @@ void SALOMEDS_StudyBuilder_i::OnRemoveSObject(SALOMEDS::SObject_ptr theObject) * Purpose : */ //============================================================================ -void SALOMEDS_StudyBuilder_i::CheckLocked() throw (SALOMEDS::StudyBuilder::LockProtection) { - _study->CheckLocked(); +void SALOMEDS_StudyBuilder_i::CheckLocked() throw (SALOMEDS::StudyBuilder::LockProtection) +{ + SALOMEDS::Locker lock; + Unexpect aCatch(SBLockProtection); + try { + _impl->CheckLocked(); + } + catch(...) { + throw SALOMEDS::StudyBuilder::LockProtection(); + } } //============================================================================ @@ -909,17 +528,13 @@ void SALOMEDS_StudyBuilder_i::CheckLocked() throw (SALOMEDS::StudyBuilder::LockP void SALOMEDS_StudyBuilder_i::SetName(SALOMEDS::SObject_ptr theSO, const char* theValue) throw(SALOMEDS::StudyBuilder::LockProtection) { + SALOMEDS::Locker lock; Unexpect aCatch(SBLockProtection); CheckLocked(); - - if(CORBA::is_nil(theSO)) - return; - - //Find label - TDF_Label aLabel; - CORBA::String_var aSOID = theSO->GetID(); - TDF_Tool::Label(_doc->GetData(), aSOID, aLabel); - TDataStd_Name::Set(aLabel, (char*)theValue); + + Handle(SALOMEDSImpl_SObject) aSO; + aSO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSObject((char*)theSO->GetID()); + _impl->SetName(aSO, TCollection_AsciiString((char*)theValue)); } //============================================================================ @@ -928,19 +543,15 @@ void SALOMEDS_StudyBuilder_i::SetName(SALOMEDS::SObject_ptr theSO, const char* t */ //============================================================================ void SALOMEDS_StudyBuilder_i::SetComment(SALOMEDS::SObject_ptr theSO, const char* theValue) - throw(SALOMEDS::StudyBuilder::LockProtection) + throw(SALOMEDS::StudyBuilder::LockProtection) { + SALOMEDS::Locker lock; Unexpect aCatch(SBLockProtection); CheckLocked(); - if(CORBA::is_nil(theSO)) - return; - - //Find label - TDF_Label aLabel; - CORBA::String_var aSOID = theSO->GetID(); - TDF_Tool::Label(_doc->GetData(), aSOID, aLabel); - TDataStd_Comment::Set(aLabel, (char*)theValue); + Handle(SALOMEDSImpl_SObject) aSO; + aSO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSObject((char*)theSO->GetID()); + _impl->SetComment(aSO, TCollection_AsciiString((char*)theValue)); } //============================================================================ @@ -951,15 +562,11 @@ void SALOMEDS_StudyBuilder_i::SetComment(SALOMEDS::SObject_ptr theSO, const char void SALOMEDS_StudyBuilder_i::SetIOR(SALOMEDS::SObject_ptr theSO, const char* theValue) throw(SALOMEDS::StudyBuilder::LockProtection) { + SALOMEDS::Locker lock; Unexpect aCatch(SBLockProtection); CheckLocked(); - if(CORBA::is_nil(theSO)) - return; - - //Find label - TDF_Label aLabel; - CORBA::String_var aSOID = theSO->GetID(); - TDF_Tool::Label(_doc->GetData(), aSOID, aLabel); - SALOMEDS_IORAttribute::Set(aLabel, TCollection_ExtendedString((char*)theValue),_study); + Handle(SALOMEDSImpl_SObject) aSO; + aSO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSObject((char*)theSO->GetID()); + _impl->SetIOR(aSO, TCollection_AsciiString((char*)theValue)); } diff --git a/src/SALOMEDS/SALOMEDS_StudyBuilder_i.hxx b/src/SALOMEDS/SALOMEDS_StudyBuilder_i.hxx index 38f29b440..ecd6876ba 100644 --- a/src/SALOMEDS/SALOMEDS_StudyBuilder_i.hxx +++ b/src/SALOMEDS/SALOMEDS_StudyBuilder_i.hxx @@ -1,67 +1,35 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// // File : SALOMEDS_StudyBuilder_i.hxx -// Author : Yves FRICAUD +// Author : Sergey RUIN // Module : SALOME -// $Header$ -#ifndef __SALOMEDS_STUDYBUIlDER_I_H__ +#ifndef __SALOMEDS_STUDYBUILDER_I_H__ #define __SALOMEDS_STUDYBUILDER_I_H__ +// std C++ headers +#include + // IDL headers #include #include CORBA_SERVER_HEADER(SALOMEDS) #include CORBA_SERVER_HEADER(SALOMEDS_Attributes) +#include "SALOMEDSImpl_StudyBuilder.hxx" + // Cascade header #include -class SALOMEDS_Study_i; -class SALOMEDS_SObject_i; -class SALOMEDS_Callback_i; - -class SALOMEDS_StudyBuilder_i: public virtual POA_SALOMEDS::StudyBuilder, - public virtual PortableServer::RefCountServantBase +class SALOMEDS_StudyBuilder_i: public POA_SALOMEDS::StudyBuilder, + public PortableServer::RefCountServantBase { - SALOMEDS_StudyBuilder_i(); // Not implemented - void operator=(const SALOMEDS_StudyBuilder_i&); // Not implemented - - SALOMEDS_Study_i* _study; - Handle(TDocStd_Document) _doc; // OCAF Document - - void OnAddSObject(SALOMEDS::SObject_ptr theObject); - void OnRemoveSObject(SALOMEDS::SObject_ptr theObject); - +private: + CORBA::ORB_ptr _orb; + Handle(SALOMEDSImpl_StudyBuilder) _impl; // OCAF Document public: - SALOMEDS_StudyBuilder_i(SALOMEDS_Study_i* theStudy, - const Handle(TDocStd_Document)& theDocument); + + SALOMEDS_StudyBuilder_i(const Handle(SALOMEDSImpl_StudyBuilder), CORBA::ORB_ptr); ~SALOMEDS_StudyBuilder_i(); - CORBA::ORB_var GetORB() const; - PortableServer::POA_var GetPOA() const; - //! NewComponent /*! \param ComponentDataType @@ -111,8 +79,6 @@ public: throw(SALOME::SALOME_Exception); virtual void Load(SALOMEDS::SObject_ptr sco); - SALOMEDS_SObject_i* RemoveSObject(SALOMEDS::SObject_ptr theSObject, - bool theIsForgetAllAttributes = true); virtual void RemoveObject(SALOMEDS::SObject_ptr anObject); virtual void RemoveObjectWithChildren(SALOMEDS::SObject_ptr anObject); diff --git a/src/SALOMEDS/SALOMEDS_StudyManager_i.cxx b/src/SALOMEDS/SALOMEDS_StudyManager_i.cxx index 588019be2..aabb1dec7 100644 --- a/src/SALOMEDS/SALOMEDS_StudyManager_i.cxx +++ b/src/SALOMEDS/SALOMEDS_StudyManager_i.cxx @@ -1,227 +1,37 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// // File : SALOMEDS_StudyManager_i.cxx -// Author : Yves FRICAUD +// Author : Sergey RUIN // Module : SALOME -// $Header$ - -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "SALOMEDS_StudyManager_i.hxx" +#include "utilities.h" #include "SALOME_LifeCycleCORBA.hxx" - +#include "SALOMEDS_StudyManager_i.hxx" #include "SALOMEDS_Study_i.hxx" -#include "SALOMEDS_SObject_i.hxx" -#include "SALOMEDS_StudyBuilder_i.hxx" - -#include "SALOMEDS_IORAttribute.hxx" -#include "SALOMEDS_PersRefAttribute.hxx" -#include "SALOMEDS_TargetAttribute.hxx" +#include "SALOMEDS_SComponent_i.hxx" +#include "SALOMEDS_Driver_i.hxx" +#include "SALOMEDS.hxx" -#include "SALOMEDS_Tool.hxx" -#include "HDFexplorer.hxx" +#include "SALOMEDSImpl_Study.hxx" +#include "SALOMEDSImpl_SObject.hxx" +#include "SALOMEDSImpl_SComponent.hxx" +#include "SALOMEDSImpl_AttributeIOR.hxx" -// IDL headers -#include -#include CORBA_SERVER_HEADER(SALOMEDS_Attributes) +#include +#include +#include -#include "SALOME_GenericObj_i.hh" #include "Utils_CorbaException.hxx" -#include "Utils_ExceptHandlers.hxx" - -UNEXPECT_CATCH(SalomeException,SALOME::SALOME_Exception); -UNEXPECT_CATCH(LockProtection, SALOMEDS::StudyBuilder::LockProtection); - -#define USE_CASE_LABEL_ID "0:2" -#define AUTO_SAVE_GUID "128268A3-71C9-4036-89B1-F81BD6A4FCF2" -#define AUTO_SAVE_TAG "0:8" -#define AUTO_SAVE_TIME_OUT_IN_SECONDS 1200 - -#include "utilities.h" +#include using namespace std; -//=========================================================================== -namespace SALOMEDS{ - - CORBA::Object_var - GetObject(const TDF_Label& theLabel, CORBA::ORB_ptr theORB) - { - try { - Handle(SALOMEDS_IORAttribute) anAttr; - if(theLabel.FindAttribute(SALOMEDS_IORAttribute::GetID(),anAttr)) - return theORB->string_to_object(TCollection_AsciiString(anAttr->Get()).ToCString()); - }catch(...){ - } - return CORBA::Object::_nil(); - } - - - PortableServer::ServantBase_var - GetServant(CORBA::Object_ptr theObject, PortableServer::POA_ptr thePOA) - { - if(CORBA::is_nil(theObject)) - return NULL; - try{ - return thePOA->reference_to_servant(theObject); - }catch(...){ - return NULL; - } - } - -} - -//=========================================================================== -//Function : LoadAttributes -//=========================================================================== -static -void -ReadAttributes(SALOMEDS_Study_i* theStudy, - SALOMEDS::SObject_ptr aSO, - HDFdataset* hdf_dataset) -{ - hdf_dataset->OpenOnDisk(); - - SALOMEDS::GenericAttribute_var anAttr; - - char* current_string = new char[hdf_dataset->GetSize()]; - hdf_dataset->ReadFromDisk(current_string); - - if (!strcmp(hdf_dataset->GetName(),"COMPONENTDATATYPE")) { - anAttr = theStudy->GetBuilder()->FindOrCreateAttribute(aSO, "AttributeComment"); - } else if (!strcmp(hdf_dataset->GetName(),"Reference")) { - theStudy->GetBuilder()->Addreference(aSO, theStudy->CreateObjectID(current_string)); - delete(current_string); - hdf_dataset->CloseOnDisk(); - return; - } else { - MESSAGE("Read attribute "<GetName()) - anAttr = theStudy->GetBuilder()->FindOrCreateAttribute(aSO, hdf_dataset->GetName()); - } - - if (!CORBA::is_nil(anAttr)) { - anAttr->Restore(current_string); - MESSAGE("Restoring attribute "<GetName()<<" by string '"<GetName()); - MESSAGE("LoadAttributes: unknown types"); - } - delete(current_string); - hdf_dataset->CloseOnDisk(); -} - -//============================================================================ -//Function : Translate_IOR_to_persistentID -//============================================================================ -static void Translate_IOR_to_persistentID(SALOMEDS_Study_i* theStudy, - SALOMEDS_StudyBuilder_i* theBuilder, - SALOMEDS::SObject_ptr theSObject, - SALOMEDS::Driver_ptr theEngine, - CORBA::Boolean theIsMultiFile, - CORBA::Boolean theIsASCII) -{ - MESSAGE("In Translate_IOR_to_persistentID"); - SALOMEDS_ChildIterator_i anIter = theStudy->GetChildIterator(theSObject); - for(; anIter.More(); anIter.Next()){ - SALOMEDS::GenericAttribute_var anAttr; - SALOMEDS::SObject_var aSObject = anIter.Value(); - if(aSObject->FindAttribute(anAttr,"AttributeIOR")){ - SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); - CORBA::String_var aString = anIOR->Value(); - CORBA::String_var aPersistentID = - theEngine->IORToLocalPersistentID(aSObject,aString,theIsMultiFile,theIsASCII); - anAttr = theBuilder->FindOrCreateAttribute(aSObject,"AttributePersistentRef"); - SALOMEDS::AttributePersistentRef_var aPersistentRef = SALOMEDS::AttributePersistentRef::_narrow(anAttr); - aPersistentRef->SetValue(aPersistentID); - aString = aSObject->GetID(); - } - Translate_IOR_to_persistentID(theStudy,theBuilder,aSObject,theEngine,theIsMultiFile,theIsASCII); - } -} +#include "SALOME_GenericObj_i.hh" -//============================================================================ -//Function : BuildlTree -//============================================================================ -static -void -BuildTree(SALOMEDS_Study_i* theStudy, HDFgroup* hdf_current_group) -{ - hdf_current_group->OpenOnDisk(); - - SALOMEDS::SObject_var aSO; - char* Entry = hdf_current_group->GetName(); - if (strcmp(Entry,"STUDY_STRUCTURE") == 0) { - MESSAGE("find the root of the document"); - aSO = theStudy->CreateObjectID("0:1"); - } - else { - aSO = theStudy->CreateObjectID(Entry); - MESSAGE("BuildTree : Create a new label"<nInternalObjects(); - - for (Standard_Integer i=0; iInternalObjectIndentify(i,name); - if (strncmp(name, "INTERNAL_COMPLEX",16) == 0) continue; - hdf_object_type type = hdf_current_group->InternalObjectType(name); +#include "Utils_ExceptHandlers.hxx" - if (type == HDF_DATASET) { - MESSAGE("--> Dataset: Internal Object Name : " << name); - HDFdataset* new_dataset = new HDFdataset(name,hdf_current_group); - ReadAttributes(theStudy,aSO,new_dataset); - new_dataset = 0; // will be deleted by father destructor +UNEXPECT_CATCH(SalomeException,SALOME::SALOME_Exception); +UNEXPECT_CATCH(LockProtection, SALOMEDS::StudyBuilder::LockProtection); - } - else if (type == HDF_GROUP) { - MESSAGE( "--> Group: Internal Object Name : " << name); - HDFgroup* new_group = new HDFgroup(name,hdf_current_group); - BuildTree(theStudy, new_group); - new_group = 0; // will be deleted by father destructor - } - } - hdf_current_group->CloseOnDisk(); -} +static SALOMEDS_Driver_i* GetDriver(const Handle(SALOMEDSImpl_SObject)& theObject, CORBA::ORB_ptr orb); //============================================================================ @@ -229,17 +39,16 @@ BuildTree(SALOMEDS_Study_i* theStudy, HDFgroup* hdf_current_group) * Purpose : SALOMEDS_StudyManager_i constructor */ //============================================================================ -SALOMEDS_StudyManager_i::SALOMEDS_StudyManager_i(CORBA::ORB_ptr theORB, - PortableServer::POA_ptr thePOA): - _orb(CORBA::ORB::_duplicate(theORB)), - _poa(PortableServer::POA::_duplicate(thePOA)), - _OCAFApp(new SALOMEDS_OCAFApplication()), - _name_service(theORB) +SALOMEDS_StudyManager_i::SALOMEDS_StudyManager_i(CORBA::ORB_ptr orb, PortableServer::POA_ptr thePOA) { + _orb = CORBA::ORB::_duplicate(orb); + _poa = PortableServer::POA::_duplicate(thePOA); + _name_service = new SALOME_NamingService(_orb); // Study directory creation in the naming service : to register all // open studies in the session - _name_service.Create_Directory("/Study"); - _IDcounter = 0; + _name_service->Create_Directory("/Study"); + _impl = new SALOMEDSImpl_StudyManager; + _factory = new SALOMEDS_DriverFactory_i(_orb); } //============================================================================ @@ -250,19 +59,8 @@ SALOMEDS_StudyManager_i::SALOMEDS_StudyManager_i(CORBA::ORB_ptr theORB, SALOMEDS_StudyManager_i::~SALOMEDS_StudyManager_i() { // Destroy directory to register open studies - _name_service.Destroy_Directory("/Study"); -} - -SALOMEDS_Study_i* -SALOMEDS_StudyManager_i::DownCast(SALOMEDS::Study_ptr theStudy) const -{ - if(!CORBA::is_nil(theStudy)){ - PortableServer::POA_var aPOA = GetPOA(); - PortableServer::ServantBase_var aServant = SALOMEDS::GetServant(theStudy,aPOA); - if(aServant.in()) - return dynamic_cast(aServant.in()); - } - return NULL; + _name_service->Destroy_Directory("/Study"); + delete _factory; } //============================================================================ @@ -271,9 +69,10 @@ SALOMEDS_StudyManager_i::DownCast(SALOMEDS::Study_ptr theStudy) const * context name */ //============================================================================ -void SALOMEDS_StudyManager_i::register_name(char * theName) { +void SALOMEDS_StudyManager_i::register_name(char * name) +{ SALOMEDS::StudyManager_var aManager(_this()); - _name_service.Register(aManager.in(),theName); + _name_service->Register(aManager.in(), name); } @@ -282,45 +81,33 @@ void SALOMEDS_StudyManager_i::register_name(char * theName) { * Purpose : Create a New Study of name study_name */ //============================================================================ -SALOMEDS::Study_ptr SALOMEDS_StudyManager_i::NewStudy(const char* theStudyName) +SALOMEDS::Study_ptr SALOMEDS_StudyManager_i::NewStudy(const char* study_name) { - Handle(TDocStd_Document) aDocument; - _OCAFApp->NewDocument("SALOME_STUDY",aDocument); + SALOMEDS::Locker lock; + + Handle(SALOMEDSImpl_Study) aStudyImpl = _impl->NewStudy(TCollection_AsciiString((char*)study_name)); + if(aStudyImpl.IsNull()) { + MESSAGE("NewStudy : Error : " << _impl->GetErrorCode()); + return SALOMEDS::Study::_nil(); + } MESSAGE("NewStudy : Creating the CORBA servant holding it... "); - SALOMEDS_Study_i* aStudyServant = new SALOMEDS_Study_i(this,aDocument,theStudyName); - SALOMEDS::Study_var aStudy = aStudyServant->_this(); - //Study->StudyId( _OCAFApp->NbDocuments() ); - _IDcounter++; - aStudyServant->StudyId( _IDcounter ); + SALOMEDS_Study_i *Study_servant = new SALOMEDS_Study_i(aStudyImpl, _orb); + SALOMEDS::Study_var Study = SALOMEDS::Study::_narrow(Study_servant->_this()); // Register study in the naming service // Path to acces the study - if(!_name_service.Change_Directory("/Study")){ - MESSAGE( "Unable to access the study directory" ); - }else - _name_service.Register(aStudy, theStudyName); - + if(!_name_service->Change_Directory("/Study")) + MESSAGE( "Unable to access the study directory" ) + else + _name_service->Register(Study, study_name); + // Assign the value of the IOR in the study->root - CORBA::String_var anIOR = _orb->object_to_string(aStudy); - SALOMEDS_IORAttribute::Set(aDocument->Main().Root(), - const_cast(anIOR.in()), - aStudyServant); - - // set Study properties - SALOMEDS::AttributeStudyProperties_var aProp = aStudyServant->GetProperties(); - OSD_Process aProcess; - Quantity_Date aDate = aProcess.SystemDate(); - aProp->SetCreationDate(CORBA::Long(aDate.Minute()), - CORBA::Long(aDate.Hour()), - CORBA::Long(aDate.Day()), - CORBA::Long(aDate.Month()), - CORBA::Long(aDate.Year())); - aProp->SetCreationMode("from scratch"); - aProp->SetUserName(aProcess.UserName().ToCString()); - - return aStudy._retn(); + const char* IORStudy = _orb->object_to_string(Study); + + aStudyImpl->SetTransientReference((char*)IORStudy); + return Study; } //============================================================================ @@ -328,98 +115,32 @@ SALOMEDS::Study_ptr SALOMEDS_StudyManager_i::NewStudy(const char* theStudyName) * Purpose : Open a Study from it's persistent reference */ //============================================================================ -SALOMEDS::Study_ptr SALOMEDS_StudyManager_i::Open(const char* theURL) +SALOMEDS::Study_ptr SALOMEDS_StudyManager_i::Open(const char* aUrl) throw(SALOME::SALOME_Exception) { + SALOMEDS::Locker lock; + Unexpect aCatch(SalomeException); MESSAGE("Begin of SALOMEDS_StudyManager_i::Open"); - bool isASCII = false; - std::ostringstream anURLStream; - if (HDFascii::isASCII(theURL)) { - isASCII = true; - auto_ptr aResultPath(HDFascii::ConvertFromASCIIToHDF(theURL)); - anURLStream< hdf_file(new HDFfile(const_cast(aHDFUrl.c_str()))); + Handle(SALOMEDSImpl_Study) aStudyImpl = _impl->Open(TCollection_AsciiString((char*)aUrl)); - try { - hdf_file->OpenOnDisk(HDF_RDONLY);// mpv: was RDWR, but opened file can be write-protected too - }catch(HDFexception){ - std::ostringstream aStream; - aStream<<"Can't open file "<NewDocument("SALOME_STUDY",Doc); - - SALOMEDS_Study_i* aStudyServant = new SALOMEDS_Study_i(this,Doc,theURL); - SALOMEDS::Study_var aStudy = aStudyServant->_this(); - - // aStudy->StudyId( _OCAFApp->NbDocuments() ); - _IDcounter++; - aStudy->StudyId( _IDcounter ); - - // Assign the value of the URL in the study object - aStudyServant->URL(theURL); - SCRUTE(theURL); + SALOMEDS_Study_i * Study_servant = new SALOMEDS_Study_i(aStudyImpl, _orb); + SALOMEDS::Study_var Study = SALOMEDS::Study::_narrow(Study_servant->_this()); // Assign the value of the IOR in the study->root - CORBA::String_var anIOR = _orb->object_to_string(aStudy); - SALOMEDS_IORAttribute::Set(Doc->Main().Root(), - const_cast(anIOR.in()), - aStudyServant); - - SALOMEDS_PersRefAttribute::Set(Doc->Main(),const_cast(theURL)); - - if (!hdf_file->ExistInternalObject("STUDY_STRUCTURE")) { - MESSAGE("SALOMEDS_StudyManager::Open : the study is empty"); - return aStudy._retn(); - } - - //Create the Structure of the OCAF Document - HDFgroup *hdf_group_study_structure = new HDFgroup("STUDY_STRUCTURE",hdf_file.get()); - - Handle(TDF_Data) DF = Doc->GetData(); - - try{ - BuildTree(aStudyServant,hdf_group_study_structure); - }catch(HDFexception){ - std::ostringstream aStream; - aStream<<"Can't open file "<object_to_string(Study); + aStudyImpl->SetTransientReference((char*)IORStudy); - hdf_file->CloseOnDisk(); - // Register study in the naming service // Path to acces the study - if(!_name_service.Change_Directory("/Study")){ - MESSAGE( "Unable to access the study directory" ); - }else{ - CORBA::String_var aString(aStudyServant->Name()); - _name_service.Register(aStudy,aString.in()); - } - - if (isASCII) { - SALOMEDS::ListOfFileNames_var aFilesToRemove = new SALOMEDS::ListOfFileNames; - aFilesToRemove->length(1); - std::string aDir = SALOMEDS_Tool::GetDirFromPath(aHDFUrl); - aFilesToRemove[0] = CORBA::string_dup(&aHDFUrl[strlen(aDir.c_str())]); - SALOMEDS_Tool::RemoveTemporaryFiles(aDir,aFilesToRemove,true); - } + if(!_name_service->Change_Directory("/Study")) MESSAGE( "Unable to access the study directory" ) + else _name_service->Register(Study, CORBA::string_dup(aStudyImpl->Name().ToCString())); - return aStudy._retn(); + return Study; } @@ -431,17 +152,17 @@ SALOMEDS::Study_ptr SALOMEDS_StudyManager_i::Open(const char* theURL) * close action without saving */ //============================================================================ -void SALOMEDS_StudyManager_i::Close(SALOMEDS::Study_ptr aStudy) +void SALOMEDS_StudyManager_i::Close(SALOMEDS::Study_ptr aStudy) { + SALOMEDS::Locker lock; + if(aStudy->_is_nil()) return; - - aStudy->RemovePostponed(-1); - + // Destroy study name in the naming service - if(_name_service.Change_Directory("/Study")){ + if(_name_service->Change_Directory("/Study")){ CORBA::String_var aString(aStudy->Name()); - _name_service.Destroy_Name(aString.in()); - } + _name_service->Destroy_Name(aString.in()); + } aStudy->Close(); } @@ -451,24 +172,30 @@ void SALOMEDS_StudyManager_i::Close(SALOMEDS::Study_ptr aStudy) * Purpose : Save a Study to it's persistent reference */ //============================================================================ -void SALOMEDS_StudyManager_i::Save(SALOMEDS::Study_ptr theStudy, CORBA::Boolean theMultiFile) +void SALOMEDS_StudyManager_i::Save(SALOMEDS::Study_ptr aStudy, CORBA::Boolean theMultiFile) { - CORBA::String_var anURL = theStudy->URL(); - if(strcmp(anURL.in(),"") == 0){ - MESSAGE( "No path specified to save the study. Nothing done"); - }else{ - _SaveAs(anURL,theStudy,theMultiFile,false); + SALOMEDS::Locker lock; + + if(aStudy->_is_nil()) { + MESSAGE("Save error: Study is null"); + return; } + + Handle(SALOMEDSImpl_Study) aStudyImpl = _impl->GetStudyByID(aStudy->StudyId()); + _impl->Save(aStudyImpl, _factory, theMultiFile); } -void SALOMEDS_StudyManager_i::SaveASCII(SALOMEDS::Study_ptr theStudy, CORBA::Boolean theMultiFile) +void SALOMEDS_StudyManager_i::SaveASCII(SALOMEDS::Study_ptr aStudy, CORBA::Boolean theMultiFile) { - CORBA::String_var anURL = theStudy->URL(); - if(strcmp(anURL.in(),"") == 0){ - MESSAGE( "No path specified to save the study. Nothing done"); - }else{ - _SaveAs(anURL,theStudy,theMultiFile,true); + SALOMEDS::Locker lock; + + if(aStudy->_is_nil()) { + MESSAGE("SaveASCII error: Study is null"); + return; } + + Handle(SALOMEDSImpl_Study) aStudyImpl = _impl->GetStudyByID(aStudy->StudyId()); + _impl->SaveASCII(aStudyImpl, _factory, theMultiFile); } //============================================================================= @@ -476,15 +203,30 @@ void SALOMEDS_StudyManager_i::SaveASCII(SALOMEDS::Study_ptr theStudy, CORBA::Boo * Purpose : Save a study to the persistent reference aUrl */ //============================================================================ -void SALOMEDS_StudyManager_i::SaveAs(const char* aUrl, SALOMEDS::Study_ptr theStudy, CORBA::Boolean theMultiFile) +void SALOMEDS_StudyManager_i::SaveAs(const char* aUrl, SALOMEDS::Study_ptr aStudy, CORBA::Boolean theMultiFile) { - _SaveAs(aUrl,theStudy,theMultiFile, false); + SALOMEDS::Locker lock; + if(aStudy->_is_nil()) { + MESSAGE("SaveASCII error: Study is null"); + return; + } + + Handle(SALOMEDSImpl_Study) aStudyImpl = _impl->GetStudyByID(aStudy->StudyId()); + _impl->SaveAs(TCollection_AsciiString((char*)aUrl), aStudyImpl, _factory, theMultiFile); } -void SALOMEDS_StudyManager_i::SaveAsASCII(const char* aUrl, SALOMEDS::Study_ptr theStudy, CORBA::Boolean theMultiFile) +void SALOMEDS_StudyManager_i::SaveAsASCII(const char* aUrl, SALOMEDS::Study_ptr aStudy, CORBA::Boolean theMultiFile) { - _SaveAs(aUrl,theStudy,theMultiFile, true); + SALOMEDS::Locker lock; + + if(aStudy->_is_nil()) { + MESSAGE("SaveASCII error: Study is null"); + return; + } + + Handle(SALOMEDSImpl_Study) aStudyImpl = _impl->GetStudyByID(aStudy->StudyId()); + _impl->SaveAsASCII(TCollection_AsciiString((char*)aUrl), aStudyImpl, _factory, theMultiFile); } //============================================================================ @@ -494,21 +236,28 @@ void SALOMEDS_StudyManager_i::SaveAsASCII(const char* aUrl, SALOMEDS::Study_ptr //============================================================================ SALOMEDS::ListOfOpenStudies* SALOMEDS_StudyManager_i::GetOpenStudies() { - // MESSAGE("Begin of GetOpenStudies"); - SALOMEDS::ListOfOpenStudies_var aStudyList = new SALOMEDS::ListOfOpenStudies; - - if(!_name_service.Change_Directory("/Study")){ - MESSAGE("No active study in this session"); - }else{ - vector aList = _name_service.list_directory(); - aStudyList->length(aList.size()); - for(unsigned int ind = 0; ind < aList.size(); ind++){ - aStudyList[ind] = CORBA::string_dup(aList[ind].c_str()); - SCRUTE(aStudyList[ind]) ; - } - } + SALOMEDS::Locker lock; + + Handle(TColStd_HSequenceOfTransient) anOpened = _impl->GetOpenStudies(); + int aLength = anOpened->Length(); - return aStudyList._retn(); + SALOMEDS::ListOfOpenStudies_var _list_open_studies = new SALOMEDS::ListOfOpenStudies; + _list_open_studies->length(aLength); + + if(!aLength) + { + MESSAGE("No active study in this session"); + } + else + { + for (unsigned int ind=1; ind <= aLength; ind++) + { + Handle(SALOMEDSImpl_Study) aStudy = Handle(SALOMEDSImpl_Study)::DownCast(anOpened->Value(ind)); + _list_open_studies[ind-1] = CORBA::string_dup(aStudy->Name().ToCString()); + SCRUTE(_list_open_studies[ind-1]) ; + } + } + return _list_open_studies._retn(); } //============================================================================ @@ -516,579 +265,76 @@ SALOMEDS::ListOfOpenStudies* SALOMEDS_StudyManager_i::GetOpenStudies() * Purpose : Get a study from its name */ //============================================================================ -SALOMEDS::Study_ptr -SALOMEDS_StudyManager_i::GetStudyByName(const char* theStudyName) +SALOMEDS::Study_ptr SALOMEDS_StudyManager_i::GetStudyByName(const char* aStudyName) { - SALOMEDS::Study_var aStudy; - - // Go to study directory and look for aStudyName - if(!_name_service.Change_Directory("/Study")){ - MESSAGE("No active study in this session"); - ASSERT(false); // Stop here... - } + SALOMEDS::Locker lock; - if(_name_service.Find(theStudyName) > 0){ - // Study found - CORBA::Object_ptr anObj = _name_service.Resolve(theStudyName) ; - aStudy = SALOMEDS::Study::_narrow(anObj); - MESSAGE("Study " << theStudyName << " found in the naming service"); - }else{ - MESSAGE("Study " << theStudyName << " not found in the naming service"); - } - return aStudy._retn(); -} + Handle(SALOMEDSImpl_Study) aStudyImpl = _impl->GetStudyByName(TCollection_AsciiString((char*)aStudyName)); -//============================================================================ -/*! Function : GetStudyByID - * Purpose : Get a study from its ID - */ -//============================================================================ -SALOMEDS::Study_ptr -SALOMEDS_StudyManager_i::GetStudyByID(CORBA::Short aStudyID) -{ - SALOMEDS::Study_var aStudy; - - if(!_name_service.Change_Directory("/Study")){ - MESSAGE("No active study in this session"); - }else{ - vector aList = _name_service.list_directory(); - for(unsigned int ind = 0; ind < aList.size(); ind++){ - const char* aStudyName = aList[ind].c_str(); - MESSAGE( "GetStudyByID = " << aStudyName ); - if(_name_service.Find(aStudyName) > 0){ - CORBA::Object_ptr anObj = _name_service.Resolve(aStudyName) ; - aStudy = SALOMEDS::Study::_narrow(anObj); - MESSAGE( " aStudyID : " << aStudyID << "-" << aStudy->StudyId() ); - if(aStudyID == aStudy->StudyId()){ - MESSAGE("Study with studyID = " << aStudyID << " found in the naming service"); - return aStudy._retn(); - } - }else{ - MESSAGE("Study " << aStudyName << " not found in the naming service"); - } + if(aStudyImpl.IsNull()) + { + MESSAGE("No active study in this session"); + ASSERT(false); // Stop here... } - } - return aStudy._retn(); -} -//============================================================================ -/*! Function : SaveAttributes - * Purpose : Save attributes for object - */ -//============================================================================ -static void SaveAttributes(SALOMEDS::SObject_ptr SO, HDFgroup *hdf_group_sobject) { - int a; - hdf_size size[1]; - SALOMEDS::ListOfAttributes_var anAttrList = SO->GetAllAttributes(); - for(a = anAttrList->length() - 1; a >= 0; a--) { - if (strcmp(anAttrList[a]->Type(), "AttributeIOR") == 0) continue; // never write AttributeIOR to file - if (strcmp(anAttrList[a]->Type(), "AttributeExternalFileDef") == 0) continue; // never write ExternalFileDef to file - if (strcmp(anAttrList[a]->Type(), "AttributeFileType") == 0) continue; // never write FileType to file - CORBA::String_var aSaveStr(anAttrList[a]->Store()); - size[0] = (hdf_int32) strlen(aSaveStr.in()) + 1; - HDFdataset *hdf_dataset = new HDFdataset(anAttrList[a]->Type(),hdf_group_sobject,HDF_STRING,size,1); - hdf_dataset->CreateOnDisk(); - hdf_dataset->WriteOnDisk(aSaveStr); - hdf_dataset->CloseOnDisk(); - //cout<<"********** Write Attribute "<Type()<<" : "<ReferencedObject(RefSO)) { - CORBA::String_var attribute_reference(RefSO->GetID()); - size[0] = strlen(attribute_reference) + 1 ; - HDFdataset *hdf_dataset = new HDFdataset("Reference",hdf_group_sobject,HDF_STRING,size,1); - hdf_dataset->CreateOnDisk(); - hdf_dataset->WriteOnDisk(attribute_reference); - hdf_dataset->CloseOnDisk(); - hdf_dataset = 0; // will be deleted by father hdf object destructor - } + SALOMEDS_Study_i * Study_servant = new SALOMEDS_Study_i(aStudyImpl, _orb); + SALOMEDS::Study_var Study = SALOMEDS::Study::_narrow(Study_servant->_this()); + + return Study; } -//============================================================================= -/*! Function : _SaveProperties - * Purpose : save the study properties in HDF file - */ //============================================================================ -void SALOMEDS_StudyManager_i::_SaveProperties(SALOMEDS_Study_i* theStudy, HDFgroup *hdf_group) -{ - // add modifications list (user and date of save) - SALOMEDS::AttributeStudyProperties_ptr aProp = theStudy->GetProperties(); - int aLocked = aProp->IsLocked(); - if (aLocked) - aProp->SetLocked(Standard_False); - OSD_Process aProcess; - Quantity_Date aDate = aProcess.SystemDate(); - aProp->SetModification(aProcess.UserName().ToCString(), - CORBA::Long(aDate.Minute()), - CORBA::Long(aDate.Hour()), - CORBA::Long(aDate.Day()), - CORBA::Long(aDate.Month()), - CORBA::Long(aDate.Year())); - if(aLocked) - aProp->SetLocked(Standard_True); - - SALOMEDS::StringSeq_var aNames; - SALOMEDS::LongSeq_var aMinutes, aHours, aDays, aMonths, aYears; - aProp->GetModificationsList(aNames,aMinutes,aHours,aDays,aMonths,aYears,true); - - std::ostringstream aPropertyList; - aPropertyList<<(strlen(aProp->GetCreationMode()) != 0? aProp->GetCreationMode()[0] : '0'); - aPropertyList<<(aProp->IsLocked()? 'l': 'u'); - - int aLength = aNames->length(); - for(int anIndex = 0; anIndex < aLength; anIndex++) { - aPropertyList<CreateOnDisk(); - hdf_dataset->WriteOnDisk(const_cast(aProperty.c_str())); - MESSAGE("attribute StudyProperties " << aProperty << " wrote on file"); - hdf_dataset->CloseOnDisk(); - hdf_dataset = 0; //will be deleted by hdf_sco_group destructor - aProp->SetModified(0); -} - -//============================================================================= -/*! Function : _SaveAs - * Purpose : save the study in HDF file +/*! Function : GetStudyByID + * Purpose : Get a study from its ID */ //============================================================================ -void SALOMEDS_StudyManager_i::_SaveAs(const char* aUrl, - SALOMEDS::Study_ptr theStudy, - CORBA::Boolean theMultiFile, - CORBA::Boolean theASCII) +SALOMEDS::Study_ptr SALOMEDS_StudyManager_i::GetStudyByID(CORBA::Short aStudyID) { - // HDF File will be composed of differents part : - // * For each ComponentDataType, all data created by the component - // Informations in data group hdf_group_datacomponent - // * Study Structure -> Exactly what is contained in OCAF document - // Informations in data group hdf_group_study_structure - - if(SALOMEDS_Study_i* aStudy = DownCast(theStudy)){ - HDFfile *hdf_file=0; - HDFgroup *hdf_group_study_structure =0; - HDFgroup *hdf_sco_group =0; - HDFgroup *hdf_sco_group2 =0; - - HDFgroup *hdf_group_datacomponent =0; - HDFdataset *hdf_dataset =0; - hdf_size size[1]; - hdf_int32 name_len = 0; + SALOMEDS::Locker lock; - int aLocked = aStudy->GetProperties()->IsLocked(); - if(aLocked) - aStudy->GetProperties()->SetLocked(false); + Handle(SALOMEDSImpl_Study) aStudyImpl = _impl->GetStudyByID(aStudyID); - SALOMEDS_StudyBuilder_i* SB= aStudy->GetBuilder(); - try{ - // mpv 15.12.2003: for saving components we have to load all data from all modules - SALOMEDS_SComponentIterator_i aComponentIter = aStudy->GetComponentIterator(); - for(; aComponentIter.More(); aComponentIter.Next()){ - SALOMEDS::SComponent_var sco = aComponentIter.Value(); - // if there is an associated Engine call its method for saving - CORBA::String_var IOREngine; - try{ - if(!sco->ComponentIOR(IOREngine)){ - SALOMEDS::GenericAttribute_var aGeneric; - SALOMEDS::AttributeName_var aName; - if(sco->FindAttribute(aGeneric, "AttributeName")) - aName = SALOMEDS::AttributeName::_narrow(aGeneric); - - if(!aName->_is_nil()){ - CORBA::String_var aCompType = aName->Value(); - - CORBA::String_var aFactoryType; - if(strcmp(aCompType, "SUPERV") == 0) - aFactoryType = "SuperVisionContainer"; - else - aFactoryType = "FactoryServer"; - - Engines::Component_var aComp = - SALOME_LifeCycleCORBA(&_name_service).FindOrLoad_Component(aFactoryType, aCompType); - - if(aComp->_is_nil()){ - Engines::Component_var aComp = - SALOME_LifeCycleCORBA(&_name_service).FindOrLoad_Component("FactoryServerPy", aCompType); - } - - if(!aComp->_is_nil()){ - SALOMEDS::Driver_var aDriver = SALOMEDS::Driver::_narrow(aComp); - if (!CORBA::is_nil(aDriver)) { - SB->LoadWith(sco, aDriver); - } - } - } - } - }catch(...){ - MESSAGE("Can not restore information to resave it"); - return; - } - } - - CORBA::String_var anOldName = aStudy->Name(); - aStudy->URL(aUrl); - - // To change for Save - // Do not have to do a new file but just a Open??? Rewrite all informations after erasing evrything?? - hdf_file = new HDFfile((char *)aUrl); - hdf_file->CreateOnDisk(); - MESSAGE("File " << aUrl << " created"); - - //----------------------------------------------------------------------- - // 1 - Create a groupe for each SComponent and Update the PersistanceRef - //----------------------------------------------------------------------- - hdf_group_datacomponent = new HDFgroup("DATACOMPONENT",hdf_file); - hdf_group_datacomponent->CreateOnDisk(); - - //SRN: Added 17 Nov, 2003 - SALOMEDS::SObject_var anAutoSaveSO = aStudy->FindObjectID(AUTO_SAVE_TAG); - //SRN: End - - aComponentIter.Init(); - for(; aComponentIter.More(); aComponentIter.Next()){ - SALOMEDS::SComponent_var sco = aComponentIter.Value(); - - CORBA::String_var scoid = sco->GetID(); - hdf_sco_group = new HDFgroup(scoid,hdf_group_datacomponent); - hdf_sco_group->CreateOnDisk(); - - CORBA::String_var componentDataType = sco->ComponentDataType(); - MESSAGE ( "Look for an engine for data type :"<< componentDataType); - - //SRN: Added 17 Nov 2003: If there is a specified attribute, the component peforms a special save - if(!CORBA::is_nil(anAutoSaveSO) && SB->IsGUID(sco, AUTO_SAVE_GUID)){ - SALOMEDS::GenericAttribute_var aGeneric; - SALOMEDS::AttributeTableOfString_var aTable; - if(anAutoSaveSO->FindAttribute(aGeneric, "AttributeTableOfString")){ - aTable = SALOMEDS::AttributeTableOfString::_narrow(aGeneric); - Standard_Integer nbRows = aTable->GetNbRows(), k, aTimeOut = 0; - if(nbRows > 0 && aTable->GetNbColumns() > 1) { - SALOMEDS::StringSeq_var aRow; - for(k=1; k<=nbRows; k++){ - aRow = aTable->GetRow(k); - if(strcmp(aRow[0], componentDataType) == 0){ - CORBA::String_var anEntry = CORBA::string_dup(aRow[1]); - SALOMEDS::SObject_var aCompSpecificSO = aStudy->FindObjectID(anEntry); - if(!CORBA::is_nil(aCompSpecificSO)) { - SALOMEDS::AttributeInteger_var anInteger; - if(aCompSpecificSO->FindAttribute(aGeneric, "AttributeInteger")) { - anInteger = SALOMEDS::AttributeInteger::_narrow(aGeneric); - anInteger->SetValue(-1); - while(anInteger->Value() < 0) { sleep(2); if(++aTimeOut > AUTO_SAVE_TIME_OUT_IN_SECONDS) break; } - } // if(aCompSpecificSO->FindAttribute(anInteger, "AttributeInteger")) - } // if(!CORBA::is_nil(aCompSpecificSO)) - } // if (strcmp(aRow[0], componentDataType) == 0) - } // for - - } // if(nbRows > 0 && aTable->GetNbColumns() > 1) - - } // if(anAutoSaveSO->FindAttribute(aTable, "AttributeTableOfString") - - } // if(SB->IsGUID(AUTO_SAVE_GUID) - - //SRN: End - - CORBA::String_var IOREngine; - if(sco->ComponentIOR(IOREngine)){ - // we have found the associated engine to write the data - MESSAGE ( "We have found an engine for data type :"<< componentDataType); - CORBA::Object_var obj = _orb->string_to_object(IOREngine); - SALOMEDS::Driver_var Engine = SALOMEDS::Driver::_narrow(obj) ; - - if(!CORBA::is_nil(Engine)){ - MESSAGE ( "Save the data of type:"<< componentDataType); - MESSAGE("Engine :"<ComponentDataType()); - - SALOMEDS::TMPFile_var aStream; - - if(theASCII) - aStream = Engine->SaveASCII(sco,SALOMEDS_Tool::GetDirFromPath(aUrl).c_str(),theMultiFile); - else - aStream = Engine->Save(sco,SALOMEDS_Tool::GetDirFromPath(aUrl).c_str(),theMultiFile); - - HDFdataset *hdf_dataset; - hdf_size aHDFSize[1]; - if(aStream->length() > 0){ //The component saved some auxiliary files, then put them into HDF file - - aHDFSize[0] = aStream->length(); - - HDFdataset *hdf_dataset = new HDFdataset("FILE_STREAM", hdf_sco_group, HDF_STRING, aHDFSize, 1); - hdf_dataset->CreateOnDisk(); - hdf_dataset->WriteOnDisk((unsigned char*) &aStream[0]); //Save the stream in the HDF file - hdf_dataset->CloseOnDisk(); - } - // store multifile state - aHDFSize[0] = 2; - hdf_dataset = new HDFdataset("MULTIFILE_STATE", hdf_sco_group, HDF_STRING, aHDFSize, 1); - hdf_dataset->CreateOnDisk(); - hdf_dataset->WriteOnDisk((void*)(theMultiFile?"M":"S")); // save: multi or single - hdf_dataset->CloseOnDisk(); - hdf_dataset=0; //will be deleted by hdf_sco_AuxFiles destructor - - // store ASCII state - aHDFSize[0] = 2; - hdf_dataset = new HDFdataset("ASCII_STATE", hdf_sco_group, HDF_STRING, aHDFSize, 1); - hdf_dataset->CreateOnDisk(); - hdf_dataset->WriteOnDisk((void*)(theASCII?"A":"B")); // save: ASCII or BINARY - hdf_dataset->CloseOnDisk(); - hdf_dataset=0; //will be deleted by hdf_sco_AuxFiles destructor - - Translate_IOR_to_persistentID(aStudy,SB,sco,Engine,theMultiFile, theASCII); - MESSAGE("After Translate_IOR_to_persistentID"); - - // Creation of the persistance reference attribute - } - } - hdf_sco_group->CloseOnDisk(); - hdf_sco_group=0; // will be deleted by hdf_group_datacomponent destructor - } - hdf_group_datacomponent->CloseOnDisk(); - hdf_group_datacomponent =0; // will be deleted by hdf_file destructor - - - //----------------------------------------------------------------------- - //3 - Write the Study Structure - //----------------------------------------------------------------------- - hdf_group_study_structure = new HDFgroup("STUDY_STRUCTURE",hdf_file); - hdf_group_study_structure->CreateOnDisk(); - - // save component attributes - aComponentIter.Init(); - for(; aComponentIter.More(); aComponentIter.Next()){ - SALOMEDS::SComponent_var SC = aComponentIter.Value(); - - CORBA::String_var scid = SC->GetID(); - hdf_sco_group2 = new HDFgroup(scid,hdf_group_study_structure); - hdf_sco_group2->CreateOnDisk(); - SaveAttributes(SC, hdf_sco_group2); - // ComponentDataType treatment - CORBA::String_var component_name = SC->ComponentDataType(); - MESSAGE("Component data type " << component_name << " treated"); - - name_len = (hdf_int32) strlen(component_name.in()); - size[0] = name_len +1 ; - hdf_dataset = new HDFdataset("COMPONENTDATATYPE",hdf_sco_group2,HDF_STRING,size,1); - hdf_dataset->CreateOnDisk(); - hdf_dataset->WriteOnDisk(const_cast(component_name.in())); - MESSAGE("component name " << component_name << " wrote on file"); - hdf_dataset->CloseOnDisk(); - hdf_dataset=0; //will be deleted by hdf_sco_group destructor - _SaveObject(aStudy, SC, hdf_sco_group2); - hdf_sco_group2->CloseOnDisk(); - hdf_sco_group2=0; // will be deleted by hdf_group_study_structure destructor - } - //----------------------------------------------------------------------- - //4 - Write the Study UseCases Structure - //----------------------------------------------------------------------- - SALOMEDS::SObject_var aSO = aStudy->FindObjectID(USE_CASE_LABEL_ID); - if(!aSO->_is_nil()){ - HDFgroup *hdf_soo_group = new HDFgroup(USE_CASE_LABEL_ID,hdf_group_study_structure); - hdf_soo_group->CreateOnDisk(); - SaveAttributes(aSO, hdf_soo_group); - _SaveObject(aStudy, aSO, hdf_soo_group); - MESSAGE("Use cases data structure writed"); - hdf_soo_group->CloseOnDisk(); - hdf_soo_group=0; // will be deleted by hdf_group_study_structure destructor - } - - if (aLocked) - aStudy->GetProperties()->SetLocked(true); - //----------------------------------------------------------------------- - //5 - Write the Study Properties - //----------------------------------------------------------------------- - name_len = (hdf_int32) strlen(aStudy->Name()); - size[0] = name_len +1 ; - hdf_dataset = new HDFdataset("STUDY_NAME",hdf_group_study_structure,HDF_STRING,size,1); - hdf_dataset->CreateOnDisk(); - CORBA::String_var studid = aStudy->Name(); - hdf_dataset->WriteOnDisk(studid); - MESSAGE("study name " << studid << " wrote on file"); - hdf_dataset->CloseOnDisk(); - hdf_dataset=0; // will be deleted by hdf_group_study_structure destructor - - _SaveProperties(aStudy, hdf_group_study_structure); - - hdf_group_study_structure->CloseOnDisk(); - hdf_file->CloseOnDisk(); - - _name_service.Change_Directory("/Study"); - _name_service.Destroy_Name(anOldName); - _name_service.Register(theStudy, aStudy->Name()); - - aStudy->IsSaved(true); - hdf_group_study_structure =0; // will be deleted by hdf_file destructor - delete hdf_file; // recursively deletes all hdf objects... - }catch(HDFexception){ - MESSAGE( "HDFexception ! " ); + if(aStudyImpl.IsNull()) + { + MESSAGE("No active study in this session"); + ASSERT(false); // Stop here... } - if(theASCII){ // save file in ASCII format - HDFascii::ConvertFromHDFToASCII(aUrl, true); - } - } + + SALOMEDS_Study_i * Study_servant = new SALOMEDS_Study_i(aStudyImpl, _orb); + SALOMEDS::Study_var Study = SALOMEDS::Study::_narrow(Study_servant->_this()); + + return Study; } //============================================================================ -/*! Function : _SaveObject - * Purpose : +/*! Function : GetDocumentOfStudy + * Purpose : */ //============================================================================ -void SALOMEDS_StudyManager_i::_SaveObject(SALOMEDS_Study_i* theStudy, - SALOMEDS::SObject_ptr theSObject, - HDFgroup *hdf_group_datatype) +Handle(TDocStd_Document) SALOMEDS_StudyManager_i::GetDocumentOfStudy(SALOMEDS::Study_ptr theStudy) { - // Write in group hdf_group_datatype all informations of SObject SC - // Iterative function to parse all SObjects under a SComponent - SALOMEDS::SObject_var RefSO; - HDFgroup *hdf_group_sobject = 0; - - SALOMEDS_ChildIterator_i aChildIter = theStudy->GetChildIterator(theSObject); - for(; aChildIter.More(); aChildIter.Next()){ - SALOMEDS::SObject_var aSObject = aChildIter.Value(); - SALOMEDS::ListOfAttributes_var anAllAttributes = aSObject->GetAllAttributes(); - - // mpv: don't save empty labels - if(anAllAttributes->length() == 0 && !aSObject->ReferencedObject(RefSO)){ - SALOMEDS_ChildIterator_i aSubChildIter = theStudy->GetChildIterator(theSObject); - if(!aSubChildIter.More()) - continue; - - aSubChildIter.InitEx(true); - bool anEmpty = true; - for(; aSubChildIter.More() && anEmpty; aSubChildIter.Next()){ - SALOMEDS::SObject_var aSObj = aSubChildIter.Value(); - SALOMEDS::ListOfAttributes_var anAllAttr = aSObj->GetAllAttributes(); - if(anAllAttr->length() != 0 || aSObj->ReferencedObject(RefSO)) - anEmpty = false; - } - if(anEmpty) - continue; - } + SALOMEDS::Locker lock; - CORBA::String_var scoid(aSObject->GetID()); - hdf_group_sobject = new HDFgroup(scoid,hdf_group_datatype); - hdf_group_sobject->CreateOnDisk(); - SaveAttributes(aSObject, hdf_group_sobject); - _SaveObject(theStudy,aSObject, hdf_group_sobject); - hdf_group_sobject->CloseOnDisk(); - hdf_group_sobject =0; // will be deleted by father hdf object destructor - } + Handle(SALOMEDSImpl_Study) aStudyImpl = _impl->GetStudyByID(theStudy->StudyId()); + Handle(TDocStd_Document) aDocument = _impl->GetDocumentOfStudy(aStudyImpl); + return aDocument; } -//============================================================================ -/*! Function : _SubstituteSlash - * Purpose : - */ -//============================================================================ - -std::string SALOMEDS_StudyManager_i::_SubstituteSlash(const char *theUrl) -{ - ASSERT(1==0); - TCollection_ExtendedString aUrl(const_cast(theUrl)); - aUrl.ChangeAll(ToExtCharacter('/'),ToExtCharacter(':')); - TCollection_AsciiString ch(aUrl); - return ch.ToCString(); -} //============================================================================ /*! Function : CanCopy * Purpose : */ //============================================================================ -CORBA::Boolean SALOMEDS_StudyManager_i::CanCopy(SALOMEDS::SObject_ptr theObject) { - SALOMEDS::SComponent_var aComponent = theObject->GetFatherComponent(); - - if(aComponent->_is_nil()) - return false; - - if(aComponent == theObject) - return false; - - CORBA::String_var IOREngine; - if(!aComponent->ComponentIOR(IOREngine)) - return false; - - CORBA::Object_var obj = _orb->string_to_object(IOREngine); - SALOMEDS::Driver_var Engine = SALOMEDS::Driver::_narrow(obj) ; - if (CORBA::is_nil(Engine)) - return false; +CORBA::Boolean SALOMEDS_StudyManager_i::CanCopy(SALOMEDS::SObject_ptr theObject) +{ + SALOMEDS::Locker lock; - return Engine->CanCopy(theObject); -} + SALOMEDS::Study_var aStudy = theObject->GetStudy(); + Handle(SALOMEDSImpl_Study) aStudyImpl = _impl->GetStudyByID(aStudy->StudyId()); + Handle(SALOMEDSImpl_SObject) anObject = aStudyImpl->GetSObject((char*)theObject->GetID()); -//============================================================================ -/*! Function : CopyLabel - * Purpose : - */ -//============================================================================ -void SALOMEDS_StudyManager_i::CopyLabel(SALOMEDS_Study_i* theSourceStudy, - const SALOMEDS::Driver_ptr theEngine, - const Standard_Integer theSourceStartDepth, - const TDF_Label& theSource, - const TDF_Label& theDestinationMain) -{ - int a; - TDF_Label aTargetLabel = theDestinationMain; - TDF_Label aAuxTargetLabel = theDestinationMain.Father().FindChild(2); - for(a = theSource.Depth() - theSourceStartDepth; a > 0 ; a--) { - TDF_Label aSourceLabel = theSource; - for(int aNbFather = 1; aNbFather < a; aNbFather++) aSourceLabel = aSourceLabel.Father(); - aTargetLabel = aTargetLabel.FindChild(aSourceLabel.Tag()); - aAuxTargetLabel = aAuxTargetLabel.FindChild(aSourceLabel.Tag()); - } - // iterate attributes - TDF_AttributeIterator anAttrIterator(theSource); - Handle(TDF_RelocationTable) aRT = new TDF_RelocationTable(); - for(; anAttrIterator.More(); anAttrIterator.Next()) { - Handle(TDF_Attribute) anAttr = anAttrIterator.Value(); - if (!Handle(TDataStd_TreeNode)::DownCast(anAttr).IsNull()) continue; // never copy tree node attribute - if (!Handle(SALOMEDS_TargetAttribute)::DownCast(anAttr).IsNull()) continue; // and target attribute - - if (!Handle(TDF_Reference)::DownCast(anAttr).IsNull()) { // reference copied as Comment in auxiliary tree - TDF_Label aReferenced = Handle(TDF_Reference)::DownCast(anAttr)->Get(); - TCollection_AsciiString anEntry; - TDF_Tool::Entry(aReferenced, anEntry); - // store the value of name attribute of referenced label - Handle(TDataStd_Name) aNameAttribute; - if (aReferenced.FindAttribute(TDataStd_Name::GetID(), aNameAttribute)) { - anEntry += " "; - anEntry += aNameAttribute->Get(); - } - TDataStd_Comment::Set(aAuxTargetLabel, TCollection_ExtendedString(anEntry)); - continue; - } - - if (!Handle(SALOMEDS_IORAttribute)::DownCast(anAttr).IsNull()) { // IOR => ID and TMPFile of Engine - TCollection_AsciiString anEntry; - TDF_Tool::Entry(theSource, anEntry); - SALOMEDS::SObject_var aSO = theSourceStudy->FindObjectID(anEntry.ToCString()); - CORBA::Long anObjID; - SALOMEDS::TMPFile_var aStream = theEngine->CopyFrom(aSO, anObjID); - int aLen = aStream->length(); - TCollection_ExtendedString aResStr(""); - for(a = 0; a < aLen; a++) { - aResStr += TCollection_ExtendedString(ToExtCharacter((Standard_Character)aStream[a])); - } - TDataStd_Integer::Set(aAuxTargetLabel, anObjID); - TDataStd_Name::Set(aAuxTargetLabel, aResStr); - continue; - } - Handle(TDF_Attribute) aNewAttribute = anAttr->NewEmpty(); - aTargetLabel.AddAttribute(aNewAttribute); - anAttr->Paste(aNewAttribute, aRT); -// aRT->SetRelocation(anAttr, aNewAttribute); - } + return _impl->CanCopy(anObject, GetDriver(anObject, _orb)); } //============================================================================ @@ -1096,201 +342,33 @@ void SALOMEDS_StudyManager_i::CopyLabel(SALOMEDS_Study_i* theSourceStudy, * Purpose : */ //============================================================================ -CORBA::Boolean SALOMEDS_StudyManager_i::Copy(SALOMEDS::SObject_ptr theObject) { - // adoptation for alliances datamodel copy: without IOR attributes !!! - // copy only SObjects and attributes without component help - SALOMEDS::GenericAttribute_var anAttribute; - bool aStructureOnly = !theObject->FindAttribute(anAttribute, "AttributeIOR"); - - PortableServer::ServantBase_var aServant = GetServant(theObject,_poa); - SALOMEDS_SObject_i* aSObject = dynamic_cast(aServant.in()); - if(aSObject == NULL) - return false; - - SALOMEDS_Study_i* aStudy = aSObject->GetStudyServant(); - SALOMEDS::Driver_var anEngine; - CORBA::String_var aString; - if (!aStructureOnly) { - SALOMEDS::SComponent_var aComponent = theObject->GetFatherComponent(); - if(!aComponent->ComponentIOR(aString)) - return false; - - CORBA::Object_var anObj = _orb->string_to_object(aString); - anEngine = SALOMEDS::Driver::_narrow(anObj) ; - } - - // CAF document of current study usage - Handle(TDocStd_Document) aDocument = aStudy->GetDocument(); - if(aDocument.IsNull()) - return false; - - // create new document for clipboard - Handle(TDocStd_Document) aTargetDocument; - _OCAFApp->NewDocument("SALOME_STUDY", aTargetDocument); - // set component data type to the name attribute of root label - if(!aStructureOnly){ - aString = anEngine->ComponentDataType(); - TDataStd_Comment::Set(aTargetDocument->Main().Root(),const_cast(aString.in())); - } - // set to the Root label integer attribute: study id - TDataStd_Integer::Set(aTargetDocument->Main().Root(),aStudy->StudyId()); - - // iterate all theObject's label children - TDF_Label aStartLabel; - aString = theObject->GetID(); - TDF_Tool::Label(aDocument->GetData(),const_cast(aString.in()),aStartLabel); - Standard_Integer aSourceStartDepth = aStartLabel.Depth(); - - // copy main source label - CopyLabel(aStudy,anEngine,aSourceStartDepth,aStartLabel,aTargetDocument->Main()); - - // copy all subchildren of the main source label (all levels) - TDF_ChildIterator anIterator(aStartLabel,Standard_True); - for(; anIterator.More(); anIterator.Next()){ - CopyLabel(aStudy,anEngine,aSourceStartDepth,anIterator.Value(),aTargetDocument->Main()); - } - - // done: free old clipboard document and - if (!_clipboard.IsNull()) { -// Handle(TDocStd_Owner) anOwner; -// if (_clipboard->Main().Root().FindAttribute(TDocStd_Owner::GetID(), anOwner)) { -// Handle(TDocStd_Document) anEmptyDoc; -// anOwner->SetDocument(anEmptyDoc); -// } - _OCAFApp->Close(_clipboard); - } +CORBA::Boolean SALOMEDS_StudyManager_i::Copy(SALOMEDS::SObject_ptr theObject) +{ + SALOMEDS::Locker lock; - _clipboard = aTargetDocument; + SALOMEDS::Study_var aStudy = theObject->GetStudy(); + Handle(SALOMEDSImpl_Study) aStudyImpl = _impl->GetStudyByID(aStudy->StudyId()); + Handle(SALOMEDSImpl_SObject) anObject = aStudyImpl->GetSObject((char*)theObject->GetID()); - return true; + return _impl->Copy(anObject, GetDriver(anObject, _orb)); } -//============================================================================ -/*! Function : CanPaste - * Purpose : - */ -//============================================================================ -CORBA::Boolean SALOMEDS_StudyManager_i::CanPaste(SALOMEDS::SObject_ptr theObject) { - if (_clipboard.IsNull()) return false; - - Handle(TDataStd_Comment) aCompName; - if (!_clipboard->Main().Root().FindAttribute(TDataStd_Comment::GetID(), aCompName)) return false; - Handle(TDataStd_Integer) anObjID; - if (!_clipboard->Main().Father().FindChild(2).FindAttribute(TDataStd_Integer::GetID(), anObjID)) - return false; - - SALOMEDS::SComponent_var aComponent = theObject->GetFatherComponent(); - if(aComponent->_is_nil()) - return false; - - CORBA::String_var IOREngine; - if(!aComponent->ComponentIOR(IOREngine)) - return false; - - CORBA::Object_var obj = _orb->string_to_object(IOREngine); - SALOMEDS::Driver_var Engine = SALOMEDS::Driver::_narrow(obj) ; - if (CORBA::is_nil(Engine)) - return false; - return Engine->CanPaste(TCollection_AsciiString(aCompName->Get()).ToCString(),anObjID->Get()); -} //============================================================================ -/*! Function : PasteLabel +/*! Function : CanPaste * Purpose : */ //============================================================================ -TDF_Label SALOMEDS_StudyManager_i::PasteLabel(SALOMEDS_Study_i* theDestinationStudy, - const SALOMEDS::Driver_ptr theEngine, - const TDF_Label& theSource, - const TDF_Label& theDestinationStart, - const int theCopiedStudyID, - const bool isFirstElement) +CORBA::Boolean SALOMEDS_StudyManager_i::CanPaste(SALOMEDS::SObject_ptr theObject) { + SALOMEDS::Locker lock; - // get corresponding source, target and auxiliary labels - TDF_Label aTargetLabel = theDestinationStart; - TDF_Label aAuxSourceLabel = theSource.Root().FindChild(2); - int a; - if (!isFirstElement) { - for(a = theSource.Depth() - 1; a > 0 ; a--) { - TDF_Label aSourceLabel = theSource; - for(int aNbFather = 1; aNbFather < a; aNbFather++) - aSourceLabel = aSourceLabel.Father(); - aTargetLabel = aTargetLabel.FindChild(aSourceLabel.Tag()); - aAuxSourceLabel = aAuxSourceLabel.FindChild(aSourceLabel.Tag()); - } - } - - // check auxiliary label for TMPFile => IOR - Handle(TDataStd_Name) aNameAttribute; - if (aAuxSourceLabel.FindAttribute(TDataStd_Name::GetID(), aNameAttribute)) { - Handle(TDataStd_Integer) anObjID; - - aAuxSourceLabel.FindAttribute(TDataStd_Integer::GetID(), anObjID); - Handle(TDataStd_Comment) aComponentName; - theSource.Root().FindAttribute(TDataStd_Comment::GetID(), aComponentName); - std::string aCompName = TCollection_AsciiString(aComponentName->Get()).ToCString(); - if (theEngine->CanPaste(aCompName.c_str(),anObjID->Get())) { - SALOMEDS::TMPFile_var aTMPFil = new SALOMEDS::TMPFile(); - TCollection_ExtendedString aTMPStr = aNameAttribute->Get(); - int aLen = aTMPStr.Length(); - aTMPFil->length(aLen); - for(a = 0; a < aLen; a++) { - aTMPFil[a] = ToCharacter(aTMPStr.Value(a+1)); - } - TCollection_AsciiString anEntry; - TDF_Tool::Entry(aTargetLabel, anEntry); - SALOMEDS::SObject_var aPastedSO = theDestinationStudy->FindObjectID(anEntry.ToCString()); - if(isFirstElement){ - SALOMEDS::SObject_var aDestSO = - theEngine->PasteInto(aTMPFil.in(), - anObjID->Get(), - aPastedSO->GetFatherComponent()); - TDF_Tool::Label(theDestinationStart.Data(), aDestSO->GetID(), aTargetLabel); - }else - theEngine->PasteInto(aTMPFil.in(),anObjID->Get(),aPastedSO); - } - } - - // iterate attributes - TDF_AttributeIterator anAttrIterator(theSource); - Handle(TDF_RelocationTable) aRT = new TDF_RelocationTable(); - for(; anAttrIterator.More(); anAttrIterator.Next()) { - Handle(TDF_Attribute) anAttr = anAttrIterator.Value(); - if (aTargetLabel.FindAttribute(anAttr->ID(), anAttr)) { - aTargetLabel.ForgetAttribute(anAttr->ID()); - anAttr = anAttrIterator.Value(); - } - Handle(TDF_Attribute) aNewAttribute = anAttr->NewEmpty(); - aTargetLabel.AddAttribute(aNewAttribute); - anAttr->Paste(aNewAttribute, aRT); -// aRT->SetRelocation(anAttr, aNewAttribute); - } - // check auxiliary label for Comment => reference or name attribute of the referenced object - Handle(TDataStd_Comment) aCommentAttribute; - if (aAuxSourceLabel.FindAttribute(TDataStd_Comment::GetID(), aCommentAttribute)) { - std::string anEntry(TCollection_AsciiString(aCommentAttribute->Get()).ToCString()); - std::size_t aNameStart = anEntry.find(' '); - std::string aName; - if(aNameStart != std::string::npos){ - aName = anEntry.substr(aNameStart+1); - anEntry = anEntry.substr(0,aNameStart); - } - if (theCopiedStudyID == theDestinationStudy->StudyId()) { // if copy to the same study, reanimate reference - TDF_Label aRefLabel; - TDF_Tool::Label(aTargetLabel.Data(),&anEntry[0],aRefLabel); - TDF_Reference::Set(aTargetLabel, aRefLabel); - SALOMEDS_TargetAttribute::Set(aRefLabel)->Append(aTargetLabel); // target attributes structure support - } else { - if(aNameStart != std::string::npos) - TDataStd_Name::Set(aTargetLabel, &aName[0]); - else - TDataStd_Name::Set(aTargetLabel, - TCollection_ExtendedString("Reference to:") + &anEntry[0]); - } - } + SALOMEDS::Study_var aStudy = theObject->GetStudy(); + Handle(SALOMEDSImpl_Study) aStudyImpl = _impl->GetStudyByID(aStudy->StudyId()); + Handle(SALOMEDSImpl_SObject) anObject = aStudyImpl->GetSObject((char*)theObject->GetID()); - return aTargetLabel; + return _impl->CanPaste(anObject, GetDriver(anObject, _orb)); } + //============================================================================ /*! Function : Paste * Purpose : @@ -1299,56 +377,76 @@ TDF_Label SALOMEDS_StudyManager_i::PasteLabel(SALOMEDS_Study_i* theDestinationSt SALOMEDS::SObject_ptr SALOMEDS_StudyManager_i::Paste(SALOMEDS::SObject_ptr theObject) throw(SALOMEDS::StudyBuilder::LockProtection) { + SALOMEDS::Locker lock; + Unexpect aCatch(LockProtection); + SALOMEDS::Study_var aStudy = theObject->GetStudy(); + + Handle(SALOMEDSImpl_Study) aStudyImpl = _impl->GetStudyByID(aStudy->StudyId()); + Handle(SALOMEDSImpl_SObject) anObject = aStudyImpl->GetSObject((char*)theObject->GetID()); + Handle(SALOMEDSImpl_SObject) aNewSO; + + try { + aNewSO = _impl->Paste(anObject, GetDriver(anObject, _orb)); + } + catch (...) { + throw SALOMEDS::StudyBuilder::LockProtection(); + } - PortableServer::ServantBase_var aServant = GetServant(theObject,_poa); - SALOMEDS_SObject_i* aSObject = dynamic_cast(aServant.in()); - if(aSObject == NULL) - return false; + SALOMEDS_SObject_i * so_servant = new SALOMEDS_SObject_i (aNewSO, _orb); + SALOMEDS::SObject_var so = SALOMEDS::SObject::_narrow(so_servant->_this()); + return so._retn(); +} - SALOMEDS_Study_i* aStudy = aSObject->GetStudyServant(); - // if study is locked, then paste can't be done - if (aStudy->GetProperties()->IsLocked()) - throw SALOMEDS::StudyBuilder::LockProtection(); +SALOMEDS_Driver_i* GetDriver(const Handle(SALOMEDSImpl_SObject)& theObject, CORBA::ORB_ptr orb) +{ + SALOMEDS::Locker lock; - // if there is no component name, then paste only SObjects and attributes: without component help - Handle(TDataStd_Comment) aComponentName; - bool aStructureOnly = !_clipboard->Main().Root().FindAttribute(TDataStd_Comment::GetID(), aComponentName); - - // get copied study ID - Handle(TDataStd_Integer) aStudyIDAttribute; - if (!_clipboard->Main().Root().FindAttribute(TDataStd_Integer::GetID(), aStudyIDAttribute)) - return SALOMEDS::SObject::_nil(); - - // get component-engine - SALOMEDS::SComponent_var aComponent; - SALOMEDS::Driver_var anEngine; - CORBA::String_var aString; - if (!aStructureOnly) { - aComponent = theObject->GetFatherComponent(); - if(!aComponent->ComponentIOR(aString)) - return SALOMEDS::SObject::_nil(); - - CORBA::Object_var anObj = _orb->string_to_object(aString); - anEngine = SALOMEDS::Driver::_narrow(anObj) ; - } + SALOMEDS_Driver_i* driver = NULL; + + Handle(SALOMEDSImpl_SComponent) aSCO = theObject->GetFatherComponent(); + if(!aSCO.IsNull()) { + TCollection_AsciiString IOREngine = aSCO->GetIOR(); + if(!IOREngine.IsEmpty()) { + CORBA::Object_var obj = orb->string_to_object(IOREngine.ToCString()); + SALOMEDS::Driver_var Engine = SALOMEDS::Driver::_narrow(obj) ; + driver = new SALOMEDS_Driver_i(Engine, orb); + } + } - // CAF document of current study usage - Handle(TDocStd_Document) aDocument = aStudy->GetDocument(); - if (aDocument.IsNull()) - return SALOMEDS::SObject::_nil(); + return driver; +} - // fill root inserted SObject - int aCStudyID = aStudyIDAttribute->Get(); - TDF_Label aLabel = aStructureOnly? aSObject->GetLabel(): aSObject->GetFatherComponentLabel(); - TDF_Label aStartLabel = PasteLabel(aStudy,anEngine,_clipboard->Main(),aLabel,aCStudyID,true); +//=========================================================================== +namespace SALOMEDS +{ +/* + CORBA::Object_var + GetObject(const TDF_Label& theLabel, CORBA::ORB_ptr theORB) + { + try { + Handle(SALOMEDS_IORAttribute) anAttr; + if(theLabel.FindAttribute(SALOMEDS_IORAttribute::GetID(),anAttr)) + return theORB->string_to_object(TCollection_AsciiString(anAttr->Get()).ToCString()); + }catch(...){ + } + return CORBA::Object::_nil(); + } +*/ - // paste all sublebels - TDF_ChildIterator anIterator(_clipboard->Main(),Standard_True); - for(; anIterator.More(); anIterator.Next()) { - PasteLabel(aStudy,anEngine,anIterator.Value(),aStartLabel,aCStudyID,false); + PortableServer::ServantBase_var + GetServant(CORBA::Object_ptr theObject, PortableServer::POA_ptr thePOA) + { + if(CORBA::is_nil(theObject)) + return NULL; + try{ + return thePOA->reference_to_servant(theObject); + }catch(...){ + return NULL; + } } - return SALOMEDS_SObject_i::NewRef(aStudy,aStartLabel)._retn(); } + +//=========================================================================== diff --git a/src/SALOMEDS/SALOMEDS_StudyManager_i.hxx b/src/SALOMEDS/SALOMEDS_StudyManager_i.hxx index a6e4c9e6c..3d384ffd4 100644 --- a/src/SALOMEDS/SALOMEDS_StudyManager_i.hxx +++ b/src/SALOMEDS/SALOMEDS_StudyManager_i.hxx @@ -1,113 +1,56 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// // File : SALOMEDS_StudyManager_i.hxx -// Author : Yves FRICAUD +// Author : Sergey RUIN // Module : SALOME -// $Header$ #ifndef __SALOMEDS_STUDYMANAGER_I_H__ #define __SALOMEDS_STUDYMANAGER_I_H__ // std C++ headers #include -#include // IDL headers #include #include CORBA_SERVER_HEADER(SALOMEDS) -// Cascade headers -#include -#include -#include -#include -#include -#include - -#include "SALOMEDS_OCAFApplication.hxx" +// Naming Service header #include "SALOME_NamingService.hxx" -// HDF -#include "HDFOI.hxx" +#include +#include -class SALOMEDS_Study_i; +//Standard not implemented +#include +#include "SALOMEDS_Driver_i.hxx" +#include "SALOMEDSImpl_StudyManager.hxx" namespace SALOMEDS{ // To convert IOR from SALOMEDS_IORAttribute to CORBA::Object - CORBA::Object_var - GetObject(const TDF_Label&, CORBA::ORB_ptr); - - // To convert CORBA::Object to PortableServer::ServantBase - PortableServer::ServantBase_var - GetServant(CORBA::Object_ptr, PortableServer::POA_ptr); - -} + /* CORBA::Object_var GetObject(const TDF_Label&, CORBA::ORB_ptr); */ + // To convert CORBA::Object to PortableServer::ServantBase + PortableServer::ServantBase_var GetServant(CORBA::Object_ptr, PortableServer::POA_ptr); -class SALOMEDS_StudyManager_i: - public virtual POA_SALOMEDS::StudyManager, - public virtual PortableServer::RefCountServantBase -{ - SALOMEDS_StudyManager_i(); // Not implemented - void operator=(const SALOMEDS_StudyManager_i&); // Not implemented +} +class SALOMEDS_StudyManager_i: public POA_SALOMEDS::StudyManager, + public PortableServer::RefCountServantBase { private: - CORBA::ORB_var _orb; - PortableServer::POA_var _poa; - SALOME_NamingService _name_service; - Handle (SALOMEDS_OCAFApplication) _OCAFApp; - Handle(TDocStd_Document) _clipboard; - int _IDcounter; - - // _SaveAs private function called by Save and SaveAs - virtual void _SaveAs(const char* aUrl, - SALOMEDS::Study_ptr aStudy, - CORBA::Boolean theMultiFile, - CORBA::Boolean theASCII); - // _SaveObject private function called by _SaveAs - void _SaveObject(SALOMEDS_Study_i* theStudy, - SALOMEDS::SObject_ptr SC, - HDFgroup *hdf_group_datatype); - // _SubstituteSlash function called by Open and GetStudyByName - virtual std::string _SubstituteSlash(const char *aUrl); - - void _SaveProperties(SALOMEDS_Study_i* theStudy, HDFgroup *hdf_group); + + CORBA::ORB_ptr _orb; + PortableServer::POA_var _poa; + Handle(SALOMEDSImpl_StudyManager) _impl; + SALOME_NamingService* _name_service; + SALOMEDS_DriverFactory_i* _factory; public: + //! standard constructor - SALOMEDS_StudyManager_i(CORBA::ORB_ptr theORB, PortableServer::POA_ptr thePOA); + SALOMEDS_StudyManager_i(CORBA::ORB_ptr orb, PortableServer::POA_ptr thePOA); //! standard destructor virtual ~SALOMEDS_StudyManager_i(); - CORBA::ORB_var GetORB() const { return _orb; } - - PortableServer::POA_var GetPOA() const { return _poa; } - - SALOMEDS_Study_i* DownCast(SALOMEDS::Study_ptr theStudy) const; - //! method to Register study Manager in the naming service /*! \param char* arguments, the context to register the study manager in the NS @@ -171,13 +114,16 @@ public: */ virtual SALOMEDS::Study_ptr GetStudyByID(CORBA::Short aStudyID) ; - void CopyLabel(SALOMEDS_Study_i* theSourceStudy, + + Handle(TDocStd_Document) GetDocumentOfStudy(SALOMEDS::Study_ptr theStudy); + + void CopyLabel(const SALOMEDS::Study_ptr theSourceStudy, const SALOMEDS::Driver_ptr theEngine, const Standard_Integer theSourceStartDepth, const TDF_Label& theSource, const TDF_Label& theDestinationMain); - TDF_Label PasteLabel(SALOMEDS_Study_i* theDestinationStudy, + TDF_Label PasteLabel(const SALOMEDS::Study_ptr theDestinationStudy, const SALOMEDS::Driver_ptr theEngine, const TDF_Label& theSource, const TDF_Label& theDestinationStart, diff --git a/src/SALOMEDS/SALOMEDS_StudyPropertiesAttribute.cdl b/src/SALOMEDS/SALOMEDS_StudyPropertiesAttribute.cdl deleted file mode 100644 index 2e07a07ec..000000000 --- a/src/SALOMEDS/SALOMEDS_StudyPropertiesAttribute.cdl +++ /dev/null @@ -1,93 +0,0 @@ --- SALOME SALOMEDS : data structure of SALOME and sources of Salome data server --- --- Copyright (C) 2003 CEA/DEN, EDF R&D --- --- --- --- File : SALOMEDS_StudyPropertiesAttribute.cdl --- Author : Yves FRICAUD --- Module : SALOME - -class StudyPropertiesAttribute from SALOMEDS inherits Attribute from TDF - - ---Purpose: - - -uses Attribute from TDF, - Label from TDF, - GUID from Standard, - DataSet from TDF, - RelocationTable from TDF, - Data from TDF, - ExtendedString from TCollection, - HSequenceOfExtendedString from TColStd, - HSequenceOfInteger from TColStd - -is - - - ---Purpose: class methods - -- ============= - - GetID (myclass) - ---C++: return const & - returns GUID from Standard; - - Set (myclass; label : Label from TDF) - returns StudyPropertiesAttribute from SALOMEDS; - - ---Purpose: Common methods - -- ============ - - Create - returns mutable StudyPropertiesAttribute from SALOMEDS; - - Init(me: mutable); - - SetUserName(me: mutable; theName : ExtendedString from TCollection); - GetCreatorName(me) returns ExtendedString from TCollection; - GetUserNames(me) returns HSequenceOfExtendedString from TColStd; - SetFirstName(me: mutable; theName : ExtendedString from TCollection); - - SetModificationDate(me: mutable; theMinute, theHour, theDay, theMonth, theYear : Integer from Standard); - GetCreationDate(me; theMinute, theHour, theDay, theMonth, theYear : out Integer from Standard) - returns Boolean from Standard; - GetModificationDates(me; theMinutes, theHours, theDays, theMonths, theYears : out HSequenceOfInteger from TColStd); - - SetCreationMode(me: mutable; theMode : Integer from Standard); - GetCreationMode(me) returns Integer from Standard; - - SetModified(me: mutable; theModified : Integer from Standard); - IsModified(me) returns Boolean from Standard; - GetModified(me) returns Integer from Standard; - - SetLocked(me: mutable; theLocked : Boolean from Standard); - IsLocked(me) returns Boolean from Standard; - IsLockChanged(me: mutable; theErase : Boolean from Standard) returns Boolean from Standard; - - ID (me) - ---C++: return const & - returns GUID from Standard; - - Restore (me: mutable; with : Attribute from TDF); - - NewEmpty (me) - returns mutable Attribute from TDF; - - Paste (me; into : mutable Attribute from TDF; - RT : mutable RelocationTable from TDF); - -fields - - myUserName : HSequenceOfExtendedString from TColStd; - myMinute : HSequenceOfInteger from TColStd; - myHour : HSequenceOfInteger from TColStd; - myDay : HSequenceOfInteger from TColStd; - myMonth : HSequenceOfInteger from TColStd; - myYear : HSequenceOfInteger from TColStd; - myMode : Integer from Standard; - myModified : Integer from Standard; - myLocked : Boolean from Standard; - myLockChanged : Boolean from Standard; - -end StudyPropertiesAttribute; diff --git a/src/SALOMEDS/SALOMEDS_StudyPropertiesAttribute.cxx b/src/SALOMEDS/SALOMEDS_StudyPropertiesAttribute.cxx deleted file mode 100644 index 62835949d..000000000 --- a/src/SALOMEDS/SALOMEDS_StudyPropertiesAttribute.cxx +++ /dev/null @@ -1,217 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// -// -// File : SALOMEDS_StudyPropertiesAttribute.cxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include -using namespace std; - -const Standard_GUID& SALOMEDS_StudyPropertiesAttribute::GetID() -{ - static Standard_GUID SALOMEDS_StudyPropertiesAttributeID ("128371A2-8F52-11d6-A8A3-0001021E8C7F"); - return SALOMEDS_StudyPropertiesAttributeID; -} - -Handle(SALOMEDS_StudyPropertiesAttribute) SALOMEDS_StudyPropertiesAttribute::Set(const TDF_Label& label) -{ - Handle(SALOMEDS_StudyPropertiesAttribute) anAttr; - if (!label.FindAttribute(SALOMEDS_StudyPropertiesAttribute::GetID(),anAttr)) { - anAttr = new SALOMEDS_StudyPropertiesAttribute(); - label.AddAttribute(anAttr); - } - return anAttr; -} - -SALOMEDS_StudyPropertiesAttribute::SALOMEDS_StudyPropertiesAttribute() -{ - myLocked = Standard_False; - myLockChanged = Standard_False; - Init(); -} - -void SALOMEDS_StudyPropertiesAttribute::Init() -{ - myUserName = new TColStd_HSequenceOfExtendedString(); - myMinute = new TColStd_HSequenceOfInteger(); - myHour = new TColStd_HSequenceOfInteger(); - myDay = new TColStd_HSequenceOfInteger(); - myMonth = new TColStd_HSequenceOfInteger(); - myYear = new TColStd_HSequenceOfInteger(); -// myModified = 0; - myMode = 0; // none -} - -void SALOMEDS_StudyPropertiesAttribute::SetUserName(const TCollection_ExtendedString& theName) -{ - Backup(); - myUserName->Append(theName); -} - -void SALOMEDS_StudyPropertiesAttribute::SetFirstName(const TCollection_ExtendedString& theName) -{ - Backup(); - if (myUserName->Length() == 0) myUserName->Append(theName); - else myUserName->SetValue(1, theName); -} - -TCollection_ExtendedString SALOMEDS_StudyPropertiesAttribute::GetCreatorName() const -{ - if (myUserName->Length() == 0) return TCollection_ExtendedString(""); - return myUserName->Value(1); -} - -Handle(TColStd_HSequenceOfExtendedString) SALOMEDS_StudyPropertiesAttribute::GetUserNames() const -{ - return myUserName; -} - -void SALOMEDS_StudyPropertiesAttribute::SetModificationDate(const Standard_Integer theMinute, - const Standard_Integer theHour, - const Standard_Integer theDay, - const Standard_Integer theMonth, - const Standard_Integer theYear) -{ - Backup(); - if (theMinute<0 || theMinute>60 || theHour<0 || theHour>24 || theDay<0 || theDay>31 || theMonth<0 || theMonth>12) - return; - myMinute->Append(theMinute); - myHour->Append(theHour); - myDay->Append(theDay); - myMonth->Append(theMonth); - myYear->Append(theYear); -} - -Standard_Boolean SALOMEDS_StudyPropertiesAttribute::GetCreationDate(Standard_Integer& theMinute, - Standard_Integer& theHour, - Standard_Integer& theDay, - Standard_Integer& theMonth, - Standard_Integer& theYear) const -{ - if (myMinute->Length() != 0) { - theMinute = myMinute->Value(1); - theHour = myHour->Value(1); - theDay = myDay->Value(1); - theMonth = myMonth->Value(1); - theYear = myYear->Value(1); - return Standard_True; - } - return Standard_False; -} - -void SALOMEDS_StudyPropertiesAttribute::GetModificationDates(Handle(TColStd_HSequenceOfInteger)& theMinutes, - Handle(TColStd_HSequenceOfInteger)& theHours, - Handle(TColStd_HSequenceOfInteger)& theDays, - Handle(TColStd_HSequenceOfInteger)& theMonths, - Handle(TColStd_HSequenceOfInteger)& theYears) const -{ - theMinutes = myMinute; - theHours = myHour; - theDays = myDay; - theMonths = myMonth; - theYears = myYear; -} - -void SALOMEDS_StudyPropertiesAttribute::SetCreationMode(const Standard_Integer theMode) -{ - Backup(); - myMode = theMode; -} - -Standard_Integer SALOMEDS_StudyPropertiesAttribute::GetCreationMode() const -{ - return myMode; -} - -void SALOMEDS_StudyPropertiesAttribute::SetModified(const Standard_Integer theModified) -{ - myModified = theModified; -} - -Standard_Boolean SALOMEDS_StudyPropertiesAttribute::IsModified() const -{ - return (myModified != 0); -} - -Standard_Integer SALOMEDS_StudyPropertiesAttribute::GetModified() const -{ - return myModified; -} - -void SALOMEDS_StudyPropertiesAttribute::SetLocked(const Standard_Boolean theLocked) -{ -// Backup(); - if (myLocked != theLocked) { - myLockChanged = Standard_True; - myLocked = theLocked; - } -} - -Standard_Boolean SALOMEDS_StudyPropertiesAttribute::IsLocked() const -{ - return myLocked; -} - -Standard_Boolean SALOMEDS_StudyPropertiesAttribute::IsLockChanged(const Standard_Boolean theErase) { - if (!myLockChanged) return Standard_False; - if (theErase) myLockChanged = Standard_False; - return Standard_True; -} - -const Standard_GUID& SALOMEDS_StudyPropertiesAttribute::ID() const -{ - return GetID(); -} - -void SALOMEDS_StudyPropertiesAttribute::Restore(const Handle(TDF_Attribute)& with) -{ - Handle(SALOMEDS_StudyPropertiesAttribute) aProp = Handle(SALOMEDS_StudyPropertiesAttribute)::DownCast(with); - Init(); - Standard_Integer i; - Handle(TColStd_HSequenceOfExtendedString) aNames = aProp->GetUserNames(); - for(i = aNames->Length(); i > 0; i--) { - myUserName->Prepend(aNames->Value(i)); - } - Handle(TColStd_HSequenceOfInteger) aMinutes, aHours, aDays, aMonths, aYears; - aProp->GetModificationDates(aMinutes, aHours, aDays, aMonths, aYears); - for(i = aMinutes->Length(); i > 0; i--) { - myMinute->Prepend(aMinutes->Value(i)); - myHour->Prepend(aHours->Value(i)); - myDay->Prepend(aDays->Value(i)); - myMonth->Prepend(aMonths->Value(i)); - myYear->Prepend(aYears->Value(i)); - } - myMode = aProp->GetCreationMode(); -// myModified = aProp->GetModified(); -// myLocked = aProp->IsLocked(); -} - -Handle(TDF_Attribute) SALOMEDS_StudyPropertiesAttribute::NewEmpty() const -{ - return new SALOMEDS_StudyPropertiesAttribute(); -} - -void SALOMEDS_StudyPropertiesAttribute::Paste(const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)&) const -{ - Handle(SALOMEDS_StudyPropertiesAttribute) aProp = Handle(SALOMEDS_StudyPropertiesAttribute)::DownCast(into); - aProp->Init(); - - Standard_Integer i; - for(i = 1; i <= myUserName->Length(); i++) { - aProp->SetUserName(myUserName->Value(i)); - } - for(i = 1; i <= myMinute->Length(); i++) { - aProp->SetModificationDate(myMinute->Value(i), myHour->Value(i), myDay->Value(i), myMonth->Value(i), myYear->Value(i)); - } - - aProp->SetCreationMode(myMode); -// aProp->SetModified(myModified); -// aProp->SetLocked(myLocked); -} - diff --git a/src/SALOMEDS/SALOMEDS_StudyPropertiesAttribute.hxx b/src/SALOMEDS/SALOMEDS_StudyPropertiesAttribute.hxx deleted file mode 100644 index d9139f730..000000000 --- a/src/SALOMEDS/SALOMEDS_StudyPropertiesAttribute.hxx +++ /dev/null @@ -1,148 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// -// -// File : SALOMEDS_StudyPropertiesAttribute.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _SALOMEDS_StudyPropertiesAttribute_HeaderFile -#define _SALOMEDS_StudyPropertiesAttribute_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_SALOMEDS_StudyPropertiesAttribute_HeaderFile -#include -#endif - -#ifndef _Handle_TColStd_HSequenceOfExtendedString_HeaderFile -#include -#endif -#ifndef _Handle_TColStd_HSequenceOfInteger_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -#ifndef _TDF_Attribute_HeaderFile -#include -#endif -#ifndef _Handle_TDF_Attribute_HeaderFile -#include -#endif -#ifndef _Handle_TDF_RelocationTable_HeaderFile -#include -#endif -class TColStd_HSequenceOfExtendedString; -class TColStd_HSequenceOfInteger; -class Standard_GUID; -class TDF_Label; -class TCollection_ExtendedString; -class TDF_Attribute; -class TDF_RelocationTable; - - -class SALOMEDS_StudyPropertiesAttribute : public TDF_Attribute { - -public: - - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - // Methods PUBLIC - // -Standard_EXPORT static const Standard_GUID& GetID() ; -Standard_EXPORT static Handle_SALOMEDS_StudyPropertiesAttribute Set(const TDF_Label& label) ; -Standard_EXPORT SALOMEDS_StudyPropertiesAttribute(); -Standard_EXPORT void Init() ; -Standard_EXPORT void SetUserName(const TCollection_ExtendedString& theName) ; -Standard_EXPORT void SetFirstName(const TCollection_ExtendedString& theName) ; -Standard_EXPORT TCollection_ExtendedString GetCreatorName() const; -Standard_EXPORT Handle_TColStd_HSequenceOfExtendedString GetUserNames() const; -Standard_EXPORT void SetModificationDate(const Standard_Integer theMinute,const Standard_Integer theHour,const Standard_Integer theDay,const Standard_Integer theMonth,const Standard_Integer theYear) ; -Standard_EXPORT Standard_Boolean GetCreationDate(Standard_Integer& theMinute,Standard_Integer& theHour,Standard_Integer& theDay,Standard_Integer& theMonth,Standard_Integer& theYear) const; -Standard_EXPORT void GetModificationDates(Handle(TColStd_HSequenceOfInteger)& theMinutes,Handle(TColStd_HSequenceOfInteger)& theHours,Handle(TColStd_HSequenceOfInteger)& theDays,Handle(TColStd_HSequenceOfInteger)& theMonths,Handle(TColStd_HSequenceOfInteger)& theYears) const; -Standard_EXPORT void SetCreationMode(const Standard_Integer theMode) ; -Standard_EXPORT Standard_Integer GetCreationMode() const; -Standard_EXPORT void SetModified(const Standard_Integer theModified) ; -Standard_EXPORT Standard_Boolean IsModified() const; -Standard_EXPORT Standard_Integer GetModified() const; -Standard_EXPORT void SetLocked(const Standard_Boolean theLocked) ; -Standard_EXPORT Standard_Boolean IsLocked() const; -Standard_EXPORT Standard_Boolean IsLockChanged(const Standard_Boolean theErase) ; -Standard_EXPORT const Standard_GUID& ID() const; -Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ; -Standard_EXPORT Handle_TDF_Attribute NewEmpty() const; -Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const; -Standard_EXPORT ~SALOMEDS_StudyPropertiesAttribute(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_StudyPropertiesAttribute_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // -Handle_TColStd_HSequenceOfExtendedString myUserName; -Handle_TColStd_HSequenceOfInteger myMinute; -Handle_TColStd_HSequenceOfInteger myHour; -Handle_TColStd_HSequenceOfInteger myDay; -Handle_TColStd_HSequenceOfInteger myMonth; -Handle_TColStd_HSequenceOfInteger myYear; -Standard_Integer myMode; -Standard_Integer myModified; -Standard_Boolean myLocked; -Standard_Boolean myLockChanged; - - -}; - - - - - -// other inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/SALOMEDS/SALOMEDS_StudyPropertiesAttribute.ixx b/src/SALOMEDS/SALOMEDS_StudyPropertiesAttribute.ixx deleted file mode 100644 index 6dedfff9f..000000000 --- a/src/SALOMEDS/SALOMEDS_StudyPropertiesAttribute.ixx +++ /dev/null @@ -1,68 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// -// -// File : SALOMEDS_StudyPropertiesAttribute.ixx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -SALOMEDS_StudyPropertiesAttribute::~SALOMEDS_StudyPropertiesAttribute() {} - - - -Standard_EXPORT Handle_Standard_Type& SALOMEDS_StudyPropertiesAttribute_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TDF_Attribute); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDF_Attribute); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_StudyPropertiesAttribute", - sizeof(SALOMEDS_StudyPropertiesAttribute), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(SALOMEDS_StudyPropertiesAttribute) Handle(SALOMEDS_StudyPropertiesAttribute)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(SALOMEDS_StudyPropertiesAttribute) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_StudyPropertiesAttribute))) { - _anOtherObject = Handle(SALOMEDS_StudyPropertiesAttribute)((Handle(SALOMEDS_StudyPropertiesAttribute)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& SALOMEDS_StudyPropertiesAttribute::DynamicType() const -{ - return STANDARD_TYPE(SALOMEDS_StudyPropertiesAttribute) ; -} -Standard_Boolean SALOMEDS_StudyPropertiesAttribute::IsKind(const Handle(Standard_Type)& AType) const -{ - return (STANDARD_TYPE(SALOMEDS_StudyPropertiesAttribute) == AType || TDF_Attribute::IsKind(AType)); -} -Handle_SALOMEDS_StudyPropertiesAttribute::~Handle_SALOMEDS_StudyPropertiesAttribute() {} - diff --git a/src/SALOMEDS/SALOMEDS_StudyPropertiesAttribute.jxx b/src/SALOMEDS/SALOMEDS_StudyPropertiesAttribute.jxx deleted file mode 100644 index b1e91888c..000000000 --- a/src/SALOMEDS/SALOMEDS_StudyPropertiesAttribute.jxx +++ /dev/null @@ -1,35 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// -// -// File : SALOMEDS_StudyPropertiesAttribute.jxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _TColStd_HSequenceOfExtendedString_HeaderFile -#include -#endif -#ifndef _TColStd_HSequenceOfInteger_HeaderFile -#include -#endif -#ifndef _Standard_GUID_HeaderFile -#include -#endif -#ifndef _TDF_Label_HeaderFile -#include -#endif -#ifndef _TCollection_ExtendedString_HeaderFile -#include -#endif -#ifndef _TDF_Attribute_HeaderFile -#include -#endif -#ifndef _TDF_RelocationTable_HeaderFile -#include -#endif -#ifndef _SALOMEDS_StudyPropertiesAttribute_HeaderFile -#include -#endif diff --git a/src/SALOMEDS/SALOMEDS_Study_i.cxx b/src/SALOMEDS/SALOMEDS_Study_i.cxx index 1f8e0aa75..4f365ceee 100644 --- a/src/SALOMEDS/SALOMEDS_Study_i.cxx +++ b/src/SALOMEDS/SALOMEDS_Study_i.cxx @@ -1,142 +1,45 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// // File : SALOMEDS_Study_i.cxx -// Author : Yves FRICAUD +// Author : Sergey RUIN // Module : SALOME -// $Header$ - -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include +using namespace std; +#include "utilities.h" #include "SALOMEDS_Study_i.hxx" - -#include "SALOMEDS_StudyManager_i.hxx" -#include "SALOMEDS_Callback_i.hxx" - -#include "SALOMEDS_SComponent_i.hxx" -#include "SALOMEDS_SObject_i.hxx" - -#include "SALOMEDS_StudyBuilder_i.hxx" +#include "SALOMEDS_UseCaseIterator_i.hxx" +#include "SALOMEDS_GenericAttribute_i.hxx" +#include "SALOMEDS_AttributeStudyProperties_i.hxx" #include "SALOMEDS_ChildIterator_i.hxx" +#include "SALOMEDS_Driver_i.hxx" +#include "SALOMEDS.hxx" -#include "SALOMEDS_UseCaseBuilder_i.hxx" -#include "SALOMEDS_SComponentIterator_i.hxx" - -#include "SALOME_GenericObj_i.hh" -#include "SALOMEDS_LocalIDAttribute.hxx" -#include "SALOMEDS_PersRefAttribute.hxx" +#include "SALOMEDSImpl_SObject.hxx" +#include "SALOMEDSImpl_SComponent.hxx" +#include "SALOMEDSImpl_UseCaseBuilder.hxx" +#include "SALOMEDSImpl_AttributeStudyProperties.hxx" -#include "SALOMEDS_StudyPropertiesAttribute.hxx" -#include "SALOMEDS_DataMapIteratorOfDataMapStringLabel.hxx" -#include "utilities.h" +#include +#include +#include +#include +#include -#define DIRECTORYID 16661 -#define FILEID "FILE: " -#define FILELOCALID 26662 +#include +#include -using namespace std; -bool operator<(const TDF_Label& theLeft, const TDF_Label& theRight) -{ - TColStd_ListOfInteger aTagLeftList; - TDF_Tool::TagList(theLeft,aTagLeftList); - TColStd_ListIteratorOfListOfInteger anLeftIter(aTagLeftList); - - TColStd_ListOfInteger aTagRightList; - TDF_Tool::TagList(theRight,aTagRightList); - TColStd_ListIteratorOfListOfInteger anRightIter(aTagRightList); - - for(;;){ - Standard_Boolean aLeftMore = anLeftIter.More(); - Standard_Boolean aRightMore = anRightIter.More(); - - if(!aLeftMore && !aRightMore) - return Standard_False; - - if(!aLeftMore) - return Standard_True; - - if(!aRightMore) - return Standard_False; - - Standard_Integer aLeftTag = anLeftIter.Value(); - anLeftIter.Next(); - - Standard_Integer aRightTag = anRightIter.Value(); - anRightIter.Next(); - - if(aLeftTag == aRightTag) - continue; - - return aLeftTag < aRightTag; - } - - return Standard_False; -} - - //============================================================================ /*! Function : SALOMEDS_Study_i * Purpose : SALOMEDS_Study_i constructor */ //============================================================================ -SALOMEDS_Study_i::SALOMEDS_Study_i(SALOMEDS_StudyManager_i* theStudyManager, - const Handle(TDocStd_Document)& theDoc, - const char* theStudyName): - _StudyManager(theStudyManager), - _doc(theDoc), - _isSaved(false), - _URL(NULL), - _StudyId(-1), - _autoFill(true), - myNbUndos(0) +SALOMEDS_Study_i::SALOMEDS_Study_i(const Handle(SALOMEDSImpl_Study) theImpl, + CORBA::ORB_ptr orb) { - _UseCaseBuilder = new SALOMEDS_UseCaseBuilder_i(this,_doc); - SALOMEDS::UseCaseBuilder_var aUseCaseBuilder = _UseCaseBuilder->_this(); - - _Builder = new SALOMEDS_StudyBuilder_i(this,_doc); - SALOMEDS::StudyBuilder_var aStudyBuilder = _Builder->_this(); - - SALOMEDS_Callback_i* aCallBackServant = new SALOMEDS_Callback_i(aUseCaseBuilder); - _callbackOnAdd = aCallBackServant->_this(); - _callbackOnRemove = _callbackOnAdd; - - _name = new char[strlen(theStudyName) +1]; - strcpy(_name,theStudyName); - myNbPostponed.Append(0); + _orb = CORBA::ORB::_duplicate(orb); + _impl = theImpl; + _UseCaseBuilder = new SALOMEDS_UseCaseBuilder_i(_impl->GetUseCaseBuilder(), _orb); + _Builder = new SALOMEDS_StudyBuilder_i(_impl->NewBuilder(), _orb); } //============================================================================ @@ -146,100 +49,8 @@ SALOMEDS_Study_i::SALOMEDS_Study_i(SALOMEDS_StudyManager_i* theStudyManager, //============================================================================ SALOMEDS_Study_i::~SALOMEDS_Study_i() { - delete [] _name ; - delete [] _URL ; } -//============================================================================ -CORBA::ORB_var SALOMEDS_Study_i::GetORB() const -{ - return _StudyManager->GetORB(); -} - -//============================================================================ -PortableServer::POA_var SALOMEDS_Study_i::GetPOA() const -{ - return _StudyManager->GetPOA(); -} - - -SALOMEDS_SObject_i* -SALOMEDS_Study_i::DownCast(SALOMEDS::SObject_ptr theSObject) const -{ - if(!CORBA::is_nil(theSObject)){ - PortableServer::POA_var aPOA = GetPOA(); - PortableServer::ServantBase_var aServant = SALOMEDS::GetServant(theSObject,aPOA); - if(aServant.in()) - return dynamic_cast(aServant.in()); - } - return NULL; -} - -//============================================================================ -/*! Function : SetOnAddSObject - * Purpose : - */ -//============================================================================ -SALOMEDS::Callback_ptr SALOMEDS_Study_i::SetOnAddSObject(SALOMEDS::Callback_ptr theCallback) -{ - SALOMEDS::Callback_var aRet = _callbackOnAdd; - _callbackOnAdd = SALOMEDS::Callback::_duplicate(theCallback); - return aRet._retn(); -} - -//============================================================================ -/*! Function : SetOnNewSObject - * Purpose : - */ -//============================================================================ -SALOMEDS::Callback_ptr SALOMEDS_Study_i::SetOnRemoveSObject(SALOMEDS::Callback_ptr theCallback) -{ - SALOMEDS::Callback_var aRet = _callbackOnRemove; - _callbackOnAdd = SALOMEDS::Callback::_duplicate(theCallback); - return aRet._retn(); -} - -//============================================================================ -void SALOMEDS_Study_i::OnAddSObject(SALOMEDS::SObject_ptr theObject) -{ - if(!CORBA::is_nil(_callbackOnAdd.in())) - _callbackOnAdd->OnAddSObject(theObject); -} - -//============================================================================ -void SALOMEDS_Study_i::OnRemoveSObject(SALOMEDS::SObject_ptr theObject) -{ - if(!CORBA::is_nil(_callbackOnRemove.in())) - _callbackOnRemove->OnRemoveSObject(theObject); -} - -//============================================================================ -void SALOMEDS_Study_i::CheckLocked() -{ - if(_doc->HasOpenCommand()) - return; - - Handle(SALOMEDS_StudyPropertiesAttribute) anAttr; - if(_doc->Main().FindAttribute(SALOMEDS_StudyPropertiesAttribute::GetID(),anAttr)) - if(anAttr->IsLocked()) - throw SALOMEDS::StudyBuilder::LockProtection(); -} - - -//============================================================================ -char* SALOMEDS_Study_i::ConvertObjectToIOR(CORBA::Object_ptr theObject) -{ - return GetORB()->object_to_string(theObject); -} - - -//============================================================================ -CORBA::Object_ptr SALOMEDS_Study_i::ConvertIORToObject(const char* theIOR) -{ - return GetORB()->string_to_object(theIOR); -} - - //============================================================================ /*! Function : GetPersistentReference * Purpose : Get persistent reference of study (idem URL()) @@ -247,7 +58,8 @@ CORBA::Object_ptr SALOMEDS_Study_i::ConvertIORToObject(const char* theIOR) //============================================================================ char* SALOMEDS_Study_i::GetPersistentReference() { - return URL(); + SALOMEDS::Locker lock; + return CORBA::string_dup(_impl->GetPersistentReference().ToCString()); } //============================================================================ /*! Function : GetTransientReference @@ -256,18 +68,8 @@ char* SALOMEDS_Study_i::GetPersistentReference() //============================================================================ char* SALOMEDS_Study_i::GetTransientReference() { - CORBA::String_var IOR; - - Handle(SALOMEDS_IORAttribute) Att; - TDF_Label _lab = _doc->GetData()->Root(); - if (!_lab.FindAttribute(SALOMEDS_IORAttribute::GetID(),Att)){ - - TCollection_AsciiString ch(Att->Get()); - IOR = CORBA::string_dup(ch.ToCString()); - } - else IOR = CORBA::string_dup(""); // NULL ? - - return CORBA::string_dup(IOR); + SALOMEDS::Locker lock; + return CORBA::string_dup(_impl->GetTransientReference().ToCString()); } //============================================================================ @@ -277,8 +79,8 @@ char* SALOMEDS_Study_i::GetTransientReference() //============================================================================ CORBA::Boolean SALOMEDS_Study_i::IsEmpty() { - if (_doc.IsNull()) return true; - return _doc->IsEmpty(); + SALOMEDS::Locker lock; + return _impl->IsEmpty(); } //============================================================================ @@ -286,21 +88,16 @@ CORBA::Boolean SALOMEDS_Study_i::IsEmpty() * Purpose : Find a Component with ComponentDataType = aComponentName */ //============================================================================ -SALOMEDS::SComponent_ptr -SALOMEDS_Study_i::FindComponent(const char* theComponentName) +SALOMEDS::SComponent_ptr SALOMEDS_Study_i::FindComponent (const char* aComponentName) { - bool anIsFound = false; - SALOMEDS::SComponent_var aSComponent; - SALOMEDS_SComponentIterator_i aComponentIter(this,_doc); - for(; aComponentIter.More() && !anIsFound; aComponentIter.Next()){ - SALOMEDS::SComponent_var aSComp = aComponentIter.Value(); - CORBA::String_var aName = aSComp->ComponentDataType(); - if(strcmp(theComponentName,aName.in()) == 0){ - aSComponent = aSComp; - anIsFound = true; - } - } - return aSComponent._retn(); + SALOMEDS::Locker lock; + + Handle(SALOMEDSImpl_SComponent) aCompImpl = _impl->FindComponent(TCollection_AsciiString((char*)aComponentName)); + if(aCompImpl.IsNull()) return SALOMEDS::SComponent::_nil(); + + SALOMEDS_SComponent_i * so_servant = new SALOMEDS_SComponent_i (aCompImpl, _orb); + SALOMEDS::SComponent_var compo = SALOMEDS::SComponent::_narrow(so_servant->SComponent::_this()); + return compo._retn(); } //============================================================================ @@ -310,28 +107,14 @@ SALOMEDS_Study_i::FindComponent(const char* theComponentName) //============================================================================ SALOMEDS::SComponent_ptr SALOMEDS_Study_i::FindComponentID(const char* aComponentID) { - // Iterate on each components defined in the study - // Get the component ID and compare with aComponentID - bool _find = false; - char *ID; - SALOMEDS::SComponent_ptr compo; - - SALOMEDS_SComponentIterator_i itcomp(this,_doc); - for (; itcomp.More(); itcomp.Next()) { - SALOMEDS::SComponent_var SC = itcomp.Value(); - ID = SC->GetID(); - if(strcmp(aComponentID,ID)==0) - { - // ComponentID found - _find = true; - compo = SALOMEDS::SComponent::_narrow(SC); - } - } - if(!_find) - { - compo = SALOMEDS::SComponent::_nil(); - } - return compo; + SALOMEDS::Locker lock; + + Handle(SALOMEDSImpl_SComponent) aCompImpl = _impl->FindComponentID(TCollection_AsciiString((char*)aComponentID)); + if(aCompImpl.IsNull()) return SALOMEDS::SComponent::_nil(); + + SALOMEDS_SComponent_i * so_servant = new SALOMEDS_SComponent_i (aCompImpl, _orb); + SALOMEDS::SComponent_var compo = SALOMEDS::SComponent::_narrow(so_servant->SComponent::_this()); + return compo._retn(); } //============================================================================ @@ -339,29 +122,24 @@ SALOMEDS::SComponent_ptr SALOMEDS_Study_i::FindComponentID(const char* aComponen * Purpose : Find an Object with SALOMEDS::Name = anObjectName */ //============================================================================ -SALOMEDS::SObject_ptr SALOMEDS_Study_i::FindObject(const char* theObjectName) +SALOMEDS::SObject_ptr SALOMEDS_Study_i::FindObject(const char* anObjectName) { - // Iterate to all components defined in the study - // After testing the component name, iterate in all objects defined under - // components (function _FindObject) - bool aIsFound = false; - SALOMEDS::SObject_var aRefSO; - SALOMEDS_SComponentIterator_i aComponentIter(this,_doc); - for(; aComponentIter.More() && !aIsFound; aComponentIter.Next()){ - TDF_Label aLab = aComponentIter.GetValue(); - Handle(TDataStd_Name) anAttr; - if(aLab.FindAttribute(TDataStd_Name::GetID(),anAttr)){ - TCollection_AsciiString aString(anAttr->Get()); - if(strcmp(aString.ToCString(),theObjectName) == 0){ - aRefSO = SALOMEDS_SComponent_i::NewRef(this,aLab)._retn(); - aIsFound = true; - } - } - if(!aIsFound) - aRefSO = _FindObject(aLab,theObjectName,aIsFound); - } + SALOMEDS::Locker lock; + + Handle(SALOMEDSImpl_SObject) aSO = _impl->FindObject(TCollection_AsciiString((char*)anObjectName)); + if(aSO.IsNull()) return SALOMEDS::SObject::_nil(); - return aRefSO._retn(); + if(aSO->DynamicType() == STANDARD_TYPE(SALOMEDSImpl_SComponent)) { + Handle(SALOMEDSImpl_SComponent) aSCO = Handle(SALOMEDSImpl_SComponent)::DownCast(aSO); + SALOMEDS_SComponent_i * sco_servant = new SALOMEDS_SComponent_i (aSCO, _orb); + SALOMEDS::SComponent_var sco = SALOMEDS::SComponent::_narrow(sco_servant->SComponent::_this()); + return sco._retn(); + } + + SALOMEDS_SObject_i * so_servant = new SALOMEDS_SObject_i (aSO, _orb); + SALOMEDS::SObject_var so = SALOMEDS::SObject::_narrow(so_servant->_this()); + + return so._retn(); } //============================================================================ @@ -371,15 +149,13 @@ SALOMEDS::SObject_ptr SALOMEDS_Study_i::FindObject(const char* theObjectName) //============================================================================ SALOMEDS::SObject_ptr SALOMEDS_Study_i::FindObjectID(const char* anObjectID) { - // Convert aSO->GetID in TDF_Label. - TDF_Label Lab; - TDF_Tool::Label(_doc->GetData(), (char*)anObjectID, Lab); - - if (Lab.IsNull()) - return SALOMEDS::SObject::_nil(); - - return SALOMEDS_SObject_i::NewRef(this,Lab)._retn(); + SALOMEDS::Locker lock; + Handle(SALOMEDSImpl_SObject) aSO = _impl->FindObjectID(TCollection_AsciiString((char*)anObjectID)); + if(aSO.IsNull()) return SALOMEDS::SObject::_nil(); + SALOMEDS_SObject_i * so_servant = new SALOMEDS_SObject_i (aSO, _orb); + SALOMEDS::SObject_var so = SALOMEDS::SObject::_narrow(so_servant->_this()); + return so._retn(); } //============================================================================ @@ -389,14 +165,14 @@ SALOMEDS::SObject_ptr SALOMEDS_Study_i::FindObjectID(const char* anObjectID) //============================================================================ SALOMEDS::SObject_ptr SALOMEDS_Study_i::CreateObjectID(const char* anObjectID) { - // Convert aSO->GetID in TDF_Label. - TDF_Label Lab; - TDF_Tool::Label(_doc->GetData(), (char*)anObjectID, Lab, Standard_True); - - if (Lab.IsNull()) - return SALOMEDS::SObject::_nil(); + SALOMEDS::Locker lock; + + Handle(SALOMEDSImpl_SObject) aSO = _impl->CreateObjectID((char*)anObjectID); + if(aSO.IsNull()) return SALOMEDS::SObject::_nil(); - return SALOMEDS_SObject_i::NewRef(this,Lab)._retn(); + SALOMEDS_SObject_i * so_servant = new SALOMEDS_SObject_i (aSO, _orb); + SALOMEDS::SObject_var so = SALOMEDS::SObject::_narrow(so_servant->_this()); + return so._retn(); } //============================================================================ @@ -405,95 +181,40 @@ SALOMEDS::SObject_ptr SALOMEDS_Study_i::CreateObjectID(const char* anObjectID) * : with ComponentDataType = aComponentName */ //============================================================================ -SALOMEDS::Study::ListOfSObject* -SALOMEDS_Study_i::FindObjectByName(const char* theObjectName, - const char* theComponentName) +SALOMEDS::Study::ListOfSObject* SALOMEDS_Study_i::FindObjectByName( const char* anObjectName, + const char* aComponentName ) { - SALOMEDS::Study::ListOfSObject_var aListOfSObj = new SALOMEDS::Study::ListOfSObject ; - aListOfSObj->length(0); + SALOMEDS::Locker lock; - SALOMEDS::SComponent_ptr aSComponent = FindComponent(theComponentName) ; - if(aSComponent->_is_nil()){ - MESSAGE ("In FindObjectByName() : Component named " << theComponentName << " not found "); - return aListOfSObj._retn(); + Handle(TColStd_HSequenceOfTransient) aSeq = _impl->FindObjectByName(TCollection_AsciiString((char*)anObjectName), + TCollection_AsciiString((char*)aComponentName)); + int aLength = aSeq->Length(); + SALOMEDS::Study::ListOfSObject_var listSO = new SALOMEDS::Study::ListOfSObject ; + listSO->length(aLength); + for(int i = 1; i<=aLength; i++) { + Handle(SALOMEDSImpl_SObject) aSO = Handle(SALOMEDSImpl_SObject)::DownCast(aSeq->Value(i)); + SALOMEDS_SObject_i * so_servant = new SALOMEDS_SObject_i (aSO, _orb); + SALOMEDS::SObject_var so = SALOMEDS::SObject::_narrow(so_servant->_this()); + listSO[i-1] = so ; } - - // Iterate on each object and subobject of the component - // If objectName is found add it to the list of SObjects - TDF_Label aLabel; - CORBA::String_var anEntry = aSComponent->GetID(); - TDF_Tool::Label(_doc->GetData(),const_cast(anEntry.in()),aLabel); - - int aLength = 0 ; - SALOMEDS::SObject_var aRefSO; - TDF_ChildIterator aChildIter(aLabel,true); - for(; aChildIter.More(); aChildIter.Next()){ - TDF_Label aLab = aChildIter.Value(); - Handle(TDataStd_Name) anAttr; - if(aLab.FindAttribute(TDataStd_Name::GetID(),anAttr)){ - TCollection_AsciiString aString(anAttr->Get()); - if(strcmp(aString.ToCString(),theObjectName) == 0){ - aRefSO = SALOMEDS_SObject_i::NewRef(this,aLab)._retn(); - /* add to list */ - aLength++ ; - aListOfSObj->length(aLength); - aListOfSObj[aLength-1] = aRefSO; - } - } - } - - return aListOfSObj._retn() ; + return listSO._retn() ; } - - //============================================================================ /*! Function : FindObjectIOR * Purpose : Find an Object with IOR = anObjectIOR */ //============================================================================ -SALOMEDS::SObject_ptr SALOMEDS_Study_i::FindObjectIOR(const char* theObjectIOR) +SALOMEDS::SObject_ptr SALOMEDS_Study_i::FindObjectIOR(const char* anObjectIOR) { - // firstly searching in the datamap for optimization - char* anIOR = const_cast(theObjectIOR); - if(myIORLabels.IsBound(anIOR)){ - TDF_Label aLabel = myIORLabels.Find(anIOR); - TSObjectHolder aSObjectHolder = SALOMEDS_SObject_i::New(this,aLabel); - SALOMEDS_SObject_i* aSObjectPtr = aSObjectHolder.first; - SALOMEDS::SObject_var aSObject = aSObjectHolder.second; - // 11 oct 2002: forbidden attributes must be checked here - SALOMEDS::GenericAttribute_var anAttr; - if(!aSObjectPtr->FindAttribute(anAttr,"AttributeIOR")){ - myIORLabels.UnBind(anIOR); - }else{ - return aSObject._retn(); - } - } + SALOMEDS::Locker lock; - // Iterate to all components defined in the study - // After testing the component name, iterate in all objects defined under - // components (function _FindObject) - bool aIsFound = false; - SALOMEDS::SObject_var aRefSO; - SALOMEDS_SComponentIterator_i aComponentIter(this,_doc); - for(; aComponentIter.More() && !aIsFound; aComponentIter.Next()){ - TDF_Label aLab = aComponentIter.GetValue(); - Handle(SALOMEDS_IORAttribute) anAttr; - if(aLab.FindAttribute(SALOMEDS_IORAttribute::GetID(),anAttr)){ - TCollection_AsciiString aString(anAttr->Get()); - if(strcmp(aString.ToCString(),theObjectIOR) == 0){ - aRefSO = SALOMEDS_SComponent_i::NewRef(this,aLab); - aIsFound = true; - } - } - if(!aIsFound) - aRefSO = _FindObjectIOR(aLab,theObjectIOR,aIsFound); - } + Handle(SALOMEDSImpl_SObject) aSO = _impl->FindObjectIOR(TCollection_AsciiString((char*)anObjectIOR)); + if(aSO.IsNull()) return SALOMEDS::SObject::_nil(); - if(!aRefSO->_is_nil()) - MESSAGE("SALOMEDS_Study_i::FindObjectIOR: found label with old methods"); - - return aRefSO._retn(); + SALOMEDS_SObject_i * so_servant = new SALOMEDS_SObject_i (aSO, _orb); + SALOMEDS::SObject_var so = SALOMEDS::SObject::_narrow(so_servant->_this()); + return so._retn(); } //============================================================================ @@ -503,57 +224,14 @@ SALOMEDS::SObject_ptr SALOMEDS_Study_i::FindObjectIOR(const char* theObjectIOR) //============================================================================ SALOMEDS::SObject_ptr SALOMEDS_Study_i::FindObjectByPath(const char* thePath) { - TCollection_AsciiString aPath(CORBA::string_dup(thePath)), aToken; - SALOMEDS::SObject_var aSO = SALOMEDS::SObject::_nil(); - int i = 1, aLength = aPath.Length(); - bool isRelative = false; - - if(aLength == 0) { //Empty path - return the current context - return SALOMEDS_SObject_i::NewRef(this,_current)._retn(); - } - - if(aPath.Value(1) != '/') //Relative path - isRelative = true; - - TDF_ChildIterator anIterator; - TDF_Label aLabel; - Handle(TDataStd_Name) anAttr; - - if(isRelative) { - if(_current.IsNull()) throw SALOMEDS::Study::StudyInvalidContext(); - anIterator.Initialize(_current, Standard_False); - } - else { - if(aPath.Length() == 1 && aPath.Value(1) == '/') { //Root - return SALOMEDS_SObject_i::NewRef(this,_doc->Main())._retn(); - } - anIterator.Initialize(_doc->Main(), Standard_False); - } - - while(i <= aLength) { - - aToken = aPath.Token("/", i); - if(aToken.Length() == 0) break; + SALOMEDS::Locker lock; - for ( ; anIterator.More(); anIterator.Next() ) { - aLabel = anIterator.Value(); - if(aLabel.FindAttribute(TDataStd_Name::GetID(), anAttr)) { - if(anAttr->Get() == aToken) { - aToken = aPath.Token("/", i+1); //Check if it was the last part of the path - if(aToken.Length() == 0) { //The searched label is found (no part of the path is left) - return SALOMEDS_SObject_i::NewRef(this,aLabel)._retn(); - } - - anIterator.Initialize(aLabel, Standard_False); - break; - } - } - } + Handle(SALOMEDSImpl_SObject) aSO = _impl->FindObjectByPath(TCollection_AsciiString((char*)thePath)); + if(aSO.IsNull()) return SALOMEDS::SObject::_nil(); - i++; - } - - return aSO._retn(); + SALOMEDS_SObject_i * so_servant = new SALOMEDS_SObject_i (aSO, _orb); + SALOMEDS::SObject_var so = SALOMEDS::SObject::_narrow(so_servant->_this()); + return so._retn(); } //============================================================================ @@ -563,39 +241,15 @@ SALOMEDS::SObject_ptr SALOMEDS_Study_i::FindObjectByPath(const char* thePath) //============================================================================ char* SALOMEDS_Study_i::GetObjectPath(CORBA::Object_ptr theObject) { - TCollection_AsciiString aPath(""); - if(CORBA::is_nil(theObject)) - return CORBA::string_dup(aPath.ToCString()); - - SALOMEDS::SObject_var anObject = SALOMEDS::SObject::_narrow(theObject); - if(anObject->_is_nil()) { - CORBA::String_var anIOR = GetORB()->object_to_string(theObject); - anObject = FindObjectIOR(anIOR); - if(anObject->_is_nil()) - return CORBA::string_dup(aPath.ToCString()); - } + SALOMEDS::Locker lock; - SALOMEDS::GenericAttribute_var anAttr; - if(anObject->FindAttribute(anAttr, "AttributeName")) { - SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr); - if(anAttr->_is_nil()) - return CORBA::string_dup(aPath.ToCString()); - TCollection_AsciiString aValue(aName->Value()); - aValue.Prepend("/"); - aValue += aPath; - aPath = aValue; - SALOMEDS::SObject_ptr aFather = anObject->GetFather(); - if(!aFather->_is_nil()) { - TDF_Label aLabel; - Handle(TDataStd_Name) aNameAttrib; - TDF_Tool::Label(_doc->GetData(), aFather->GetID(), aLabel); - if(aLabel.FindAttribute(TDataStd_Name::GetID(), aNameAttrib)) { - aValue = GetObjectPath(aFather); - aPath = aValue + aPath; - } - } - } + TCollection_AsciiString aPath(""); + if(CORBA::is_nil(theObject)) return CORBA::string_dup(aPath.ToCString()); + Handle(SALOMEDSImpl_SObject) aSO = _impl->FindObjectIOR(_orb->object_to_string(theObject)); + if(aSO.IsNull()) return CORBA::string_dup(aPath.ToCString()); + + aPath = _impl->GetObjectPath(aSO); return CORBA::string_dup(aPath.ToCString()); } @@ -607,34 +261,11 @@ char* SALOMEDS_Study_i::GetObjectPath(CORBA::Object_ptr theObject) //============================================================================ void SALOMEDS_Study_i::SetContext(const char* thePath) { - if(thePath == NULL || strlen(thePath) == 0) throw SALOMEDS::Study::StudyInvalidDirectory(); - TCollection_AsciiString aPath(CORBA::string_dup(thePath)), aContext(""); - bool isInvalid = false; - SALOMEDS::SObject_var aSO; - - if(aPath.Value(1) != '/') { //Relative path - aContext = TCollection_AsciiString(GetContext()); - aContext += '/'; - aContext += aPath; - } - else - aContext = aPath; - - try { - aSO = FindObjectByPath(aContext.ToCString()); - } - catch( ... ) { - isInvalid = true; - } - - if(isInvalid || aSO->_is_nil()) throw SALOMEDS::Study::StudyInvalidContext(); + SALOMEDS::Locker lock; - TDF_Label aLabel; - TDF_Tool::Label(_doc->GetData(), aSO->GetID(), aLabel); - if(aLabel.IsNull()) throw SALOMEDS::Study::StudyInvalidContext(); - else - _current = aLabel; //Set the current context - + _impl->SetContext(TCollection_AsciiString((char*)thePath)); + if(_impl->IsError() && _impl->GetErrorCode() == "InvalidContext") + throw SALOMEDS::Study::StudyInvalidContext(); } //============================================================================ @@ -644,11 +275,10 @@ void SALOMEDS_Study_i::SetContext(const char* thePath) //============================================================================ char* SALOMEDS_Study_i::GetContext() { - if(_current.IsNull()) - throw SALOMEDS::Study::StudyInvalidContext(); + SALOMEDS::Locker lock; - SALOMEDS::SObject_var aSObject = SALOMEDS_SObject_i::NewRef(this,_current); - return GetObjectPath(aSObject); + if(!_impl->HasCurrentContext()) throw SALOMEDS::Study::StudyInvalidContext(); + return CORBA::string_dup(_impl->GetContext().ToCString()); } //============================================================================ @@ -656,34 +286,17 @@ char* SALOMEDS_Study_i::GetContext() * Purpose : method to get all object names in the given context (or in the current context, if 'theContext' is empty) */ //============================================================================ -SALOMEDS::ListOfStrings* SALOMEDS_Study_i::GetObjectNames(const char* theContext) { - TColStd_SequenceOfExtendedString aResultSeq; +SALOMEDS::ListOfStrings* SALOMEDS_Study_i::GetObjectNames(const char* theContext) +{ + SALOMEDS::Locker lock; + SALOMEDS::ListOfStrings_var aResult = new SALOMEDS::ListOfStrings; - TDF_Label aLabel; - if (strlen(theContext) == 0) { - if(_current.IsNull()) throw SALOMEDS::Study::StudyInvalidContext(); - aLabel = _current; - } else { - TDF_Label aTmp = _current; - SetContext(theContext); - aLabel = _current; - _current = aTmp; - } - TDF_ChildIterator anIter(aLabel, Standard_False); // iterate all subchildren at all sublevels - for(; anIter.More(); anIter.Next()) { - TDF_Label aLabel = anIter.Value(); -// Handle(TDF_Attribute) anAttribute; -// if (aLabel.FindAttribute(SALOMEDS_IORAttribute::GetID(), anAttribute) || -// aLabel.FindAttribute(SALOMEDS_LocalIDAttribute::GetID(), anAttribute)) { - Handle(TDataStd_Name) aName; - if (aLabel.FindAttribute(TDataStd_Name::GetID(), aName)) aResultSeq.Append(aName->Get()); -// } - } - // fill the result table - int anIndex, aLength = aResultSeq.Length(); + if (strlen(theContext) == 0 && !_impl->HasCurrentContext()) throw SALOMEDS::Study::StudyInvalidContext(); + Handle(TColStd_HSequenceOfAsciiString) aSeq = _impl->GetObjectNames(TCollection_AsciiString((char*)theContext)); + int aLength = aSeq->Length(); aResult->length(aLength); - for(anIndex = 0; anIndex < aLength; anIndex++) { - aResult[anIndex] = CORBA::string_dup(TCollection_AsciiString(aResultSeq.Value(anIndex + 1)).ToCString()); + for(int anIndex = 1; anIndex <= aLength; anIndex++) { + aResult[anIndex-1] = CORBA::string_dup(TCollection_AsciiString(aSeq->Value(anIndex)).ToCString()); } return aResult._retn(); } @@ -693,37 +306,17 @@ SALOMEDS::ListOfStrings* SALOMEDS_Study_i::GetObjectNames(const char* theContext * Purpose : method to get all directory names in the given context (or in the current context, if 'theContext' is empty) */ //============================================================================ -SALOMEDS::ListOfStrings* SALOMEDS_Study_i::GetDirectoryNames(const char* theContext) { - TColStd_SequenceOfExtendedString aResultSeq; +SALOMEDS::ListOfStrings* SALOMEDS_Study_i::GetDirectoryNames(const char* theContext) +{ + SALOMEDS::Locker lock; + SALOMEDS::ListOfStrings_var aResult = new SALOMEDS::ListOfStrings; - TDF_Label aLabel; - if (strlen(theContext) == 0) { - if(_current.IsNull()) throw SALOMEDS::Study::StudyInvalidContext(); - aLabel = _current; - } else { - TDF_Label aTmp = _current; - SetContext(theContext); - aLabel = _current; - _current = aTmp; - } - TDF_ChildIterator anIter(aLabel, Standard_False); // iterate first-level children at all sublevels - for(; anIter.More(); anIter.Next()) { - TDF_Label aLabel = anIter.Value(); - Handle(SALOMEDS_LocalIDAttribute) anID; - if (aLabel.FindAttribute(SALOMEDS_LocalIDAttribute::GetID(), anID)) { - if (anID->Get() == DIRECTORYID) { - Handle(TDataStd_Name) aName; - if (aLabel.FindAttribute(TDataStd_Name::GetID(), aName)) { - aResultSeq.Append(aName->Get()); - } - } - } - } - // fill the result table - int anIndex, aLength = aResultSeq.Length(); + if (strlen(theContext) == 0 && !_impl->HasCurrentContext()) throw SALOMEDS::Study::StudyInvalidContext(); + Handle(TColStd_HSequenceOfAsciiString) aSeq = _impl->GetDirectoryNames(TCollection_AsciiString((char*)theContext)); + int aLength = aSeq->Length(); aResult->length(aLength); - for(anIndex = 0; anIndex < aLength; anIndex++) { - aResult[anIndex] = CORBA::string_dup(TCollection_AsciiString(aResultSeq.Value(anIndex + 1)).ToCString()); + for(int anIndex = 1; anIndex <= aLength; anIndex++) { + aResult[anIndex-1] = CORBA::string_dup(TCollection_AsciiString(aSeq->Value(anIndex)).ToCString()); } return aResult._retn(); } @@ -733,40 +326,17 @@ SALOMEDS::ListOfStrings* SALOMEDS_Study_i::GetDirectoryNames(const char* theCont * Purpose : method to get all file names in the given context (or in the current context, if 'theContext' is empty) */ //============================================================================ -SALOMEDS::ListOfStrings* SALOMEDS_Study_i::GetFileNames(const char* theContext) { - TColStd_SequenceOfExtendedString aResultSeq; +SALOMEDS::ListOfStrings* SALOMEDS_Study_i::GetFileNames(const char* theContext) +{ + SALOMEDS::Locker lock; + SALOMEDS::ListOfStrings_var aResult = new SALOMEDS::ListOfStrings; - TDF_Label aLabel; - if (strlen(theContext) == 0) { - if(_current.IsNull()) throw SALOMEDS::Study::StudyInvalidContext(); - aLabel = _current; - } else { - TDF_Label aTmp = _current; - SetContext(theContext); - aLabel = _current; - _current = aTmp; - } - TDF_ChildIterator anIter(aLabel, Standard_False); // iterate all subchildren at all sublevels - for(; anIter.More(); anIter.Next()) { - TDF_Label aLabel = anIter.Value(); - Handle(SALOMEDS_LocalIDAttribute) anID; - if (aLabel.FindAttribute(SALOMEDS_LocalIDAttribute::GetID(), anID)) { - if (anID->Get() == FILELOCALID) { - Handle(SALOMEDS_PersRefAttribute) aName; - if(aLabel.FindAttribute(SALOMEDS_PersRefAttribute::GetID(), aName)) { - TCollection_ExtendedString aFileName = aName->Get(); - if(aFileName.Length() > 0) - aResultSeq.Append(aFileName.Split(strlen(FILEID))); - } - } - } -// } - } - // fill the result table - int anIndex, aLength = aResultSeq.Length(); + if (strlen(theContext) == 0 && !_impl->HasCurrentContext()) throw SALOMEDS::Study::StudyInvalidContext(); + Handle(TColStd_HSequenceOfAsciiString) aSeq = _impl->GetFileNames(TCollection_AsciiString((char*)theContext)); + int aLength = aSeq->Length(); aResult->length(aLength); - for(anIndex = 0; anIndex < aLength; anIndex++) { - aResult[anIndex] = CORBA::string_dup(TCollection_AsciiString(aResultSeq.Value(anIndex + 1)).ToCString()); + for(int anIndex = 1; anIndex <= aLength; anIndex++) { + aResult[anIndex-1] = CORBA::string_dup(TCollection_AsciiString(aSeq->Value(anIndex)).ToCString()); } return aResult._retn(); } @@ -776,20 +346,17 @@ SALOMEDS::ListOfStrings* SALOMEDS_Study_i::GetFileNames(const char* theContext) * Purpose : method to get all components names */ //============================================================================ -SALOMEDS::ListOfStrings* SALOMEDS_Study_i::GetComponentNames(const char* theContext) { - TColStd_SequenceOfExtendedString aResultSeq; +SALOMEDS::ListOfStrings* SALOMEDS_Study_i::GetComponentNames(const char* theContext) +{ + SALOMEDS::Locker lock; + SALOMEDS::ListOfStrings_var aResult = new SALOMEDS::ListOfStrings; - TDF_ChildIterator anIter(_doc->Main(), Standard_False); // iterate all subchildren at first level - for(; anIter.More(); anIter.Next()) { - TDF_Label aLabel = anIter.Value(); - Handle(TDataStd_Name) aName; - if (aLabel.FindAttribute(TDataStd_Name::GetID(), aName)) aResultSeq.Append(aName->Get()); - } - // fill the result table - int anIndex, aLength = aResultSeq.Length(); + if (strlen(theContext) == 0 && !_impl->HasCurrentContext()) throw SALOMEDS::Study::StudyInvalidContext(); + Handle(TColStd_HSequenceOfAsciiString) aSeq = _impl->GetComponentNames(TCollection_AsciiString((char*)theContext)); + int aLength = aSeq->Length(); aResult->length(aLength); - for(anIndex = 0; anIndex < aLength; anIndex++) { - aResult[anIndex] = CORBA::string_dup(TCollection_AsciiString(aResultSeq.Value(anIndex + 1)).ToCString()); + for(int anIndex = 1; anIndex <= aLength; anIndex++) { + aResult[anIndex-1] = CORBA::string_dup(TCollection_AsciiString(aSeq->Value(anIndex)).ToCString()); } return aResult._retn(); } @@ -799,66 +366,45 @@ SALOMEDS::ListOfStrings* SALOMEDS_Study_i::GetComponentNames(const char* theCont * Purpose : Create a ChildIterator from an SObject */ //============================================================================ -SALOMEDS::ChildIterator_ptr -SALOMEDS_Study_i::NewChildIterator(SALOMEDS::SObject_ptr theSObject) +SALOMEDS::ChildIterator_ptr SALOMEDS_Study_i::NewChildIterator(SALOMEDS::SObject_ptr theSO) { - SALOMEDS_ChildIterator_i* aServant = - new SALOMEDS_ChildIterator_i(GetChildIterator(theSObject)); + SALOMEDS::Locker lock; - return aServant->_this(); -} + Handle(SALOMEDSImpl_SObject) aSO = _impl->GetSObject(theSO->GetID()); -SALOMEDS_ChildIterator_i -SALOMEDS_Study_i::GetChildIterator(SALOMEDS::SObject_ptr theSObject) -{ - TDF_Label aLab; - TDF_Tool::Label(_doc->GetData(),theSObject->GetID(),aLab); - return SALOMEDS_ChildIterator_i(this,aLab); + //Create iterator + SALOMEDS_ChildIterator_i* it_servant = new SALOMEDS_ChildIterator_i(aSO->GetLabel(), _orb); + SALOMEDS::ChildIterator_var it = SALOMEDS::ChildIterator::_narrow(it_servant->_this()); + + return it; } + //============================================================================ /*! Function : NewComponentIterator * Purpose : Create a SComponentIterator */ //============================================================================ -SALOMEDS::SComponentIterator_ptr -SALOMEDS_Study_i::NewComponentIterator() +SALOMEDS::SComponentIterator_ptr SALOMEDS_Study_i::NewComponentIterator() { - SALOMEDS_SComponentIterator_i* aServant = - new SALOMEDS_SComponentIterator_i(GetComponentIterator()); + SALOMEDS::Locker lock; - return aServant->_this(); + SALOMEDSImpl_SComponentIterator aCI = _impl->NewComponentIterator(); + SALOMEDS_SComponentIterator_i* it_servant = new SALOMEDS_SComponentIterator_i(aCI, _orb); + SALOMEDS::SComponentIterator_var it = SALOMEDS::SComponentIterator::_narrow(it_servant->_this()); + return it; } -SALOMEDS_SComponentIterator_i -SALOMEDS_Study_i::GetComponentIterator() -{ - return SALOMEDS_SComponentIterator_i(this,_doc); -} - -//============================================================================ -/*! Function : GetUseCaseBuilder - * Purpose : Returns a UseCase builder - */ -//============================================================================ -SALOMEDS::UseCaseBuilder_ptr SALOMEDS_Study_i::GetUseCaseBuilder() -{ - return _UseCaseBuilder->_this(); -} //============================================================================ /*! Function : NewBuilder * Purpose : Create a StudyBuilder */ //============================================================================ -SALOMEDS_StudyBuilder_i* SALOMEDS_Study_i::GetBuilder() -{ - return _Builder; -} - SALOMEDS::StudyBuilder_ptr SALOMEDS_Study_i::NewBuilder() { - return GetBuilder()->_this(); + SALOMEDS::Locker lock; + return _Builder->_this(); } //============================================================================ @@ -868,7 +414,8 @@ SALOMEDS::StudyBuilder_ptr SALOMEDS_Study_i::NewBuilder() //============================================================================ char* SALOMEDS_Study_i::Name() { - return CORBA::string_dup(_name); + SALOMEDS::Locker lock; + return CORBA::string_dup(_impl->Name().ToCString()); } //============================================================================ @@ -878,8 +425,8 @@ char* SALOMEDS_Study_i::Name() //============================================================================ void SALOMEDS_Study_i::Name(const char* name) { - _name = new char[strlen(name) +1]; - strcpy(_name,name); + SALOMEDS::Locker lock; + _impl->Name(TCollection_AsciiString((char*)name)); } //============================================================================ @@ -889,7 +436,8 @@ void SALOMEDS_Study_i::Name(const char* name) //============================================================================ CORBA::Boolean SALOMEDS_Study_i::IsSaved() { - return _isSaved; + SALOMEDS::Locker lock; + return _impl->IsSaved(); } //============================================================================ @@ -899,7 +447,8 @@ CORBA::Boolean SALOMEDS_Study_i::IsSaved() //============================================================================ void SALOMEDS_Study_i::IsSaved(CORBA::Boolean save) { - _isSaved = save; + SALOMEDS::Locker lock; + _impl->IsSaved(save); } //============================================================================ @@ -909,11 +458,8 @@ void SALOMEDS_Study_i::IsSaved(CORBA::Boolean save) //============================================================================ CORBA::Boolean SALOMEDS_Study_i::IsModified() { - // True if is modified and not saved - if (_doc->IsModified()) - if (!_isSaved) return true; - else return false; - else return false; + SALOMEDS::Locker lock; + return _impl->IsModified(); } //============================================================================ @@ -923,11 +469,8 @@ CORBA::Boolean SALOMEDS_Study_i::IsModified() //============================================================================ char* SALOMEDS_Study_i::URL() { - if(!_URL) { - _URL = new char[1]; - _URL[0] = (char)0; - } - return CORBA::string_dup(_URL); + SALOMEDS::Locker lock; + return CORBA::string_dup(_impl->URL().ToCString()); } //============================================================================ @@ -937,107 +480,56 @@ char* SALOMEDS_Study_i::URL() //============================================================================ void SALOMEDS_Study_i::URL(const char* url) { - if (_URL) delete [] _URL; - _URL = new char[strlen(url) +1]; - strcpy(_URL,url); - SCRUTE(_URL); - - char *aName = _URL; - char *adr = strtok(aName, "/"); - while (adr) - { - aName = adr; - adr = strtok(NULL, "/"); - } - strcpy(_URL,url); - Name(aName); + SALOMEDS::Locker lock; + _impl->URL(TCollection_AsciiString((char*)url)); } -//============================================================================ -/*! Function : _FindObject - * Purpose : Find an Object with SALOMEDS::Name = anObjectName - */ -//============================================================================ -SALOMEDS::SObject_ptr -SALOMEDS_Study_i::_FindObject(TDF_Label theLabel, - const char* theObjectName, - bool& theIsFound) +CORBA::Short SALOMEDS_Study_i::StudyId() { - theIsFound = false; - // Iterate on each objects and subobjects of the component - // If objectName find, stop the loop and get the object reference - SALOMEDS::SObject_var aRefSO; - TDF_ChildIterator aChildIter(theLabel,true); - for(; aChildIter.More() && !theIsFound; aChildIter.Next()){ - TDF_Label aLab = aChildIter.Value(); - Handle(TDataStd_Name) anAttr; - if(aLab.FindAttribute(TDataStd_Name::GetID(),anAttr)){ - TCollection_AsciiString aString(anAttr->Get()); - if(strcmp(aString.ToCString(),theObjectName) == 0){ - aRefSO = SALOMEDS_SObject_i::NewRef(this,aLab); - theIsFound = true; - } - } - } - return aRefSO._retn(); + SALOMEDS::Locker lock; + return _impl->StudyId(); } -//============================================================================ -/*! Function : _FindObject - * Purpose : Find an Object with SALOMEDS::IOR = anObjectIOR - */ -//============================================================================ -SALOMEDS::SObject_ptr -SALOMEDS_Study_i::_FindObjectIOR(TDF_Label theLabel, - const char* theObjectIOR, - bool& theIsFound) -{ - // Iterate on each objects and subobjects of the component - // If objectName find, stop the loop and get the object reference - SALOMEDS::SObject_var aRefSO; - TDF_ChildIterator aChildIter(theLabel,true); - for(; aChildIter.More() && !theIsFound; aChildIter.Next()){ - TDF_Label aLab = aChildIter.Value(); - Handle(SALOMEDS_IORAttribute) anAttr; - if(aLab.FindAttribute(SALOMEDS_IORAttribute::GetID(),anAttr)){ - TCollection_AsciiString aString(anAttr->Get()); - if(strcmp(aString.ToCString(),theObjectIOR) == 0){ - aRefSO = SALOMEDS_SObject_i::NewRef(this,aLab); - theIsFound = true; - } - } - } - return aRefSO._retn(); +void SALOMEDS_Study_i::StudyId(CORBA::Short id) +{ + SALOMEDS::Locker lock; + _impl->StudyId(id); } -CORBA::Short SALOMEDS_Study_i::StudyId() +void SALOMEDS_Study_i::UpdateIORLabelMap(const char* anIOR,const char* anEntry) { - return _StudyId; + SALOMEDS::Locker lock; + _impl->UpdateIORLabelMap(TCollection_AsciiString((char*)anIOR), TCollection_AsciiString((char*)anEntry)); } -void SALOMEDS_Study_i::StudyId(CORBA::Short id) +SALOMEDS::Study_ptr SALOMEDS_Study_i::GetStudy(const TDF_Label theLabel, CORBA::ORB_ptr orb) { - _StudyId = id; -} + SALOMEDS::Locker lock; -void SALOMEDS_Study_i::UpdateIORLabelMap(const char* anIOR,const char* anEntry) { - TDF_Label aLabel; - CORBA::String_var anEn = CORBA::string_dup(anEntry); - CORBA::String_var IOR = CORBA::string_dup(anIOR); - TDF_Tool::Label(_doc->GetData(),anEn,aLabel, Standard_True); - if (myIORLabels.IsBound(TCollection_ExtendedString(IOR))) myIORLabels.UnBind(TCollection_ExtendedString(IOR)); - myIORLabels.Bind(TCollection_ExtendedString(IOR), aLabel); + Handle(SALOMEDSImpl_AttributeIOR) Att; + if (theLabel.Root().FindAttribute(SALOMEDSImpl_AttributeIOR::GetID(),Att)){ + char* IOR = CORBA::string_dup(TCollection_AsciiString(Att->Value()).ToCString()); + CORBA::Object_var obj = orb->string_to_object(IOR); + SALOMEDS::Study_ptr aStudy = SALOMEDS::Study::_narrow(obj) ; + ASSERT(!CORBA::is_nil(aStudy)); + return SALOMEDS::Study::_duplicate(aStudy); + } else { + MESSAGE("GetStudy: Problem to get study"); + } + return SALOMEDS::Study::_nil(); } -void SALOMEDS_Study_i::IORUpdated(const Handle(SALOMEDS_IORAttribute) theAttribute) { - TCollection_AsciiString aString; - TDF_Tool::Entry(theAttribute->Label(),aString); - TCollection_AsciiString aValue(theAttribute->Get()); - UpdateIORLabelMap(aValue.ToCString(),aString.ToCString()); +void SALOMEDS_Study_i::IORUpdated(const Handle(SALOMEDSImpl_AttributeIOR) theAttribute) +{ + SALOMEDS::Locker lock; + SALOMEDSImpl_Study::IORUpdated(theAttribute); } -SALOMEDS::Study::ListOfSObject* SALOMEDS_Study_i::FindDependances(SALOMEDS::SObject_ptr anObject) { +SALOMEDS::Study::ListOfSObject* SALOMEDS_Study_i::FindDependances(SALOMEDS::SObject_ptr anObject) +{ + SALOMEDS::Locker lock; + SALOMEDS::GenericAttribute_ptr aTarget; if (anObject->FindAttribute(aTarget,"AttributeTarget")) { return SALOMEDS::AttributeTarget::_narrow(aTarget)->Get(); @@ -1048,49 +540,50 @@ SALOMEDS::Study::ListOfSObject* SALOMEDS_Study_i::FindDependances(SALOMEDS::SObj } -SALOMEDS::AttributeStudyProperties_ptr SALOMEDS_Study_i::GetProperties(){ - SALOMEDS::SObject_var aSObject = FindObjectID("0:1"); - - SALOMEDS::GenericAttribute_var anAttr = - GetBuilder()->FindOrCreateAttribute(aSObject,"AttributeStudyProperties"); - - return SALOMEDS::AttributeStudyProperties::_narrow(anAttr); +SALOMEDS::AttributeStudyProperties_ptr SALOMEDS_Study_i::GetProperties() +{ + SALOMEDS::Locker lock; + + Handle(SALOMEDSImpl_AttributeStudyProperties) anAttr = _impl->GetProperties(); + SALOMEDS_AttributeStudyProperties_i* SP = new SALOMEDS_AttributeStudyProperties_i(anAttr, _orb); + return SP->AttributeStudyProperties::_this(); } -char* SALOMEDS_Study_i::GetLastModificationDate() { - SALOMEDS::AttributeStudyProperties_var aProp = GetProperties(); - SALOMEDS::StringSeq_var aNames; - SALOMEDS::LongSeq_var aMinutes, aHours, aDays, aMonths, aYears; - aProp->GetModificationsList(aNames , aMinutes ,aHours, aDays, aMonths, aYears, true); - int aLastIndex = aNames->length() - 1; - char aResult[20]; - sprintf(aResult, "%2.2d/%2.2d/%4.4d %2.2d:%2.2d", (int)(aDays[aLastIndex]),(int)(aMonths[aLastIndex]), - (int)(aYears[aLastIndex]), (int)(aHours[aLastIndex]), (int)(aMinutes[aLastIndex])); - CORBA::String_var aResStr = CORBA::string_dup(aResult); - return aResStr._retn(); +char* SALOMEDS_Study_i::GetLastModificationDate() +{ + SALOMEDS::Locker lock; + return CORBA::string_dup(_impl->GetLastModificationDate().ToCString()); } -SALOMEDS::ListOfDates* SALOMEDS_Study_i::GetModificationsDate() { - SALOMEDS::AttributeStudyProperties_var aProp = GetProperties(); - SALOMEDS::StringSeq_var aNames; - SALOMEDS::LongSeq_var aMinutes, aHours, aDays, aMonths, aYears; - aProp->GetModificationsList(aNames , aMinutes ,aHours, aDays, aMonths, aYears, false); - - int anIndex, aLength = aNames->length(); +SALOMEDS::ListOfDates* SALOMEDS_Study_i::GetModificationsDate() +{ + SALOMEDS::Locker lock; + + Handle(TColStd_HSequenceOfAsciiString) aSeq = _impl->GetModificationsDate(); + int aLength = aSeq->Length(); SALOMEDS::ListOfDates_var aDates = new SALOMEDS::ListOfDates; aDates->length(aLength); - for(anIndex = 0; anIndex < aLength; anIndex++) { - char aDate[20]; - sprintf(aDate, "%2.2d/%2.2d/%4.4d %2.2d:%2.2d", (int)(aDays[anIndex]), (int)(aMonths[anIndex]), - (int)(aYears[anIndex]), (int)(aHours[anIndex]), (int)(aMinutes[anIndex])); - aDates[anIndex] = CORBA::string_dup(aDate); + for(int anIndex = 1; anIndex <= aLength; anIndex++) { + aDates[anIndex-1] = CORBA::string_dup(aSeq->Value(anIndex).ToCString()); } return aDates._retn(); } +//============================================================================ +/*! Function : GetUseCaseBuilder + * Purpose : Returns a UseCase builder + */ +//============================================================================ +SALOMEDS::UseCaseBuilder_ptr SALOMEDS_Study_i::GetUseCaseBuilder() +{ + SALOMEDS::Locker lock; + return _UseCaseBuilder->_this(); +} + + //============================================================================ /*! Function : Close * Purpose : @@ -1098,11 +591,14 @@ SALOMEDS::ListOfDates* SALOMEDS_Study_i::GetModificationsDate() { //============================================================================ void SALOMEDS_Study_i::Close() { - SALOMEDS_SComponentIterator_i itcomponent(this,_doc); + SALOMEDS::Locker lock; + + RemovePostponed(-1); + + SALOMEDS::SComponentIterator_var itcomponent = NewComponentIterator(); - const CORBA::ORB_var& anORB = GetORB(); - for (; itcomponent.More(); itcomponent.Next()) { - SALOMEDS::SComponent_var sco = itcomponent.Value(); + for (; itcomponent->More(); itcomponent->Next()) { + SALOMEDS::SComponent_var sco = itcomponent->Value(); MESSAGE ( "Look for an engine for data type :"<< sco->ComponentDataType()); // if there is an associated Engine call its method for closing @@ -1110,24 +606,19 @@ void SALOMEDS_Study_i::Close() if (sco->ComponentIOR(IOREngine)) { // we have found the associated engine to write the data MESSAGE ( "We have found an engine for data type :"<< sco->ComponentDataType()); - CORBA::Object_var obj = anORB->string_to_object(IOREngine); + CORBA::Object_var obj = _orb->string_to_object(IOREngine); if (!CORBA::is_nil(obj)) { SALOMEDS::Driver_var anEngine = SALOMEDS::Driver::_narrow(obj) ; - - if (!anEngine->_is_nil()) + + if (!anEngine->_is_nil()) { + SALOMEDS::unlock(); anEngine->Close(sco); + SALOMEDS::lock(); + } } } } - - Handle(TDocStd_Application) anApp = Handle(TDocStd_Application)::DownCast(_doc->Application()); -// Handle(TDocStd_Owner) anOwner; -// if (_doc->Main().Root().FindAttribute(TDocStd_Owner::GetID(), anOwner)) { -// Handle(TDocStd_Document) anEmptyDoc; -// anOwner->SetDocument(anEmptyDoc); -// } - if(!anApp.IsNull()) anApp->Close(_doc); - _doc.Nullify(); + _impl->Close(); } //============================================================================ @@ -1135,36 +626,26 @@ void SALOMEDS_Study_i::Close() * Purpose : */ //============================================================================ -void SALOMEDS_Study_i::AddPostponed(const char* theIOR) { - if (!GetBuilder()->HasOpenCommand()) return; - try { - CORBA::Object_var obj = GetORB()->string_to_object(theIOR); - if (!CORBA::is_nil(obj)) { - SALOME::GenericObj_var aGeneric = SALOME::GenericObj::_narrow(obj) ; - if (!CORBA::is_nil(aGeneric)) { - TCollection_AsciiString anIOR(const_cast(theIOR)); - anIOR.Prepend("d"); - myPostponedIORs.Append(anIOR); // add prefix: deleted - myNbPostponed.SetValue(myNbPostponed.Length(), myNbPostponed.Last() + 1); - } - } - } catch(...) {} +void SALOMEDS_Study_i::AddPostponed(const char* theIOR) +{ + SALOMEDS::Locker lock; + + CORBA::Object_var obj = _orb->string_to_object(theIOR); + if (!CORBA::is_nil(obj)) { + SALOME::GenericObj_var aGeneric = SALOME::GenericObj::_narrow(obj) ; + if (!CORBA::is_nil(aGeneric)) _impl->AddPostponed((char*)theIOR); + } } -void SALOMEDS_Study_i::AddCreatedPostponed(const char* theIOR) { - if (!GetBuilder()->HasOpenCommand()) return; - try { - CORBA::Object_var obj = GetORB()->string_to_object(theIOR); - if (!CORBA::is_nil(obj)) { - SALOME::GenericObj_var aGeneric = SALOME::GenericObj::_narrow(obj) ; - if (!CORBA::is_nil(aGeneric)) { - TCollection_AsciiString anIOR(const_cast(theIOR)); - anIOR.Prepend("c"); - myPostponedIORs.Append(anIOR); // add prefix: created - myNbPostponed.SetValue(myNbPostponed.Length(), myNbPostponed.Last() + 1); - } - } - } catch(...) {} +void SALOMEDS_Study_i::AddCreatedPostponed(const char* theIOR) +{ + SALOMEDS::Locker lock; + + CORBA::Object_var obj = _orb->string_to_object(theIOR); + if (!CORBA::is_nil(obj)) { + SALOME::GenericObj_var aGeneric = SALOME::GenericObj::_narrow(obj) ; + if (!CORBA::is_nil(aGeneric)) _impl->AddCreatedPostponed((char*)theIOR); + } } //============================================================================ @@ -1172,62 +653,32 @@ void SALOMEDS_Study_i::AddCreatedPostponed(const char* theIOR) { * Purpose : */ //============================================================================ -void SALOMEDS_Study_i::RemovePostponed(const CORBA::Long theUndoLimit) { - int anIndex; - int anOld; +void SALOMEDS_Study_i::RemovePostponed(const CORBA::Long theUndoLimit) +{ + SALOMEDS::Locker lock; - int aUndoLimit = theUndoLimit; - if (theUndoLimit < 0) aUndoLimit = 0; - - const CORBA::ORB_var& anORB = GetORB(); - if (myNbUndos > 0) { // remove undone - anOld = 0; - for(anIndex = 1; anIndex < myNbPostponed.Length() - myNbUndos; anIndex++) - anOld += myNbPostponed(anIndex); - int aNew = myPostponedIORs.Length() - myNbPostponed.Last(); - - for(anIndex = anOld + 1; anIndex <= aNew; anIndex++) { - TCollection_AsciiString anIOR = myPostponedIORs(anIndex); - if (anIOR.Value(1) == 'c') { - CORBA::Object_var obj = anORB->string_to_object(anIOR.Split(1).ToCString()); - SALOME::GenericObj_var aGeneric = SALOME::GenericObj::_narrow(obj); - if (!CORBA::is_nil(aGeneric)) aGeneric->Destroy(); - } + Handle(TColStd_HSequenceOfAsciiString) aSeq = _impl->RemovePostponed(theUndoLimit); + int aLegth = aSeq->Length(); + for(int i = 1; i <= aLegth; i++) { + TCollection_AsciiString anIOR = aSeq->Value(i); + if (anIOR.Value(1) == 'c') { + CORBA::Object_var obj = _orb->string_to_object(anIOR.Split(1).ToCString()); + SALOME::GenericObj_var aGeneric = SALOME::GenericObj::_narrow(obj); + if (!CORBA::is_nil(aGeneric)) aGeneric->Destroy(); } - if (anOld < aNew) myPostponedIORs.Remove(anOld + 1, aNew); - if (myNbPostponed.Length() > 0) myNbPostponed.Remove(myNbPostponed.Length() - myNbUndos, myNbPostponed.Length() - 1); - - myNbUndos = 0; - } - - if (myNbPostponed.Length() > aUndoLimit) { // remove objects, that can not be undone - anOld = 0; - for(anIndex = myNbPostponed.Length() - aUndoLimit; anIndex >= 1; anIndex--) - anOld += myNbPostponed(anIndex); - for(anIndex = 1; anIndex <= anOld; anIndex++) { - TCollection_AsciiString anIOR = myPostponedIORs(anIndex); - if (anIOR.Value(1) == 'd') { - CORBA::Object_var obj = anORB->string_to_object(anIOR.Split(1).ToCString()); - SALOME::GenericObj_var aGeneric = SALOME::GenericObj::_narrow(obj); - if (!CORBA::is_nil(aGeneric)) aGeneric->Destroy(); - } + else if (anIOR.Value(1) == 'd') { + CORBA::Object_var obj = _orb->string_to_object(anIOR.Split(1).ToCString()); + SALOME::GenericObj_var aGeneric = SALOME::GenericObj::_narrow(obj); + if (!CORBA::is_nil(aGeneric)) aGeneric->Destroy(); } - if (anOld > 0) myPostponedIORs.Remove(1, anOld); - myNbPostponed.Remove(1, myNbPostponed.Length() - aUndoLimit); - } - - if (theUndoLimit == -1) { // remove all IORs from the study on the study close - TDF_ChildIDIterator anIter(_doc->GetData()->Root(), SALOMEDS_IORAttribute::GetID(), Standard_True); - for(; anIter.More(); anIter.Next()) { - Handle(SALOMEDS_IORAttribute) anAttr = Handle(SALOMEDS_IORAttribute)::DownCast(anIter.Value()); - CORBA::String_var anIOR = CORBA::string_dup(TCollection_AsciiString(anAttr->Get()).ToCString()); + else { try { - CORBA::Object_var obj = anORB->string_to_object(anIOR); + CORBA::Object_var obj = _orb->string_to_object(anIOR.ToCString()); SALOME::GenericObj_var aGeneric = SALOME::GenericObj::_narrow(obj); if (!CORBA::is_nil(aGeneric)) aGeneric->Destroy(); } catch (...) {} } - } else myNbPostponed.Append(0); + } } //============================================================================ @@ -1235,10 +686,26 @@ void SALOMEDS_Study_i::RemovePostponed(const CORBA::Long theUndoLimit) { * Purpose : */ //============================================================================ -void SALOMEDS_Study_i::UndoPostponed(const CORBA::Long theWay) { - myNbUndos += theWay; - // remove current postponed - if (myNbPostponed.Last() > 0) - myPostponedIORs.Remove(myPostponedIORs.Length() - myNbPostponed.Last() + 1, myPostponedIORs.Length()); - myNbPostponed(myNbPostponed.Length()) = 0; +void SALOMEDS_Study_i::UndoPostponed(const CORBA::Long theWay) +{ + SALOMEDS::Locker lock; + + _impl->UndoPostponed(theWay); +} + + +//============================================================================ +/*! Function : DumpStudy + * Purpose : + */ +//============================================================================ +CORBA::Boolean SALOMEDS_Study_i::DumpStudy(const char* thePath, const char* theBaseName, CORBA::Boolean isPublished) +{ + SALOMEDS::Locker lock; + + TCollection_AsciiString aPath((char*)thePath), aBaseName((char*)theBaseName); + SALOMEDS_DriverFactory_i* factory = new SALOMEDS_DriverFactory_i(_orb); + CORBA::Boolean ret = _impl->DumpStudy(aPath, aBaseName, isPublished, factory); + delete factory; + return ret; } diff --git a/src/SALOMEDS/SALOMEDS_Study_i.hxx b/src/SALOMEDS/SALOMEDS_Study_i.hxx index 18b9ef8fb..5e969bd8f 100644 --- a/src/SALOMEDS/SALOMEDS_Study_i.hxx +++ b/src/SALOMEDS/SALOMEDS_Study_i.hxx @@ -1,108 +1,46 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// // File : SALOMEDS_Study_i.hxx -// Author : Yves FRICAUD +// Author : Sergey RUIN // Module : SALOME -// $Header$ #ifndef __SALOMEDS_STUDY_I_H__ #define __SALOMEDS_STUDY_I_H__ // std C++ headers -#include -#include +#include // IDL headers #include +#include CORBA_SERVER_HEADER(SALOME_GenericObj) #include CORBA_SERVER_HEADER(SALOMEDS) -// Cascade headers -#include -#include -#include -#include -#include -#include +#include //SALOMEDS headers -#include "SALOMEDS_DataMapStringLabel.hxx" -#include "SALOMEDS_IORAttribute.hxx" - #include "SALOMEDS_SComponentIterator_i.hxx" -#include "SALOMEDS_ChildIterator_i.hxx" - -class SALOMEDS_StudyManager_i; -class SALOMEDS_UseCaseBuilder_i; -class SALOMEDS_StudyBuilder_i; -class SALOMEDS_SObject_i; - +#include "SALOMEDS_StudyBuilder_i.hxx" +#include "SALOMEDS_SObject_i.hxx" +#include "SALOMEDS_UseCaseBuilder_i.hxx" +#include "SALOMEDS_Callback_i.hxx" -bool operator<(const TDF_Label& theLeft, const TDF_Label& theRight); +#include "SALOMEDSImpl_Study.hxx" +#include "SALOMEDSImpl_AttributeIOR.hxx" - -class SALOMEDS_Study_i: public virtual POA_SALOMEDS::Study, - public virtual PortableServer::RefCountServantBase +class SALOMEDS_Study_i: public POA_SALOMEDS::Study, + public PortableServer::RefCountServantBase { +private: + CORBA::ORB_ptr _orb; + Handle(SALOMEDSImpl_Study) _impl; + SALOMEDS_StudyBuilder_i* _Builder; + SALOMEDS_UseCaseBuilder_i* _UseCaseBuilder; public: - typedef TDF_Label TSObjectID; - typedef std::pair TSObjectHolder; - typedef std::map TSObjectMap; - SALOMEDS_Study_i(SALOMEDS_StudyManager_i* theStudyManager, - const Handle(TDocStd_Document)& theDoc, - const char* theStudyName); + //! standard constructor + SALOMEDS_Study_i(const Handle(SALOMEDSImpl_Study), CORBA::ORB_ptr); + //! standard destructor virtual ~SALOMEDS_Study_i(); - - SALOMEDS_StudyManager_i* GetStudyManager(){ return _StudyManager; } - - Handle(TDocStd_Document) GetDocument(){ return _doc; } - - TSObjectMap& GetSObjectMap(){ return mySObjectMap;} - - CORBA::ORB_var GetORB() const; - - PortableServer::POA_var GetPOA() const; - - SALOMEDS_SObject_i* DownCast(SALOMEDS::SObject_ptr theSObject) const; - - SALOMEDS::Callback_ptr SetOnAddSObject(SALOMEDS::Callback_ptr theCallback); - - SALOMEDS::Callback_ptr SetOnRemoveSObject(SALOMEDS::Callback_ptr theCallback); - - void OnAddSObject(SALOMEDS::SObject_ptr theObject); - - void OnRemoveSObject(SALOMEDS::SObject_ptr theObject); - - void CheckLocked(); - - - virtual char* ConvertObjectToIOR(CORBA::Object_ptr theObject); - - virtual CORBA::Object_ptr ConvertIORToObject(const char* theIOR); - //! method to Get persistent reference of study (idem URL()) /*! \sa URL() @@ -225,20 +163,17 @@ public: \return ChildIterator_ptr arguments, the created ChildIterator */ virtual SALOMEDS::ChildIterator_ptr NewChildIterator(SALOMEDS::SObject_ptr aSO); - SALOMEDS_ChildIterator_i GetChildIterator(SALOMEDS::SObject_ptr theSObject); //! method to Create a SComponentIterator /*! \return SComponentIterator_ptr arguments, the created SComponentIterator */ virtual SALOMEDS::SComponentIterator_ptr NewComponentIterator(); - SALOMEDS_SComponentIterator_i GetComponentIterator(); //! method to Create a StudyBuilder /*! \return StudyBuilder_ptr arguments, the created StudyBuilder */ - SALOMEDS_StudyBuilder_i* GetBuilder(); virtual SALOMEDS::StudyBuilder_ptr NewBuilder(); //! method to get study name @@ -286,7 +221,9 @@ public: virtual CORBA::Short StudyId(); virtual void StudyId(CORBA::Short id); - void IORUpdated(const Handle(SALOMEDS_IORAttribute) theAttribute); + static SALOMEDS::Study_ptr GetStudy(const TDF_Label theLabel, CORBA::ORB_ptr orb); + + static void IORUpdated(const Handle(SALOMEDSImpl_AttributeIOR) theAttribute); virtual void UpdateIORLabelMap(const char* anIOR, const char* aLabel); @@ -298,11 +235,14 @@ public: virtual SALOMEDS::ListOfDates* GetModificationsDate(); + virtual char* ConvertObjectToIOR(CORBA::Object_ptr theObject) {return _orb->object_to_string(theObject); } + virtual CORBA::Object_ptr ConvertIORToObject(const char* theIOR) { return _orb->string_to_object(theIOR); }; + virtual SALOMEDS::UseCaseBuilder_ptr GetUseCaseBuilder(); virtual void Close(); - void EnableUseCaseAutoFilling(CORBA::Boolean isEnabled) { _autoFill = isEnabled; } + void EnableUseCaseAutoFilling(CORBA::Boolean isEnabled) { _impl->EnableUseCaseAutoFilling(isEnabled); } // postponed destroying of CORBA object functionality virtual void AddPostponed(const char* theIOR); @@ -313,46 +253,9 @@ public: // if theUndoLimit==0, removes all virtual void UndoPostponed(const CORBA::Long theWay); // theWay = 1: resurrect objects, // theWay = -1: get back to the list of postponed -private: - friend class SALOMEDS_StudyBuilder_i; - friend class SALOMEDS_SObject_i; - - SALOMEDS_StudyManager_i* _StudyManager; - TSObjectMap mySObjectMap; - - SALOMEDS_UseCaseBuilder_i* _UseCaseBuilder; - SALOMEDS_StudyBuilder_i* _Builder; - SALOMEDS::Callback_var _callbackOnAdd; - SALOMEDS::Callback_var _callbackOnRemove; - - char* _name; - Handle(TDocStd_Document) _doc; // OCAF Document - CORBA::Boolean _isSaved; // True if the Study is saved - char* _URL; //URL of the persistent reference of the study - CORBA::Short _StudyId; - - SALOMEDS_DataMapStringLabel myIORLabels; - - // data structures for postponed destroying of CORBA object functionality - TColStd_SequenceOfAsciiString myPostponedIORs; // ordered set of IORs - TColStd_SequenceOfInteger myNbPostponed; // number of IOR in the each transaction - int myNbUndos; // number of current Undos, made by user - - TDF_Label _current; - bool _autoFill; - - SALOMEDS::SObject_ptr _FindObject(TDF_Label theLabel, - const char* theObjectIOR, - bool& theIsFound); - SALOMEDS::SObject_ptr _FindObjectIOR(TDF_Label theLabel, - const char* theObjectIOR, - bool& theIsFound); - - SALOMEDS_Study_i(); // Not implemented - void operator=(const SALOMEDS_Study_i&); // Not implemented + virtual CORBA::Boolean DumpStudy(const char* thePath, const char* theBaseName, CORBA::Boolean isPublished); + virtual Handle(SALOMEDSImpl_Study) GetImpl() { return _impl; } }; - - #endif diff --git a/src/SALOMEDS/SALOMEDS_UseCaseBuilder_i.cxx b/src/SALOMEDS/SALOMEDS_UseCaseBuilder_i.cxx index c35e2f560..4aca24826 100644 --- a/src/SALOMEDS/SALOMEDS_UseCaseBuilder_i.cxx +++ b/src/SALOMEDS/SALOMEDS_UseCaseBuilder_i.cxx @@ -1,66 +1,25 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// -// // File : SALOMEDS_UseCaseBuilder_i.cxx -// Author : Yves FRICAUD +// Author : Sergey RUIN // Module : SALOME +using namespace std; #include "SALOMEDS_UseCaseBuilder_i.hxx" -#include "SALOMEDS_Study_i.hxx" -#include "SALOMEDS_SObject_i.hxx" #include "SALOMEDS_UseCaseIterator_i.hxx" - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#define USE_CASE_LABEL_TAG 2 -#define USE_CASE_GUID "AA43BB12-D9CD-11d6-945D-0050DA506788" +#include "SALOMEDS_SObject_i.hxx" +#include "SALOMEDS.hxx" #include "utilities.h" -using namespace std; - //============================================================================ /*! Function : constructor * Purpose : */ //============================================================================ -SALOMEDS_UseCaseBuilder_i::SALOMEDS_UseCaseBuilder_i(SALOMEDS_Study_i* theStudy, - const Handle(TDocStd_Document)& theDocument): - _doc(theDocument), - _study(theStudy) +SALOMEDS_UseCaseBuilder_i::SALOMEDS_UseCaseBuilder_i(const Handle(SALOMEDSImpl_UseCaseBuilder)& theImpl, + CORBA::ORB_ptr orb) { - if(_doc.IsNull()) return; - - TDF_Label aLabel = _doc->Main().Root().FindChild(USE_CASE_LABEL_TAG); //Iterate all use cases - if(!aLabel.FindAttribute(Standard_GUID(USE_CASE_GUID), _root)) { - _root = TDataStd_TreeNode::Set(aLabel, Standard_GUID(USE_CASE_GUID)); - } - - Handle(TDF_Reference) aRef; - if(!_root->FindAttribute(TDF_Reference::GetID(), aRef)) { - aRef = TDF_Reference::Set(_root->Label(), _root->Label()); - } - - Handle(TDataStd_Name) aNameAttr; - if(!aLabel.FindAttribute(TDataStd_Name::GetID(), aNameAttr)) { - aNameAttr = TDataStd_Name::Set(aLabel, "Use cases"); - } - + _orb = CORBA::ORB::_duplicate(orb); + _impl = theImpl; } //============================================================================ @@ -73,21 +32,6 @@ SALOMEDS_UseCaseBuilder_i::~SALOMEDS_UseCaseBuilder_i() } -//============================================================================ -CORBA::ORB_var SALOMEDS_UseCaseBuilder_i::GetORB() const -{ - return _study->GetORB(); -} - - -//============================================================================ -PortableServer::POA_var SALOMEDS_UseCaseBuilder_i::GetPOA() const -{ - return _study->GetPOA(); -} - - -//============================================================================ //============================================================================ /*! Function : Append * Purpose : @@ -95,27 +39,9 @@ PortableServer::POA_var SALOMEDS_UseCaseBuilder_i::GetPOA() const //============================================================================ CORBA::Boolean SALOMEDS_UseCaseBuilder_i::Append(SALOMEDS::SObject_ptr theObject) { - if(_root.IsNull() || theObject->_is_nil()) return 0; - - TDF_Label aLabel; - - TDF_Tool::Label(_root->Label().Data(), theObject->GetID(), aLabel); - if(aLabel.IsNull()) return 0; - - Handle(TDataStd_TreeNode) aNode, aCurrentNode; - aNode = TDataStd_TreeNode::Set(aLabel, _root->ID()); - aNode->Remove(); - - Handle(TDF_Reference) aRef; - if(!_root->FindAttribute(TDF_Reference::GetID(), aRef)) { - aRef = TDF_Reference::Set(_root->Label(), _root->Label()); - } - TDF_Label aCurrent = aRef->Get(); - - if(aCurrent.IsNull() || !aCurrent.FindAttribute(_root->ID(), aCurrentNode)) - aCurrentNode = _root; - - return aCurrentNode->Append(aNode); + SALOMEDS::Locker lock; + if(_impl.IsNull() || theObject->_is_nil()) return 0; + return _impl->Append(_impl->GetSObject(theObject->GetID())); } //============================================================================ @@ -125,39 +51,9 @@ CORBA::Boolean SALOMEDS_UseCaseBuilder_i::Append(SALOMEDS::SObject_ptr theObject //============================================================================ CORBA::Boolean SALOMEDS_UseCaseBuilder_i::Remove(SALOMEDS::SObject_ptr theObject) { - if(_root.IsNull() || theObject->_is_nil()) return 0; - - TDF_Label aLabel; - TDF_Tool::Label(_root->Label().Data(), theObject->GetID(), aLabel); - if(aLabel.IsNull()) return 0; - - Handle(TDataStd_TreeNode) aNode; - if(!aLabel.FindAttribute(_root->ID(), aNode)) return 0; - - aNode->Remove(); - - TDF_AttributeList aList; - aList.Append(aNode); - - Handle(TDF_Reference) aRef; - if(!_root->FindAttribute(TDF_Reference::GetID(), aRef)) { - aRef = TDF_Reference::Set(_root->Label(), _root->Label()); - } - TDF_Label aCurrent = aRef->Get(); - - TDataStd_ChildNodeIterator aChildItr(aNode, Standard_True); - for(; aChildItr.More(); aChildItr.Next()) - aList.Append(aChildItr.Value()); - - TDF_ListIteratorOfAttributeList anIterator(aList); - for(; anIterator.More(); anIterator.Next()) { - if(anIterator.Value()->Label() == aCurrent) { //The current node is removed - aRef->Set(_root->Label()); //Reset the current node to the root - } - anIterator.Value()->Label().ForgetAttribute(_root->ID()); - } - - return 1; + SALOMEDS::Locker lock; + if(_impl.IsNull() || theObject->_is_nil()) return 0; + return _impl->Remove(_impl->GetSObject(theObject->GetID())); } @@ -169,24 +65,9 @@ CORBA::Boolean SALOMEDS_UseCaseBuilder_i::Remove(SALOMEDS::SObject_ptr theObject CORBA::Boolean SALOMEDS_UseCaseBuilder_i::AppendTo(SALOMEDS::SObject_ptr theFather, SALOMEDS::SObject_ptr theObject) { - if(_root.IsNull() || theFather->_is_nil() || theObject->_is_nil()) return 0; - - TDF_Label aFatherLabel, aLabel; - Handle(TDataStd_TreeNode) aFather, aNode; - - TDF_Tool::Label(_root->Label().Data(), theFather->GetID(), aFatherLabel); - if(aFatherLabel.IsNull()) return 0; - if(!aFatherLabel.FindAttribute(_root->ID(), aFather)) return 0; - - TDF_Tool::Label(_root->Label().Data(), theObject->GetID(), aLabel); - if(aLabel.IsNull()) return 0; - if(!aLabel.FindAttribute(_root->ID(), aNode)) { - aNode = TDataStd_TreeNode::Set(aLabel, _root->ID()); - } - else - aNode->Remove(); - - return aFather->Append(aNode); + SALOMEDS::Locker lock; + if(_impl.IsNull() || theFather->_is_nil() || theObject->_is_nil()) return 0; + return _impl->AppendTo(_impl->GetSObject(theFather->GetID()), _impl->GetSObject(theObject->GetID())); } //============================================================================ @@ -197,26 +78,9 @@ CORBA::Boolean SALOMEDS_UseCaseBuilder_i::AppendTo(SALOMEDS::SObject_ptr theFath CORBA::Boolean SALOMEDS_UseCaseBuilder_i::InsertBefore(SALOMEDS::SObject_ptr theFirst, SALOMEDS::SObject_ptr theNext) { - if(_root.IsNull() || theFirst->_is_nil() || theNext->_is_nil()) return 0; - - TDF_Label aFirstLabel, aLabel; - Handle(TDataStd_TreeNode) aFirstNode, aNode; - - TDF_Tool::Label(_root->Label().Data(), theFirst->GetID(), aFirstLabel); - if(aFirstLabel.IsNull()) return 0; - if(aFirstLabel.FindAttribute(_root->ID(), aFirstNode)) { - aFirstNode->Remove(); - aFirstLabel.ForgetAttribute(aFirstNode->ID()); - } - - aFirstNode = TDataStd_TreeNode::Set(aFirstLabel, _root->ID()); - - - TDF_Tool::Label(_root->Label().Data(), theNext->GetID(), aLabel); - if(aLabel.IsNull()) return 0; - if(!aLabel.FindAttribute(_root->ID(), aNode)) return 0; - - return aNode->InsertBefore(aFirstNode); + SALOMEDS::Locker lock; + if(_impl.IsNull() || theFirst->_is_nil() || theNext->_is_nil()) return 0; + return _impl->AppendTo(_impl->GetSObject(theFirst->GetID()), _impl->GetSObject(theNext->GetID())); } @@ -227,23 +91,9 @@ CORBA::Boolean SALOMEDS_UseCaseBuilder_i::InsertBefore(SALOMEDS::SObject_ptr the //============================================================================ CORBA::Boolean SALOMEDS_UseCaseBuilder_i::SetCurrentObject(SALOMEDS::SObject_ptr theObject) { - if(_root.IsNull() || theObject->_is_nil()) return 0; - - TDF_Label aLabel; - Handle(TDataStd_TreeNode) aNode; - TDF_Tool::Label(_root->Label().Data(), theObject->GetID(), aLabel); - if(aLabel.IsNull()) return 0; - if(!aLabel.FindAttribute(_root->ID(), aNode)) return 0; - - - Handle(TDF_Reference) aRef; - if(!_root->FindAttribute(TDF_Reference::GetID(), aRef)) { - aRef = TDF_Reference::Set(_root->Label(), aNode->Label()); - } - - aRef->Set(aNode->Label()); - - return 1; + SALOMEDS::Locker lock; + if(_impl.IsNull() || theObject->_is_nil()) return 0; + return _impl->SetCurrentObject(_impl->GetSObject(theObject->GetID())); } //============================================================================ @@ -253,14 +103,9 @@ CORBA::Boolean SALOMEDS_UseCaseBuilder_i::SetCurrentObject(SALOMEDS::SObject_ptr //============================================================================ CORBA::Boolean SALOMEDS_UseCaseBuilder_i::SetRootCurrent() { - if(_root.IsNull()) return 0; - - Handle(TDF_Reference) aRef; - if(!_root->FindAttribute(TDF_Reference::GetID(), aRef)) - aRef = TDF_Reference::Set(_root->Label(), _root->Label()); - - aRef->Set(_root->Label()); - return 1; + SALOMEDS::Locker lock; + if(_impl.IsNull()) return 0; + return _impl->SetRootCurrent(); } //============================================================================ @@ -270,17 +115,9 @@ CORBA::Boolean SALOMEDS_UseCaseBuilder_i::SetRootCurrent() //============================================================================ CORBA::Boolean SALOMEDS_UseCaseBuilder_i::HasChildren(SALOMEDS::SObject_ptr theObject) { - if(_root.IsNull()) return 0; - - TDF_Label aLabel; - if (theObject->_is_nil()) aLabel = _root->Label(); - else TDF_Tool::Label(_root->Label().Data(), theObject->GetID(), aLabel); - if(aLabel.IsNull()) return 0; - - Handle(TDataStd_TreeNode) aNode; - if(!aLabel.FindAttribute(_root->ID(), aNode)) return 0; - - return !(aNode->First().IsNull()); + SALOMEDS::Locker lock; + if(_impl.IsNull()) return 0; + return _impl->HasChildren(_impl->GetSObject(theObject->GetID())); } //============================================================================ @@ -288,18 +125,11 @@ CORBA::Boolean SALOMEDS_UseCaseBuilder_i::HasChildren(SALOMEDS::SObject_ptr theO * Purpose : */ //============================================================================ -CORBA::Boolean SALOMEDS_UseCaseBuilder_i::SetName(const char* theName) { - if(_root.IsNull()) return 0; - - Handle(TDataStd_Name) aNameAttrib; - TCollection_ExtendedString aName(const_cast(theName)); - - if (!_root->FindAttribute(TDataStd_Name::GetID(), aNameAttrib)) - aNameAttrib = TDataStd_Name::Set(_root->Label(), aName); - else - aNameAttrib->Set(aName); - - return 1; +CORBA::Boolean SALOMEDS_UseCaseBuilder_i::SetName(const char* theName) +{ + SALOMEDS::Locker lock; + if(_impl.IsNull()) return 0; + return _impl->SetName((char*)theName); } @@ -310,16 +140,13 @@ CORBA::Boolean SALOMEDS_UseCaseBuilder_i::SetName(const char* theName) { //============================================================================ SALOMEDS::SObject_ptr SALOMEDS_UseCaseBuilder_i::GetCurrentObject() { - if(_root.IsNull()) return NULL; - - Handle(TDF_Reference) aRef; - if(!_root->FindAttribute(TDF_Reference::GetID(), aRef)) { - aRef = TDF_Reference::Set(_root->Label(), _root->Label()); - } - TDF_Label aCurrent = aRef->Get(); - if(aCurrent.IsNull()) return NULL; - - return SALOMEDS_SObject_i::NewRef(_study,aCurrent)._retn(); + SALOMEDS::Locker lock; + + if(_impl.IsNull()) return NULL; + Handle(SALOMEDSImpl_SObject) aSO = _impl->GetCurrentObject(); + SALOMEDS_SObject_i * so_servant = new SALOMEDS_SObject_i (aSO, _orb); + SALOMEDS::SObject_var so = SALOMEDS::SObject::_narrow(so_servant->_this()); + return so._retn(); } //============================================================================ @@ -327,14 +154,10 @@ SALOMEDS::SObject_ptr SALOMEDS_UseCaseBuilder_i::GetCurrentObject() * Purpose : */ //============================================================================ -char* SALOMEDS_UseCaseBuilder_i::GetName() { - CORBA::String_var aString; - if(_root.IsNull()) return aString._retn(); - - Handle(TDataStd_Name) aName; - if (!_root->FindAttribute(TDataStd_Name::GetID(), aName)) return aString._retn(); - aString = CORBA::string_dup(TCollection_AsciiString(aName->Get()).ToCString()); - return aString._retn(); +char* SALOMEDS_UseCaseBuilder_i::GetName() +{ + SALOMEDS::Locker lock; + return CORBA::string_dup(_impl->GetName().ToCString()); } //============================================================================ @@ -344,12 +167,10 @@ char* SALOMEDS_UseCaseBuilder_i::GetName() { //============================================================================ CORBA::Boolean SALOMEDS_UseCaseBuilder_i::IsUseCase(SALOMEDS::SObject_ptr theObject) { - if(theObject->_is_nil()) return false; - TDF_Label aFather, aLabel; - TDF_Tool::Label(_doc->GetData(), theObject->GetID(), aLabel); - aFather = _doc->Main().Root().FindChild(USE_CASE_LABEL_TAG); - if(aLabel.Father() == aFather) return true; - return false; + SALOMEDS::Locker lock; + + if(_impl.IsNull() || theObject->_is_nil()) return false; + return _impl->IsUseCase(_impl->GetSObject(theObject->GetID())); } //============================================================================ @@ -359,36 +180,13 @@ CORBA::Boolean SALOMEDS_UseCaseBuilder_i::IsUseCase(SALOMEDS::SObject_ptr theObj //============================================================================ SALOMEDS::SObject_ptr SALOMEDS_UseCaseBuilder_i::AddUseCase(const char* theName) { - Standard_GUID aBasicGUID(USE_CASE_GUID); - - //Create a use cases structure if it not exists - - Handle(TDataStd_TreeNode) aFatherNode, aNode; - Handle(TDataStd_Integer) anInteger; - Handle(TDF_Reference) aRef; - - TDF_Label aLabel = _doc->Main().Root().FindChild(USE_CASE_LABEL_TAG); - - if(!_root->FindAttribute(TDF_Reference::GetID(), aRef)) { - aRef = TDF_Reference::Set(aLabel, aLabel); - } - - if(!aRef->Get().FindAttribute(aBasicGUID, aFatherNode)) { - aFatherNode = TDataStd_TreeNode::Set(aRef->Get()); - } - - if(!_root->FindAttribute(TDataStd_Integer::GetID(), anInteger)) { - anInteger = TDataStd_Integer::Set(aLabel, 0); - } - - //Create a new use case - anInteger->Set(anInteger->Get()+1); - TDF_Label aChild = aLabel.FindChild(anInteger->Get()); - aNode = TDataStd_TreeNode::Set(aChild, aBasicGUID); - aFatherNode->Append(aNode); - TDataStd_Name::Set(aChild, TCollection_ExtendedString(const_cast(theName))); - - return SALOMEDS_SObject_i::NewRef(_study,aChild)._retn(); + SALOMEDS::Locker lock; + + if(_impl.IsNull()) return SALOMEDS::SObject::_nil(); + Handle(SALOMEDSImpl_SObject) aSO = _impl->AddUseCase((char*)theName); + SALOMEDS_SObject_i * so_servant = new SALOMEDS_SObject_i (aSO, _orb); + SALOMEDS::SObject_var so = SALOMEDS::SObject::_narrow(so_servant->_this()); + return so._retn(); } //============================================================================ @@ -396,17 +194,13 @@ SALOMEDS::SObject_ptr SALOMEDS_UseCaseBuilder_i::AddUseCase(const char* theName) * Purpose : Creates a new UseCase iterator, if anObject is null all use cases are iterated */ //============================================================================ -SALOMEDS::UseCaseIterator_ptr SALOMEDS_UseCaseBuilder_i::GetUseCaseIterator(SALOMEDS::SObject_ptr anObject) +SALOMEDS::UseCaseIterator_ptr SALOMEDS_UseCaseBuilder_i::GetUseCaseIterator(SALOMEDS::SObject_ptr theObject) { - TDF_Label aLabel; - - if(!anObject->_is_nil()) { - TDF_Tool::Label(_doc->GetData(), anObject->GetID(), aLabel); //Iterate only sub tree in the use case - } - else { - aLabel = _doc->Main().Root().FindChild(USE_CASE_LABEL_TAG); //Iterate all use cases - } - - SALOMEDS_UseCaseIterator_i* aServant = new SALOMEDS_UseCaseIterator_i(_study,aLabel,USE_CASE_GUID,Standard_False); - return aServant->_this(); + SALOMEDS::Locker lock; + + if(_impl.IsNull()) return SALOMEDS::UseCaseIterator::_nil(); + Handle(SALOMEDSImpl_UseCaseIterator) anItr = _impl->GetUseCaseIterator(_impl->GetSObject(theObject->GetID())); + SALOMEDS_UseCaseIterator_i* aServant = new SALOMEDS_UseCaseIterator_i(anItr, _orb); + SALOMEDS::UseCaseIterator_var anIterator = SALOMEDS::UseCaseIterator::_narrow(aServant->_this()); + return anIterator._retn(); } diff --git a/src/SALOMEDS/SALOMEDS_UseCaseBuilder_i.hxx b/src/SALOMEDS/SALOMEDS_UseCaseBuilder_i.hxx index 796c80379..cb99539bd 100644 --- a/src/SALOMEDS/SALOMEDS_UseCaseBuilder_i.hxx +++ b/src/SALOMEDS/SALOMEDS_UseCaseBuilder_i.hxx @@ -1,47 +1,42 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// -// // File : SALOMEDS_UseCaseBuilder_i.hxx -// Author : Yves FRICAUD +// Author : Sergey RUIN // Module : SALOME #ifndef __SALOMEDS_USECaseBuilder_I_H__ #define __SALOMEDS_USECaseBuilder_I_H__ +// std C++ headers +#include + // IDL headers #include #include CORBA_SERVER_HEADER(SALOMEDS) #include CORBA_SERVER_HEADER(SALOMEDS_Attributes) // Cascade headers -#include -#include +#include +#include -class SALOMEDS_Study_i; +#include "SALOMEDSImpl_UseCaseIterator.hxx" +#include "SALOMEDSImpl_UseCaseBuilder.hxx" class SALOMEDS_UseCaseBuilder_i: public POA_SALOMEDS::UseCaseBuilder, public PortableServer::RefCountServantBase { - SALOMEDS_UseCaseBuilder_i(); // Not implemented - void operator=(const SALOMEDS_UseCaseBuilder_i&); // Not implemented - private: - Handle(TDataStd_TreeNode) _root; - Handle(TDocStd_Document) _doc; - SALOMEDS_Study_i* _study; + + CORBA::ORB_ptr _orb; + Handle(SALOMEDSImpl_UseCaseBuilder) _impl; public: - SALOMEDS_UseCaseBuilder_i(SALOMEDS_Study_i* theStudy, - const Handle(TDocStd_Document)& theDocument); + + //! standard constructor + SALOMEDS_UseCaseBuilder_i(const Handle(SALOMEDSImpl_UseCaseBuilder)& theDocument, + CORBA::ORB_ptr); + //! standard destructor ~SALOMEDS_UseCaseBuilder_i(); - CORBA::ORB_var GetORB() const; - PortableServer::POA_var GetPOA() const; - virtual CORBA::Boolean Append(SALOMEDS::SObject_ptr theObject); virtual CORBA::Boolean Remove(SALOMEDS::SObject_ptr theObject); diff --git a/src/SALOMEDS/SALOMEDS_UseCaseIterator_i.cxx b/src/SALOMEDS/SALOMEDS_UseCaseIterator_i.cxx index 38dbd0568..fc99c72d6 100644 --- a/src/SALOMEDS/SALOMEDS_UseCaseIterator_i.cxx +++ b/src/SALOMEDS/SALOMEDS_UseCaseIterator_i.cxx @@ -1,36 +1,25 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// -// // File : SALOMEDS_UseCaseIterator_i.cxx -// Author : Yves FRICAUD +// Author : Sergey RUIN // Module : SALOME using namespace std; #include "SALOMEDS_UseCaseIterator_i.hxx" #include "SALOMEDS_SObject_i.hxx" -#include "utilities.h" - +#include "SALOMEDS.hxx" +#include "SALOMEDSImpl_SObject.hxx" +#include "utilities.h" //============================================================================ /*! Function : constructor * Purpose : */ //============================================================================ -SALOMEDS_UseCaseIterator_i::SALOMEDS_UseCaseIterator_i(SALOMEDS_Study_i* theStudy, - const TDF_Label& theLabel, - const Standard_GUID& theGUID, - const Standard_Boolean theIsAllLevels): - _guid(theGUID), - _levels(theIsAllLevels), - _study(theStudy) +SALOMEDS_UseCaseIterator_i::SALOMEDS_UseCaseIterator_i(const Handle(SALOMEDSImpl_UseCaseIterator)& theImpl, + CORBA::ORB_ptr orb) { - if(theLabel.FindAttribute(_guid, _node)) { - _it.Initialize (_node, _levels); - } + _orb = CORBA::ORB::_duplicate(orb); + _impl = theImpl; } //============================================================================ @@ -49,7 +38,8 @@ SALOMEDS_UseCaseIterator_i::~SALOMEDS_UseCaseIterator_i() //============================================================================ void SALOMEDS_UseCaseIterator_i::Init(CORBA::Boolean allLevels) { - _it.Initialize (_node, allLevels); + SALOMEDS::Locker lock; + _impl->Init(allLevels); } //============================================================================ @@ -59,17 +49,19 @@ void SALOMEDS_UseCaseIterator_i::Init(CORBA::Boolean allLevels) //============================================================================ CORBA::Boolean SALOMEDS_UseCaseIterator_i::More() { - return _it.More(); + SALOMEDS::Locker lock; + return _impl->More(); } - //============================================================================ +//============================================================================ /*! Function : Next * */ //============================================================================ void SALOMEDS_UseCaseIterator_i::Next() { - _it.Next(); + SALOMEDS::Locker lock; + _impl->Next(); } @@ -78,10 +70,12 @@ void SALOMEDS_UseCaseIterator_i::Next() * Purpose : */ //============================================================================ - SALOMEDS::SObject_ptr SALOMEDS_UseCaseIterator_i::Value() { - TDF_Label L = _it.Value()->Label(); - return SALOMEDS_SObject_i::NewRef(_study,L)._retn(); + SALOMEDS::Locker lock; + Handle(SALOMEDSImpl_SObject) aSO = _impl->Value(); + SALOMEDS_SObject_i * so_servant = new SALOMEDS_SObject_i (aSO, _orb); + SALOMEDS::SObject_var so = SALOMEDS::SObject::_narrow(so_servant->_this()); + return so._retn(); } diff --git a/src/SALOMEDS/SALOMEDS_UseCaseIterator_i.hxx b/src/SALOMEDS/SALOMEDS_UseCaseIterator_i.hxx index 3e1777207..aee6cb52e 100644 --- a/src/SALOMEDS/SALOMEDS_UseCaseIterator_i.hxx +++ b/src/SALOMEDS/SALOMEDS_UseCaseIterator_i.hxx @@ -1,46 +1,31 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// -// // File : SALOMEDS_UseCaseIterator_i.hxx -// Author : Yves FRICAUD +// Author : Sergey RUIN // Module : SALOME #ifndef __SALOMEDS_USECASEITERATOR_I_H__ #define __SALOMEDS_USECASEITERATOR_I_H__ +// std C++ headers +#include + // IDL headers #include #include CORBA_SERVER_HEADER(SALOMEDS) -// Cascade headers -#include -#include -#include - -class SALOMEDS_Study_i; +#include "SALOMEDSImpl_UseCaseIterator.hxx" class SALOMEDS_UseCaseIterator_i: public POA_SALOMEDS::UseCaseIterator, public PortableServer::RefCountServantBase { - SALOMEDS_UseCaseIterator_i(); // Not implemented - void operator=(const SALOMEDS_UseCaseIterator_i&); // Not implemented - private: - Standard_GUID _guid; - Standard_Boolean _levels; - Handle(TDataStd_TreeNode) _node; - TDataStd_ChildNodeIterator _it; - SALOMEDS_Study_i* _study; + CORBA::ORB_ptr _orb; + Handle(SALOMEDSImpl_UseCaseIterator) _impl; public: + //! standard constructor - SALOMEDS_UseCaseIterator_i(SALOMEDS_Study_i* theStudy, - const TDF_Label& theLabel, - const Standard_GUID& theGUID, - const Standard_Boolean theIsAllLevels); + SALOMEDS_UseCaseIterator_i(const Handle(SALOMEDSImpl_UseCaseIterator)& theImpl, + CORBA::ORB_ptr); //! standard destructor ~SALOMEDS_UseCaseIterator_i(); @@ -50,6 +35,4 @@ public: virtual void Next(); virtual SALOMEDS::SObject_ptr Value(); }; - - #endif -- 2.39.2