From 9e3a9049fd3b6a2f8600ee04cfde0ec860a3c3c6 Mon Sep 17 00:00:00 2001 From: prascle Date: Tue, 14 Oct 2003 11:34:32 +0000 Subject: [PATCH] import SalomePro v1.2c --- idl/Logger.idl | 1 + idl/Makefile.in | 57 +++++- idl/SALOMEDS.idl | 382 +++-------------------------------- idl/SALOME_Component.idl | 4 +- idl/SALOME_Exception.idl | 14 +- idl/SALOME_ModuleCatalog.idl | 7 +- idl/SALOME_Session.idl | 5 +- 7 files changed, 96 insertions(+), 374 deletions(-) diff --git a/idl/Logger.idl b/idl/Logger.idl index d58070da2..c30b5e22f 100644 --- a/idl/Logger.idl +++ b/idl/Logger.idl @@ -16,6 +16,7 @@ module SALOME_Logger { //put message into one special place for all servers using Logger oneway void putMessage (in string message); + void ping (); }; }; diff --git a/idl/Makefile.in b/idl/Makefile.in index 68cb40756..f9c23f5f5 100644 --- a/idl/Makefile.in +++ b/idl/Makefile.in @@ -1,8 +1,27 @@ +# 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 # -# generate dependencies for idl file : # +# +# File : Makefile.in +# Module : idl -# source path top_srcdir=@top_srcdir@ top_builddir=.. srcdir=@srcdir@ @@ -11,34 +30,56 @@ VPATH=.:$(srcdir) @COMMENCE@ IDL_FILES = \ + GEOM_Gen.idl \ SALOME_Exception.idl \ SALOME_ModuleCatalog.idl \ SALOME_DataTypeCatalog.idl \ SALOME_RessourcesCatalog.idl \ + GEOM_Shape.idl \ SALOMEDS.idl \ SALOMEDS_Attributes.idl \ SALOME_Session.idl \ SALOME_Component.idl \ SALOME_TestComponent.idl \ + SUPERV.idl \ SALOME_Registry.idl \ + MED.idl \ + Med_Gen.idl \ + AddComponent.idl \ + DivComponent.idl \ + FactorialComponent.idl \ + MulComponent.idl \ + SubComponent.idl \ + SyrComponent.idl \ + SyrControlComponent.idl \ + TypesCheck.idl \ TypeData.idl \ MPIObject.idl \ MPIContainer.idl \ - Logger.idl + NPVecComponent.idl \ + NPMatComponent.idl \ + NPSolveComponent.idl \ + SMESH_Gen.idl \ + SMESH_Mesh.idl \ + SMESH_Hypothesis.idl \ + SMESH_BasicHypothesis.idl \ + Calculator.idl \ + Logger.idl \ + VISU_Gen.idl PY_CLIENT_IDL = $(IDL_FILES) -# we copy all idl file in $(top_builddir)/idl -inc: $(IDL_FILES:%=$(top_builddir)/idl/%) +# we copy all idl file in $(top_builddir)/share/salome/idl +inc: $(IDL_FILES:%=$(top_builddir)/share/salome/idl/%) -$(IDL_FILES:%=$(top_builddir)/idl/%):$(top_builddir)/idl/%:% +$(IDL_FILES:%=$(top_builddir)/share/salome/idl/%):$(top_builddir)/share/salome/idl/%:% # $(CP) $< $@ cp -f $< $@ lib: pyidl -PYTHON_BUILD_SITE=$(top_builddir)/lib/python$(PYTHON_VERSION)/site-packages/@PACKAGE@ +PYTHON_BUILD_SITE=$(top_builddir)/lib/python$(PYTHON_VERSION)/site-packages/salome pyidl: $(PYTHON_BUILD_SITE) $(IDL_FILES:%.idl=$(PYTHON_BUILD_SITE)/%_idl.py) @@ -73,6 +114,6 @@ cleandep: distclean: -$(RM) *.py - -$(RM) $(IDL_FILES:%=$(top_builddir)/idl/%) + -$(RM) $(IDL_FILES:%=$(top_builddir)/share/salome/idl/%) -$(RM) Makefile diff --git a/idl/SALOMEDS.idl b/idl/SALOMEDS.idl index 5fcb8c16a..ed5f15d54 100644 --- a/idl/SALOMEDS.idl +++ b/idl/SALOMEDS.idl @@ -9,7 +9,7 @@ // 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. +// 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 @@ -24,347 +24,7 @@ // $Header$ /*! \mainpage - \image html Application-About.png - -*/ -/*! \page page1 Mapping of IDL definitions to Python language. -\section Intro Introduction -%SALOME PRO is a distributed client/server application using the Common Object Request Broker Architecture (CORBA). -CORBA architecture uses the Interface Definition Language (IDL), which specifies interfaces between CORBA objects. So with help of IDL -CORBA's language independence is ensured . Because interfaces described in IDL can be mapped to the most of currently used programming languages, CORBA applications and components are thus -independent of the language(s) used to implement them. In other words, a client written in C++ can communicate with a server written in Java, which in turn can communicate with -another server written in COBOL, and so forth. - -One important thing to remember about IDL is that it is not an implementation language. That is, applications can't be written in IDL. The sole purpose of IDL is to define interfaces; -providing implementations for these interfaces is performed using some other language. - -This page contains an abridged reference manual for mapping of IDL definitions to Python language. It will be useful for Python programmers who are not familiar -with IDL language. All examples are taken from %SALOME PRO source files. -The complete version of Python Language Mapping Specification can be found here. - -
CONTENTS: -- \ref subsection1 -- \ref subsection2 -- \ref subsection3 -- \ref subsection4 -- \ref subsection5 -- \ref subsection6 -- \ref subsection7 - -\subsection subsection1 Using Scoped Names - -Python implements a module concept that is similar to the IDL scoping mechanisms, -except that it does not allow for nested modules. In addition, Python requires each -object to be implemented in a module; globally visible objects are not supported. - -Because of these constraints, scoped names are translated into Python using the -following rules: - -• An IDL module mapped into a Python module. Modules containing modules are -mapped to packages (i.e., directories with an __init__ module containing all -definitions excluding the nested modules). An implementation can chose to map toplevel -definitions (including the module CORBA) to modules in an implementationdefined -package, to allow concurrent installations of different CORBA runtime -libraries. In that case, the implementation must provide additional modules so that -toplevel modules can be used without importing them from a package. - -• For all other scopes, a Python class is introduced that contains all the definitions -inside this scope. - -• Other global definitions (except modules) appear in a module whose name is -implementation dependent. Implementations are encouraged to use the name of the -IDL file when defining the name of that module. - -For instance, - -\verbatim -module SALOMEDS { - interface StudyManager { - void Close(in Study aStudy); - }; -}; -\endverbatim - -would introduce a module SALOMEDS.py, which contains the following definitions: - -\verbatim -# module SALOMEDS.py -class StudyManager: - def _Close(self,aStudy): - pass #interfaces are discussed later -\endverbatim - -To avoid conflicts, IDL names that are also Python identifiers are prefixed with an underscore (‘_’). - -\subsection subsection2 Mapping for Template and Array Types - -Both the bounded and the unbounded string type of IDL are mapped to the Python -string type. Wide strings are represented by an implementation-defined type with the -following properties: - -• For the wide string X and the integer n, X[n] returns the nth character, which is a -wide string of length 1. - -• len(X) returns the number of characters of wide string X. - -• CORBA.wstr(c) returns a wide character with the code point c in an -implementation-defined encoding. - -• X+Y returns the concatenation of wide strings X and Y. - -• CORBA.word(CORBA.wstr(c)) == c - -The sequence template is mapped to sequence objects (e.g., tuples or lists). -Applications should not assume that values of a sequence type are mutable. Sequences -and arrays of octets and characters are mapped to the string type for efficiency reasons. - -For example, given the IDL definitions - -\verbatim -module SALOMEDS { - typedef sequence StringSeq; - - interface AttributeTableOfInteger : GenericAttribute { - - void SetRowTitles(in StringSeq theTitles) raises(IncorrectArgumentLength); - }; -}; -\endverbatim - -a client could invoke the operation - -\verbatim -print My_AttributeTableOfInteger.SetRowTitles(["X","F"]) -\endverbatim - -Array types are mapped like sequence templates. The application in this example also expects an -IncorrectArgumentLength exception if it passes sequences that violate the bounds constraint or -arrays of wrong size. - -Another example with arrays. The following IDL definition - -\verbatim -module SALOMEDS { - typedef sequence ListOfAttributes; - interface SObject { - ListOfAttributes GetAllAttributes(); - }; -}; -\endverbatim - -is equal to - -\verbatim -import SALOMEDS - -attributes=[] - -attributes = My_SObject.GetAllAttributes() - -length = len(attributes) - -print "Attributes number = ", length -print attributes -\endverbatim - -\subsection subsection3 Mapping for Objects and Operations - -A CORBA object reference is represented as a Python object at run-time. This object -provides all the operations that are available on the interface of the object. Although -this specification does not mandate the use of classes for stub objects, the following -discussion uses classes to indicate the interface. - -The nil object is represented by None. - -If an operation expects parameters of the IDL Object type, any Python object -representing an object reference might be passed as actual argument. - -If an operation expects a parameter of an abstract interface, either an object -implementing that interface, or a value supporting this interface may be passed as -actual argument. The semantics of abstract values then define whether the argument is -passed by value or by reference. - -Operations of an interface map to methods available on the object references. -Parameters with a parameter attribute of in or inout -are passed from left to right tothe method, skipping out parameters. -The return value of a method depends on the number of out parameters -and the return type. If the operation returns a value, this -value forms the first result value. All inout or out -parameters form consecutive result values. The method result depends then on the number -of result values: - -• If there is no result value, the method returns None. - -• If there is exactly one result value, it is returned as a single value. - -• If there is more than one result value, all of them are packed into a tuple, and this -tuple is returned. - -Assuming the IDL definition - -\verbatim -module SALOMEDS{ - interface StudyBuilder{ - boolean FindAttribute ( in SObject anObject, - out GenericAttribute anAttribute, - in string aTypeOfAttribute ); - }; -}; -\endverbatim - -a client could write - -\verbatim -from SALOMEDS import StudyBuilder; -my_StudyBuilder=... - - res,A=my_StudyBuilder.FindAttribute(Sobj, "AttributeSequenceOfReal") -\endverbatim - -In this example A corresponds to the return value anAttribute and -res to the boolean return value. - -If an interface defines an attribute name, for example, the attribute is mapped into an -operation _get_name. If the attribute is not readonly, there is an -additional operation _set_name. - -The IDL definition - -\verbatim -module SALOMEDS{ - interface Study{ - attribute string Name; - }; -}; -\endverbatim - -is equal to the following - -\verbatim -from SALOMEDS import Study -My_Study=... - Name=My_Study._get_name(); - Name=My_Study._set_name(); -\endverbatim - -\subsection subsection4 Narrowing Object References - -Python objects returned from CORBA operations or pseudo-operations (such as -string_to_object) might have a dynamic type, which is more specific than the -static type as defined in the operation signature. - -Since there is no efficient and reliable way of automatically creating the most specific -type, explicit narrowing is necessary. To narrow an object reference A to an interface -class AttributeSequenceOfReal, the client can use the following operation - -\verbatim -A = A._narrow(SALOMEDS.AttributeSequenceOfReal) -\endverbatim - -\subsection subsection5 Mapping for Exceptions - -An IDL exception is translated into a Python class derived from -CORBA.UserException. System exceptions are derived from CORBA.SystemException. -Both base classes are derived from CORBA.Exception. The parameters of the -exception are mapped in the same way as the fields of a struct definition. When -raising an exception, a new instance of the class is created; the constructor -expects the exception parameters. For example, the definition - -\verbatim -module SALOMEDS{ - interface StudyBuilder{ - exception LockProtection {}; - void CommitCommand() raises(LockProtection); - }; -}; -\endverbatim - -could be used caught as - -\verbatim -from SALOMEDS import StudyBuilder; -my_StudyBuilder=... -try: - my_StudyBuilder.CommitCommand(); -except StudyBuilder.LockProtection,value: - print "Error! Study is locked for modifications" -\endverbatim - - -\subsection subsection6 Mapping for Enumeration Types - -An enumeration is mapped into a number of constant objects in the name space where -the enumeration is defined. An application may only test for equivalence of two -enumeration values, and not assume that they behave like numbers. -For example, the definition - -\verbatim -module VISU { - interface PrsObject{ - - enum PrsObjType{ TCURVE, TTABLE, TMESH, TCONTAINER, - TSCALARMAP, TISOSURFACE, TDEFORMEDSHAPE, - TCUTPLANES, TVECTORS }; - }; -}; -\endverbatim - -introduces the objects - -\verbatim -from VISU import PrsObject -VISU.PrsObjType.TCURVE,VISU.PrsObjType.TTABLE,VISU.PrsObjType.TMESH,VISU.PrsObjType.TCONTAINER, -VISU.PrsObjType.TSCALARMAP,VISU.PrsObjType.TISOSURFACE,VISU.PrsObjType.TDEFORMEDSHAPE,VISU.PrsObjType.TCUTPLANES, -VISU.PrsObjType.TVECTORS -\endverbatim - -\subsection subsection7 Mapping for Structured Types - -An IDL struct definition is mapped into a Python class or type. For each field in the -struct, there is a corresponding attribute in the class with the same name as the field. -The constructor of the class expects the field values, from left to right. -For example, the IDL definition - -\verbatim -struct SDate { - short Second; - short Minute; - short Hour; - short Day; - short Month; - short Year; - }; -\endverbatim - -could be used in the Python statements - -\verbatim -Date=SDate(30, 12, 15, 26, 1, 79) -print Date.Second,Date.Minute,Date.Hour,Date.Day,Date.Month,Date.Year -\endverbatim -*/ -/*! \page page2 Mapping of SALOME IDL definitions to Python language. - - - - %SALOME STUDY module - - Mapping of %SALOMEDS functions - - Mapping of SALOMEDS_Attributes functions - - %SAlOME KERNEL module - - Mapping of %Med_Gen functions - - Mapping of %SALOME_Session functions - - Mapping of %SALOME_ModuleCatalog functions - - Mapping of %SALOME_Exception functions - - Mapping of %SALOME_Component functions - - %SALOME MED component - - Mapping of %Med functions - - %SALOME SUPERVISION module - - Mapping of %SUPERV functions - - %SALOME %VISU module - - Mapping of %VISU_Gen functions - -*/ - -/*! \defgroup Study SALOME STUDY module + \image html Application-About.png */ /*! @@ -377,7 +37,7 @@ print Date.Second,Date.Minute,Date.Hour,Date.Day,Date.Month,Date.Year #include "SALOME_Exception.idl" -/*! \ingroup Study +/*! This package contains the interfaces used for creation, managment and modification of the %Study */ @@ -400,7 +60,10 @@ module SALOMEDS /*! IOR of the study in %SALOME application */ typedef string SalomeReference; -/*! List of names of open studies in a %SALOME session + +/*! List of the names of studies which are currently open in this %SALOME session. +Since %SALOME is a multi-study application, it allows to open a lot of studies +during each working session. */ typedef sequence ListOfOpenStudies; /*! List of file names @@ -436,10 +99,12 @@ module SALOMEDS interface UseCaseIterator; interface UseCaseBuilder; interface Callback; + /*! List of attributes */ typedef sequence ListOfAttributes; -/*! Exception indicating that this feature hasn't been implemented + +/*! Exception indicating that this feature hasn't been implemented. */ exception NotImplemented {}; @@ -489,7 +154,7 @@ module SALOMEDS */ typedef sequence ListOfSObject; /*! - Gets a persistent reference to the %Study. + Gets the persistent reference to the %Study. */ PersistentReference GetPersistentReference(); /*! @@ -901,24 +566,35 @@ module SALOMEDS Closes the study. */ void Close(in Study aStudy); -/*! \brief Saving the study +/*! \brief Saving the study in a HDF file (or files). Saves the study. + \param theMultiFile If this parameter is True the study will be saved in several files.
See also an example of this method usage in batchmode of %SALOME application. */ void Save(in Study aStudy, in boolean theMultiFile); +/*! \brief Saving the study in a ASCII file (or files). + Saves the study in a ASCII format. + \param theMultiFile If this parameter is True the study will be saved in several files. +*/ void SaveASCII(in Study aStudy, in boolean theMultiFile); -/*! \brief Saving the study in a file +/*! \brief Saving the study in a specified HDF file (or files). + + Saves the study in a specified file (or files). + \param theMultiFile If this parameter is True the study will be saved in several files. - Saves the study in a specified file.
See also an example of this method usage in batchmode of %SALOME application. */ void SaveAs(in URL aUrl, // if the file already exists in Study aStudy, in boolean theMultiFile); // overwrite (as option) +/*! \brief Saving the study in a specified ASCII file (or files). + Saves the study in a specified ASCII file (or files). + \param theMultiFile If this parameter is True the study will be saved in several files. +*/ void SaveAsASCII(in URL aUrl, // if the file already exists in Study aStudy, in boolean theMultiFile); // overwrite (as option) @@ -1039,8 +715,7 @@ module SALOMEDS //========================================================================== /*! \brief %Generic attribute interface - %Generic attribute is a base interface for all attributes which inherit - its methods. + %Generic attribute is a base interface for all attributes which can be assigned to the SObjects created in the study. */ //========================================================================== interface GenericAttribute @@ -1063,6 +738,7 @@ module SALOMEDS //========================================================================== /*! \brief %SComponent interface + The %SComponent interface establishes in the study a permanent assocition to the Components integrated into %SALOME platform. The %SComponent interface is a specialization of the %SObject interface. It inherits the most of its methods from the %SObject interface. */ @@ -1240,7 +916,7 @@ Activates the %UseCaseIterator. If allLevels is True the Iterator is }; //========================================================================== //========================================================================== -/*! \brief The callback interface +/*! \brief The callback interface The %StudyBuilder can be created with the method NewBuilder. While invocation of this method a new object of the class Callback is created and this object is assigned to the newly created Builder as callback which should be called when adding and removing of the ojects. @@ -1367,5 +1043,5 @@ Activates the %UseCaseIterator. If allLevels is True the Iterator is }; }; - + #endif diff --git a/idl/SALOME_Component.idl b/idl/SALOME_Component.idl index 085bf919b..391112dfd 100644 --- a/idl/SALOME_Component.idl +++ b/idl/SALOME_Component.idl @@ -25,7 +25,7 @@ #ifndef _SALOME_COMPONENT_IDL_ #define _SALOME_COMPONENT_IDL_ -/*! \ingroup Kernel +/*! This is a package of interfaces used for connecting new components to %SALOME application. It also contains a set of interfaces used for management of %MED component in %SALOME application. @@ -37,7 +37,7 @@ module Engines /*! \brief Interface of the %Container This interface defines the process of loading and registration - of new components in SALOME application + of new components in %SALOME application */ interface Container { diff --git a/idl/SALOME_Exception.idl b/idl/SALOME_Exception.idl index 6c559445b..c310e9de4 100644 --- a/idl/SALOME_Exception.idl +++ b/idl/SALOME_Exception.idl @@ -24,25 +24,31 @@ // $Header$ /*! \file SALOME_Exception.idl This file contains the objects defining the main exception used -in %SALOME application. +in %SALOME application. The idl SALOME_Exception provides a generic CORBA exception for SALOME, + with an attribute that gives an exception type,a message, plus optional source file name and line number. +This idl is intended to serve for all user CORBA exceptions raised in SALOME code, as IDL specification +does not support exception inheritance. So, all the user CORBA exceptions from SALOME could be +handled in a single catch. + */ #ifndef _SALOME_EXCEPTION_IDL_ #define _SALOME_EXCEPTION_IDL_ /*! -Module SALOME regroups all idl definitions for SALOME Kernel +Module %SALOME regroups all idl definitions for %SALOME Kernel component */ module SALOME { /*! -This enumeration contains the elements indicating the type of the exception. +This enumeration contains the elements indicating the type of the exception +which can be raised during %SALOME session. */ enum ExceptionType { COMM, /*!< Communication problem */ BAD_PARAM, /*!< Bad User parameters */ - INTERNAL_ERROR /*!< SALOME Bug, irrecoverable */ + INTERNAL_ERROR /*!< Application level problem, irrecoverable */ }; /*! This struct contains a set of fields defining the structure of the exception. diff --git a/idl/SALOME_ModuleCatalog.idl b/idl/SALOME_ModuleCatalog.idl index 431f61ef8..fc61fb305 100644 --- a/idl/SALOME_ModuleCatalog.idl +++ b/idl/SALOME_ModuleCatalog.idl @@ -27,14 +27,15 @@ creation of the catalog of components in %SALOME application */ -/*! \ingroup Kernel +/*! The main package of interfaces used for creation of the module catalog in %SALOME application. */ module SALOME_ModuleCatalog { // Type Definitions /*! -This enumeration contains a set of definitions of %SALOME modules. +This enumeration contains a set of definitions of the components integrated +into %SALOME application. */ enum ComponentType { GEOM, /*!