From: jfa Date: Fri, 16 Nov 2007 09:45:22 +0000 (+0000) Subject: A patch from Paul RASCLE for: kernel documentation with doxygen, modification on... X-Git-Tag: V4_1_0rc2~13 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=877dcc91b414bf993c6e09b84bf11ead36f9b2d9;p=modules%2Fkernel.git A patch from Paul RASCLE for: kernel documentation with doxygen, modification on Catalog for YACS, modifications on DSC, remove some prints, some mistakes on check_omniorb & check_swig. --- diff --git a/bin/appli_gen.py b/bin/appli_gen.py index 6d70fe939..89e30a94e 100644 --- a/bin/appli_gen.py +++ b/bin/appli_gen.py @@ -215,7 +215,8 @@ def install(prefix,config_file): f.write(module) f.write(',') pass - f.write(_config["guimodules"][-1]) + if len(_config["guimodules"]) > 0: + f.write(_config["guimodules"][-1]) f.write('"/>') command=""" diff --git a/bin/launchConfigureParser.py b/bin/launchConfigureParser.py index 51d16de15..150f15598 100755 --- a/bin/launchConfigureParser.py +++ b/bin/launchConfigureParser.py @@ -786,12 +786,10 @@ def get_env(theAdditionalOptions=[], appname="SalomeApp"): args["session_gui"] = False args[batch_nam] = False args["study_hdf"] = None - print 'launchConfigureParser cmd_opts',cmd_opts if cmd_opts.gui is not None: args[gui_nam] = cmd_opts.gui if cmd_opts.batch is not None: args[batch_nam] = True - print 'launchConfigureParser args[',batch_nam,']',args[batch_nam] if args[gui_nam]: args["session_gui"] = True if cmd_opts.desktop is not None: diff --git a/bin/runSalome.py b/bin/runSalome.py index d4ddabe89..6c01d90e4 100755 --- a/bin/runSalome.py +++ b/bin/runSalome.py @@ -606,7 +606,7 @@ def useSalome(args, modules_list, modules_root_dir): traceback.print_exc() print print - print "--- erreur au lancement Salome ---" + print "--- Error during Salome launch ---" #print process_id @@ -815,7 +815,6 @@ def main(): """Salome launch as a main application""" import sys print "runSalome running on ",os.getenv('HOSTNAME') - print os.environ.itervalues args, modules_list, modules_root_dir = setenv.get_config() kill_salome(args) save_config = True diff --git a/doc/Makefile.am b/doc/Makefile.am index c504425be..cfa250da1 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -30,13 +30,13 @@ SUBDIRS = salome doc_DATA = if RST2HTML_IS_OK - doc_DATA += \ - index.html \ - UnitTests.html \ - SALOME_Application.html \ - INSTALL.html \ - kernel_resources.html \ - KERNEL_Services.html +# doc_DATA += \ +# index.html \ +# UnitTests.html \ +# SALOME_Application.html \ +# INSTALL.html \ +# kernel_resources.html \ +# KERNEL_Services.html endif EXTRA_DIST=$(doc_DATA) @@ -55,4 +55,4 @@ usr_docs: (cd salome && $(MAKE) $(AM_MAKEFLAGS) usr_docs) dev_docs: - (cd salome && $(MAKE) $(AM_MAKEFLAGS) dev_docs) \ No newline at end of file + (cd salome && $(MAKE) $(AM_MAKEFLAGS) dev_docs) diff --git a/doc/salome/Makefile.am b/doc/salome/Makefile.am index b1075e0b8..eefea69e5 100644 --- a/doc/salome/Makefile.am +++ b/doc/salome/Makefile.am @@ -49,3 +49,9 @@ info_TEXINFOS = Batch.texi install-data-local: html usr_docs cp -rp $(top_builddir)/doc/salome/Batch.html $(docdir) + +EXTRA_DIST= main.dox batch.dox install.dox \ + kernel_resources.dox kernel_services.dox \ + salome_application.dox unittests.dox \ + salome_file.dox + diff --git a/doc/salome/tui/KERNEL/doxyuser.in b/doc/salome/tui/KERNEL/doxyuser.in index 4b407f61b..d3387500b 100644 --- a/doc/salome/tui/KERNEL/doxyuser.in +++ b/doc/salome/tui/KERNEL/doxyuser.in @@ -77,6 +77,7 @@ WARN_LOGFILE = log.txt # configuration options related to the input files #--------------------------------------------------------------------------- INPUT = \ + @top_srcdir@/doc/salome \ @top_srcdir@/bin \ @top_srcdir@/idl \ @top_srcdir@/src/Container \ @@ -85,7 +86,7 @@ INPUT = \ @top_srcdir@/src/Notification \ @top_srcdir@/src/Utils \ @top_srcdir@/src/DSC -FILE_PATTERNS = *.idl *.hxx *.cxx python_extension_must_be_here +FILE_PATTERNS = *.dox *.idl *.hxx *.cxx python_extension_must_be_here RECURSIVE = YES EXCLUDE = EXCLUDE_SYMLINKS = NO diff --git a/doc/salome/tui/KERNEL/sources/footer.html b/doc/salome/tui/KERNEL/sources/footer.html index 8aa47dfe0..56d52a61a 100755 --- a/doc/salome/tui/KERNEL/sources/footer.html +++ b/doc/salome/tui/KERNEL/sources/footer.html @@ -1,15 +1,10 @@ - - - + + + + + +
+
Copyright © 2003-2007 CEA, EDF
+
+ + diff --git a/doc/salome/tui/KERNEL/sources/myheader.html b/doc/salome/tui/KERNEL/sources/myheader.html index 25bfe5ec3..bddc997ec 100755 --- a/doc/salome/tui/KERNEL/sources/myheader.html +++ b/doc/salome/tui/KERNEL/sources/myheader.html @@ -2,22 +2,12 @@ - - Main Page - - + $title + + - -  - - - - - - - -
  General KERNEL Documentation    End User KERNEL Services  
-

- - +
+SALOME documentation central +
+
diff --git a/doc/salome/tui/Makefile.am b/doc/salome/tui/Makefile.am index 07b894756..12a714b16 100644 --- a/doc/salome/tui/Makefile.am +++ b/doc/salome/tui/Makefile.am @@ -48,13 +48,20 @@ usr_docs: fi; \ $(DOXYGEN) ./doxyuser1; \ cd ..; - $(INSTALL) -d $(docdir)/tui/KERNEL; - cp -fr $(srcdir)/KERNEL/sources/static/*.* $(docdir)/tui/KERNEL; - cp -fr $(srcdir)/KERNEL/sources/ $(docdir)/tui/KERNEL; - cp -fr KERNEL $(docdir)/tui - cp -fr $(srcdir)/KERNEL/HTML/ $(docdir)/tui/KERNEL; - cp -f $(srcdir)/pythfilter.py $(docdir)/tui/KERNEL; - cp -fr $(srcdir)/KERNEL/exemple/ $(docdir)/tui/KERNEL; +# $(INSTALL) -d $(docdir)/tui/KERNEL; + cp -fr $(srcdir)/KERNEL/sources/static/*.* $(docdir); + cp -fr $(srcdir)/KERNEL/sources/ $(docdir); + cp -fr KERNEL/[a-l]*.* $(docdir) + cp -fr KERNEL/[m-z]*.* $(docdir) + cp -fr $(srcdir)/KERNEL/HTML/ $(docdir); + cp -f $(srcdir)/pythfilter.py $(docdir); + cp -fr $(srcdir)/KERNEL/exemple/ $(docdir); +# cp -fr $(srcdir)/KERNEL/sources/static/*.* $(docdir)/tui/KERNEL; +# cp -fr $(srcdir)/KERNEL/sources/ $(docdir)/tui/KERNEL; +# cp -fr KERNEL $(docdir)/tui +# cp -fr $(srcdir)/KERNEL/HTML/ $(docdir)/tui/KERNEL; +# cp -f $(srcdir)/pythfilter.py $(docdir)/tui/KERNEL; +# cp -fr $(srcdir)/KERNEL/exemple/ $(docdir)/tui/KERNEL; dev_docs: cp -fr $(srcdir)/KERNEL/* ./INPUT; \ diff --git a/idl/SALOMEDS.idl b/idl/SALOMEDS.idl index 885da2c56..6fd42cd02 100644 --- a/idl/SALOMEDS.idl +++ b/idl/SALOMEDS.idl @@ -23,10 +23,6 @@ // Author : Yves FRICAUD // $Header$ -/*! \mainpage - \image html Application-About1.jpg -*/ - /*! \file SALOMEDS.idl This file contains a set of interfaces used for creation, managment and modification of the %Study diff --git a/idl/SALOME_ModuleCatalog.idl b/idl/SALOME_ModuleCatalog.idl index 667bef10b..9fc9dac5b 100644 --- a/idl/SALOME_ModuleCatalog.idl +++ b/idl/SALOME_ModuleCatalog.idl @@ -87,6 +87,40 @@ The list of the parameters of service. typedef sequence ListOfServicesParameter; typedef sequence ListOfServicesDataStreamParameter; + typedef sequence ListOfString; + enum TypeKind + { + NONE , + Dble , + Int , + Str , + Bool , + Objref , + Seq , + Array , + Struc + }; + struct MemberDefinition + { + string name; /*! Name of the member */ + string type; /*! Type of the member */ + }; + typedef sequence ListOfMemberDefinition; +/*! + * Struct to get the definition of types used in Salome catalogs + */ + struct TypeDefinition + { + string name; /*! Name of the type */ + TypeKind kind; /*! Kind of the type.*/ + string id; /*! id (if needed) */ + string content; /*! Content type (if needed) */ + ListOfString bases; /*! Content type (if needed) */ + ListOfMemberDefinition members; /*! Members types (if needed) */ + }; + + typedef sequence ListOfTypeDefinition; + /*! This struct contains fields completely defining each service. */ @@ -143,7 +177,7 @@ List of path prefixes /*! Description of a component */ - struct Component + struct ComponentDef { ComponentType type; string name; @@ -313,6 +347,11 @@ This interface is used for creation of the module catalog in %SALOME application */ oneway void ShutdownWithExit(); +/*! + * Get the types of the catalog + */ + ListOfTypeDefinition GetTypes(); + /*! Gets a list of names of computers of the catalog */ @@ -347,7 +386,7 @@ Gets one component of the catalog. /*! Gets the description of a component of the catalog. */ - Component GetComponentInfo(in string componentName) raises(NotFound); + ComponentDef GetComponentInfo(in string componentName) raises(NotFound); /*! Reads a xml file and imports new components from this file. diff --git a/resources/KERNELCatalog.xml.in b/resources/KERNELCatalog.xml.in index 02afa4055..347458ed4 100644 --- a/resources/KERNELCatalog.xml.in +++ b/resources/KERNELCatalog.xml.in @@ -8,6 +8,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/salome_adm/unix/config_files/check_omniorb.m4 b/salome_adm/unix/config_files/check_omniorb.m4 index 3ad61129a..f82428747 100644 --- a/salome_adm/unix/config_files/check_omniorb.m4 +++ b/salome_adm/unix/config_files/check_omniorb.m4 @@ -61,31 +61,31 @@ then OMNIORB_CXXFLAGS="-DOMNIORB_VERSION=$OMNIORB_VERSION" case $build_cpu in sparc*) - AC_DEFINE(__sparc__) + # AC_DEFINE(__sparc__) OMNIORB_CXXFLAGS="$OMNIORB_CXXFLAGS -D__sparc__" ;; *86*) - AC_DEFINE(__x86__) + # AC_DEFINE(__x86__) OMNIORB_CXXFLAGS="$OMNIORB_CXXFLAGS -D__x86__" ;; esac case $build_os in osf*) - AC_DEFINE(__osf1__) + # AC_DEFINE(__osf1__) __OSVERSION__=5 - AC_DEFINE(__OSVERSION__) + AC_DEFINE([__OSVERSION__], [5], [Description]) OMNIORB_CXXFLAGS="$OMNIORB_CXXFLAGS -D__osf1__" ;; solaris*) - AC_DEFINE(__sunos__) + # AC_DEFINE(__sunos__) __OSVERSION__=5 - AC_DEFINE(__OSVERSION__) + AC_DEFINE([__OSVERSION__], [5], [Description]) OMNIORB_CXXFLAGS="$OMNIORB_CXXFLAGS -D__sunos__" ;; linux*) - AC_DEFINE(__linux__) + # AC_DEFINE(__linux__) __OSVERSION__=2 - AC_DEFINE(__OSVERSION__) + AC_DEFINE([__OSVERSION__], [2], [Description]) OMNIORB_CXXFLAGS="$OMNIORB_CXXFLAGS -D__linux__" ;; esac @@ -214,15 +214,15 @@ then AC_SUBST(OMNIORB_IDL_TIE_H) AC_SUBST(OMNIORB_IDL_TIE_CXX) - AC_DEFINE(OMNIORB) + AC_DEFINE([OMNIORB], [], [Description]) CORBA_HAVE_POA=1 - AC_DEFINE(CORBA_HAVE_POA) + AC_DEFINE([CORBA_HAVE_POA], [], [Description]) CORBA_ORB_INIT_HAVE_3_ARGS=1 - AC_DEFINE(CORBA_ORB_INIT_HAVE_3_ARGS) + AC_DEFINE([CORBA_ORB_INIT_HAVE_3_ARGS], [], [Description]) CORBA_ORB_INIT_THIRD_ARG='"omniORB"' - AC_DEFINE(CORBA_ORB_INIT_THIRD_ARG, "omniORB") + AC_DEFINE([CORBA_ORB_INIT_THIRD_ARG], [], [omniORB]) fi diff --git a/salome_adm/unix/config_files/check_swig.m4 b/salome_adm/unix/config_files/check_swig.m4 index db9d234e9..019755067 100644 --- a/salome_adm/unix/config_files/check_swig.m4 +++ b/salome_adm/unix/config_files/check_swig.m4 @@ -57,6 +57,13 @@ EOF AC_MSG_RESULT($swig_ok) fi +numpydir=`$PYTHON -c "import numpy;print numpy.get_include()" 2>/dev/null` +if test -d "$numpydir"; then + SWIG_FLAGS="$SWIG_FLAGS -DWITH_NUMPY" + PYTHON_INCLUDES="$PYTHON_INCLUDES -I$numpydir" + AC_DEFINE([WITH_NUMPY], [], [Python has numpy extension]) +fi + AC_SUBST(SWIG_FLAGS) AC_SUBST(SWIG) diff --git a/src/Communication/SALOME_Communication.hxx b/src/Communication/SALOME_Communication.hxx index c3593fbc5..93c11cc56 100755 --- a/src/Communication/SALOME_Communication.hxx +++ b/src/Communication/SALOME_Communication.hxx @@ -44,4 +44,4 @@ #define COMMUNICATION_EXPORT #endif -#endif \ No newline at end of file +#endif diff --git a/src/DSC/DSC_Python/Makefile.am b/src/DSC/DSC_Python/Makefile.am index 48ed93f93..a40629e79 100644 --- a/src/DSC/DSC_Python/Makefile.am +++ b/src/DSC/DSC_Python/Makefile.am @@ -59,7 +59,7 @@ COMMON_LIBS = @CORBA_LIBS@ AM_CFLAGS = -fexceptions pkgpython_PYTHON = calcium.py dsccalcium.py pkgpyexec_LTLIBRARIES = _calcium.la -SWIG_FLAGS= -python -c++ -noexcept +MY_SWIG_FLAGS= $(SWIG_FLAGS) -noexcept SWIG_SRC=calcium.i _calcium_la_SOURCES = calcium_wrap.cpp _calcium_la_LDFLAGS = -module @@ -73,7 +73,7 @@ _calcium_la_LIBADD = ../DSC_User/Datastream/Calcium/libCalciumC.la \ _calcium_la_CXXFLAGS = $(PYTHON_INCLUDES) $(COMMON_CPPFLAGS) calcium_wrap.cpp calcium.py:calcium.i - $(SWIG) $(SWIG_FLAGS) -o calcium_wrap.cpp $< + $(SWIG) $(MY_SWIG_FLAGS) -o calcium_wrap.cpp $< CLEANFILES = calcium_wrap.cpp diff --git a/src/DSC/DSC_Python/calcium.i b/src/DSC/DSC_Python/calcium.i index f7700dd20..3d093153c 100644 --- a/src/DSC/DSC_Python/calcium.i +++ b/src/DSC/DSC_Python/calcium.i @@ -9,6 +9,7 @@ %{ //C++ Includes +#include #include #include #include @@ -42,6 +43,10 @@ struct omniORBpyAPI { %{ // init section +#ifdef WITH_NUMPY + import_array() +#endif + PyObject* omnipy = PyImport_ImportModule((char*)"_omnipy"); if (!omnipy) { @@ -55,25 +60,326 @@ struct omniORBpyAPI { %} %include "carrays.i" -%include "cpointer.i" - -/* Wrap a class interface around an "int *" */ -%pointer_class(int, intp); -/* Wrap a class interface around an "float *" */ -%pointer_class(float, floatp); -/* Wrap a class interface around an "double *" */ -%pointer_class(double, doublep); %array_class(int, intArray); %array_class(float, floatArray); %array_class(double, doubleArray); -%typemap(python,in) CORBA::Boolean +#ifdef WITH_NUMPY +/* + * Most of this code is borrowed from numpy distribution + * The following code originally appeared in enthought/kiva/agg/src/numeric.i, + * author unknown. It was translated from C++ to C by John Hunter. Bill + * Spotz has modified it slightly to fix some minor bugs, add some comments + * and some functionality. + */ + +%{ + +#include + +/* Macros to extract array attributes. + */ +#define is_array(a) ((a) && PyArray_Check((PyArrayObject *)a)) +#define array_type(a) (int)(PyArray_TYPE(a)) +#define array_dimensions(a) (((PyArrayObject *)a)->nd) +#define array_size(a,i) (((PyArrayObject *)a)->dimensions[i]) +#define array_is_contiguous(a) (PyArray_ISCONTIGUOUS(a)) + +/* Given a PyObject, return a string describing its type. + */ +char* pytype_string(PyObject* py_obj) { + if (py_obj == NULL ) return "C NULL value"; + if (PyCallable_Check(py_obj)) return "callable" ; + if (PyString_Check( py_obj)) return "string" ; + if (PyInt_Check( py_obj)) return "int" ; + if (PyFloat_Check( py_obj)) return "float" ; + if (PyDict_Check( py_obj)) return "dict" ; + if (PyList_Check( py_obj)) return "list" ; + if (PyTuple_Check( py_obj)) return "tuple" ; + if (PyFile_Check( py_obj)) return "file" ; + if (PyModule_Check( py_obj)) return "module" ; + if (PyInstance_Check(py_obj)) return "instance" ; + + return "unkown type"; +} + +/* Given a Numeric typecode, return a string describing the type. + */ +char* typecode_string(int typecode) { + char* type_names[20] = {"char","unsigned byte","byte","short", + "unsigned short","int","unsigned int","long", + "float","double","complex float","complex double", + "object","ntype","unkown"}; + return type_names[typecode]; +} + +/* Make sure input has correct numeric type. Allow character and byte + * to match. Also allow int and long to match. + */ +int type_match(int actual_type, int desired_type) { + return PyArray_EquivTypenums(actual_type, desired_type); +} + +/* Given a PyObject pointer, cast it to a PyArrayObject pointer if + * legal. If not, set the python error string appropriately and + * return NULL./ + */ +PyArrayObject* obj_to_array_no_conversion(PyObject* input, int typecode) { + PyArrayObject* ary = NULL; + if (is_array(input) && (typecode == PyArray_NOTYPE || + PyArray_EquivTypenums(array_type(input), + typecode))) { + ary = (PyArrayObject*) input; + } + else if is_array(input) { + char* desired_type = typecode_string(typecode); + char* actual_type = typecode_string(array_type(input)); + PyErr_Format(PyExc_TypeError, + "Array of type '%s' required. Array of type '%s' given", + desired_type, actual_type); + ary = NULL; + } + else { + char * desired_type = typecode_string(typecode); + char * actual_type = pytype_string(input); + PyErr_Format(PyExc_TypeError, + "Array of type '%s' required. A %s was given", + desired_type, actual_type); + ary = NULL; + } + return ary; +} + +/* Convert the given PyObject to a Numeric array with the given + * typecode. On Success, return a valid PyArrayObject* with the + * correct type. On failure, the python error string will be set and + * the routine returns NULL. + */ +PyArrayObject* obj_to_array_allow_conversion(PyObject* input, int typecode, + int* is_new_object) +{ + PyArrayObject* ary = NULL; + PyObject* py_obj; + if (is_array(input) && (typecode == PyArray_NOTYPE || type_match(array_type(input),typecode))) { + ary = (PyArrayObject*) input; + *is_new_object = 0; + } + else { + py_obj = PyArray_FromObject(input, typecode, 0, 0); + /* If NULL, PyArray_FromObject will have set python error value.*/ + ary = (PyArrayObject*) py_obj; + *is_new_object = 1; + } + return ary; +} + +/* Given a PyArrayObject, check to see if it is contiguous. If so, + * return the input pointer and flag it as not a new object. If it is + * not contiguous, create a new PyArrayObject using the original data, + * flag it as a new object and return the pointer. + */ +PyArrayObject* make_contiguous(PyArrayObject* ary, int* is_new_object, + int min_dims, int max_dims) +{ + PyArrayObject* result; + if (array_is_contiguous(ary)) { + result = ary; + *is_new_object = 0; + } + else { + result = (PyArrayObject*) PyArray_ContiguousFromObject((PyObject*)ary, + array_type(ary), + min_dims, + max_dims); + *is_new_object = 1; + } + return result; +} + +/* Convert a given PyObject to a contiguous PyArrayObject of the + * specified type. If the input object is not a contiguous + * PyArrayObject, a new one will be created and the new object flag + * will be set. + */ +PyArrayObject* obj_to_array_contiguous_allow_conversion(PyObject* input, + int typecode, + int* is_new_object) { + int is_new1 = 0; + int is_new2 = 0; + PyArrayObject* ary2; + PyArrayObject* ary1 = obj_to_array_allow_conversion(input, typecode, + &is_new1); + if (ary1) { + ary2 = make_contiguous(ary1, &is_new2, 0, 0); + if ( is_new1 && is_new2) { + Py_DECREF(ary1); + } + ary1 = ary2; + } + *is_new_object = is_new1 || is_new2; + return ary1; +} + +/* Test whether a python object is contiguous. If array is + * contiguous, return 1. Otherwise, set the python error string and + * return 0. + */ +int require_contiguous(PyArrayObject* ary) { + int contiguous = 1; + if (!array_is_contiguous(ary)) { + PyErr_SetString(PyExc_TypeError, "Array must be contiguous. A discontiguous array was given"); + contiguous = 0; + } + return contiguous; +} + +/* Require the given PyArrayObject to have a specified number of + * dimensions. If the array has the specified number of dimensions, + * return 1. Otherwise, set the python error string and return 0. + */ +int require_dimensions(PyArrayObject* ary, int exact_dimensions) { + int success = 1; + if (array_dimensions(ary) != exact_dimensions) { + PyErr_Format(PyExc_TypeError, + "Array must have %d dimensions. Given array has %d dimensions", + exact_dimensions, array_dimensions(ary)); + success = 0; + } + return success; +} + +/* Require the given PyArrayObject to have one of a list of specified + * number of dimensions. If the array has one of the specified number + * of dimensions, return 1. Otherwise, set the python error string + * and return 0. + */ +int require_dimensions_n(PyArrayObject* ary, int* exact_dimensions, int n) { + int success = 0; + int i; + char dims_str[255] = ""; + char s[255]; + for (i = 0; i < n && !success; i++) { + if (array_dimensions(ary) == exact_dimensions[i]) { + success = 1; + } + } + if (!success) { + for (i = 0; i < n-1; i++) { + sprintf(s, "%d, ", exact_dimensions[i]); + strcat(dims_str,s); + } + sprintf(s, " or %d", exact_dimensions[n-1]); + strcat(dims_str,s); + PyErr_Format(PyExc_TypeError, + "Array must have %s dimensions. Given array has %d dimensions", + dims_str, array_dimensions(ary)); + } + return success; +} + +/* Require the given PyArrayObject to have a specified shape. If the + * array has the specified shape, return 1. Otherwise, set the python + * error string and return 0. + */ +int require_size(PyArrayObject* ary, int* size, int n) { + int i; + int success = 1; + int len; + char desired_dims[255] = "["; + char s[255]; + char actual_dims[255] = "["; + for(i=0; i < n;i++) { + if (size[i] != -1 && size[i] != array_size(ary,i)) { + success = 0; + } + } + if (!success) { + for (i = 0; i < n; i++) { + if (size[i] == -1) { + sprintf(s, "*,"); + } + else + { + sprintf(s, "%d,", size[i]); + } + strcat(desired_dims,s); + } + len = strlen(desired_dims); + desired_dims[len-1] = ']'; + for (i = 0; i < n; i++) { + sprintf(s, "%d,", array_size(ary,i)); + strcat(actual_dims,s); + } + len = strlen(actual_dims); + actual_dims[len-1] = ']'; + PyErr_Format(PyExc_TypeError, + "Array must have shape of %s. Given array has shape of %s", + desired_dims, actual_dims); + } + return success; +} + +%} + +/* input typemap */ +%define TYPEMAP_IN3(type,typecode) +%typemap(in) type* IN_ARRAY3 + (PyArrayObject* array=NULL, int is_new_object) { + int size[1] = {-1}; + if ((SWIG_ConvertPtr($input, (void **) &$1, $1_descriptor,0)) == -1) + { + array = obj_to_array_contiguous_allow_conversion($input, typecode, &is_new_object); + if (!array || !require_dimensions(array,1) || !require_size(array,size,1)) SWIG_fail; + $1 = (type*) array->data; + } +} +%typemap(freearg) type* IN_ARRAY3 { + if (is_new_object$argnum && array$argnum) Py_DECREF(array$argnum); +} +%enddef + +TYPEMAP_IN3(int, PyArray_INT) +TYPEMAP_IN3(float, PyArray_FLOAT ) +TYPEMAP_IN3(double, PyArray_DOUBLE) + +#undef TYPEMAP_IN3 + +%apply int* IN_ARRAY3 {int *val}; +%apply float* IN_ARRAY3 {float *val}; +%apply double* IN_ARRAY3 {double *val}; + +/* inplace typemaps */ + +%define TYPEMAP_INPLACE3(type,typecode) +%typemap(in) type* INPLACE_ARRAY3 (PyArrayObject* temp=NULL) { + if ((SWIG_ConvertPtr($input, (void **) &$1, $1_descriptor,0)) == -1) + { + temp = obj_to_array_no_conversion($input,typecode); + if (!temp || !require_contiguous(temp)) SWIG_fail; + $1 = (type*) temp->data; + } +} +%enddef + +TYPEMAP_INPLACE3(int, PyArray_INT) +TYPEMAP_INPLACE3(float, PyArray_FLOAT ) +TYPEMAP_INPLACE3(double, PyArray_DOUBLE) + +#undef TYPEMAP_INPLACE3 + +%apply int* INPLACE_ARRAY3 {int *lval}; +%apply float* INPLACE_ARRAY3 {float *lval}; +%apply double* INPLACE_ARRAY3 {double *lval}; + +#endif + +%typemap(in) CORBA::Boolean { $1=(CORBA::Boolean)PyInt_AsLong($input); } -%typemap(python,in) CORBA::ORB_ptr +%typemap(in) CORBA::ORB_ptr { try { CORBA::Object_ptr obj = api->pyObjRefToCxxObjRef($input,1); @@ -83,7 +389,8 @@ struct omniORBpyAPI { PyErr_SetString(PyExc_RuntimeError, "not a valid CORBA object ptr"); } } -%typemap(python,in) PortableServer::POA_ptr + +%typemap(in) PortableServer::POA_ptr { try { CORBA::Object_ptr obj = api->pyObjRefToCxxObjRef($input,1); @@ -94,7 +401,7 @@ struct omniORBpyAPI { } } -%typemap(python,in) Engines::Container_ptr +%typemap(in) Engines::Container_ptr { try { CORBA::Object_ptr obj = api->pyObjRefToCxxObjRef($input,1); @@ -104,7 +411,8 @@ struct omniORBpyAPI { PyErr_SetString(PyExc_RuntimeError, "not a valid CORBA object ptr"); } } -%typemap(python,in) Ports::Port_ptr + +%typemap(in) Ports::Port_ptr { try { CORBA::Object_ptr obj = api->pyObjRefToCxxObjRef($input,1); @@ -115,7 +423,7 @@ struct omniORBpyAPI { } } -%typemap(python,out) Ports::Port_ptr , Ports::PortProperties_ptr +%typemap(out) Ports::Port_ptr , Ports::PortProperties_ptr { $result = api->cxxObjRefToPyObjRef($1, 1); } @@ -224,6 +532,13 @@ class PySupervCompo:public Superv_Component_i } }; +%apply int *OUTPUT { int *nval }; +%apply float *INOUT { float *ti }; +%apply float *INPUT { float *tf }; +%apply int *INOUT { int *niter }; +%apply double *INOUT { double *ti }; +%apply double *INPUT { double *tf }; + extern "C" void create_calcium_port(Superv_Component_i* compo,char* name,char* type,char *mode,char* depend); #define CP_TEMPS 40 @@ -232,10 +547,19 @@ extern "C" void create_calcium_port(Superv_Component_i* compo,char* name,char* t #define CP_CONT 20 #define CP_ARRET 21 -int cp_een(void *component,int dep,float t,int n,char *nom,int nval,int *val); -int cp_edb(void *component,int dep,double t,int n,char *nom,int nval,double *val); +int cp_cd(void *component,char *name); + +int cp_een(void *component,int dep,float t,int n,char *nom,int nval,int *eval); +int cp_edb(void *component,int dep,double t,int n,char *nom,int nval,double *eval); +int cp_ere(void *component,int dep,float t,int n,char *nom,int nval,float *eval); +int cp_ecp(void *component,int dep,float t,int n,char *nom,int nval,float *eval); +int cp_elo(void *component,int dep,float t,int n,char *nom,int nval,int *eval); + +int cp_len(void *component,int dep,float *ti,float *tf,int *niter,char *nom,int nmax,int *nval,int *lval); +int cp_ldb(void *component,int dep,double *ti,double *tf,int *niter,char *nom,int nmax,int *nval,double *lval); +int cp_lre(void *component,int dep,float *ti,float *tf,int *niter,char *nom,int nmax,int *nval,float *lval); +int cp_lcp(void *component,int dep,float *ti,float *tf,int *niter,char *nom,int nmax,int *nval,float *lval); +int cp_llo(void *component,int dep,float *ti,float *tf,int *niter,char *nom,int nmax,int *nval,int *lval); -int cp_len(void *component,int dep,float *INOUT,float *INPUT,int *INOUT,char *nom,int nmax,int *OUTPUT,int *val); -int cp_ldb(void *component,int dep,double *INOUT,double *INPUT,int *INOUT,char *nom,int nmax,int *OUTPUT,double *val); int cp_fin(void *component,int cp_end); diff --git a/src/DSC/Makefile.am b/src/DSC/Makefile.am index edc4849c7..dc9af3cb8 100644 --- a/src/DSC/Makefile.am +++ b/src/DSC/Makefile.am @@ -28,3 +28,5 @@ SUBDIR_PAR = ParallelDSC endif SUBDIRS = DSC_Basic DSC_User $(SUBDIR_PAR) DSC_Python + +EXTRA_DIST= DSC.dox diff --git a/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx b/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx index 9877b1bda..a18a09c8e 100644 --- a/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx +++ b/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx @@ -503,11 +503,8 @@ _LoadComponent(const Engines::MachineParameters& params, int studyId, const Engines::MachineList& listOfMachines) { - const char *containerName = params.container_name; - int nbproc = NbProc(params); - - MESSAGE("_LoadComponent, required " << containerName << - " " << componentName << " " << nbproc); + MESSAGE("_LoadComponent, required " << params.container_name << + " " << componentName << " " << NbProc(params)); Engines::Container_var cont = _ContManager->FindOrStartContainer(params, diff --git a/src/LifeCycleCORBA/Test_LifeCycleCORBA.cxx b/src/LifeCycleCORBA/Test_LifeCycleCORBA.cxx index c9f1e44bc..2cd147634 100644 --- a/src/LifeCycleCORBA/Test_LifeCycleCORBA.cxx +++ b/src/LifeCycleCORBA/Test_LifeCycleCORBA.cxx @@ -140,12 +140,6 @@ int main (int argc, char * argv[]) { INFOS("Caught system exception COMM_FAILURE -- unable to contact the object."); } -#ifndef WNT - catch(CORBA::SystemException&) - { - INFOS("Caught a CORBA::SystemException."); - } -#endif catch(CORBA::Exception&) { INFOS("Caught CORBA::Exception."); diff --git a/src/ModuleCatalog/SALOME_ModuleCatalog_Acomponent_impl.cxx b/src/ModuleCatalog/SALOME_ModuleCatalog_Acomponent_impl.cxx index 7e4409a5a..2e9b3160d 100644 --- a/src/ModuleCatalog/SALOME_ModuleCatalog_Acomponent_impl.cxx +++ b/src/ModuleCatalog/SALOME_ModuleCatalog_Acomponent_impl.cxx @@ -50,7 +50,7 @@ static int MYDEBUG = 0; // and the pathes prefixes for all computers //---------------------------------------------------------------------- SALOME_ModuleCatalog_AcomponentImpl::SALOME_ModuleCatalog_AcomponentImpl -(SALOME_ModuleCatalog::Component &C) : _Component(C) +(SALOME_ModuleCatalog::ComponentDef &C) : _Component(C) { if(MYDEBUG) BEGIN_OF("SALOME_ModuleCatalog_AcomponentImpl"); diff --git a/src/ModuleCatalog/SALOME_ModuleCatalog_Acomponent_impl.hxx b/src/ModuleCatalog/SALOME_ModuleCatalog_Acomponent_impl.hxx index c7b580a17..943d5d02e 100644 --- a/src/ModuleCatalog/SALOME_ModuleCatalog_Acomponent_impl.hxx +++ b/src/ModuleCatalog/SALOME_ModuleCatalog_Acomponent_impl.hxx @@ -40,7 +40,7 @@ class MODULECATALOG_EXPORT SALOME_ModuleCatalog_AcomponentImpl: public POA_SALOM { public: //! standard constructor - SALOME_ModuleCatalog_AcomponentImpl(SALOME_ModuleCatalog::Component &C); + SALOME_ModuleCatalog_AcomponentImpl(SALOME_ModuleCatalog::ComponentDef &C); //! standard destructor virtual ~SALOME_ModuleCatalog_AcomponentImpl(); @@ -143,7 +143,7 @@ public: private : - SALOME_ModuleCatalog::Component _Component; + SALOME_ModuleCatalog::ComponentDef _Component; //! method to duplicate an interface /*! diff --git a/src/ModuleCatalog/SALOME_ModuleCatalog_Client.cxx b/src/ModuleCatalog/SALOME_ModuleCatalog_Client.cxx index 5aa0ab5ab..02384368c 100644 --- a/src/ModuleCatalog/SALOME_ModuleCatalog_Client.cxx +++ b/src/ModuleCatalog/SALOME_ModuleCatalog_Client.cxx @@ -160,8 +160,6 @@ int main(int argc,char **argv) void PrintComponent(SALOME_ModuleCatalog::Acomponent_ptr C) { - const char *_name = C->componentname(); - MESSAGE("Name : " << C->componentname()); MESSAGE("Type : " << C->component_type() << " multistudy : " << C->multistudy()); MESSAGE("Constraint : " << C->constraint()); diff --git a/src/ModuleCatalog/SALOME_ModuleCatalog_Handler.cxx b/src/ModuleCatalog/SALOME_ModuleCatalog_Handler.cxx index c4104d9bd..97c257ded 100644 --- a/src/ModuleCatalog/SALOME_ModuleCatalog_Handler.cxx +++ b/src/ModuleCatalog/SALOME_ModuleCatalog_Handler.cxx @@ -45,7 +45,12 @@ static int MYDEBUG = 0; // Function : SALOME_ModuleCatalog_Handler // Purpose : Constructor //---------------------------------------------------------------------- -SALOME_ModuleCatalog_Handler::SALOME_ModuleCatalog_Handler() +SALOME_ModuleCatalog_Handler::SALOME_ModuleCatalog_Handler(ParserPathPrefixes& pathList, + ParserComponents& moduleList, + ParserTypes& typeMap, + TypeList& typeList):_typeMap(typeMap),_typeList(typeList), + _pathList(pathList),_moduleList(moduleList) + { if(MYDEBUG) BEGIN_OF("SALOME_ModuleCatalog_Handler"); @@ -145,7 +150,7 @@ void SALOME_ModuleCatalog_Handler::ProcessXmlDocument(xmlDocPtr theDoc) // Processing the document nodes while(aCurNode != NULL) { - // Process path prefix list (tag test_path_prefix_list) + // Part 1: Process path prefix list (tag test_path_prefix_list) if ( !xmlStrcmp(aCurNode->name,(const xmlChar*)test_path_prefix_list) ) { xmlNodePtr aCurSubNode = aCurNode->xmlChildrenNode; @@ -196,7 +201,199 @@ void SALOME_ModuleCatalog_Handler::ProcessXmlDocument(xmlDocPtr theDoc) } } - //@ Process list of components (tag test_component_list) + //Part 2: Process list of types + if ( !xmlStrcmp(aCurNode->name,(const xmlChar*)"type-list") ) + { + xmlNodePtr aTypeNode = aCurNode->xmlChildrenNode; + while (aTypeNode != NULL) + { + // match "type" + if ( !xmlStrcmp(aTypeNode->name, (const xmlChar*)"type" )) + { + // Here is a basic type description + ParserType aType; + xmlChar * name=xmlGetProp(aTypeNode,(const xmlChar*)"name"); + if(name) + { + aType.name = (const char*)name; + xmlFree(name); + } + xmlChar *kind=xmlGetProp(aTypeNode,(const xmlChar*)"kind"); + if(kind) + { + aType.kind = (const char*)kind; + xmlFree(kind); + } + if(aType.kind == "double" || + aType.kind == "int" || + aType.kind == "bool" || + aType.kind == "string") + { + if ( _typeMap.find(aType.name) == _typeMap.end() ) + { + std::cerr << "Registered basic type: " << aType.name << " " << aType.kind << std::endl; + _typeMap[aType.name]=aType; + _typeList.push_back(aType); + } + else + std::cerr << "Warning: this type (" << aType.name << "," << aType.kind << ") already exists, it will be ignored." << std::endl; + } + else + std::cerr << "Warning: this type (" << aType.name << "," << aType.kind << ") has incorrect kind, it will be ignored." << std::endl; + } + else if ( !xmlStrcmp(aTypeNode->name, (const xmlChar*)"sequence" )) + { + // Here is a sequence type description + ParserSequence aType; + xmlChar * name=xmlGetProp(aTypeNode,(const xmlChar*)"name"); + if(name) + { + aType.name = (const char*)name; + xmlFree(name); + } + xmlChar *content=xmlGetProp(aTypeNode,(const xmlChar*)"content"); + if(content) + { + aType.content = (const char*)content; + xmlFree(content); + } + if ( _typeMap.find(aType.content) != _typeMap.end() ) + { + if ( _typeMap.find(aType.name) == _typeMap.end() ) + { + std::cerr << "Registered sequence type: " << aType.name << " " << aType.content << std::endl; + _typeMap[aType.name]=aType; + _typeList.push_back(aType); + } + else + std::cerr << "Warning: this type (" << aType.name << "," << aType.kind << ") already exists, it will be ignored." << std::endl; + } + else + { + std::cerr << "Warning: this sequence type (" << aType.name << "," << aType.content << ") has unknown content type, it will be ignored." << std::endl; + } + } + else if ( !xmlStrcmp(aTypeNode->name, (const xmlChar*)"objref" )) + { + // Here is an objref type description + ParserObjref aType; + int error=0; + xmlChar * name=xmlGetProp(aTypeNode,(const xmlChar*)"name"); + if(name) + { + aType.name = (const char*)name; + xmlFree(name); + } + xmlChar *id=xmlGetProp(aTypeNode,(const xmlChar*)"id"); + if(id) + { + aType.id = (const char*)id; + xmlFree(id); + } + + xmlNodePtr aTypeSubNode = aTypeNode->xmlChildrenNode; + while (aTypeSubNode != NULL) + { + if ( !xmlStrcmp(aTypeSubNode->name, (const xmlChar*)"base" )) + { + //a base type + xmlChar* content = xmlNodeGetContent(aTypeSubNode); + if(content) + { + std::string base=(const char*)content; + xmlFree(content); + if ( _typeMap.find(base) != _typeMap.end() && _typeMap[base].kind == "objref") + { + aType.bases.push_back(base); + } + else + { + std::cerr << "Warning: this objref type (" << aType.name << ") has unknown base type (" << base << "), it will be ignored." << std::endl; + error=1; + break; + } + } + } + aTypeSubNode = aTypeSubNode->next; + } + if(!error) + { + if ( _typeMap.find(aType.name) == _typeMap.end() ) + { + std::cerr << "Registered objref type: " << aType.name << " " << aType.id << std::endl; + _typeMap[aType.name]=aType; + _typeList.push_back(aType); + } + else + std::cerr << "Warning: this type (" << aType.name << "," << aType.kind << ") already exists, it will be ignored." << std::endl; + } + } + else if ( !xmlStrcmp(aTypeNode->name, (const xmlChar*)"struct" )) + { + // Here is a struct type description + ParserStruct aType; + int error=0; + xmlChar * name=xmlGetProp(aTypeNode,(const xmlChar*)"name"); + if(name) + { + aType.name = (const char*)name; + xmlFree(name); + } + xmlChar *id=xmlGetProp(aTypeNode,(const xmlChar*)"id"); + if(id) + { + aType.id = (const char*)id; + xmlFree(id); + } + + xmlNodePtr aTypeSubNode = aTypeNode->xmlChildrenNode; + while (aTypeSubNode != NULL) + { + if ( !xmlStrcmp(aTypeSubNode->name, (const xmlChar*)"member" )) + { + std::pair member; + xmlChar * m_name=xmlGetProp(aTypeSubNode,(const xmlChar*)"name"); + if(m_name) + { + member.first=(const char*)m_name; + xmlFree(m_name); + } + xmlChar * m_type=xmlGetProp(aTypeSubNode,(const xmlChar*)"type"); + if(m_type) + { + member.second=(const char*)m_type; + xmlFree(m_type); + } + if ( _typeMap.find(member.second) != _typeMap.end() ) + { + aType.members.push_back(member); + } + else + { + std::cerr << "Warning: this struct type (" << aType.name << ") has unknown member type (" << member.first << "," << member.second << "), it will be ignored." << std::endl; + error=1; + break; + } + } + aTypeSubNode = aTypeSubNode->next; + } + if(!error) + { + if ( _typeMap.find(aType.name) == _typeMap.end() ) + { + std::cerr << "Registered struct type: " << aType.name << " " << aType.id << std::endl; + _typeMap[aType.name]=aType; + _typeList.push_back(aType); + } + else + std::cerr << "Warning: this type (" << aType.name << "," << aType.kind << ") already exists, it will be ignored." << std::endl; + } + } // end of struct + aTypeNode = aTypeNode->next; + } + } + + //Part 3: Process list of components (tag test_component_list) if ( !xmlStrcmp(aCurNode->name,(const xmlChar*)test_component_list) ) { xmlNodePtr aComponentNode = aCurNode->xmlChildrenNode; @@ -325,7 +522,7 @@ void SALOME_ModuleCatalog_Handler::ProcessXmlDocument(xmlDocPtr theDoc) xmlNodePtr aCompServiceNode = aSubNode->xmlChildrenNode; while(aCompServiceNode != NULL) { // Tag test_service - if ( !xmlStrcmp(aCompServiceNode->name, (const xmlChar*)test_interface_name) ) { + if ( !xmlStrcmp(aCompServiceNode->name, (const xmlChar*)"component-service") ) { xmlNodePtr aCompServiceSubNode = aCompServiceNode->xmlChildrenNode; while(aCompServiceSubNode != NULL) { diff --git a/src/ModuleCatalog/SALOME_ModuleCatalog_Handler.hxx b/src/ModuleCatalog/SALOME_ModuleCatalog_Handler.hxx index d8c27c5a8..22f7c416a 100644 --- a/src/ModuleCatalog/SALOME_ModuleCatalog_Handler.hxx +++ b/src/ModuleCatalog/SALOME_ModuleCatalog_Handler.hxx @@ -43,7 +43,7 @@ class MODULECATALOG_EXPORT SALOME_ModuleCatalog_Handler { public: //! standard constructor - SALOME_ModuleCatalog_Handler(); + SALOME_ModuleCatalog_Handler(ParserPathPrefixes& pathList,ParserComponents& moduleList,ParserTypes& typeMap,TypeList& typeList); //! standard destructor virtual ~SALOME_ModuleCatalog_Handler(); @@ -107,6 +107,8 @@ private: ParserComponent _aModule; + ParserPathPrefixes& _pathList; + ParserComponents& _moduleList; ParserInterfaces _interfaceList; ParserInterface _aInterface; @@ -126,6 +128,12 @@ private: ParserDataStreamParameters _outDataStreamParamList; ParserDataStreamParameter _outDataStreamParam; + ParserTypes& _typeMap; + TypeList& _typeList; + + ParserSequences _sequenceMap; + ParserObjrefs _objrefMap; + ParserStructs _structMap; }; #endif // SALOME_CATALOG_HANDLER_H diff --git a/src/ModuleCatalog/SALOME_ModuleCatalog_Parser.hxx b/src/ModuleCatalog/SALOME_ModuleCatalog_Parser.hxx index 6d797172a..8369f9917 100644 --- a/src/ModuleCatalog/SALOME_ModuleCatalog_Parser.hxx +++ b/src/ModuleCatalog/SALOME_ModuleCatalog_Parser.hxx @@ -31,6 +31,7 @@ #include #include +#include // Type Definitions struct ParserPathPrefix @@ -102,16 +103,35 @@ struct ParserComponent typedef std::vector ParserComponents ; -#ifdef WRITE_CATA_COMPONENT -// contains all the paths and the computers defined in the catalog - ParserPathPrefixes _pathList; - -// contains all the modules defined in the catalog - ParserComponents _moduleList; -#else -extern ParserPathPrefixes _pathList; -extern ParserComponents _moduleList; -#endif +struct ParserType +{ + std::string name; + std::string kind; + std::string id; + std::string content; + std::vector bases; + std::vector< std::pair > members; +}; +typedef std::map ParserTypes ; +typedef std::map RefTypes ; +typedef std::vector TypeList ; + +struct ParserSequence:public ParserType +{ + ParserSequence(){kind="sequence";} +}; +typedef std::map ParserSequences ; +struct ParserObjref:public ParserType +{ + ParserObjref(){kind="objref";} +}; +typedef std::map ParserObjrefs ; + +struct ParserStruct:public ParserType +{ + ParserStruct(){kind="struct";} +}; +typedef std::map ParserStructs ; #endif // SALOME_CATALOG_PARSER_H diff --git a/src/ModuleCatalog/SALOME_ModuleCatalog_Server.cxx b/src/ModuleCatalog/SALOME_ModuleCatalog_Server.cxx index 735ff5b13..892b2fbb8 100644 --- a/src/ModuleCatalog/SALOME_ModuleCatalog_Server.cxx +++ b/src/ModuleCatalog/SALOME_ModuleCatalog_Server.cxx @@ -39,7 +39,7 @@ using namespace std; int main(int argc,char **argv) { // initialize the ORB - CORBA::ORB_ptr orb = CORBA::ORB_init (argc, argv); + CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); // LocalTraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb); try { @@ -137,19 +137,19 @@ int main(int argc,char **argv) // Active catalog - SALOME_ModuleCatalogImpl Catalogue_i(argc, argv, orb); - poa->activate_object (&Catalogue_i); + SALOME_ModuleCatalogImpl* Catalogue_i=new SALOME_ModuleCatalogImpl(argc, argv, orb); + PortableServer::ObjectId_var cataid = poa->activate_object (Catalogue_i); + //activate POA manager mgr->activate(); - - CORBA::Object_ptr myCata = Catalogue_i._this(); + CORBA::Object_var myCata = Catalogue_i->_this(); + Catalogue_i->_remove_ref(); // initialise Naming Service - SALOME_NamingService *_NS; - _NS = new SALOME_NamingService(orb); + SALOME_NamingService _NS(orb); // register Catalog in Naming Service - _NS->Register(myCata ,"/Kernel/ModulCatalog"); + _NS.Register(myCata ,"/Kernel/ModulCatalog"); MESSAGE("Running CatalogServer."); @@ -161,6 +161,8 @@ int main(int argc,char **argv) timer.ShowAbsolute(); #endif orb->run(); + std::cerr << "server returned from orb->run()" << std::endl; + orb->destroy(); // mgr->deactivate(true,true); // poa->destroy(1,1); diff --git a/src/ModuleCatalog/SALOME_ModuleCatalog_impl.cxx b/src/ModuleCatalog/SALOME_ModuleCatalog_impl.cxx index ebd482b8d..e794b05a5 100644 --- a/src/ModuleCatalog/SALOME_ModuleCatalog_impl.cxx +++ b/src/ModuleCatalog/SALOME_ModuleCatalog_impl.cxx @@ -50,16 +50,22 @@ list splitStringToList(const string& theString, const string& theSeparat list aList; int sepLen = theSeparator.length(); - int subLen = 0, strLen = theString.length(); + int startPos = 0, sepPos = theString.find(theSeparator, startPos); - for (int startPos = 0; startPos < theString.length(); startPos += subLen + sepLen) - { - int sepPos = theString.find(theSeparator, startPos); - subLen = sepPos - startPos; - if (subLen < 1) subLen = strLen - startPos; - string anItem = theString.substr(startPos, subLen); - aList.push_back(anItem); - } + while (1) + { + string anItem ; + if(sepPos != string::npos) + anItem = theString.substr(startPos, sepPos - startPos); + else + anItem = theString.substr(startPos); + if (anItem.length() > 0) + aList.push_back(anItem); + if(sepPos == string::npos) + break; + startPos = sepPos + sepLen; + sepPos = theString.find(theSeparator, startPos); + } return aList; } @@ -157,7 +163,9 @@ SALOME_ModuleCatalogImpl::SALOME_ModuleCatalogImpl(int argc, char** argv, CORBA: _parse_xml_file(aPath.c_str(), _general_module_list, - _general_path_list); + _general_path_list, + _typeMap, + _typeList); } // Verification of _general_path_list content @@ -174,7 +182,9 @@ SALOME_ModuleCatalogImpl::SALOME_ModuleCatalogImpl(int argc, char** argv, CORBA: // _personal_path_list members with the personal catalog files _parse_xml_file(_personal_path, _personal_module_list, - _personal_path_list); + _personal_path_list, + _typeMap, + _typeList); // Verification of _general_path_list content if(!_verify_path_prefix(_personal_path_list)){ @@ -200,6 +210,76 @@ SALOME_ModuleCatalogImpl::~SALOME_ModuleCatalogImpl() } +//! Get the list of all types of the catalog +/*! + * \return the list of types + */ +SALOME_ModuleCatalog::ListOfTypeDefinition* SALOME_ModuleCatalogImpl::GetTypes() +{ + SALOME_ModuleCatalog::ListOfTypeDefinition_var type_list = new SALOME_ModuleCatalog::ListOfTypeDefinition(); + type_list->length(_typeList.size()); + + for (int ind = 0 ; ind < _typeList.size() ; ind++) + { + std::cerr << "name: " << _typeList[ind].name << std::endl; + //no real need to call string_dup, omniorb calls it on operator= (const char *) but it is safer + type_list[ind].name=CORBA::string_dup(_typeList[ind].name.c_str()); + type_list[ind].kind=SALOME_ModuleCatalog::NONE; + if(_typeList[ind].kind=="double") + type_list[ind].kind=SALOME_ModuleCatalog::Dble; + else if(_typeList[ind].kind=="int") + type_list[ind].kind=SALOME_ModuleCatalog::Int; + else if(_typeList[ind].kind=="bool") + type_list[ind].kind=SALOME_ModuleCatalog::Bool; + else if(_typeList[ind].kind=="string") + type_list[ind].kind=SALOME_ModuleCatalog::Str; + else if(_typeList[ind].kind=="objref") + { + type_list[ind].kind=SALOME_ModuleCatalog::Objref; + type_list[ind].id=CORBA::string_dup(_typeList[ind].id.c_str()); + //bases + type_list[ind].bases.length(_typeList[ind].bases.size()); + std::vector::const_iterator miter; + miter=_typeList[ind].bases.begin(); + int n_memb=0; + while(miter != _typeList[ind].bases.end()) + { + type_list[ind].bases[n_memb]=CORBA::string_dup(miter->c_str()); + miter++; + n_memb++; + } + } + else if(_typeList[ind].kind=="sequence") + { + type_list[ind].kind=SALOME_ModuleCatalog::Seq; + type_list[ind].content=CORBA::string_dup(_typeList[ind].content.c_str()); + } + else if(_typeList[ind].kind=="array") + { + type_list[ind].kind=SALOME_ModuleCatalog::Array; + type_list[ind].content=CORBA::string_dup(_typeList[ind].content.c_str()); + } + else if(_typeList[ind].kind=="struct") + { + type_list[ind].kind=SALOME_ModuleCatalog::Struc; + //members + type_list[ind].members.length(_typeList[ind].members.size()); + + std::vector< std::pair >::const_iterator miter; + miter=_typeList[ind].members.begin(); + int n_memb=0; + while(miter != _typeList[ind].members.end()) + { + type_list[ind].members[n_memb].name=CORBA::string_dup(miter->first.c_str()); + type_list[ind].members[n_memb].type=CORBA::string_dup(miter->second.c_str()); + n_memb++; + miter++; + } + } + } + return type_list._retn(); +} + //---------------------------------------------------------------------- // Function : GetComputerList // Purpose : get a computer list @@ -439,7 +519,7 @@ SALOME_ModuleCatalogImpl::GetTypedComponentList(SALOME_ModuleCatalog::ComponentT if (_personal_module_list[ind].type == _temp_component_type) { _list_typed_component->length(_j + 1); - _list_typed_component[_j] = (_moduleList[ind].name).c_str(); + _list_typed_component[_j] = _personal_module_list[ind].name.c_str(); //if(MYDEBUG) SCRUTE(_list_typed_component[_j]); _j++; } @@ -514,7 +594,7 @@ SALOME_ModuleCatalogImpl::GetComponent(const char* name) // DebugParserComponent(*C_parser); - SALOME_ModuleCatalog::Component C_corba; + SALOME_ModuleCatalog::ComponentDef C_corba; duplicate(C_corba, *C_parser); @@ -533,7 +613,7 @@ SALOME_ModuleCatalogImpl::GetComponent(const char* name) return compo; } -SALOME_ModuleCatalog::Component * +SALOME_ModuleCatalog::ComponentDef * SALOME_ModuleCatalogImpl::GetComponentInfo(const char *name) { std::string s(name); @@ -542,8 +622,8 @@ SALOME_ModuleCatalogImpl::GetComponentInfo(const char *name) if (C_parser) { - SALOME_ModuleCatalog::Component * C_corba - = new SALOME_ModuleCatalog::Component; + SALOME_ModuleCatalog::ComponentDef * C_corba + = new SALOME_ModuleCatalog::ComponentDef; duplicate(*C_corba, *C_parser); return C_corba; } @@ -600,12 +680,18 @@ SALOME_ModuleCatalogImpl::findComponent(const string & name) void SALOME_ModuleCatalogImpl::_parse_xml_file(const char* file, ParserComponents& modulelist, - ParserPathPrefixes& pathList) + ParserPathPrefixes& pathList, + ParserTypes& typeMap, + TypeList& typeList) { if(MYDEBUG) BEGIN_OF("_parse_xml_file"); if(MYDEBUG) SCRUTE(file); - SALOME_ModuleCatalog_Handler* handler = new SALOME_ModuleCatalog_Handler(); + //Local path and module list for the file to parse + ParserPathPrefixes _pathList; + ParserComponents _moduleList; + + SALOME_ModuleCatalog_Handler* handler = new SALOME_ModuleCatalog_Handler(_pathList,_moduleList,typeMap,typeList); FILE* aFile = fopen(file, "r"); @@ -650,7 +736,7 @@ SALOME_ModuleCatalogImpl::_parse_xml_file(const char* file, void SALOME_ModuleCatalogImpl::ImportXmlCatalogFile(const char* file) { - _parse_xml_file(file, _personal_module_list, _personal_path_list); + _parse_xml_file(file, _personal_module_list, _personal_path_list,_typeMap,_typeList); } @@ -665,7 +751,7 @@ SALOME_ModuleCatalogImpl::ImportXmlCatalogFile(const char* file) // Purpose : create a component from the catalog parsing //---------------------------------------------------------------------- void SALOME_ModuleCatalogImpl::duplicate -(SALOME_ModuleCatalog::Component & C_corba, +(SALOME_ModuleCatalog::ComponentDef & C_corba, const ParserComponent & C_parser) { C_corba.name = CORBA::string_dup(C_parser.name.c_str()); diff --git a/src/ModuleCatalog/SALOME_ModuleCatalog_impl.hxx b/src/ModuleCatalog/SALOME_ModuleCatalog_impl.hxx index 4c9334c84..fc4d269fe 100644 --- a/src/ModuleCatalog/SALOME_ModuleCatalog_impl.hxx +++ b/src/ModuleCatalog/SALOME_ModuleCatalog_impl.hxx @@ -55,6 +55,12 @@ public: */ virtual SALOME_ModuleCatalog::ListOfComputers* GetComputerList(); + //! method to get the list of all types of the catalog + /*! + * \return the types list + */ + virtual SALOME_ModuleCatalog::ListOfTypeDefinition* GetTypes(); + //! method to get the PathPrefix of a computer /*! If the wanted computer doesn't exist, the Notfound exception is thrown \param machinename const char* arguments @@ -100,7 +106,7 @@ public: \param componentname const char* arguments \return the wanted component description */ - virtual SALOME_ModuleCatalog::Component * + virtual SALOME_ModuleCatalog::ComponentDef * GetComponentInfo(const char *name); void ping(){}; @@ -115,10 +121,13 @@ private: \param file const char* arguments \param modulelist ParserComponents arguments \param pathlist ParserPathPrefixes arguments + \param typeMap ParserTypes arguments */ virtual void _parse_xml_file(const char* file, ParserComponents & modulelist, - ParserPathPrefixes & pathlist); + ParserPathPrefixes & pathlist, + ParserTypes& typeMap, + TypeList& typeList); //! method to find component in the parser list /*! @@ -132,7 +141,7 @@ private: \param C_corba Component argument \param C_parser const ParserComponent argument */ - void duplicate(SALOME_ModuleCatalog::Component & C_corba, + void duplicate(SALOME_ModuleCatalog::ComponentDef & C_corba, const ParserComponent & C_parser); //! method to create a CORBA interface description from parser @@ -201,6 +210,8 @@ private: // These variables will contain the informations on the general common catalog ParserComponents _general_module_list ; ParserPathPrefixes _general_path_list ; + ParserTypes _typeMap; + TypeList _typeList; // These variables will contain the informations on the personal catalog ParserComponents _personal_module_list ; diff --git a/src/Registry/SALOME_Registry_Server.cxx b/src/Registry/SALOME_Registry_Server.cxx index 470cde401..50e608f31 100644 --- a/src/Registry/SALOME_Registry_Server.cxx +++ b/src/Registry/SALOME_Registry_Server.cxx @@ -187,15 +187,15 @@ int main( int argc , char **argv ) } string absoluteName = string("/") + registryName; naming.Register( varComponents , absoluteName.c_str() ) ; - MESSAGE("On attend les requetes des clients") ; + MESSAGE("Wait client requests") ; try { // Activation du POA - MESSAGE("Activation du POA") ; + MESSAGE("POA activation") ; manager->activate() ; // Lancement de l'ORB - MESSAGE("Lancement de l'ORB") ; + MESSAGE("ORB launching") ; #ifdef CHECKTIME Utils_Timer timer; timer.Start(); @@ -207,7 +207,7 @@ int main( int argc , char **argv ) } catch( const CORBA::Exception &ex ) { - MESSAGE("Erreur systeme") ; + MESSAGE("System error") ; return EXIT_FAILURE ; } diff --git a/src/ResourcesManager/SALOME_ResourcesCatalog_Handler.cxx b/src/ResourcesManager/SALOME_ResourcesCatalog_Handler.cxx index a0fc63552..c4232d56d 100755 --- a/src/ResourcesManager/SALOME_ResourcesCatalog_Handler.cxx +++ b/src/ResourcesManager/SALOME_ResourcesCatalog_Handler.cxx @@ -251,7 +251,6 @@ void SALOME_ResourcesCatalog_Handler::ProcessXmlDocument(xmlDocPtr theDoc) SCRUTE((*iter).second.Alias); SCRUTE((*iter).second.UserName); SCRUTE((*iter).second.AppliPath); - SCRUTE((*iter).second.PreReqFilePath); SCRUTE((*iter).second.OS); SCRUTE((*iter).second.Protocol); SCRUTE((*iter).second.Mode); diff --git a/src/SALOMEDS/Makefile.am b/src/SALOMEDS/Makefile.am index 4acba05d4..0d9bac30a 100644 --- a/src/SALOMEDS/Makefile.am +++ b/src/SALOMEDS/Makefile.am @@ -288,15 +288,8 @@ bin_PROGRAMS = SALOMEDS_Server SALOMEDS_Client SALOMEDS_Server_SOURCES = SALOMEDS_Server.cxx SALOMEDS_Server_CPPFLAGS = $(COMMON_CPPFLAGS) -SALOMEDS_Server_LDADD = \ - libSalomeDS.la $(COMMON_LIBS) \ - ../ResourcesManager/libSalomeResourcesManager.la \ - @CORBA_LIBS@ +SALOMEDS_Server_LDADD = libSalomeDS.la SALOMEDS_Client_SOURCES = SALOMEDS_Client.cxx SALOMEDS_Client_CPPFLAGS = $(COMMON_CPPFLAGS) -SALOMEDS_Client_LDADD = \ - libSalomeDS.la $(COMMON_LIBS) \ - ../ResourcesManager/libSalomeResourcesManager.la \ - @CORBA_LIBS@ - +SALOMEDS_Client_LDADD = libSalomeDS.la diff --git a/src/SALOMEDS/Test/Makefile.am b/src/SALOMEDS/Test/Makefile.am index 53ff19a81..79200aafc 100644 --- a/src/SALOMEDS/Test/Makefile.am +++ b/src/SALOMEDS/Test/Makefile.am @@ -144,7 +144,4 @@ EXTRA_DIST = \ bin_PROGRAMS = TestSALOMEDS dist_TestSALOMEDS_SOURCES = TestSALOMEDS.cxx TestSALOMEDS_CPPFLAGS = $(COMMON_CPPFLAGS) -TestSALOMEDS_LDADD = \ - libSALOMEDSTest.la ../libSalomeDS.la \ - $(RPATH)/NamingService/Test/libNamingServiceTest.la \ - $(COMMON_LIBS) +TestSALOMEDS_LDADD = libSALOMEDSTest.la